@import url("https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap");

:root {
  --text: #f0ebe0;
  --muted: rgba(240, 235, 224, 0.5);
  --accent: #c9a84c;
  --accent-dim: rgba(201, 168, 76, 0.18);
  --panel-bg: #161614;
  --panel-border: rgba(201, 168, 76, 0.2);
  --panel-radius: 20px;
  --line: rgba(201, 168, 76, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Lexend", "Segoe UI", sans-serif;
  background: #0e0e0c;
  min-height: 100vh;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ── Page layout ── */

.page {
  display: flex;
  gap: 1.25rem;
  width: 100%;
  max-width: 860px;
  align-items: flex-start;
}

/* ── Game panel ── */

.game-panel {
  flex: 1;
  min-width: 0;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.game-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.game-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.bank-section {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.1rem;
}

.bank-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.bank-display {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Zones ── */

.zone {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-bottom: 0.6rem;
}

.zone-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.zone-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.zone-total {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.zone-turn {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: #f0c060;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 88px;
  align-items: flex-end;
}

.card-img {
  height: 88px;
  width: auto;
  border-radius: 5px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  margin-right: -18px;
  transition: margin 120ms ease;
}

.cards:hover .card-img {
  margin-right: 2px;
}

.card-back {
  height: 88px;
  width: 62px;
  border-radius: 5px;
  background: linear-gradient(135deg, #2a2520 0%, #1a1814 100%);
  border: 1px solid rgba(201, 168, 76, 0.3);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.zone-divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1px;
  background: var(--line);
}

.result {
  position: absolute;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent);
  background: #161614;
  padding: 0 0.75rem;
  white-space: nowrap;
}

/* ── Result row ── */

.result-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 1.4rem;
  flex-wrap: wrap;
}

.bet-display {
  font-size: 0.82rem;
  color: var(--muted);
}

.insurance-display {
  font-size: 0.78rem;
  color: rgba(253, 246, 236, 0.45);
}


/* ── Controls ── */

.controls {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.bet-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bet-prompt {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

.bet-error {
  font-size: 0.75rem;
  color: #f08080;
  margin: 0;
}

.chip-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.chip-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.chip-btn:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.22);
}

.chip-btn:active {
  background: var(--accent-dim);
  border-color: rgba(74, 127, 214, 0.5);
}

.bet-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.current-bet {
  font-size: 1rem;
  font-weight: 700;
  flex: 1;
}

.action-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.38rem 0.9rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms ease;
}

.action-btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--panel-border);
  color: var(--muted);
}

.action-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.action-btn.primary {
  background: var(--accent);
  color: #0e0e0c;
}

.action-btn.primary:hover {
  background: #d4b55a;
}

/* ── Game buttons ── */

.game-buttons {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.game-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.game-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.game-btn.hit {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.game-btn.hit:hover { background: rgba(255, 255, 255, 0.12); }

.game-btn.stand {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.game-btn.stand:hover { background: rgba(255, 255, 255, 0.12); }

.game-btn.double-down {
  background: var(--accent-dim);
  border-color: rgba(201, 168, 76, 0.35);
  color: var(--accent);
}

.game-btn.double-down:hover { background: rgba(201, 168, 76, 0.28); }

.game-btn.reset {
  margin-left: auto;
  color: var(--muted);
}

.hidden { display: none !important; }

/* ── Coach panel ── */

.coach-panel {
  width: 270px;
  flex-shrink: 0;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.coach-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.coach-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

/* Toggle switch */
.coach-toggle-wrap {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.coach-toggle-wrap input { display: none; }

.coach-toggle-track {
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  position: relative;
  transition: background 160ms ease;
}

.coach-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  transition: transform 160ms ease, background 160ms ease;
}

.coach-toggle-wrap input:checked + .coach-toggle-track {
  background: var(--accent);
}

.coach-toggle-wrap input:checked + .coach-toggle-track::after {
  transform: translateX(12px);
  background: #fff;
}

.coach-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.coach-advice {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.coach-waiting {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

.coach-detail {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.6;
  border-left: 2px solid var(--line);
  padding-left: 0.6rem;
}

.coach-line {
  margin-bottom: 0.25rem;
}

.coach-line:last-child {
  margin-bottom: 0;
}

.coach-label-word {
  color: var(--text);
  font-weight: 700;
  margin-right: 0.2rem;
}

.advice-hit, .advice-stand, .advice-double, .advice-split, .advice-no-insurance {
  color: var(--text);
}


/* Coach history */
.coach-history {
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.history-heading {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(253, 246, 236, 0.35);
  margin-bottom: 0.1rem;
}

.history-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
}

.history-row .action { font-weight: 600; }
.history-row.correct .action { color: #82d49a; }
.history-row.wrong   .action { color: #f08080; }

/* ── Responsive ── */
@media (max-width: 700px) {
  .page { flex-direction: column; }
  .coach-panel { width: 100%; }
  .cards { min-height: 72px; }
  .card-img, .card-back { height: 72px; }
  .card-back { width: 50px; }
}
