/* ============================================================
   Basic Strategy Trainer – Stylesheet
   Design rule: no borders anywhere. Surfaces are separated by
   tone, shadow and spacing only.
   ============================================================ */
:root {
  --bg: #0b0e13;
  --bg-2: #10141b;
  --panel: #151a23;
  --panel-2: #1c2230;
  --panel-3: #232b3b;
  --text: #e8ebf1;
  --muted: #8b95a8;
  --accent: #e9c46a;
  --accent-2: #f3d78f;
  --green: #2fcc71;
  --red: #ef5350;
  --teal: #3cb8c8;
  --purple: #a888f0;
  --felt-1: #1c6b47;
  --felt-2: #0f4a30;
  --felt-3: #0a3322;
  --card-w: 64px;
  --card-h: 92px;
  --card-offset: 26px;
  --chip: 44px;
  --radius: 16px;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --topbar-h: 58px;
  --controls-h: 132px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: radial-gradient(1200px 700px at 50% -10%, #182030 0%, var(--bg) 60%);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; }
kbd {
  font-family: inherit;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  margin-left: 4px;
  vertical-align: middle;
}

/* ---------- top bar ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
}
.brand { font-weight: 700; letter-spacing: 0.2px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand-mark { color: var(--accent); font-size: 18px; }
.bankroll {
  display: flex; align-items: baseline; gap: 10px;
  padding: 7px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  transition: box-shadow 0.3s, background 0.3s;
}
.bankroll.flash-up { background: rgba(47, 204, 113, 0.14); box-shadow: 0 0 24px rgba(47, 204, 113, 0.35); }
.bankroll.flash-down { background: rgba(239, 83, 80, 0.14); box-shadow: 0 0 24px rgba(239, 83, 80, 0.35); }
.bankroll-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.bankroll-value { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; color: var(--accent-2); }
.topnav { display: flex; gap: 8px; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; cursor: pointer; border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 10px 18px; border-radius: 999px;
  font-weight: 600; font-size: 13px; letter-spacing: 0.2px;
  transition: transform 0.12s ease, background 0.15s, opacity 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-ghost { background: rgba(255, 255, 255, 0.05); }
.btn-primary { background: var(--accent); color: #1a1405; }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); box-shadow: 0 6px 18px rgba(233, 196, 106, 0.3); }
.btn-primary kbd { color: rgba(0, 0, 0, 0.55); background: rgba(0, 0, 0, 0.12); }
.btn-icon { appearance: none; background: transparent; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.btn-icon:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.btn-link { appearance: none; background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-link:hover { color: var(--text); }

/* ---------- action cards (Hit / Stand / Double / Split) ---------- */
.action-group { gap: 12px; }
.action-card {
  --ac: var(--text);
  --tint: rgba(255, 255, 255, 0.06);
  position: relative; appearance: none; border: 0; cursor: pointer;
  width: 176px; height: 92px; border-radius: 20px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 3px;
  padding: 14px 18px;
  background: var(--tint);
  color: var(--text); text-align: left;
  overflow: hidden;
  transition: transform 0.15s ease, opacity 0.15s, box-shadow 0.15s;
}
.action-card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: var(--ac); opacity: 0; transition: opacity 0.15s;
}
.action-card > * { position: relative; z-index: 1; }
.action-card .ac-label { font-size: 21px; font-weight: 800; color: var(--ac); letter-spacing: -0.2px; line-height: 1; }
.action-card .ac-sub { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.action-card kbd { position: absolute; top: 12px; right: 12px; margin: 0; background: rgba(255, 255, 255, 0.08); }
.action-card[data-action="H"] { --ac: #6cd3e0; --tint: rgba(60, 184, 200, 0.13); }
.action-card[data-action="S"] { --ac: var(--accent-2); --tint: rgba(233, 196, 106, 0.13); }
.action-card[data-action="D"] { --ac: #62e39a; --tint: rgba(47, 204, 113, 0.13); }
.action-card[data-action="P"] { --ac: #bfa4f7; --tint: rgba(168, 136, 240, 0.14); }
.action-card:hover:not(:disabled) { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(0, 0, 0, 0.4); }
.action-card:hover:not(:disabled)::after { opacity: 0.1; }
.action-card:active:not(:disabled) { transform: translateY(-1px) scale(0.98); }
.action-card:disabled { opacity: 0.28; cursor: not-allowed; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: calc(100vh - var(--topbar-h) - var(--controls-h));
}
.table-wrap { position: relative; overflow: hidden; }
.sidebar {
  padding: 14px;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 0;
}

/* ---------- table ---------- */
.table {
  position: absolute; left: 50%; top: 50%;
  width: 1000px; height: 600px;
  transform: translate(-50%, -50%);
  transform-origin: center center;
}
.felt {
  position: absolute; inset: 0;
  border-radius: 30px 30px 50% 50% / 30px 30px 44% 44%;
  background:
    radial-gradient(ellipse 70% 60% at 50% 20%, rgba(255, 255, 255, 0.06), transparent 70%),
    radial-gradient(ellipse at 50% 35%, var(--felt-1) 0%, var(--felt-2) 60%, var(--felt-3) 100%);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.4), var(--shadow);
}
.table-text {
  position: absolute; left: 0; right: 0; top: 196px;
  text-align: center; font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28); font-weight: 600; pointer-events: none;
}
.message {
  position: absolute; left: 0; right: 0; top: 222px;
  text-align: center; font-size: 15px; font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: opacity 0.25s;
  pointer-events: none;
}
.message.hidden { opacity: 0; }
.bank-anchor { position: absolute; left: 50%; top: 10px; width: 1px; height: 1px; }

.shoe {
  position: absolute; right: 42px; top: 30px;
  width: 78px; height: 104px;
  border-radius: 12px;
  background: linear-gradient(160deg, #262c38, #12161d);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.shoe-card {
  position: absolute; left: 7px; top: 6px;
  width: var(--card-w); height: var(--card-h);
  border-radius: 7px;
  background: #234a9c;
}
.shoe-count {
  position: absolute; left: 0; right: 0; bottom: -20px;
  text-align: center; font-size: 10px; color: rgba(255, 255, 255, 0.4); letter-spacing: 0.5px;
}
.shoe.shuffling { animation: shuffle 0.9s ease-in-out; }
@keyframes shuffle {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-8px) rotate(-3deg); }
  40% { transform: translateX(8px) rotate(3deg); }
  60% { transform: translateX(-6px) rotate(-2deg); }
  80% { transform: translateX(6px) rotate(2deg); }
}

.dealer-area { position: absolute; left: 0; right: 0; top: 64px; display: flex; justify-content: center; }
.boxes { position: absolute; inset: 0; }
.box { position: absolute; width: 176px; height: 212px; }
.box .hands { height: 124px; display: flex; justify-content: center; align-items: flex-end; gap: 14px; }
.box .hands.multi { gap: 10px; }
.box .hands.multi .hand { transform: scale(0.88); transform-origin: bottom center; }
.box .hands.multi .hand.active { transform: scale(0.88) translateY(-6px); }
.box .hands.many .hand { transform: scale(0.7); }
.box .hands.many .hand.active { transform: scale(0.7) translateY(-6px); }

/* betting spots: printed rounded squares, tilted to the table's curve */
.bet-area { display: flex; justify-content: center; align-items: flex-start; gap: 12px; height: 66px; margin-top: 22px; }
.stack-slot { position: relative; width: 66px; height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.spot {
  position: absolute; inset: 0; border-radius: 18px;
  background: rgba(0, 0, 0, 0.17);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.28), inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  transition: background 0.2s, box-shadow 0.2s;
}
.stack-slot.main { cursor: pointer; }
.phase-betting .stack-slot.main:hover .spot {
  background: rgba(233, 196, 106, 0.16);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2), 0 0 26px rgba(233, 196, 106, 0.3);
}
.stack-slot .stack { position: relative; width: var(--chip); height: var(--chip); }
.stack .chip { position: absolute; left: 0; bottom: 0; }
.stack-amount {
  position: absolute; left: 50%; bottom: -20px; transform: translateX(-50%);
  font-size: 12px; font-weight: 700; color: var(--accent-2); white-space: nowrap;
  font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.stack-slot.insurance { width: 40px; height: 40px; margin-left: -4px; }
.stack-slot.insurance .spot { border-radius: 12px; }
.stack-slot.insurance .stack { width: 30px; height: 30px; }
.stack-slot.insurance .chip { width: 30px; height: 30px; font-size: 9px; }
.stack-slot.insurance .stack-amount { font-size: 10px; color: var(--teal); }
.box.stale .hands { opacity: 0.55; filter: saturate(0.7); }

/* ---------- hands & cards ---------- */
.hand { position: relative; width: var(--card-w); height: var(--card-h); border-radius: 9px; transition: transform 0.25s ease, box-shadow 0.25s ease; }
.hand .cards { position: absolute; inset: 0; }
.hand.active { transform: translateY(-6px); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 26px 6px rgba(233, 196, 106, 0.45); }
  50% { box-shadow: 0 0 40px 10px rgba(233, 196, 106, 0.7); }
}
.hand .total {
  position: absolute; left: 50%; bottom: -24px; transform: translateX(-50%);
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: rgba(8, 10, 14, 0.85); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: 0.3px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  opacity: 0; transition: opacity 0.2s;
}
.hand .total.show { opacity: 1; }
.hand .total.soft { color: var(--teal); }
.hand .total.bust { color: var(--red); }
.hand .total.bj { color: var(--accent-2); }
.hand.dealer .total { left: auto; right: -14px; bottom: 50%; transform: translate(100%, 50%); }
body.hide-totals .hand .total { display: none; }

.hand-result {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 6px 12px; border-radius: 999px; white-space: nowrap; z-index: 20;
  background: rgba(8, 10, 14, 0.92); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: 0.6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); text-transform: uppercase;
  animation: pop 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.hand-result.win, .hand-result.blackjack { color: var(--green); }
.hand-result.blackjack { color: var(--accent-2); }
.hand-result.lose, .hand-result.bust { color: var(--red); }
.hand-result.push { color: #cfd6e4; }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

.card {
  position: absolute; top: 0;
  width: var(--card-w); height: var(--card-h);
  perspective: 700px;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s;
}
.card.sideways { transform: translate(6px, 8px) rotate(90deg); }
.card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.38s cubic-bezier(0.3, 0.7, 0.3, 1); }
.card.face-down .card-inner { transform: rotateY(180deg); }
.card.peek .card-inner { animation: peek 0.7s ease-in-out; }
@keyframes peek { 0%, 100% { transform: rotateY(180deg); } 40%, 60% { transform: rotateY(180deg) translateY(-10px) rotateX(-18deg); } }
.card-face {
  position: absolute; inset: 0; border-radius: 7px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.card-face.front { background: linear-gradient(160deg, #ffffff, #f2f2ee); color: #1c1f26; overflow: hidden; }
.card.red .card-face.front { color: #d3302f; }
.card-face.back {
  transform: rotateY(180deg);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.09) 0 3px, transparent 3px 8px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.09) 0 3px, transparent 3px 8px),
    linear-gradient(160deg, #2c58b5, #1a3a80);
  box-shadow: inset 0 0 0 3px #f3f3ef, inset 0 0 0 4px #1a3a80, 0 2px 6px rgba(0, 0, 0, 0.35);
}
.corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.corner .rank { font-weight: 800; font-size: 15px; letter-spacing: -0.5px; }
.corner .suit { font-size: 12px; margin-top: 1px; }
.corner.tl { left: 6px; top: 6px; }
.corner.br { right: 6px; bottom: 6px; transform: rotate(180deg); }
.pip { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 30px; line-height: 1; }
.card.face .pip { font-size: 22px; }
.card.face .pip::after { content: attr(data-face); position: absolute; left: 50%; top: 100%; transform: translateX(-50%); font-size: 10px; font-weight: 800; letter-spacing: 1px; }

/* flying clones */
.fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 500; }
.fly { position: fixed; will-change: transform; }
.fly .card { position: relative; width: 100%; height: 100%; }
.fly .chip { position: absolute; left: 0; }

/* ---------- chips ---------- */
.chip {
  --c: #d64545;
  width: var(--chip); height: var(--chip); border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 12px; letter-spacing: -0.3px;
  background:
    radial-gradient(circle at 50% 50%, var(--c) 0 57%, rgba(255, 255, 255, 0.92) 58% 63%, transparent 64%),
    repeating-conic-gradient(from 8deg, rgba(255, 255, 255, 0.93) 0deg 16deg, var(--c) 16deg 45deg);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45), inset 0 -2px 4px rgba(0, 0, 0, 0.25), inset 0 2px 3px rgba(255, 255, 255, 0.18);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
  user-select: none;
}
.chip[data-value="5"] { --c: #d64545; }
.chip[data-value="10"] { --c: #3b6fd8; }
.chip[data-value="25"] { --c: #2f9e5f; }
.chip[data-value="50"] { --c: #e0892b; }
.chip[data-value="100"] { --c: #2a2d33; }
.chip[data-value="500"] { --c: #8a46c9; }

/* ---------- controls ---------- */
.controls {
  height: var(--controls-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  position: relative;
}
.control-group { display: flex; align-items: center; gap: 22px; }
.control-group[hidden] { display: none; }
.chip-tray { display: flex; gap: 12px; align-items: flex-end; height: 64px; }
.chip-tray .chip {
  width: 54px; height: 54px; font-size: 14px; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
}
.chip-tray .chip:hover { transform: translateY(-4px) scale(1.04); }
.chip-tray .chip.selected { transform: translateY(-8px) scale(1.1); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55), 0 0 22px rgba(233, 196, 106, 0.6); }
.chip-tray .chip.unaffordable { opacity: 0.3; cursor: not-allowed; }
.bet-buttons { display: flex; gap: 8px; }
.btn-deal { padding: 12px 26px; font-size: 14px; }
.insurance-group { gap: 10px; }
.insurance-text { font-weight: 600; margin-right: 8px; }
.hint { font-size: 12px; color: var(--muted); height: 16px; }

/* ---------- sidebar panels ---------- */
.panel {
  background: var(--panel); border-radius: var(--radius);
  padding: 16px 18px;
}
.panel-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted);
  margin-bottom: 12px;
}
.panel-sub { font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { background: var(--panel-2); border-radius: 12px; padding: 9px 6px; text-align: center; }
.stat-value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; transition: transform 0.2s; }
.stat.good .stat-value { color: var(--green); }
.stat.bad .stat-value { color: var(--red); }
.stat-value.bump { animation: bump 0.35s ease; }
@keyframes bump { 30% { transform: scale(1.25); } }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-top: 2px; }
.accuracy { margin-top: 14px; }
.accuracy-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.accuracy-row strong { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar-fill { height: 100%; width: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--green), #7ee2a8); transform-origin: left center; transform: scaleX(0); transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.3s; }
.bar-fill.mid { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.bar-fill.low { background: linear-gradient(90deg, var(--red), #ff8a80); }
.net-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 14px; }
.net-row strong { font-variant-numeric: tabular-nums; font-size: 14px; }
.net-row strong.pos { color: var(--green); }
.net-row strong.neg { color: var(--red); }

.log-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.log { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.log::-webkit-scrollbar { width: 6px; }
.log::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }
.log-empty { color: var(--muted); font-size: 12px; line-height: 1.5; padding: 6px 2px; }
.log-empty[hidden] { display: none; }
.log-entry {
  background: var(--panel-2); border-radius: 10px;
  padding: 8px 11px; font-size: 12px; line-height: 1.45;
  animation: slide-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slide-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.log-entry.correct { background: rgba(47, 204, 113, 0.08); }
.log-entry.wrong { background: rgba(239, 83, 80, 0.12); }
.log-entry.round { color: var(--muted); background: transparent; padding: 4px 11px 2px; }
.log-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 2px; }
.log-n { color: var(--muted); font-size: 11px; }
.log-verdict { font-weight: 700; }
.log-entry.correct .log-verdict { color: var(--green); }
.log-entry.wrong .log-verdict { color: var(--red); }
.log-body b { color: var(--text); font-weight: 600; }
.log-body .sep { color: var(--muted); margin: 0 4px; }
.log-entry.round .pos { color: var(--green); font-weight: 700; }
.log-entry.round .neg { color: var(--red); font-weight: 700; }

/* ---------- toasts ---------- */
.toast-layer { position: fixed; inset: 0; pointer-events: none; z-index: 600; }
.toast {
  position: fixed; transform: translate(-50%, -50%);
  padding: 8px 16px; border-radius: 999px; white-space: nowrap;
  font-weight: 800; font-size: 13px; letter-spacing: 0.3px;
  background: rgba(8, 10, 14, 0.95); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  animation: toast 1.7s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.toast.correct { color: var(--green); }
.toast.wrong { color: var(--red); }
.toast small { font-weight: 600; color: #cfd6e4; margin-left: 6px; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  25% { transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; transform: translate(-50%, -90%); }
  100% { opacity: 0; transform: translate(-50%, -120%); }
}
.notice {
  position: fixed; left: 50%; bottom: calc(var(--controls-h) + 14px); transform: translateX(-50%);
  padding: 9px 18px; border-radius: 999px; background: rgba(8, 10, 14, 0.95);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  font-size: 13px; font-weight: 600; animation: notice 2s ease forwards; z-index: 600;
}
@keyframes notice { 0% { opacity: 0; transform: translate(-50%, 8px); } 12%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 700; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 7, 10, 0.7); backdrop-filter: blur(4px); animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-card {
  position: relative; width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--panel); border-radius: 22px; padding: 24px 26px;
  box-shadow: var(--shadow); animation: modal-in 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.modal-wide { width: min(1040px, calc(100vw - 32px)); }
.modal-small { width: min(440px, calc(100vw - 32px)); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-card h2 { margin: 0; font-size: 18px; font-weight: 800; }
.modal-card h2 .panel-sub { margin-left: 8px; }
.modal-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin: 0 0 10px; }
.modal-card p { color: var(--muted); line-height: 1.5; margin: 0 0 16px; }
.modal-section { margin-top: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.setting {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 13px 16px; margin-bottom: 8px; border-radius: 14px; background: var(--panel-2); cursor: pointer;
  transition: background 0.15s;
}
label.setting:hover { background: var(--panel-3); }
.setting > span { display: flex; flex-direction: column; gap: 3px; }
.setting-title { font-weight: 600; }
.setting-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.switch { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); position: relative; cursor: pointer; flex: 0 0 auto; transition: background 0.2s; margin: 0; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(18px); }
.segmented { display: inline-flex; background: rgba(255, 255, 255, 0.06); border-radius: 999px; padding: 3px; flex: 0 0 auto; }
.segmented button { appearance: none; border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 12px; }
.segmented button.on { background: var(--accent); color: #1a1405; }
.kbd-list { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; color: var(--muted); }
.kbd-list kbd { margin: 0 4px 0 0; }
.rules { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.over-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.over-stats div { background: var(--panel-2); border-radius: 12px; padding: 10px; }
.over-stats b { display: block; font-size: 18px; }
.over-stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* ---------- strategy chart ---------- */
.chart-note { font-size: 12px; color: var(--muted); margin-bottom: 12px; min-height: 16px; }
.chart-note b { color: var(--accent-2); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px 22px; }
.chart-block h3 { margin-bottom: 8px; }
.chart-caption { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-left: 8px; font-weight: 500; }
.chart-table { border-collapse: separate; border-spacing: 2px; width: 100%; table-layout: fixed; }
.chart-table th, .chart-table td { text-align: center; font-size: 11.5px; font-weight: 700; height: 24px; border-radius: 5px; }
.chart-table th { color: var(--muted); font-weight: 600; font-size: 11px; }
.chart-table td.rowlabel { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.chart-table td.e, .chart-legend i { color: #1a1405; }
.e-H { background: #2a3140; color: #aeb7c7 !important; }
.e-S { background: #e6b93a; }
.e-D { background: #31b06e; }
.e-Ds { background: #33a3b8; }
.e-Y { background: #31b06e; }
.e-YN { background: #33a3b8; }
.e-N { background: #2a3140; color: #aeb7c7 !important; }
.chart-table td.hl { position: relative; z-index: 1; transform: scale(1.25); box-shadow: 0 0 16px 5px rgba(255, 255, 255, 0.5); animation: hl 1.2s ease-in-out infinite; }
@keyframes hl { 50% { box-shadow: 0 0 26px 9px rgba(255, 255, 255, 0.7); } }
.chart-table tr.hl-row td.rowlabel, .chart-table th.hl-col { color: #fff; background: rgba(255, 255, 255, 0.14); }
.chart-insurance { margin-top: 16px; padding: 11px 14px; border-radius: 12px; background: rgba(239, 83, 80, 0.14); font-size: 13px; text-align: center; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { display: inline-block; width: 26px; height: 18px; border-radius: 4px; font-style: normal; font-size: 10.5px; font-weight: 800; text-align: center; line-height: 18px; }
.chart-source { margin-top: 14px; font-size: 11px; color: var(--muted); }
.chart-source a { color: var(--accent-2); text-underline-offset: 3px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr 300px; }
  .action-card { width: 150px; height: 84px; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .brand { font-size: 13px; }
  .bankroll { padding: 4px 10px; }
  .bankroll-value { font-size: 15px; }
  .topnav { width: 100%; justify-content: center; }
  .topnav .btn { padding: 7px 10px; font-size: 12px; }
  .layout { display: block; height: auto; }
  .table-wrap { height: 62vw; min-height: 240px; }
  .log { max-height: 320px; }
  .controls { position: sticky; bottom: 0; z-index: 50; height: auto; padding: 8px 10px; gap: 4px; background: rgba(11, 14, 19, 0.92); backdrop-filter: blur(8px); }
  .control-group { flex-wrap: wrap; justify-content: center; gap: 8px 14px; }
  .action-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .action-group[hidden] { display: none; }
  .action-card { width: auto; height: 68px; padding: 10px 14px; border-radius: 16px; }
  .action-card .ac-label { font-size: 17px; }
  .chip-tray { gap: 6px; height: auto; }
  .chip-tray .chip { width: 40px; height: 40px; font-size: 11px; }
  .chip-tray .chip.selected { transform: translateY(-4px) scale(1.06); }
  .bet-buttons { gap: 6px; }
  .btn-deal { padding: 10px 18px; }
  .hint { display: none; }
  .notice { bottom: 130px; }
}
