/* Blackjack Trainer's own look, after the shell every tool shares (../shell/shell.css: the brand, the name card, the
   score, the list down the left, the settings and their "i", the windows, the result, the phone layout, and the wide
   middle column every trainer has). What is here is the card table in that column and the buttons under it. */
:root {
  --felt: #0d2325;
  --felt-edge: #1d4645;
  /* one colour per play, the same on the chart and on the buttons */
  --hit: #f2906f;
  --stand: #f0cf6a;
  --double: #6fd0e8;
  --split: #74d6a2;
  --surrender: #bcaaf2;
  --card: #f6efdf;
  --card-red: #c5372c;
  --card-black: #1c1712;
}
.pname .vs { color: var(--muted); font-weight: 500; font-stretch: 100%; font-size: .7em; margin-inline: .25em; }
.ptip .good { color: var(--ok); font-weight: 600; }
.ptip .miss { color: var(--bad); font-weight: 600; }
/* the number being typed for a count */
.answerbox { justify-self: center; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.answerbox output {
  min-width: 96px; box-sizing: border-box; padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg);
  font-family: var(--f-mono); font-weight: 600; font-size: 22px; color: var(--fg); font-variant-numeric: tabular-nums;
}
.answerbox output:empty::before { content: "?"; color: var(--line-strong); }
.answerbox.is-active output { border-color: var(--scan); }
/* how each play does on average: one row per play */
.evs { justify-self: center; display: grid; grid-template-columns: auto auto; gap: 3px 12px; margin-top: 4px; font-family: var(--f-mono); font-size: 12px; text-align: start; font-variant-numeric: tabular-nums; }
.evs small { grid-column: 1 / -1; font-family: var(--f-display); font-size: 11.5px; color: var(--muted); text-align: center; margin-bottom: 1px; }
.evs span { color: var(--muted); }
.evs b { font-weight: 600; text-align: end; color: var(--fg); }
.evs .best, .evs .best + b { color: var(--ok); }

.felt {
  flex: 1; min-height: 0; overflow: auto; box-sizing: border-box; position: relative;
  container-type: size; /* lets the cards size themselves from the table's height (cqh units) */
  background: radial-gradient(90% 70% at 50% 0%, #123032 0%, var(--felt) 60%, #0a1b1e 100%);
  border: 1px solid var(--felt-edge); border-radius: 18px;
  padding: 16px; display: grid; align-content: center; justify-items: center; gap: 14px;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.felt.is-top { align-content: start; }
.stage.flash-ok .felt { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.stage.flash-bad .felt { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.note { color: var(--muted); font-size: 13.5px; line-height: 1.55; max-width: 52ch; text-align: center; margin: 0; text-wrap: pretty; }
.note b { color: var(--fg); font-weight: 600; }
.tag { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

/* ---------- playing cards (class pcard: .card is the shell's windows) ---------- */
.pcard {
  direction: ltr; /* a card is the same card in every language: its rank top left */
  --w: 72px;
  width: var(--w); aspect-ratio: 5 / 7; flex: none; position: relative; box-sizing: border-box;
  border-radius: calc(var(--w) * 0.09); background: var(--card); color: var(--card-black);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 2px 0 rgba(0, 0, 0, 0.3), 0 8px 18px rgba(0, 0, 0, 0.35);
  font-weight: 750; font-stretch: 90%; user-select: none;
}
.pcard.red { color: var(--card-red); }
.pcard .cr { position: absolute; top: 5%; left: 10%; font-size: calc(var(--w) * 0.34); line-height: 1; letter-spacing: -0.04em; }
.pcard .cs { position: absolute; top: calc(5% + var(--w) * 0.36); left: 10%; width: calc(var(--w) * 0.2); height: calc(var(--w) * 0.2); }
.pcard .cp { position: absolute; right: 9%; bottom: 7%; width: calc(var(--w) * 0.46); height: calc(var(--w) * 0.46); }
.pcard svg { display: block; fill: currentColor; }
.pcard.back {
  background:
    repeating-linear-gradient(45deg, rgba(111, 208, 232, 0.16) 0 3px, transparent 3px 9px),
    repeating-linear-gradient(-45deg, rgba(111, 208, 232, 0.16) 0 3px, transparent 3px 9px),
    #15303a;
  border: calc(var(--w) * 0.05) solid var(--card);
}
.pcard.in { animation: deal .22s ease-out both; }
@keyframes deal { from { opacity: 0; transform: translateY(-14px) scale(.96); } }
.hand { display: flex; justify-content: center; }
.hand .pcard + .pcard { margin-inline-start: calc(var(--w) * -0.42); }
.hand.spread .pcard + .pcard { margin-inline-start: calc(var(--w) * 0.12); }

/* ---------- one hand against the dealer (strategy, deviations) ---------- */
.duel { display: grid; justify-items: center; gap: 10px; }
.duel .pcard { --w: clamp(46px, 19cqh, 104px); }
.duel .dealer .pcard { --w: clamp(40px, 16cqh, 88px); }
/* a smaller pair of hands above the chart in guided practice */
.duel.small { grid-template-columns: auto auto; gap: 6px 22px; align-items: center; margin-bottom: 10px; }
.duel.small .tag { display: none; }
.duel.small .pcard, .duel.small .dealer .pcard { --w: 44px; }
.duel.small .hand .pcard + .pcard { margin-inline-start: 5px; }
.duel .hand .pcard + .pcard { margin-inline-start: calc(var(--w) * 0.12); }
.tcbadge { font-family: var(--f-mono); font-size: 13px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 5px 14px; background: rgba(10, 15, 20, 0.5); }
.tcbadge b { color: var(--bone); font-size: 17px; font-weight: 600; margin-inline-start: 6px; }

/* ---------- strategy chart ---------- */
.charts { display: grid; gap: 16px; width: 100%; max-width: 620px; }
/* the strategy charts keep the layout every chart has (the dealer's 2 to ace left to right), in every language */
.chart { direction: ltr; width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; }
.chart caption { text-align: start; padding: 0 2px 4px; }
.chart th { font-family: var(--f-mono); font-weight: 500; font-size: 11.5px; color: var(--muted); padding: 2px 0; }
.chart th.rowh { text-align: end; padding-inline-end: 6px; width: 58px; color: var(--fg); white-space: nowrap; }
.chart td { padding: 0; }
.chart td button {
  width: 100%; height: clamp(22px, calc(3.1vh / var(--room, 1)), 30px); display: block; border: 0; border-radius: 4px; cursor: pointer; padding: 0;
  font-family: var(--f-mono); font-weight: 600; font-size: 12px; color: #10161c; background: var(--c);
}
.chart td button:hover { filter: brightness(1.15); }
.chart td button[aria-pressed="true"] { outline: 2px solid var(--fg); outline-offset: 1px; }
.chart td button.is-miss { box-shadow: inset 0 0 0 2px #10161c, 0 0 0 2px var(--bad); }
.chart td button.is-dim { opacity: .28; }
.a-H { --c: var(--hit); } .a-S { --c: var(--stand); } .a-D { --c: var(--double); } .a-P { --c: var(--split); } .a-R { --c: var(--surrender); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 18px; border-radius: 4px; background: var(--c); color: #10161c; font-family: var(--f-mono); font-style: normal; font-weight: 600; font-size: 10.5px; display: grid; place-items: center; }

/* ---------- card values ---------- */
.values { display: grid; grid-template-columns: repeat(5, auto); gap: 14px 12px; justify-content: center; }
.values figure { margin: 0; display: grid; justify-items: center; gap: 6px; }
.values .pcard { --w: min(clamp(40px, 13cqh, 64px), 13.5cqw); }
.values figcaption, .tagval { font-family: var(--f-mono); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.plus { color: var(--ok); } .minus { color: var(--bad); } .zero { color: var(--muted); }
.flash { display: flex; gap: 12px; justify-content: center; align-items: center; min-height: min(236px, 62cqh); cursor: pointer; }
.flash .pcard { --w: min(clamp(70px, 42cqh, 160px), 40cqw); }
.flash.g2 .pcard { --w: min(clamp(64px, 38cqh, 140px), 38cqw); }
.flash.g3 .pcard { --w: min(clamp(56px, 32cqh, 120px), 27cqw); }
.bigcount { font-family: var(--f-mono); font-weight: 600; font-size: clamp(34px, calc(7vh / var(--room, 1)), 56px); color: var(--bone); font-variant-numeric: tabular-nums; line-height: 1; }
.livecount { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip { background: rgba(10, 15, 20, 0.55); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 12px; display: grid; gap: 1px; min-width: 76px; text-align: center; }
.chip b { font-family: var(--f-mono); font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; color: var(--bone); }
.chip small { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.chip i { font-style: normal; font-family: var(--f-mono); font-size: 11px; font-variant-numeric: tabular-nums; }
/* bankroll over a session */
.spark { width: 100%; max-width: 560px; display: grid; gap: 4px; }
.spark svg { width: 100%; height: 110px; display: block; overflow: visible; }
.spark polyline { fill: none; stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark polyline.up { stroke: var(--ok); } .spark polyline.down { stroke: var(--bad); }
.spark line.base { stroke: var(--line-strong); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
/* the money runs left to right in every language, as charts do, so its start and end labels do too */
.sparkcap { direction: ltr; display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.devs td small { color: var(--muted); font-weight: 500; }
/* every card of a round laid out with the count after each one */
.strip { display: flex; flex-wrap: wrap; gap: 10px 6px; justify-content: center; max-width: 640px; }
.strip figure { margin: 0; display: grid; justify-items: center; gap: 3px; }
.strip .pcard { --w: clamp(30px, 6cqw, 44px); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.strip .pcard .cp { display: none; }
.strip .pcard .cr { font-size: calc(var(--w) * 0.44); top: 8%; }
.strip .pcard .cs { top: calc(8% + var(--w) * 0.5); width: calc(var(--w) * 0.34); height: calc(var(--w) * 0.34); }
.strip figcaption { font-family: var(--f-mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.strip figure.is-now .pcard { outline: 2px solid var(--scan); outline-offset: 2px; }
.strip figure.is-now figcaption { color: var(--scan); }

/* ---------- discard tray (true count) ---------- */
.trayrow { display: flex; gap: 28px; align-items: center; justify-content: center; flex-wrap: wrap; }
.tray { position: relative; width: 92px; height: var(--h, 190px); box-sizing: content-box; border: 2px solid rgba(232, 237, 240, 0.34); border-top: 0; border-radius: 0 0 8px 8px; background: rgba(232, 237, 240, 0.04); }
.tray .stack {
  position: absolute; left: 5px; right: 5px; bottom: 4px; height: var(--fill, 0%); border-radius: 2px;
  background: repeating-linear-gradient(180deg, #efe6d2 0 1.5px, #b9ae95 1.5px 2.5px);
  box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
}
.tray .ticks { position: absolute; inset: 0 auto 4px 100%; width: 34px; pointer-events: none; }
.tray .ticks span { position: absolute; left: 4px; transform: translateY(50%); font-family: var(--f-mono); font-size: 10px; color: var(--muted); padding-inline-start: 10px; white-space: nowrap; }
.tray .ticks span::before { content: ""; position: absolute; left: 0; top: 50%; width: 7px; height: 1px; background: var(--muted); }
.traycap { font-family: var(--f-mono); font-size: 11px; color: var(--muted); text-align: center; margin-top: 8px; }
.trayside { display: grid; justify-items: center; gap: 10px; }

/* ---------- index plays (deviations) ---------- */
.devs { width: 100%; max-width: 560px; border-collapse: collapse; font-size: 13px; }
.devs th { font-family: var(--f-mono); font-weight: 500; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); text-align: start; padding: 4px 8px; }
.devs td { padding: 6px 8px; border-top: 1px solid rgba(232, 237, 240, 0.09); }
.devs td:first-child { font-weight: 650; color: var(--bone); white-space: nowrap; }
.devs td.ix { font-family: var(--f-mono); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.devs tr.grp td { border: 0; padding-top: 14px; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--scan); font-weight: 500; }

/* ---------- full table ---------- */
.table { width: 100%; height: 100%; min-height: 0; display: grid; grid-template-rows: auto auto 1fr auto; gap: 8px; justify-items: center; align-items: center; position: relative; }
.table .seatlabel { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); text-align: center; }
.table .dealerbox { display: grid; gap: 5px; justify-items: center; min-height: calc(var(--dw) * 1.4 + 18px); }
.table .dealerbox .pcard { --w: var(--dw); }
.table { --dw: clamp(32px, 12.5cqh, 62px); --ow: clamp(24px, 9cqh, 46px); --yw: clamp(38px, 16cqh, 80px); }
.others { display: flex; gap: 18px; justify-content: center; align-items: start; flex-wrap: wrap; min-height: calc(var(--ow) * 1.4 + 34px); }
.seat { display: grid; gap: 4px; justify-items: center; }
.seat .pcard { --w: var(--ow); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.seat .hands { display: flex; gap: 8px; }
.you { display: grid; gap: 6px; justify-items: center; align-self: end; }
.you .hands { display: flex; gap: 16px; justify-content: center; }
.you .pcard { --w: var(--yw); }
.handbox { display: grid; gap: 4px; justify-items: center; padding: 4px 6px; border-radius: 10px; border: 1px solid transparent; }
.handbox.is-turn { border-color: var(--scan); background: rgba(111, 208, 232, 0.06); }
.handbox .res { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; min-height: 1.2em; color: var(--muted); }
.handbox .res.win { color: var(--ok); } .handbox .res.lose { color: var(--bad); }
.handbox .hand .pcard.side { transform: rotate(90deg); margin-inline-start: calc(var(--w) * -0.1); margin-inline-end: calc(var(--w) * 0.2); }
.handbox .hand.spread .pcard.side { margin-inline-start: calc(var(--w) * 0.34); }
.table .minitray { position: absolute; right: 2px; top: 0; display: grid; justify-items: center; gap: 4px; }
.table .minitray .tray { width: 34px; border-width: 1.5px; }
.table .minitray .tray .stack { left: 3px; right: 3px; bottom: 3px; }
.table .minitray .tray .ticks { display: none; }
.table .livecount { position: absolute; left: 0; top: 0; display: grid; gap: 6px; justify-content: start; }
.table .livecount .chip { min-width: 62px; padding: 4px 8px; }
.table .livecount .chip b { font-size: 15px; }

/* ---------- buttons under the table ---------- */
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; width: 100%; }
.actions:empty { display: none; }
.act {
  font: inherit; font-weight: 700; font-stretch: 105%; font-size: 15px; color: var(--fg); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 9px; padding: 11px 16px; min-width: 92px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; position: relative;
}
.act kbd { font-family: var(--f-mono); font-weight: 500; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; }
.act[data-c] { border-bottom: 3px solid var(--c); padding-bottom: 9px; }
.act:hover:not(:disabled) { border-color: var(--scan); }
.act[data-c]:hover:not(:disabled) { border-color: var(--c); }
.act:disabled { opacity: .32; cursor: default; }
.act.primary { background: var(--bone); color: #1b1610; border-color: var(--bone); }
.act.primary kbd { color: #5d5345; border-color: #a99c84; }
.act.is-right { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok); opacity: 1; }
.act.is-wrong { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); opacity: 1; }
.act.wide { min-width: 0; padding-inline: 13px; font-size: 14px; }
.act small { font-family: var(--f-mono); font-weight: 500; font-size: 10.5px; color: var(--muted); }
.act.primary small { color: #5d5345; }
.act.bet { flex-direction: column; gap: 2px; padding: 8px 14px; min-width: 84px; font-family: var(--f-mono); font-size: 16px; }
.act.bet.primary { box-shadow: 0 0 0 1px var(--bone); }
.keypad { display: grid; grid-template-columns: repeat(6, minmax(0, 54px)); gap: 5px; justify-content: center; }
.keypad button {
  font-family: var(--f-mono); font-weight: 600; font-size: 17px; color: var(--fg); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; height: 42px; padding: 0;
}
.keypad button:hover { border-color: var(--scan); }
.keypad .go { grid-column: span 2; background: var(--bone); color: #1b1610; border-color: var(--bone); font-family: var(--f-display); font-weight: 700; font-size: 14px; }

.panel select {
  width: 100%; font: inherit; font-size: 13px; font-weight: 600; color: var(--fg); background: var(--bg); border: 1px solid var(--line-strong); border-radius: 7px; padding: 8px 10px;
}
/* ---------- phones / narrow ---------- */
@media (max-width: 900px) {
  .felt { padding: 12px 10px; border-radius: 14px; }
  .chart { border-spacing: 1.5px; }
  .chart th.rowh { width: 44px; padding-inline-end: 4px; font-size: 11px; }
  .chart td button { font-size: 11px; height: 25px; border-radius: 3px; }
  .act { flex: 1 1 28%; min-width: 0; padding: 13px 8px; font-size: 15px; }
  .act kbd { display: none; }
  .act.bet { flex: 1 1 18%; min-width: 0; padding: 8px 4px; font-size: 14px; }
  .act.bet small { font-size: 10px; }
  .keypad { grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; }
  .keypad button { height: 44px; }
  .table .livecount .chip { min-width: 50px; padding: 3px 6px; }
  .table .livecount .chip b { font-size: 13px; }
  .others { gap: 10px; }
  .trayrow { gap: 18px; }
}
@media (max-width: 900px) and (max-height: 640px) {
  .ptip { font-size: 12px; line-height: 1.4; }
}
