/* ============================================================
   Blackjack Strategy Trainer – bj-style.css
   Palette: Schwarz / Dunkelgrün / Gold / Rot / Weiß
   ============================================================ */

/* ---------- Variablen ---------- */
:root {
  --black:        #080c0a;
  --felt:         #0d1f15;
  --felt-light:   #122a1c;
  --felt-mid:     #163320;
  --gold:         #c9a84c;
  --gold-light:   #e2c06a;
  --gold-dark:    #8a6820;
  --red:          #e03030;
  --red-light:    #ff5555;
  --green:        #27ae60;
  --green-light:  #2ecc71;
  --card-bg:      #faf6ee;
  --card-shadow:  rgba(0,0,0,0.7);
  --text:         #e8e8e8;
  --text-muted:   #8a9a8d;
  --border:       rgba(201,168,76,0.25);
  --radius:       14px;
  --radius-sm:    8px;
  --transition:   0.28s ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background-color: var(--black);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ============================================================
   ANIMATED BACKGROUND
   ============================================================ */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(13,60,30,0.55) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(20,50,25,0.4) 0%, transparent 70%),
    radial-gradient(ellipse 100% 80% at 50% 50%, rgba(8,12,10,1) 40%, #060a07 100%);
  animation: bgPulse 8s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes bgPulse {
  from { opacity: 1; }
  to   { opacity: 0.85; }
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(8,12,10,0.98) 0%, rgba(10,18,12,0.9) 100%);
  backdrop-filter: blur(10px);
  padding: 1rem 0;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.header-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.3rem, 3vw, 2rem);
  color: var(--gold);
  letter-spacing: 0.04em;
  text-shadow: 0 0 30px rgba(201,168,76,0.35);
}
.header-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-top: 0.2rem;
  font-weight: 300;
}
.header-actions {
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}
.btn-icon {
  background: rgba(201,168,76,0.08);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--gold);
  font-size: 1.1rem;
  width: 42px;
  height: 42px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon:hover {
  background: rgba(201,168,76,0.18);
  border-color: var(--gold);
  transform: scale(1.08);
}

/* ============================================================
   STATS BAR
   ============================================================ */
.stats-bar {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: clamp(1rem, 4vw, 3rem);
  padding: 0.85rem 1.5rem;
  background: rgba(10,16,12,0.9);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.stat-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 2.5ch;
  text-align: center;
}
.stat-value.green { color: var(--green-light); }
.stat-value.red   { color: var(--red-light); }
.stat-value.gold  { color: var(--gold); }

/* ============================================================
   MAIN GAME AREA
   ============================================================ */
.game-area {
  position: relative;
  z-index: 5;
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

/* ── Felt Zones ── */
.zone {
  width: 100%;
  background:
    radial-gradient(ellipse 80% 60% at 50% 50%, var(--felt-mid) 0%, var(--felt) 100%);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: var(--radius);
  padding: 1.4rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  box-shadow: inset 0 2px 20px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.5);
  min-height: 160px;
  position: relative;
  overflow: hidden;
}
/* Casino felt texture pattern */
.zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.012) 0px,
    rgba(255,255,255,0.012) 1px,
    transparent 1px,
    transparent 12px
  );
  pointer-events: none;
  border-radius: var(--radius);
}

.zone-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: rgba(201,168,76,0.5);
  text-transform: uppercase;
  position: absolute;
  top: 0.7rem;
  left: 1rem;
}

.cards-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  min-height: 100px;
}

.hand-total {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(201,168,76,0.75);
  min-height: 1.2em;
  text-align: center;
}

/* ── VS Divider ── */
.vs-divider {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.75rem;
}
.vs-divider::before,
.vs-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.vs-text {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

/* ============================================================
   PLAYING CARDS
   ============================================================ */
.playing-card {
  width: 72px;
  height: 104px;
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow:
    0 4px 16px var(--card-shadow),
    inset 0 1px 0 rgba(255,255,255,0.9);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 6px;
  position: relative;
  border: 1px solid rgba(0,0,0,0.12);
  /* Start hidden for animation */
  opacity: 0;
  transform: translateY(-40px) rotate(-6deg);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22,1,0.36,1);
  cursor: default;
  flex-shrink: 0;
}
.playing-card.dealt {
  opacity: 1;
  transform: translateY(0) rotate(0deg);
}
.playing-card.red-card .card-corner-top,
.playing-card.red-card .card-center,
.playing-card.red-card .card-corner-bot {
  color: #c0282a;
}
.playing-card.black-card .card-corner-top,
.playing-card.black-card .card-center,
.playing-card.black-card .card-corner-bot {
  color: #1a1a1a;
}

.card-corner-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
  font-weight: 700;
}
.card-corner-bot {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
  font-weight: 700;
  transform: rotate(180deg);
}
.card-rank {
  font-size: 1rem;
  font-weight: 800;
  font-family: 'Inter', sans-serif;
}
.card-suit-small {
  font-size: 0.7rem;
}
.card-center {
  font-size: 2rem;
  text-align: center;
  line-height: 1;
  margin: auto;
}

/* Face-down card */
.playing-card.face-down {
  background: repeating-linear-gradient(
    135deg,
    #1a4028 0px,
    #1a4028 6px,
    #163320 6px,
    #163320 12px
  );
  border: 2px solid rgba(201,168,76,0.4);
}
.playing-card.face-down::after {
  content: '♠';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: rgba(201,168,76,0.3);
}

/* ============================================================
   FEEDBACK BOX
   ============================================================ */
.feedback-box {
  width: 100%;
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: feedbackIn 0.35s ease;
}
@keyframes feedbackIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.feedback-box.correct {
  background: rgba(39,174,96,0.12);
  border: 1px solid rgba(46,204,113,0.4);
  box-shadow: 0 0 30px rgba(46,204,113,0.15);
}
.feedback-box.wrong {
  background: rgba(220,50,50,0.12);
  border: 1px solid rgba(255,85,85,0.4);
  box-shadow: 0 0 30px rgba(220,50,50,0.15);
}
.feedback-icon {
  font-size: 2.2rem;
  line-height: 1;
}
.feedback-text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
}
.feedback-text strong {
  font-weight: 700;
}
.feedback-text .correct-action {
  color: var(--green-light);
  font-weight: 700;
  font-size: 1rem;
}
.feedback-text .wrong-action {
  color: var(--red-light);
  font-weight: 700;
}

/* ============================================================
   DECISION BUTTONS
   ============================================================ */
.decision-area {
  display: flex;
  gap: 1rem;
  width: 100%;
  max-width: 520px;
}

.btn-decision {
  flex: 1;
  padding: 1.1rem 0.5rem;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.22s ease;
  position: relative;
  overflow: hidden;
}

/* Hit */
#btnHit {
  background: linear-gradient(145deg, #1a3a28, #0f2a1a);
  color: var(--green-light);
  border: 1.5px solid rgba(46,204,113,0.4);
  box-shadow: 0 4px 20px rgba(46,204,113,0.1);
}
#btnHit:hover:not(:disabled) {
  background: linear-gradient(145deg, #1f4a30, #143520);
  border-color: var(--green-light);
  box-shadow: 0 6px 28px rgba(46,204,113,0.25);
  transform: translateY(-3px);
}

/* Stand */
#btnStand {
  background: linear-gradient(145deg, #3a1a1a, #2a0f0f);
  color: var(--red-light);
  border: 1.5px solid rgba(255,85,85,0.4);
  box-shadow: 0 4px 20px rgba(220,50,50,0.1);
}
#btnStand:hover:not(:disabled) {
  background: linear-gradient(145deg, #4a1f1f, #351414);
  border-color: var(--red-light);
  box-shadow: 0 6px 28px rgba(255,85,85,0.25);
  transform: translateY(-3px);
}

/* Double */
#btnDouble {
  background: linear-gradient(145deg, #2e2510, #1e1808);
  color: var(--gold-light);
  border: 1.5px solid rgba(201,168,76,0.4);
  box-shadow: 0 4px 20px rgba(201,168,76,0.1);
}
#btnDouble:hover:not(:disabled) {
  background: linear-gradient(145deg, #3a2e14, #26200c);
  border-color: var(--gold-light);
  box-shadow: 0 6px 28px rgba(201,168,76,0.28);
  transform: translateY(-3px);
}

.btn-decision:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none !important;
}

/* Button glow feedback */
.btn-decision.flash-correct {
  animation: flashGreen 0.5s ease;
}
.btn-decision.flash-wrong {
  animation: shakeRed 0.45s ease;
}
@keyframes flashGreen {
  0%   { box-shadow: 0 0 0 rgba(46,204,113,0); }
  40%  { box-shadow: 0 0 40px rgba(46,204,113,0.7); }
  100% { box-shadow: 0 0 0 rgba(46,204,113,0); }
}
@keyframes shakeRed {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-7px); }
  40%     { transform: translateX(7px); }
  60%     { transform: translateX(-5px); }
  80%     { transform: translateX(5px); }
}

/* ============================================================
   NEXT BUTTON
   ============================================================ */
.next-area {
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: center;
}
.btn-next {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #0a0c08;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1rem 2.5rem;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 24px rgba(201,168,76,0.25);
  animation: nextIn 0.35s ease;
}
@keyframes nextIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.btn-next:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  box-shadow: 0 6px 32px rgba(201,168,76,0.4);
  transform: translateY(-2px);
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   STRATEGY MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-box {
  background: linear-gradient(160deg, #0f1c12 0%, #0a1309 100%);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: var(--radius);
  width: 100%;
  max-width: 820px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(0.95rem, 2.5vw, 1.3rem);
  color: var(--gold);
}
.modal-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.modal-close:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.modal-body {
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Strategy Legend */
.strategy-legend {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.leg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.8rem;
}
.leg.H { background: rgba(46,204,113,0.2); color: var(--green-light); border: 1px solid rgba(46,204,113,0.4); }
.leg.S { background: rgba(255,85,85,0.18); color: var(--red-light);   border: 1px solid rgba(255,85,85,0.4); }
.leg.D { background: rgba(201,168,76,0.18); color: var(--gold-light); border: 1px solid rgba(201,168,76,0.4); }

.table-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: var(--gold);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

.table-scroll { overflow-x: auto; }

/* Strategy Table */
.strategy-table {
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 460px;
  width: 100%;
}
.strategy-table th,
.strategy-table td {
  border: 1px solid rgba(255,255,255,0.06);
  padding: 0.35rem 0.5rem;
  text-align: center;
  white-space: nowrap;
}
.strategy-table thead th {
  background: rgba(201,168,76,0.12);
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.strategy-table tbody td:first-child {
  background: rgba(201,168,76,0.07);
  color: var(--gold-light);
  font-weight: 600;
  text-align: left;
  padding-left: 0.75rem;
}
/* Cell colouring by action */
.strategy-table .cell-H { background: rgba(46,204,113,0.1);  color: var(--green-light); font-weight: 600; }
.strategy-table .cell-S { background: rgba(255,85,85,0.1);   color: var(--red-light);   font-weight: 600; }
.strategy-table .cell-D { background: rgba(201,168,76,0.13); color: var(--gold-light);  font-weight: 600; }

/* ===========P=================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .game-area { padding: 1.2rem 0.8rem 3rem; gap: 0.9rem; }
  .zone { padding: 1rem 0.8rem; min-height: 130px; }
  .playing-card { width: 60px; height: 88px; }
  .card-rank { font-size: 0.85rem; }
  .card-center { font-size: 1.5rem; }
  .btn-decision { font-size: 0.9rem; padding: 0.9rem 0.3rem; }
  .decision-area { gap: 0.6rem; }
  .header-title { font-size: 1.1rem; }
  .stats-bar { gap: 0.8rem; padding: 0.7rem 0.8rem; }
  .stat-value { font-size: 1.1rem; }
}
