:root {
  color-scheme: dark;
  --felt: #082d25;
  --felt-deep: #041b17;
  --felt-light: #12483b;
  --cream: #f4e9cf;
  --paper: #fff8e8;
  --ink: #11221d;
  --muted: #9eb7ad;
  --line: rgba(244, 233, 207, 0.17);
  --red: #e2553e;
  --yellow: #e5b94b;
  --green: #5dcc8b;
  --blue: #62aeea;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--felt-deep); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  background:
    radial-gradient(circle at 20% 0%, rgba(43, 121, 95, 0.35), transparent 35rem),
    radial-gradient(circle at 90% 35%, rgba(179, 132, 53, 0.10), transparent 28rem),
    linear-gradient(150deg, #0a332a 0%, var(--felt-deep) 75%);
  font-family: "Avenir Next Condensed", "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button, select, input { font: inherit; }
button, select { min-height: 44px; }
button { cursor: pointer; }

.felt-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.3'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.app-shell {
  position: relative;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(42px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.masthead, .panel-heading, .last-card-card, .bet-title, .metric-row, .best-card-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.masthead { margin-bottom: 18px; }
.masthead h1 {
  margin: 2px 0 0;
  font: 700 clamp(2.2rem, 11vw, 4.7rem)/0.9 "Bodoni 72", Didot, Georgia, serif;
  letter-spacing: -0.055em;
}
.masthead h1 i { color: var(--red); font-weight: 400; }
.brand-row { display: flex; gap: 12px; align-items: center; }
.brand-mark { width: clamp(46px, 8vw, 70px); height: auto; flex: 0 0 auto; border-radius: 20%; box-shadow: 0 10px 28px rgba(0,0,0,.22); }
.brand-title { white-space: nowrap; }

.header-actions { display: flex; gap: 8px; align-items: center; }
.help-link, .account-link {
  display: grid;
  place-items: center;
  min-height: 44px;
  text-decoration: none;
  white-space: nowrap;
}

.eyebrow, .section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.text-button, .mini-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 15px;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.04);
}
.text-button:hover, .mini-button:hover { background: rgba(255, 255, 255, 0.1); }

/* Shared: any page may need a label that only screen readers read. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}


/* These two must sit after .text-button — same specificity, so source order
   decides, and an earlier block would lose its colour to it. */

/* Help is reference, not action. It recedes. */
.help-link {
  color: var(--muted);
  border-color: rgba(158, 183, 173, 0.30);
  background: rgba(158, 183, 173, 0.06);
}
.help-link:hover { color: var(--cream); background: rgba(158, 183, 173, 0.14); }

/* The account entry point, on every page. Worth its own emphasis: a customer
   who cleared cookies or installed the PWA has no other way back to what they
   paid for. Blue because it is the one thing up here to *do*; gold once the
   session is entitled, so "am I signed in on this device" is answerable at a
   glance without opening the page. */
.account-link {
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--blue);
  border-color: rgba(98, 174, 234, 0.48);
  background: rgba(98, 174, 234, 0.13);
}
.account-link:hover { background: rgba(98, 174, 234, 0.22); }
.account-link.is-pro {
  color: var(--ink);
  background: var(--yellow);
  border-color: var(--yellow);
}
.account-link.is-pro:hover { background: var(--yellow); filter: brightness(1.06); }

/* The primary call to action. Shared, not practice-only: the account page's
   sign-in button is the same control, and it lives here so that page does not
   have to pull in the whole drill sheet to get a styled button. */
.start-drill-button {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 0;
  border-radius: 999px;
  padding: 0 23px;
  color: var(--ink);
  background: var(--cream);
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
}
.start-drill-button span { color: var(--red); font-size: 1.35rem; }
.start-drill-button:active { transform: scale(.98); }

/* Four modes, not the three this was built for — a repeat(3) grid left
   Strategy stranded alone on a second row. */
.mode-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(2, 17, 14, 0.38);
}
.mode-switch a {
  min-height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-decoration: none;
  text-transform: uppercase;
}
.mode-switch a.active { color: var(--ink); background: var(--cream); box-shadow: 0 5px 14px rgba(0,0,0,.18); }

.practice-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 11px;
  align-items: center;
  margin: -4px 0 14px;
  padding: 10px 13px;
  border: 1px solid rgba(229,185,75,.34);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(229,185,75,.12), rgba(8,42,35,.5));
}
.practice-badge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--ink); background: var(--yellow); font-weight: 900; font-size: .72rem; }
.practice-banner p { display: grid; gap: 2px; margin: 0; }
.practice-banner strong { color: var(--cream); font-size: .78rem; }
.practice-banner small { color: var(--muted); font-size: .68rem; }
.practice-banner a { color: var(--yellow); font-size: .69rem; font-weight: 800; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.shoe-ribbon {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 13px 15px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(2, 17, 14, 0.38);
  backdrop-filter: blur(10px);
}
.shoe-ribbon div:not(.progress-track) { display: grid; }
.shoe-ribbon strong { font: 700 1.15rem/1 "Bodoni 72", Didot, serif; }
.shoe-ribbon span:not(#progressFill) { color: var(--muted); font-size: 0.66rem; text-transform: uppercase; letter-spacing: .08em; }
.progress-track { height: 5px; overflow: hidden; border-radius: 10px; background: rgba(255,255,255,.1); }
#progressFill { display: block; width: 0; height: 100%; background: var(--red); transition: width .3s ease; }

.exact-overview {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 7px;
  align-items: stretch;
  margin-bottom: 12px;
}
.exact-overview .shoe-ribbon {
  grid-template-columns: 1fr 1fr;
  align-content: center;
  min-width: 0;
  margin: 0;
  border-radius: 16px;
}
.exact-overview .shoe-ribbon strong { font-size: 1.42rem; }
.exact-overview .shoe-ribbon span:not(#progressFill) { font-size: .72rem; line-height: 1.25; }
.exact-overview .progress-track { grid-column: 1 / -1; }
.exact-overview > * { min-width: 0; height: 100%; }
.exact-overview .bet-card { display: flex; flex-direction: column; justify-content: center; padding: 14px; }
.exact-overview .bet-title { display: grid; grid-template-columns: auto 1fr; gap: 3px 6px; align-items: center; }
.exact-overview .bet-title h2 { min-width: 0; margin: 0; font-size: 1.08rem; line-height: 1.05; }
.exact-overview .status-pill { grid-column: 1 / -1; justify-self: start; }
.exact-overview .probability { margin: 12px 0 9px; font-size: clamp(1.55rem, 3vw, 2.2rem); }
.exact-overview .metric-row { display: grid; gap: 3px; align-items: start; font-size: .8rem; }
.exact-overview .bet-card small { font-size: .72rem; line-height: 1.35; }

.count-strip {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 0;
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(20,72,59,.9), rgba(5,31,26,.9));
  box-shadow: var(--shadow);
}
.count-strip > div { display: grid; place-items: center; min-width: 0; padding: 13px 7px 11px; }
.count-strip > div + div { border-left: 1px solid var(--line); }
.count-strip span { color: var(--muted); font-size: .61rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.count-strip strong { margin-top: 4px; font: 700 1.45rem/1 "Bodoni 72", Didot, serif; }
.count-strip .count-primary strong { font-size: 2rem; color: var(--yellow); }
.count-strip strong.positive { color: var(--green); }
.count-strip strong.negative { color: #ff7865; }
.count-strip small { grid-column: 1 / -1; padding: 8px 10px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: .58rem; letter-spacing: .04em; }

.workspace { display: grid; gap: 18px; }
.entry-column, .analysis-column { display: grid; align-content: start; gap: 14px; min-width: 0; }

.panel, .last-card-card, .bet-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(8, 42, 35, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.panel { padding: 17px; }
.panel h2, .bet-card h2, dialog h2 {
  margin: 3px 0 0;
  font: 700 1.25rem/1.05 "Bodoni 72", Didot, Georgia, serif;
}
.panel-heading > span { color: var(--muted); font-size: 0.75rem; }

.last-card-card {
  min-height: 130px;
  padding: 18px 20px;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(115deg, rgba(255,248,232,.96) 0%, rgba(244,233,207,.96) 62%, rgba(217,203,174,.94) 100%);
  color: var(--ink);
}
.last-card-card::after {
  content: '♠'; position: absolute; right: 76px; bottom: -55px;
  color: rgba(17,34,29,.055); font: 13rem/1 Georgia, serif; transform: rotate(9deg);
}
.last-card-card .section-kicker { color: #587067; }
.hero-card { font: 700 4.9rem/.95 "Bodoni 72", Didot, serif; letter-spacing: -.08em; }
.hero-card.red, .recent-card.red, .mini-playing-card.red { color: #c53d31; }
.hero-card.empty { color: #9ba9a3; }
.undo-button {
  z-index: 1; border: 1px solid rgba(17,34,29,.2); border-radius: 999px;
  padding: 0 15px; background: transparent; color: var(--ink); font-weight: 700;
}
.undo-button:disabled { opacity: .35; cursor: not-allowed; }

.entry-prompt { border-bottom: 1px solid var(--red); padding-bottom: 2px; }
.rank-pad { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; margin: 17px 0 10px; }
.rank-button, .suit-button {
  border: 1px solid var(--line); border-radius: 9px; background: rgba(0,0,0,.17); color: var(--cream); font-weight: 800;
}
.rank-button { min-width: 0; min-height: 54px; display: grid; place-content: center; gap: 3px; padding: 4px 2px; }
.rank-button strong { font: 700 1.05rem/1 "Bodoni 72", Didot, serif; }
.rank-button small { color: var(--muted); font-size: .5rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.rank-button.low { border-color: rgba(93,204,139,.42); background: rgba(39,130,93,.12); }
.rank-button.neutral { border-color: rgba(229,185,75,.42); background: rgba(169,121,18,.12); }
.rank-button.high { border-color: rgba(226,85,62,.44); background: rgba(195,63,50,.12); }
.rank-button.low strong { color: #8de4b2; }
.rank-button.neutral strong { color: #f3cf71; }
.rank-button.high strong { color: #ff9484; }
.rank-button.selected { color: var(--ink); background: var(--cream); border-color: var(--cream); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.24); }
.rank-button.selected strong, .rank-button.selected small { color: var(--ink); }
.rank-button:disabled { opacity: .28; cursor: not-allowed; }
.rank-legend { display: flex; flex-wrap: wrap; gap: 6px 13px; margin: -1px 0 10px; color: var(--muted); font-size: .57rem; text-transform: uppercase; letter-spacing: .06em; }
.rank-legend span::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; vertical-align: 1px; }
.rank-legend .low::before { background: var(--green); }
.rank-legend .neutral::before { background: var(--yellow); }
.rank-legend .high::before { background: var(--red); }
.suit-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.suit-button { min-height: 55px; display: grid; place-content: center; gap: 2px; padding: 4px; }
.suit-button strong { font: 700 1.65rem/1 Georgia, serif; }
.suit-button small { color: var(--muted); font-size: .5rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.suit-button.red { color: #ff7865; }
.suit-button:disabled { opacity: .3; cursor: not-allowed; }
.suit-button:not(:disabled):active, .rank-button:active { transform: scale(.96); }
.dealer-toggle { display: flex; gap: 9px; align-items: center; margin-top: 14px; color: var(--muted); font-size: .82rem; }
.dealer-toggle input { width: 18px; height: 18px; accent-color: var(--red); }

.recent-cards { display: flex; gap: 8px; min-height: 50px; margin-top: 13px; overflow-x: auto; padding-bottom: 3px; }
.recent-card, .mini-playing-card {
  display: inline-grid; place-items: center; flex: 0 0 43px; height: 52px; border-radius: 7px;
  color: var(--ink); background: var(--paper); box-shadow: 0 5px 10px rgba(0,0,0,.2);
  font: 700 1.15rem/1 "Bodoni 72", Didot, serif;
}
.muted { color: var(--muted); font-size: .82rem; align-self: center; }

.composition-panel summary { cursor: pointer; display: flex; justify-content: space-between; font-weight: 700; }
.composition-panel summary small { color: var(--muted); font-weight: 400; }
.composition-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 15px; }
.composition-cell { display: flex; justify-content: space-between; padding: 6px 8px; border-bottom: 1px solid var(--line); font-family: "SFMono-Regular", Consolas, monospace; font-size: .72rem; }
.composition-cell.red { color: #ff8979; }
.composition-cell b.low { color: var(--yellow); }

.field-help { margin: 12px 0; color: var(--muted); font-size: .78rem; }

/* ---- Count deviations ------------------------------------------------- */
.play-panel { margin-bottom: 12px; }
.play-insurance { margin: 0 0 12px; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.play-insurance b { color: var(--cream); }
.deviation-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.deviation-list li {
  display: grid;
  grid-template-columns: minmax(84px, auto) 1fr auto;
  gap: 6px 14px;
  align-items: baseline;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(2, 17, 14, 0.3);
  font-size: .82rem;
}
.deviation-list li.is-live { border-color: rgba(229,185,75,.55); background: rgba(229,185,75,.11); }
.dev-hand { color: var(--cream); font-weight: 800; white-space: nowrap; }
.dev-move { color: var(--muted); }
.dev-move b { color: var(--muted); font-weight: 700; }
.dev-move b.to, b.to { color: var(--yellow); }
.dev-index { color: var(--muted); font-size: .72rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.deviation-list.is-reference li { background: none; border-color: var(--line); }
.deviation-all { margin-top: 14px; }
.deviation-all summary { cursor: pointer; color: var(--yellow); font-size: .76rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.deviation-all summary:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; border-radius: 4px; }
.deviation-all > ul { margin-top: 12px; }

/* ---- Bet sizing -------------------------------------------------------- */
.sizing-panel { margin-bottom: 12px; }
.status-pill.bet { color: #c9ffde; background: rgba(93,204,139,.2); }
.sizing-readout { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sizing-readout article {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(2, 17, 14, 0.3);
}
.sizing-readout span { color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.sizing-readout strong { font: 700 1.5rem/1 "Bodoni 72", Didot, Georgia, serif; font-variant-numeric: tabular-nums; }
.sizing-readout strong.good { color: var(--green); }
.sizing-readout strong.bad { color: var(--cream); }
.sizing-readout small { color: var(--muted); font-size: .66rem; line-height: 1.4; }

.sizing-locked { margin: 12px 0 0; padding: 11px 13px; border: 1px dashed rgba(98,174,234,.5); border-radius: 10px; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.sizing-locked a { color: var(--blue); font-weight: 800; }
.sizing-warning { margin: 12px 0 0; padding: 11px 13px; border-left: 3px solid var(--yellow); border-radius: 4px; background: rgba(229,185,75,.1); color: var(--cream); font-size: .78rem; line-height: 1.5; }

.sizing-setup { margin-top: 14px; }
.sizing-setup summary { cursor: pointer; color: var(--yellow); font-size: .76rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.sizing-setup summary:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; border-radius: 4px; }
.sizing-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 13px; }
.sizing-fields label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.sizing-fields input, .sizing-fields select {
  min-height: 44px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--cream); background: rgba(2, 17, 14, 0.45);
  font-size: .92rem; font-weight: 600; letter-spacing: 0; text-transform: none;
}
.sizing-fields input:focus-visible, .sizing-fields select:focus-visible { outline: 2px solid var(--yellow); outline-offset: 1px; }

.risk-table { width: 100%; margin-top: 16px; border-collapse: collapse; font-size: .8rem; }
.risk-table caption { padding-bottom: 8px; color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; text-align: left; }
.risk-table th, .risk-table td { padding: 8px 0; text-align: left; border-bottom: 1px solid var(--line); }
.risk-table thead th { color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.risk-table tbody th { color: var(--cream); font-weight: 600; }
.risk-table td { text-align: right; color: var(--yellow); font-weight: 800; font-variant-numeric: tabular-nums; }
.risk-table tbody tr:last-child th, .risk-table tbody tr:last-child td { border-bottom: 0; }
.dealer-picker { display: grid; grid-template-columns: 2fr 1fr; gap: 9px; }
.dealer-picker select {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px;
  color: var(--cream); background: #09261f;
}
.mini-button { min-height: 34px; font-size: .72rem; }

.perfect-pairs-panel { scroll-margin-top: 16px; }
.perfect-pairs-panel[data-status="red"] { border-left: 4px solid var(--red); }
.perfect-pairs-panel[data-status="yellow"] { border-left: 4px solid var(--yellow); }
.perfect-pairs-panel[data-status="green"] { border-left: 4px solid var(--green); }
.perfect-pairs-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 15px 0 10px; }
.perfect-pairs-summary > span { display: grid; gap: 3px; padding: 10px; border-radius: 10px; background: rgba(0,0,0,.14); }
.perfect-pairs-summary small { color: var(--muted); font-size: .57rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.perfect-pairs-summary strong { font: 700 1.45rem/1 "Bodoni 72", Didot, serif; }
.pair-tier-grid { display: grid; gap: 7px; }
.pair-tier { display: grid; grid-template-columns: 1.2fr .85fr .85fr; gap: 5px 9px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.11); }
.pair-tier > div { display: grid; gap: 2px; }
.pair-tier > div span { color: var(--cream); font-weight: 800; }
.pair-tier > div b { color: var(--muted); font-size: .6rem; }
.pair-tier > strong { color: var(--cream); font: 700 1.08rem/1 "Bodoni 72", Didot, serif; }
.pair-tier > small { color: var(--muted); text-align: right; font-size: .63rem; }
.pair-tier > em { grid-column: 1 / -1; color: var(--muted); font-size: .58rem; font-style: normal; }
.mixed-tier { border-left: 3px solid #d78579; }
.same-color-tier { border-left: 3px solid #94aa9f; }
.perfect-tier { border-left: 3px solid var(--yellow); }

.bet-grid { display: grid; gap: 10px; }
.bet-card { padding: 17px; box-shadow: none; transition: border-color .25s ease; }
.bet-card[data-status="red"] { border-left: 4px solid var(--red); }
.bet-card[data-status="yellow"] { border-left: 4px solid var(--yellow); }
.bet-card[data-status="green"] { border-left: 4px solid var(--green); }
.bet-card[data-status="jackpot"] { border-left: 4px solid var(--yellow); background: linear-gradient(145deg, rgba(61,52,20,.5), rgba(8,42,35,.84)); }
.bet-title > span { color: var(--muted); font: 700 .72rem/1 "SFMono-Regular", monospace; }
.bet-title h2 { margin-right: auto; margin-left: 9px; }
.status-pill { padding: 4px 8px; border-radius: 999px; font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; }
.status-pill.red { color: #ffd5ce; background: rgba(226,85,62,.25); }
.status-pill.yellow { color: #ffe9ab; background: rgba(229,185,75,.22); }
.status-pill.green { color: #c9ffde; background: rgba(93,204,139,.2); }
.status-pill.inactive { color: var(--muted); background: rgba(255,255,255,.06); }
.status-pill.jackpot { color: #fff0b9; background: rgba(229,185,75,.2); }
.jackpot-bet-card h2 { color: #f3cf71; }
.jackpot-bet-card .probability { font-size: clamp(1.1rem, 2.2vw, 1.75rem); }
.probability { display: block; margin: 15px 0 10px; font: 700 2.7rem/.9 "Bodoni 72", Didot, serif; letter-spacing: -.035em; }
.metric-row { padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.metric-row b { color: var(--cream); }
.bet-card small { display: block; margin-top: 10px; color: var(--muted); }

.best-card-panel { background: linear-gradient(120deg, rgba(20,72,59,.95), rgba(8,42,35,.85)); }
.best-card-readout { justify-content: flex-start; gap: 13px; margin-top: 16px; }
.mini-playing-card { flex-basis: 54px; height: 65px; font-size: 1.5rem; }
.best-card-readout strong { display: block; font: 700 1.7rem/1 "Bodoni 72", Didot, serif; }
.best-card-readout small { color: var(--muted); }
.shoe-best-panel { display: grid; align-content: center; padding: 14px; border-radius: 12px; box-shadow: none; }
.shoe-best-panel h2 { margin-top: 3px; font-size: 1.08rem; line-height: 1.05; }
.shoe-best-panel .section-kicker { font-size: .62rem; letter-spacing: .11em; }
.shoe-best-panel .best-card-readout { gap: 11px; margin-top: 12px; align-items: center; }
.shoe-best-panel .mini-playing-card { flex-basis: 54px; height: 64px; font-size: 1.5rem; }
.shoe-best-panel .best-card-readout strong { font-size: 1.55rem; }
.shoe-best-panel .best-card-readout small { display: block; margin-top: 4px; font-size: .67rem; line-height: 1.25; }
.rules-note { padding: 4px 5px; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.rules-note strong { color: var(--cream); }
.disclaimer { opacity: .7; }

.help-section {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  scroll-margin-top: 16px;
}
.help-heading { display: flex; align-items: end; justify-content: space-between; padding: 4px 3px; }
.help-heading h2 { margin: 3px 0 0; font: 700 1.55rem/1 "Bodoni 72", Didot, Georgia, serif; }
.help-heading > span { color: var(--muted); font-size: .68rem; }
.help-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: rgba(8,42,35,.78); box-shadow: var(--shadow); }
.help-card summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 17px; cursor: pointer; list-style: none; }
.help-card summary::-webkit-details-marker { display: none; }
.help-card summary::after { content: '+'; order: 3; color: var(--muted); font: 400 1.3rem/1 Georgia, serif; }
.help-card[open] summary::after { content: '−'; }
.help-card summary span { font: 700 1.08rem/1.1 "Bodoni 72", Didot, Georgia, serif; }
.help-card summary b { margin-left: auto; color: var(--muted); font-size: .61rem; letter-spacing: .08em; text-transform: uppercase; }
.help-content { padding: 0 17px 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; line-height: 1.48; }
.help-definitions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin: 14px 0; }
.help-definitions div { padding: 11px; border-radius: 10px; background: rgba(0,0,0,.14); }
.help-definitions dt { color: var(--cream); font-weight: 800; }
.help-definitions dd { margin: 4px 0 0; }
.status-key { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.status-key span { padding: 9px 10px; border-left: 3px solid; border-radius: 8px; background: rgba(0,0,0,.12); }
.status-key b { display: block; color: var(--cream); }
.status-key .red { border-color: var(--red); }
.status-key .yellow { border-color: var(--yellow); }
.status-key .green { border-color: var(--green); }
.help-example, .help-caution { margin: 13px 0 0; }
.help-example strong { color: var(--cream); }
.help-caution { padding-left: 10px; border-left: 2px solid var(--yellow); }
.legal-copy p { margin: 14px 0 0; }
.legal-copy strong { color: var(--cream); }
.install-steps { display: grid; gap: 7px; margin: 14px 0 0; padding-left: 20px; }
.web-info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.web-info-card { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(8,42,35,.76); }
.web-info-card h2 { margin: 4px 0 8px; font: 700 1.25rem/1.05 "Bodoni 72", Didot, Georgia, serif; }
.web-info-card p:last-child { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.web-info-card strong { color: var(--cream); }
.site-footer { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: center; margin-top: 18px; padding: 16px 8px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: .67rem; text-align: center; }
.site-footer strong { color: var(--cream); }
.site-footer a { color: var(--yellow); text-underline-offset: 3px; }
.site-footer nav { display: flex; gap: 12px; }
.legal-page { min-height: 100vh; }
.legal-shell { width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 48px; }
.legal-masthead { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.legal-brand { display: flex; align-items: center; gap: 9px; color: var(--cream); font: 700 1.3rem/1 "Bodoni 72", Didot, Georgia, serif; text-decoration: none; }
.legal-brand img { width: 34px; height: 34px; border-radius: 9px; }
.legal-brand i { color: var(--red); font-weight: 400; }
.legal-back { color: var(--yellow); font-size: .72rem; font-weight: 800; text-underline-offset: 3px; }
.legal-document { padding: clamp(22px, 5vw, 42px); border: 1px solid var(--line); border-radius: 20px; background: rgba(8,42,35,.84); box-shadow: var(--shadow); }
.legal-document h1 { margin: 7px 0 10px; font: 700 clamp(2.2rem, 8vw, 4rem)/.92 "Bodoni 72", Didot, Georgia, serif; }
.legal-document .effective-date { margin: 0 0 28px; color: var(--muted); font-size: .72rem; }
.legal-document h2 { margin: 27px 0 8px; color: var(--cream); font: 700 1.25rem/1.1 "Bodoni 72", Didot, Georgia, serif; }
.legal-document p, .legal-document li { color: var(--muted); font-size: .82rem; line-height: 1.65; }
.legal-document ul { display: grid; gap: 6px; padding-left: 20px; }
.legal-document strong { color: var(--cream); }
.legal-callout { margin: 24px 0; padding: 14px 16px; border-left: 3px solid var(--yellow); background: rgba(229,185,75,.08); }

dialog { max-width: min(420px, calc(100% - 30px)); border: 1px solid rgba(17,34,29,.15); border-radius: 17px; padding: 0; color: var(--ink); background: var(--paper); box-shadow: 0 30px 100px #000; }
dialog::backdrop { background: rgba(1,12,10,.75); backdrop-filter: blur(4px); }
dialog form { padding: 24px; }
dialog p:not(.section-kicker) { color: #53645e; line-height: 1.45; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 20px; }
.dialog-actions button { border: 0; border-radius: 9px; font-weight: 800; }
.secondary-button { color: var(--ink); background: #e7dfcc; }
.danger-button { color: white; background: var(--red); }

.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 4; transform: translate(-50%, 20px); padding: 10px 15px; border-radius: 999px; color: var(--ink); background: var(--cream); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s ease; font-size: .8rem; font-weight: 700; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.reveal { animation: reveal .48s both; }
.reveal:nth-child(2) { animation-delay: .05s; }
.reveal:nth-child(3) { animation-delay: .1s; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }

@media (min-width: 760px) {
  .app-shell { padding-top: 38px; }
  .workspace { grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); align-items: start; }
  .last-card-card { min-height: 150px; }
}

@media (min-width: 521px) and (max-width: 899px) {
  .masthead h1.brand-title { font-size: clamp(2.65rem, 7vw, 3.2rem); }
  .brand-mark { width: 50px; }
  .exact-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .exact-overview .bet-card { padding: 14px 15px; }
  .exact-overview .bet-title h2 { font-size: 1.16rem; }
  .exact-overview .status-pill { font-size: .62rem; padding: 5px 9px; }
  .exact-overview .probability { margin: 11px 0 8px; font-size: 1.85rem; }
  .exact-overview .bet-card small { margin-top: 8px; }
  .exact-overview .jackpot-bet-card .probability { font-size: 1.48rem; }
  .shoe-best-panel { padding: 14px 15px; }
  .shoe-best-panel h2 { font-size: 1.16rem; }
  .shoe-best-panel .mini-playing-card { flex-basis: 58px; height: 68px; font-size: 1.6rem; }
  .shoe-best-panel .best-card-readout strong { font-size: 1.65rem; }
}

@media (max-width: 380px) {
  .shoe-ribbon { grid-template-columns: 1fr 1fr; }
  .progress-track { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .masthead { gap: 12px; }
  .masthead > div { min-width: 0; }
  .masthead h1 { font-size: clamp(2.15rem, 10vw, 2.7rem); }
  .masthead h1.brand-title { font-size: clamp(1.65rem, 6.8vw, 2rem); }
  .brand-row { gap: 8px; }
  .brand-mark { width: 38px; }
  /* Three pills cannot share a row with the wordmark at this width — the last
     one used to run past the felt and get clipped. Give the actions their own
     full-width row instead of shrinking them below a 44px tap target. */
  .masthead { flex-wrap: wrap; }
  .masthead > div:first-child { flex: 1 1 100%; }
  .header-actions { flex: 1 1 100%; gap: 6px; flex-wrap: wrap; justify-content: flex-start; }
  /* Size to content, not to the row — Practice has a single action, and a
     stretched one reads as a banner rather than a button. */
  .header-actions > * { flex: 0 1 auto; min-width: 0; }
  .text-button { padding-inline: 12px; }
  .help-link, .account-link { padding-inline: 10px; }
  /* "Quick Ranks" will not sit on one line in a quarter of 375px. */
  .mode-switch { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* The count and the card pad are the working loop, and everything between
     them is a tax paid on every hand. The last-card panel becomes a strip:
     still legible at a glance, a third of the height. */
  .last-card-card { min-height: 0; padding: 10px 14px; }
  .last-card-card .hero-card { font-size: 2.6rem; }
  .last-card-card::after { display: none; }
  .last-card-card .section-kicker { font-size: .58rem; }
  .undo-button { min-height: 40px; }
  .sizing-readout { grid-template-columns: 1fr; }
  .sizing-fields { grid-template-columns: 1fr; }
  .deviation-list li { grid-template-columns: 1fr auto; }
  .dev-move { grid-column: 1 / -1; }
  .rank-pad { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .rank-button { min-width: 0; }
  .progress-track { min-width: 0; }
  .exact-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exact-overview .shoe-ribbon { min-height: 100px; padding: 12px; }
  .exact-overview .shoe-ribbon strong { font-size: 1.32rem; }
  .exact-overview .shoe-ribbon span:not(#progressFill) { font-size: .64rem; }
  .shoe-best-panel { min-height: 100px; padding: 12px; }
  .shoe-best-panel h2 { font-size: .98rem; }
  .shoe-best-panel .section-kicker { font-size: .56rem; }
  .shoe-best-panel .best-card-readout { gap: 9px; margin-top: 9px; }
  .shoe-best-panel .mini-playing-card { flex-basis: 48px; height: 56px; font-size: 1.3rem; }
  .shoe-best-panel .best-card-readout strong { font-size: 1.3rem; }
  .shoe-best-panel .best-card-readout small { font-size: .58rem; }
  .exact-overview .bet-card { min-height: 100px; padding: 11px 10px; }
  .exact-overview .bet-title { display: flex; flex-wrap: wrap; gap: 4px; }
  .exact-overview .bet-title > span { display: none; }
  .exact-overview .bet-title h2 { width: 100%; font-size: 1rem; line-height: 1.08; }
  .exact-overview .status-pill { font-size: .54rem; padding: 4px 7px; }
  .exact-overview .probability { margin: 9px 0 2px; font-size: 1.42rem; }
  .exact-overview .metric-row, .exact-overview .bet-card > small { display: none; }
  .exact-overview .jackpot-bet-card .probability { font-size: 1.2rem; }
  .exact-overview .jackpot-bet-card .metric-row { display: block; padding-top: 6px; border: 0; font-size: .64rem; }
  .help-definitions, .status-key { grid-template-columns: 1fr; }
  .help-heading > span { display: none; }
  .help-card summary { padding: 14px; }
  .help-content { padding: 0 14px 15px; }
  .pair-tier { grid-template-columns: 1.15fr .8fr .9fr; }
  .practice-banner { grid-template-columns: auto 1fr; }
  .practice-banner a { grid-column: 2; justify-self: start; }
  .web-info-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* The table verdict. A recreational player can act on this without counting a
   single card, which makes it the most useful line on the page. */
.table-verdict {
  margin: 12px 0 0; padding: 11px 13px;
  border-left: 3px solid var(--green); border-radius: 4px;
  background: rgba(93, 204, 139, .08);
  color: var(--muted); font-size: .8rem; line-height: 1.5;
}
.table-verdict b { color: var(--cream); }
.table-verdict span { display: block; margin-top: 3px; font-size: .68rem; opacity: .8; }
.table-verdict.is-bad {
  border-left-color: var(--red); background: rgba(226, 85, 62, .1); color: #ffd9d1;
}
.table-verdict.is-bad b { color: #fff; }
