/* Hold'em Coach — pixel UI. Same Sweetie 16 look as Blackjack Coach. */
:root {
  --bg: #0f1020;
  --panel: #1a1c2c;
  --panel2: #262b44;
  --line: #333c57;
  --line2: #566c86;
  --text: #f4f4f4;
  --muted: #94b0c2;
  --ink: #0b0c16;

  --red: #b13e53;
  --pink: #ff6b81;
  --orange: #ef7d57;
  --yellow: #ffcd75;
  --lime: #a7f070;
  --green: #38b764;
  --teal: #257179;
  --navy: #29366f;
  --blue: #3b5dc9;
  --sky: #41a6f6;
  --cyan: #73eff7;
  --plum: #5d275d;

  --felt: #1f6e3c;
  --felt2: #1c6537;
  --rail: #6b3e1f;
  --rail2: #8a5a2b;

  --act-F: var(--line2);
  --act-X: var(--yellow);
  --act-C: var(--lime);
  --act-R: var(--orange);
  --act-A: var(--pink);

  --cw: 56px;
  --ch: 78px;
  --px: 'Press Start 2P', ui-monospace, Menlo, monospace;
  --vt: 'VT323', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--vt);
  font-size: 20px;
  line-height: 1.15;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(rgba(0, 0, 0, .09) 0 1px, transparent 1px 3px);
  z-index: 100;
}
button { font: inherit; color: inherit; }
h2, h3 { font-family: var(--px); font-weight: normal; margin: 0; }
[hidden] { display: none !important; }
a { color: var(--cyan); }

.px-btn, .panel, .pill, .bank, .verdict, .table-msg, .modal-box, .toast, .rec-action,
.seg button, .tabs button, .lastplay, .plate, .bubble, .card-box, .drill-card {
  --fc: var(--ink);
  box-shadow: 0 -4px 0 0 var(--fc), 0 4px 0 0 var(--fc), -4px 0 0 0 var(--fc), 4px 0 0 0 var(--fc);
}

/* ---------- Buttons ---------- */
.px-btn {
  --bc: var(--panel2);
  --tc: var(--text);
  font-family: var(--px);
  font-size: 10px;
  line-height: 1.25;
  background: var(--bc);
  color: var(--tc);
  border: 0;
  padding: 11px 12px;
  margin: 4px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 -4px 0 0 var(--fc), 0 4px 0 0 var(--fc), -4px 0 0 0 var(--fc), 4px 0 0 0 var(--fc),
    inset 0 -4px 0 0 rgba(0, 0, 0, .3), inset 0 4px 0 0 rgba(255, 255, 255, .15);
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
}
.px-btn:hover:not(:disabled) { filter: brightness(1.15); }
.px-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 -4px 0 0 var(--fc), 0 4px 0 0 var(--fc), -4px 0 0 0 var(--fc), 4px 0 0 0 var(--fc), inset 0 4px 0 0 rgba(0, 0, 0, .3);
}
.px-btn:disabled { opacity: .3; cursor: not-allowed; }
.px-btn:focus-visible, .seg button:focus-visible, .tabs button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 6px; }
.px-btn.small { font-size: 9px; padding: 9px 10px; }
.px-btn.icon { font-size: 14px; padding: 7px 10px; }
.px-btn.primary { --bc: var(--green); --tc: var(--ink); }
.px-btn.off { opacity: .45; }
.px-btn .key { display: inline-block; background: rgba(0, 0, 0, .28); padding: 3px 4px; margin-right: 7px; font-size: 8px; vertical-align: 1px; }
.px-btn small { display: block; font-size: 7px; margin-top: 5px; opacity: .8; }
.act-F { --bc: var(--act-F); --tc: var(--text); }
.act-X { --bc: var(--act-X); --tc: var(--ink); }
.act-C { --bc: var(--act-C); --tc: var(--ink); }
.act-R { --bc: var(--act-R); --tc: var(--ink); }
.act-A { --bc: var(--act-A); --tc: var(--ink); }
.px-btn.rec::after {
  content: '';
  position: absolute;
  top: -16px;
  right: -10px;
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath fill='%23ffcd75' d='M3 0h1v2h3v1H6v1H5v1h1v2H5V6H4V5H3v1H2v1H1V5h1V4H1V3H0V2h3z'/%3E%3C/svg%3E") no-repeat center / contain;
  filter: drop-shadow(2px 2px 0 var(--ink));
  animation: blink 1s steps(2) infinite;
}
.ico { display: inline-block; width: 1.05em; height: auto; vertical-align: -0.12em; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 8px; padding: 4px; }
.seg button {
  --fc: var(--line);
  font-family: var(--px);
  font-size: 9px;
  background: var(--panel);
  color: var(--muted);
  border: 0;
  padding: 8px 9px;
  cursor: pointer;
}
.seg button.on { background: var(--cyan); color: var(--ink); --fc: var(--ink); }
.seg button:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- Top bar ---------- */
.app { max-width: 1480px; margin: 0 auto; padding: 12px 16px 40px; }
.topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 8px 4px 18px; }
.logo { font-family: var(--px); font-size: 18px; display: flex; align-items: center; gap: 10px; text-shadow: 2px 2px 0 var(--plum); }
.logo-sub { font-size: 10px; color: var(--lime); text-shadow: none; align-self: flex-end; margin-bottom: 2px; }
.logo-suit .suit { width: 21px; color: var(--pink); display: block; filter: drop-shadow(2px 2px 0 var(--plum)); }
.back-link { font-family: var(--px); font-size: 8px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--cyan); }
.modes { display: flex; gap: 4px; }
.mode-btn { font-size: 10px; }
.mode-btn.on { --bc: var(--cyan); --tc: var(--ink); }
.bank { font-family: var(--px); font-size: 12px; background: var(--panel); padding: 10px 12px; margin-left: auto; color: var(--yellow); display: flex; gap: 10px; align-items: center; }
.bank .lbl { font-size: 8px; color: var(--muted); }
.top-actions { display: flex; gap: 2px; flex-wrap: wrap; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 22px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 20px; padding: 4px; }

/* ---------- Table ---------- */
.table-wrap { position: relative; margin: 8px 8px 0; }
.stage { position: relative; height: 560px; overflow-x: clip; }
.rail, .felt-in { position: absolute; clip-path: var(--stadium); }
.rail {
  inset: 34px 6px;
  background: var(--ink);
}
.rail::before { content: ''; position: absolute; inset: 6px; clip-path: var(--stadium); background: var(--rail); }
.rail::after { content: ''; position: absolute; inset: 14px; clip-path: var(--stadium); background: var(--rail2); }
.felt-in {
  inset: 56px 28px;
  background-color: var(--felt);
  background-image: repeating-conic-gradient(var(--felt2) 0 25%, transparent 0 50%);
  background-size: 4px 4px;
}
.felt-logo {
  position: absolute;
  left: 50%;
  top: 66%;
  transform: translate(-50%, -50%);
  font-family: var(--px);
  font-size: 11px;
  color: rgba(255, 205, 117, .32);
  text-align: center;
  letter-spacing: 1px;
  pointer-events: none;
  white-space: nowrap;
}
.board {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}
.slot { width: var(--cw); height: var(--ch); box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .25); }
.pot {
  position: absolute;
  left: 50%;
  top: 32%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--px);
  font-size: 11px;
  color: var(--yellow);
  z-index: 3;
  white-space: nowrap;
}
.pot .pill { background: var(--panel); padding: 7px 9px; margin: 4px; }
.pot .chip-svg { width: 22px; }

.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 4;
  width: 150px;
}
.seat[data-s='0'] { left: 50%; top: 88%; }
.seat[data-s='1'] { left: 11%; top: 72%; }
.seat[data-s='2'] { left: 11%; top: 26%; }
.seat[data-s='3'] { left: 50%; top: 11%; }
.seat[data-s='4'] { left: 89%; top: 26%; }
.seat[data-s='5'] { left: 89%; top: 72%; }
.seat .hole { display: flex; min-height: 50px; }
.seat .hole .card + .card { margin-left: -14px; }
.seat.folded .hole, .seat.folded .plate { opacity: .35; }
.seat.out { opacity: .25; }
.plate {
  --fc: var(--ink);
  background: var(--panel);
  padding: 6px 8px;
  min-width: 128px;
  text-align: center;
  position: relative;
  margin: 4px;
}
.seat.acting .plate { --fc: var(--yellow); animation: pulse 1s steps(2) infinite; }
.seat.hero .plate { background: #1d2340; }
.plate .nm { font-family: var(--px); font-size: 9px; display: flex; gap: 6px; justify-content: center; align-items: center; }
.plate .stk { font-family: var(--px); font-size: 9px; color: var(--yellow); margin-top: 5px; }
.plate .hud { font-size: 15px; color: var(--muted); margin-top: 3px; }
.style-tag { font-family: var(--px); font-size: 6px; padding: 2px 3px; color: var(--ink); background: var(--muted); }
.pos-tag {
  position: absolute;
  top: -12px;
  left: -10px;
  font-family: var(--px);
  font-size: 7px;
  padding: 3px 4px;
  background: var(--panel2);
  color: var(--text);
  box-shadow: 0 0 0 2px var(--ink);
}
.dealer-btn {
  position: absolute;
  top: -12px;
  right: -10px;
  width: 20px;
  height: 20px;
  background: var(--text);
  color: var(--ink);
  font-family: var(--px);
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--ink);
  clip-path: polygon(25% 0, 75% 0, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0 75%, 0 25%);
}
.bubble {
  --fc: var(--ink);
  position: absolute;
  top: -30px;
  font-family: var(--px);
  font-size: 8px;
  padding: 5px 6px;
  background: var(--text);
  color: var(--ink);
  white-space: nowrap;
  z-index: 6;
  animation: popBadge .2s steps(3) both;
}
.bubble.raise, .bubble.bet, .bubble.allin { background: var(--orange); }
.bubble.call, .bubble.check { background: var(--lime); }
.bubble.fold { background: var(--line2); color: var(--text); }
.bubble.win { background: var(--yellow); }
.seat[data-s='0'] .bubble { top: auto; bottom: -30px; }
.bet-chips {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--px);
  font-size: 9px;
  color: var(--text);
  text-shadow: 1px 1px 0 var(--ink);
  z-index: 3;
  white-space: nowrap;
}
.bet-chips .chip-svg { width: 18px; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, .45)); }
.bet-chips[data-s='0'] { left: 62%; top: 66%; }
.bet-chips[data-s='1'] { left: 25%; top: 64%; }
.bet-chips[data-s='2'] { left: 25%; top: 36%; }
.bet-chips[data-s='3'] { left: 62%; top: 22%; }
.bet-chips[data-s='4'] { left: 75%; top: 36%; }
.bet-chips[data-s='5'] { left: 75%; top: 64%; }
.hand-name { font-family: var(--px); font-size: 7px; color: var(--yellow); margin-top: 3px; }
.seat.hero .hand-name { display: none; } /* shown in the result message instead */

.table-msg {
  position: absolute;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  font-family: var(--px);
  font-size: 13px;
  background: var(--panel);
  padding: 12px 16px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  z-index: 8;
  white-space: nowrap;
  line-height: 1.5;
}
.table-msg.show { opacity: 1; animation: pop .25s steps(3) both; }
.table-msg.good { color: var(--lime); }
.table-msg.bad { color: #ff7a8f; }
.table-msg small { display: block; font-size: 8px; color: var(--muted); }
.verdict {
  position: absolute;
  left: 50%;
  top: 74%;
  transform: translateX(-50%);
  font-family: var(--px);
  font-size: 9px;
  padding: 9px 11px;
  background: var(--panel);
  white-space: nowrap;
  z-index: 9;
  opacity: 0;
  pointer-events: none;
}
.verdict.show { opacity: 1; animation: popTop .2s steps(3) both; }
.verdict.ok { --fc: var(--green); color: var(--lime); }
.verdict.no { --fc: var(--red); color: #ff7a8f; }

/* ---------- Cards ---------- */
.card {
  width: var(--cw);
  height: var(--ch);
  background: var(--text);
  position: relative;
  flex: 0 0 auto;
  box-shadow:
    0 -3px 0 0 var(--ink), 0 3px 0 0 var(--ink), -3px 0 0 0 var(--ink), 3px 0 0 0 var(--ink),
    6px 6px 0 0 rgba(0, 0, 0, .28), inset -3px -3px 0 0 #c2c3c7;
}
.card.red { color: var(--red); }
.card.black { color: var(--panel); }
.card.win { box-shadow: 0 -3px 0 0 var(--yellow), 0 3px 0 0 var(--yellow), -3px 0 0 0 var(--yellow), 3px 0 0 0 var(--yellow), 0 0 0 6px var(--ink), inset -3px -3px 0 0 #c2c3c7; }
.card.dim { filter: brightness(.55); }
.corner { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: var(--px); font-size: 10px; letter-spacing: -2px; line-height: 1; }
.corner.tl { top: 5px; left: 4px; }
.corner.br { bottom: 5px; right: 6px; transform: rotate(180deg); }
.suit { display: block; height: auto; }
.suit.tiny { width: 10px; }
.suit.mid { width: 21px; }
.suit.ace { width: 28px; }
.pip, .court { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.court { flex-direction: column; gap: 3px; }
.card.is-court::before { content: ''; position: absolute; inset: 18px 11px; box-shadow: inset 0 0 0 2px currentColor; opacity: .35; }
.court-letter { font-family: var(--px); font-size: 15px; }
.suit.court-suit { width: 10px; }
.card.back { background: var(--red); }
.card.back .back-inner {
  position: absolute;
  inset: 5px;
  background-color: var(--plum);
  background-image: repeating-conic-gradient(var(--red) 0 25%, transparent 0 50%);
  background-size: 6px 6px;
  box-shadow: 0 0 0 2px var(--text);
}
.card.sm { --cw: 36px; --ch: 50px; }
.card.sm .corner { font-size: 8px; }
.card.sm .suit.tiny { width: 7px; }
.card.sm .pip, .card.sm .court, .card.sm::before { display: none; }
.card.sm.back .back-inner { inset: 4px; background-size: 4px 4px; }
.card.lg { --cw: 68px; --ch: 94px; }
.card.lg .corner { font-size: 12px; }
.card.lg .suit.tiny { width: 14px; }
.card.lg .suit.mid { width: 28px; }
.card.lg .suit.ace { width: 35px; }
.card.lg .court-letter { font-size: 20px; }
.card.lg .suit.court-suit { width: 14px; }
.card.deal { animation: dealIn .28s steps(6) both; }
.ci { font-family: var(--px); font-size: .62em; display: inline-flex; align-items: center; gap: 1px; color: var(--text); background: #f4f4f4; color: var(--panel); padding: 2px 3px; margin: 0 1px; vertical-align: 1px; }
.ci.red { color: var(--red); }
.ci .ci-suit { width: 8px; }

/* ---------- Controls ---------- */
.controls { padding: 16px 4px 0; min-height: 70px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 8px; }
.controls .grp { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; }
.log-body { font-size: 17px; color: var(--muted); max-height: 240px; overflow: auto; }
.log-body b { color: var(--text); font-weight: normal; }
.log-body .st { font-family: var(--px); font-size: 8px; color: var(--yellow); margin-top: 6px; }

/* ---------- Side panels ---------- */
.panel { --fc: var(--line); background: var(--panel); padding: 14px 14px 16px; margin: 4px; }
.panel:empty { display: none; }
.panel-title { font-family: var(--px); font-size: 9px; color: var(--muted); margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-title .tag { color: var(--ink); background: var(--cyan); padding: 3px 5px; font-size: 8px; }
.panel p { margin: 8px 0 0; }
.sit { font-family: var(--px); font-size: 9px; line-height: 1.7; color: var(--text); margin-bottom: 10px; }
.sit .vs { color: var(--muted); }
.rec-action { font-family: var(--px); font-size: 20px; text-align: center; padding: 14px 8px; margin: 4px 4px 12px; color: var(--ink); background: var(--muted); }
.rec-action.hidden-rec { background: var(--panel2); color: var(--muted); font-size: 13px; line-height: 1.5; }
.rec-action small { display: block; font-size: 8px; margin-top: 8px; opacity: .75; }
.bg-F { background: var(--act-F); color: var(--text); }
.bg-X { background: var(--act-X); }
.bg-C { background: var(--act-C); }
.bg-R { background: var(--act-R); }
.bg-A { background: var(--act-A); }
.why { font-size: 19px; color: #dfe7ee; }
.callout { margin-top: 12px; padding: 9px 10px; background: var(--panel2); border-left: 4px solid var(--yellow); font-size: 18px; }
.callout b { font-family: var(--px); font-size: 8px; display: block; margin-bottom: 5px; font-weight: normal; line-height: 1.5; }
.callout.read { border-color: var(--pink); } .callout.read b { color: var(--pink); }
.callout.pos { border-color: var(--cyan); } .callout.pos b { color: var(--cyan); }
.callout.tex { border-color: var(--lime); } .callout.tex b { color: var(--lime); }
.callout.warn { border-color: var(--orange); } .callout.warn b { color: var(--orange); }
.callout.note { border-color: var(--line2); color: var(--muted); }
.lastplay { --fc: var(--line); margin-top: 16px; padding: 10px; background: #14162a; }
.lastplay.ok { --fc: var(--green); }
.lastplay.no { --fc: var(--red); }
.lastplay .lp-head { font-family: var(--px); font-size: 8px; margin-bottom: 6px; line-height: 1.6; }
.lastplay.ok .lp-head { color: var(--lime); }
.lastplay.no .lp-head { color: #ff7a8f; }
.lastplay .lp-body { font-size: 18px; color: var(--muted); }

.ev-row { display: grid; grid-template-columns: 100px 1fr 74px; align-items: center; gap: 10px; margin: 7px 0; }
.ev-name { font-family: var(--px); font-size: 7px; display: flex; gap: 6px; align-items: center; line-height: 1.3; }
.ev-name .dot { width: 10px; height: 10px; flex: 0 0 auto; }
.ev-val { font-family: var(--px); font-size: 8px; text-align: right; }
.ev-val.pos { color: var(--lime); }
.ev-val.neg { color: #ff8fa0; }
.ev-bar { position: relative; height: 12px; background: #0f1020; }
.ev-bar::before { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--line2); }
.ev-fill { position: absolute; top: 0; bottom: 0; }
.ev-fill.neg { right: 50%; background: var(--red); }
.ev-fill.pos { left: 50%; background: var(--green); }
.ev-row.best .ev-name::after { content: ''; width: 9px; height: 9px; flex: 0 0 auto; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath fill='%23ffcd75' d='M3 0h1v2h3v1H6v1H5v1h1v2H5V6H4V5H3v1H2v1H1V5h1V4H1V3H0V2h3z'/%3E%3C/svg%3E") no-repeat center / contain; }
.ev-foot { font-size: 17px; color: var(--muted); margin-top: 10px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.kpis div { background: #14162a; padding: 8px 6px; text-align: center; }
.kpis .lbl { font-family: var(--px); font-size: 6px; color: var(--muted); display: block; line-height: 1.4; }
.kpis .v { font-family: var(--px); font-size: 13px; display: block; margin-top: 6px; }
.v.good { color: var(--lime); } .v.bad { color: #ff8fa0; } .v.mid { color: var(--yellow); }
.meter { height: 14px; background: #0f1020; position: relative; margin: 6px 0 4px; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--sky); }
.meter b { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--yellow); }
.meter-cap { display: flex; justify-content: space-between; font-family: var(--px); font-size: 7px; color: var(--muted); }
.read-line { font-size: 18px; margin: 4px 0; }
.read-line b { font-family: var(--px); font-size: 8px; color: var(--muted); font-weight: normal; display: inline-block; min-width: 84px; }

/* Range grid */
.rgrid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 1px; background: var(--ink); padding: 1px; margin-top: 4px; }
.rgrid div {
  aspect-ratio: 1;
  font-family: var(--px);
  font-size: 5.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(244, 244, 244, .55);
  background: #14162a;
  position: relative;
  overflow: hidden;
  letter-spacing: -0.5px;
}
.rgrid div.r { background: var(--act-R); color: var(--ink); }
.rgrid div.c { background: var(--act-C); color: var(--ink); }
.rgrid div.me { outline: 2px solid var(--text); outline-offset: -2px; z-index: 1; animation: blink 1s steps(2) infinite; }
.rgrid div i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--pink); }
.rgrid div span { position: relative; z-index: 1; }
.rgrid.big div { font-size: 8px; }
.rgrid.big div.r, .rgrid.big div.c { font-size: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; font-size: 16px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 14px; }
.vtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.vtabs button { font-family: var(--px); font-size: 7px; padding: 6px 7px; background: var(--panel2); color: var(--muted); border: 0; cursor: pointer; box-shadow: 0 0 0 2px var(--line); }
.vtabs button.on { background: var(--pink); color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }

.mini-table { width: 100%; border-collapse: collapse; font-size: 17px; margin-top: 6px; }
.mini-table th, .mini-table td { padding: 4px 5px; border-bottom: 2px solid var(--line); text-align: right; }
.mini-table th:first-child, .mini-table td:first-child { text-align: left; }
.mini-table th { font-family: var(--px); font-size: 6px; color: var(--muted); font-weight: normal; }
.mini-table td.ok { color: var(--lime); }
.mini-table td.no { color: #ff8fa0; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-grid div { background: #14162a; padding: 8px; text-align: center; }
.stat-grid .lbl { font-family: var(--px); font-size: 7px; color: var(--muted); display: block; }
.stat-grid .v { font-family: var(--px); font-size: 12px; display: block; margin-top: 6px; }
.mistakes { list-style: none; margin: 12px 0 0; padding: 0; font-size: 17px; }
.mistakes li { padding: 5px 0; border-top: 2px solid var(--line); color: var(--muted); }
.mistakes li b { color: var(--text); font-weight: normal; }
.mistakes li em { font-style: normal; color: #ff8fa0; }
.note { font-size: 18px; color: var(--muted); }

/* ---------- Drill stage ---------- */
.drill {
  position: absolute;
  inset: 70px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 5;
  text-align: center;
}
.drill-q { font-family: var(--px); font-size: 11px; line-height: 1.7; max-width: 640px; color: var(--text); text-shadow: 2px 2px 0 var(--ink); }
.drill-row { display: flex; gap: 22px; align-items: flex-end; justify-content: center; flex-wrap: wrap; }
.drill-card { --fc: var(--ink); background: rgba(15, 16, 32, .88); padding: 10px 12px; }
.drill-card .lbl { font-family: var(--px); font-size: 7px; color: var(--muted); margin-bottom: 8px; display: block; }
.drill-card .cards { display: flex; gap: 6px; justify-content: center; }
.drill-card .big { font-family: var(--px); font-size: 14px; color: var(--yellow); }
.mini-seats { display: grid; grid-template-columns: repeat(6, auto); gap: 6px; justify-content: center; }
.mini-seats span { font-family: var(--px); font-size: 7px; padding: 5px 5px; background: var(--panel2); color: var(--muted); box-shadow: 0 0 0 2px var(--ink); }
.mini-seats span.me { background: var(--cyan); color: var(--ink); }
.mini-seats span.raiser { background: var(--orange); color: var(--ink); }
.mini-seats span.folded { opacity: .4; }

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; background: rgba(8, 9, 18, .86); z-index: 50; display: flex; justify-content: center; align-items: flex-start; overflow: auto; padding: 36px 16px; }
.modal-box { --fc: var(--line2); background: var(--panel); width: 100%; max-width: 640px; padding: 20px; margin: 4px; }
.modal-box.wide { max-width: 1140px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { font-size: 14px; color: var(--yellow); }
.sub-h { font-size: 10px; color: var(--muted); margin: 22px 0 8px; }
.settings { display: flex; flex-direction: column; gap: 10px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.setting .lbl { font-family: var(--px); font-size: 9px; color: var(--text); }
.settings-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.tabs { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px; margin-bottom: 18px; }
.tabs button { --fc: var(--line); font-family: var(--px); font-size: 9px; background: var(--panel2); color: var(--muted); border: 0; padding: 10px 11px; cursor: pointer; }
.tabs button.on { background: var(--yellow); color: var(--ink); --fc: var(--ink); }
.guide-body h3 { font-size: 11px; color: var(--yellow); margin: 22px 0 10px; line-height: 1.5; }
.guide-body h3:first-child { margin-top: 0; }
.guide-body p, .guide-body li { font-size: 19px; color: #dfe7ee; }
.guide-body ul { padding-left: 20px; margin: 6px 0; }
.guide-body li { margin: 4px 0; }
.guide-body b { color: var(--text); font-weight: normal; font-family: var(--px); font-size: 9px; }
.g-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 22px; padding: 4px; }
.g-card { background: var(--panel2); padding: 12px 14px; box-shadow: 0 0 0 3px var(--line); overflow-x: auto; }
.g-card h4 { font-family: var(--px); font-size: 10px; margin: 0 0 8px; font-weight: normal; line-height: 1.5; }
.g-card p { font-size: 18px; margin: 6px 0; }
.g-table { border-collapse: collapse; margin: 8px 0; font-size: 18px; width: 100%; max-width: 760px; }
.g-table th, .g-table td { border: 2px solid var(--line); padding: 6px 8px; text-align: left; }
.g-table th { font-family: var(--px); font-size: 8px; color: var(--muted); font-weight: normal; }
.calc { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; background: var(--panel2); padding: 12px; margin: 10px 0; }
.calc label { font-family: var(--px); font-size: 8px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.calc input { width: 78px; font-family: var(--px); font-size: 11px; background: #0f1020; color: var(--text); border: 0; padding: 8px; box-shadow: 0 0 0 3px var(--line2); margin: 4px; }
.calc .out { font-size: 19px; flex-basis: 100%; }
.chart-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chart-wrap { display: grid; grid-template-columns: minmax(280px, 520px) 1fr; gap: 24px; align-items: start; }
.hand-rank { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 2px solid var(--line); }
.hand-rank .cards { display: flex; gap: 3px; }
.hand-rank .nm { font-family: var(--px); font-size: 9px; min-width: 150px; }

/* Dashboard */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 22px; padding: 4px; }
.style-map { width: 100%; height: auto; display: block; background: #14162a; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(200%);
  opacity: 0;
  pointer-events: none;
  background: var(--panel);
  --fc: var(--cyan);
  font-family: var(--px);
  font-size: 10px;
  padding: 12px 14px;
  z-index: 60;
  max-width: calc(100vw - 40px);
  line-height: 1.6;
  text-align: center;
  transition: transform .2s steps(4);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

@keyframes dealIn { from { transform: translate(0, -120px) rotate(-10deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(.6); } 100% { transform: translate(-50%, -50%) scale(1); } }
@keyframes popTop { 0% { transform: translateX(-50%) scale(.6); } 100% { transform: translateX(-50%) scale(1); } }
@keyframes popBadge { 0% { transform: scale(.5); } 100% { transform: scale(1); } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes pulse { 50% { --fc: var(--orange); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 1120px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
}
@media (max-width: 720px) {
  :root { --cw: 40px; --ch: 56px; }
  body { font-size: 18px; }
  .app { padding: 8px 16px 32px; }
  .logo { font-size: 13px; }
  .bank { margin-left: 0; }
  .stage { height: 520px; }
  .rail { inset: 30px 0; }
  .felt-logo { display: none; }
  .felt-in { inset: 48px 16px; }
  .seat { width: 96px; }
  .seat[data-s='1'], .seat[data-s='2'] { left: 13%; }
  .seat[data-s='4'], .seat[data-s='5'] { left: 87%; }
  .plate { min-width: 0; width: 92px; padding: 5px 4px; }
  .plate .nm { font-size: 7px; }
  .plate .stk { font-size: 7px; }
  .plate .hud { display: none; }
  .style-tag { display: none; }
  .card.sm { --cw: 26px; --ch: 36px; }
  .card.lg { --cw: 50px; --ch: 70px; }
  .card.lg .corner { font-size: 10px; }
  .card.lg .suit.mid { width: 21px; }
  .corner { font-size: 8px; }
  .suit.tiny { width: 7px; }
  .suit.mid { width: 14px; }
  .suit.ace { width: 21px; }
  .court-letter { font-size: 11px; }
  .card.is-court::before { inset: 13px 8px; }
  .board { gap: 4px; }
  .px-btn { font-size: 8px; padding: 9px 8px; }
  .px-btn .key { display: none; }
  .side { grid-template-columns: minmax(0, 1fr); }
  .drill { inset: 60px 18px; }
  .drill-q { font-size: 9px; }
  .chart-wrap { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Fit table + buttons in one screen (laptop / desktop) ---------- */
@media (min-width: 721px) {
  .table-col { display: flex; flex-direction: column; height: clamp(500px, calc(100vh - var(--topbar, 80px) - 20px), 880px); }
  .table-wrap { flex: 1 1 auto; min-height: 0; display: flex; }
  .stage { flex: 1 1 auto; height: auto; }
  .controls { flex: 0 0 auto; min-height: 70px; padding-top: 14px; }
}
@media (min-width: 1121px) {
  /* keep the table in view while scrolling the coach panels */
  .table-col { position: sticky; top: 8px; }
}
@media (min-width: 721px) and (max-height: 820px) {
  :root { --cw: 46px; --ch: 64px; }
  .corner { font-size: 9px; }
  .suit.tiny { width: 7px; }
  .suit.mid { width: 14px; }
  .suit.ace { width: 21px; }
  .court-letter { font-size: 12px; }
  .card.is-court::before { inset: 14px 9px; }
  .card.lg { --cw: 56px; --ch: 78px; }
  .card.lg .corner { font-size: 10px; }
  .card.lg .suit.tiny { width: 10px; }
  .card.lg .suit.mid { width: 21px; }
  .card.lg .suit.ace { width: 28px; }
  .card.lg .court-letter { font-size: 15px; }
  .card.sm { --cw: 30px; --ch: 42px; }
  .seat .hole { min-height: 42px; }
  .seat { gap: 2px; }
  .plate { padding: 4px 6px; }
  .plate .stk { margin-top: 3px; }
  .plate .hud { font-size: 14px; margin-top: 1px; }
  .seat[data-s='0'] { top: 86%; }
  .seat[data-s='3'] { top: 12%; }
  .drill { inset: 52px 50px; gap: 10px; }
}
@media (min-width: 721px) and (max-height: 660px) {
  .card.lg { --cw: 50px; --ch: 70px; }
  .card.lg .suit.mid { width: 14px; }
  .seat[data-s='0'] { top: 85%; }
  .plate .hud { display: none; }
}

/* ---------- Phones: compact header, table + buttons on one screen ---------- */
@media (max-width: 720px) {
  .app { padding: max(8px, env(safe-area-inset-top)) 12px 28px; }
  .topbar { gap: 4px 6px; padding: 2px 0 8px; }
  /* Home button: a real, thumb-sized target (the visible square plus an invisible 44px hit area). */
  .back-link { order: 0; position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 30px; margin: 2px 4px 2px 2px;
    font-size: 11px; color: var(--text); background: var(--panel2); box-shadow: 0 0 0 2px var(--ink), inset 0 -3px 0 0 rgba(0, 0, 0, .3); }
  .back-link::after { content: ''; position: absolute; inset: -8px -6px; }
  .back-link:active { transform: translateY(1px); }
  .bl-txt { display: none; }
  .logo { order: 1; font-size: 12px; gap: 6px; }
  .logo-suit .suit { width: 14px; }
  .logo-sub { font-size: 7px; }
  .bank { order: 2; margin-left: auto; font-size: 8px; padding: 7px 7px; gap: 5px; }
  .topbar::after { content: ''; order: 3; flex-basis: 100%; height: 0; }
  .bank .lbl { font-size: 6px; }
  .bank .lbl-stack { display: none; }
  .modes { order: 4; }
  .top-actions { order: 5; margin-left: auto; }
  .topbar .px-btn { margin: 4px 2px; font-size: 7px; padding: 8px 6px; }
  .topbar .px-btn.icon { font-size: 12px; padding: 5px 7px; }

  .table-col { display: flex; flex-direction: column; height: clamp(430px, calc(100vh - var(--topbar, 90px) - 10px), 860px); height: clamp(430px, calc(100dvh - var(--topbar, 90px) - 10px), 860px); }
  .table-wrap { flex: 1 1 auto; min-height: 0; display: flex; margin: 2px 0 0; }
  .stage { flex: 1 1 auto; height: auto; }
  .rail { inset: 26px 0; }
  .felt-in { inset: 44px 16px; }
  .seat[data-s='0'] { top: 87%; }
  .seat[data-s='3'] { top: 13%; }
  .pos-tag { left: -2px; top: -11px; font-size: 6px; }
  .bet-chips[data-s='0'] { left: 50%; top: 67%; }
  .bet-chips[data-s='1'] { left: 36%; top: 70%; }
  .bet-chips[data-s='2'] { left: 32%; top: 37.5%; }
  .bet-chips[data-s='3'] { left: 50%; top: 25%; }
  .bet-chips[data-s='4'] { left: 68%; top: 37.5%; }
  .seat .hole { min-height: 38px; }
  .bet-chips[data-s='5'] { left: 64%; top: 70%; }
  .bet-chips { font-size: 8px; }
  .bet-chips .chip-svg { width: 14px; }
  .dealer-btn { right: -2px; top: -11px; width: 16px; height: 16px; font-size: 7px; }
  .bubble { font-size: 7px; padding: 4px 5px; top: -24px; }
  .seat[data-s='0'] .bubble { bottom: -24px; }
  .pot { top: 31%; }
  .pot .pill { padding: 5px 7px; font-size: 9px; }
  .verdict { font-size: 7px; padding: 6px 8px; }
  .table-msg { font-size: 11px; padding: 10px 12px; }

  .controls { flex: 0 0 auto; min-height: 0; padding: 6px 0 0; gap: 4px; }
  .controls .grp:first-child { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; gap: 0 4px; }
  .controls .grp:first-child .px-btn { margin: 4px 2px; padding: 9px 2px; white-space: normal; }
  .controls .grp + .grp { width: 100%; gap: 2px 4px; }
  .controls .seg button { padding: 7px 6px; font-size: 7px; }
  .drill { inset: 40px 8px; gap: 8px; }
  .drill-row { gap: 8px; }
  .drill-card { padding: 7px 8px; }
  .drill-card .big { font-size: 11px; }

  .modal { padding: 12px 8px; }
  .modal-box { padding: 14px 12px; }
  .tabs { gap: 6px; }
  .tabs button { font-size: 8px; padding: 8px 7px; }
  .g-table { font-size: 16px; }
  .g-table th, .g-table td { padding: 5px 5px; }
}
@media (max-width: 720px) and (max-height: 640px) {
  .board { top: 50%; }
  .seat[data-s='0'] { top: 85.5%; }
  .bet-chips[data-s='2'], .bet-chips[data-s='4'] { top: 38.5%; }
  .bet-chips[data-s='0'] { top: 62%; }
  .bet-chips[data-s='1'] { left: 38%; top: 68%; }
  .bet-chips[data-s='5'] { left: 62%; top: 68%; }
}

/* ---------- Phone coach strip (between table and buttons) ---------- */
.mcoach { display: none; }
@media (max-width: 720px) {
  .mcoach {
    display: block; flex: 0 0 auto; height: 94px; overflow: hidden; margin: 4px 0 0; padding: 7px 9px;
    background: var(--panel); box-shadow: 0 0 0 3px var(--line); cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .mcoach:empty { display: none; }
  .mc-top { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; overflow: hidden; }
  .mc-tag { font-family: var(--px); font-size: 7px; color: var(--muted); }
  .mc-act { font-family: var(--px); font-size: 10px; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
  .mc-act.mc-F { color: var(--muted); } .mc-act.mc-X { color: var(--act-X); } .mc-act.mc-C { color: var(--act-C); }
  .mc-act.mc-R { color: var(--act-R); } .mc-act.mc-A { color: var(--act-A); }
  .mc-meta { margin-left: auto; font-family: var(--px); font-size: 7px; color: var(--cyan); }
  .mc-ev { display: grid; grid-template-columns: repeat(auto-fit, minmax(46px, 1fr)); gap: 3px; margin-top: 6px; }
  .mc-ev div { background: #14162a; padding: 3px 1px; text-align: center; overflow: hidden; }
  .mc-ev .mark { box-shadow: inset 0 0 0 2px var(--yellow); }
  .mc-ev .l { display: block; font-family: var(--px); font-size: 5.5px; color: var(--muted); white-space: nowrap; }
  .mc-ev .v { display: block; font-family: var(--px); font-size: 7px; margin-top: 2px; }
  .mc-ev .v.pos { color: var(--lime); } .mc-ev .v.neg { color: #ff8fa0; }
  .mc-why { font-size: 15px; line-height: 1.05; color: #dfe7ee; margin-top: 5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .mc-ev + .mc-why { -webkit-line-clamp: 2; }
  .mc-why .ico { width: 12px; }

  /* Make room for the strip: smaller cards and tighter buttons on phones. */
  :root { --cw: 36px; --ch: 50px; }
  .card.lg { --cw: 46px; --ch: 64px; }
  .card.lg .corner { font-size: 9px; }
  .card.lg .suit.tiny { width: 7px; }
  .card.lg .suit.mid { width: 14px; }
  .card.lg .suit.ace { width: 21px; }
  .card.lg .court-letter { font-size: 12px; }
  .card.sm { --cw: 24px; --ch: 34px; }
  .card.sm .corner { font-size: 7px; }
  .seat .hole { min-height: 34px; }
  .plate { padding: 3px 4px; }
  .board { top: 50%; }
  .pot { top: 33%; }
  .seat[data-s='3'] { top: 12%; }
  .seat[data-s='3'] .bubble { top: 0; left: 90px; }
  .bet-chips[data-s='3'] { top: 23.5%; }
  .seat[data-s='0'] { top: 85.5%; }
  .bet-chips[data-s='0'] { top: 62%; }
  .bet-chips[data-s='1'] { left: 38%; top: 68%; }
  .bet-chips[data-s='2'], .bet-chips[data-s='4'] { top: 38.5%; }
  .bet-chips[data-s='5'] { left: 62%; top: 68%; }
  .controls .grp:first-child .px-btn { padding: 7px 2px; }
  .controls .grp:first-child .px-btn small { margin-top: 3px; font-size: 6px; }
  .drill { inset: 34px 6px; gap: 6px; }
  .drill-q { font-size: 8px; }
  .drill-card .cards .card.lg { --cw: 40px; --ch: 56px; }
}
@media (max-width: 720px) and (max-height: 640px) {
  .mcoach { height: 80px; }
  .mc-ev + .mc-why { -webkit-line-clamp: 1; }
  .mc-why { -webkit-line-clamp: 2; }
  :root { --cw: 32px; --ch: 45px; }
  .card.lg { --cw: 40px; --ch: 56px; }
  .card.sm { --cw: 22px; --ch: 30px; }
  .seat .hole { min-height: 30px; }
  .plate .stk { margin-top: 1px; }
}
/* Phone chip lanes: top seats' bets in one row between the top seat and the
   pot, bottom seats' bets in one row between the board and the bottom seats. */
@media (max-width: 720px) {
  .bet-chips { gap: 3px; font-size: 7px; }
  .bet-chips .chip-svg { width: 12px; }
  .seat[data-s='1'], .seat[data-s='5'] { top: 74%; }
  .bet-chips[data-s='2'] { left: 36.5%; top: 25.3%; }
  .bet-chips[data-s='3'] { left: 50%; top: 25.3%; }
  .bet-chips[data-s='4'] { left: 63.5%; top: 25.3%; }
  .bet-chips[data-s='1'] { left: 36.5%; top: 60.2%; }
  .bet-chips[data-s='0'] { left: 50%; top: 60.2%; }
  .bet-chips[data-s='5'] { left: 63.5%; top: 60.2%; }
  .seat[data-s='0'] .bubble { top: -22px; bottom: auto; }
}
/* Phones: the home button replaces the logo's suit icon, keeping the header at two rows. */
@media (max-width: 720px) {
  .logo-suit { display: none; }
  .logo { gap: 5px; }
  .back-link { margin-right: 2px; }
}
@media (max-width: 720px) {
  .bank { padding: 7px 5px; gap: 4px; }
}

/* Phone cards: rank + small suit top-left and one suit bottom-right, instead of a
   centre pip that crowds the corner indexes on these small cards. */
@media (max-width: 720px) {
  .card.face .corner.br { display: none; }
  .card.face .pip, .card.face .court { inset: auto 4px 5px auto; }
  .card.face .suit.mid, .card.face .suit.ace, .card.face .suit.court-suit { width: 14px; }
  .card.face .court-letter { display: none; }
  .card.face.is-court::before { display: none; }
  .card.lg.face .suit.mid, .card.lg.face .suit.ace, .card.lg.face .suit.court-suit { width: 21px; }
  .card.lg.face .pip, .card.lg.face .court { inset: auto 4px 5px auto; }
}
@media (max-width: 720px) and (max-height: 640px) {
  .card.lg.face .suit.mid, .card.lg.face .suit.ace, .card.lg.face .suit.court-suit { width: 14px; }
}
/* Phones: a fixed-height button area, so the table doesn't resize (jump) when
   your turn's two rows of buttons swap for a single NEXT HAND button. */
@media (max-width: 720px) {
  .controls { min-height: 92px; align-content: center; }
}
