/* ==========================================================================
   The Ringer: Craps — styles.css  v1
   Palette: bottle-green felt, chalk-cream lines, walnut rail, translucent
   red dice. Player chips red, Ringer chips purple.
   New rules go at the END of this file (append-only convention).
   ========================================================================== */
:root {
  --felt: #1b4d33;
  --felt-deep: #143d28;
  --felt-light: #236343;
  --chalk: #efe6cc;
  --chalk-dim: rgba(239, 230, 204, 0.55);
  --walnut: #3a2618;
  --walnut-deep: #24160d;
  --gold: #d9b45a;
  --red: #c8352e;
  --red-deep: #8f1f1a;
  --purple: #6a3fa0;
  --purple-deep: #3f2261;
  --ink: #1a1410;
  --paper: #f6f1e4;
  --ok: #4fbf7a;
  --warn: #e9c46a;
  --bad: #ef6a5a;
  --font-felt: 'Oswald', 'Arial Narrow', sans-serif;
  --font-body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --radius: 6px;
  --drawer-w: 360px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--paper);
  background: var(--walnut-deep);
  background-image: radial-gradient(ellipse at 50% 0%, #4a3120 0%, var(--walnut-deep) 60%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: linear-gradient(#4a3120, var(--walnut));
  border-bottom: 2px solid var(--gold);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; flex-direction: column; line-height: 1; }
.brand-title { font-family: var(--font-felt); font-weight: 600; font-size: 22px; letter-spacing: 0.02em; color: var(--gold); }
.brand-sub { font-family: var(--font-felt); font-size: 13px; color: var(--chalk); letter-spacing: 0.15em; }
.bankrolls { display: flex; gap: 10px; margin-left: auto; }
.bank {
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 8px;
  padding: 4px 10px; border-radius: var(--radius);
  background: rgba(0,0,0,0.25); border-left: 4px solid var(--red);
  min-width: 120px;
}
.bank.ringer { border-left-color: var(--purple); }
.bank-label { font-size: 12px; opacity: 0.8; }
.bank-amt { font-family: var(--font-felt); font-size: 20px; grid-row: 1 / 3; align-self: center; }
.bank-table { font-size: 11px; opacity: 0.6; }
.bank.flash-up .bank-amt { color: var(--ok); }
.bank.flash-down .bank-amt { color: var(--bad); }

.mode { display: flex; border: 1px solid var(--gold); border-radius: 20px; overflow: hidden; }
.mode-btn { background: transparent; color: var(--chalk); border: 0; padding: 6px 14px; font-size: 14px; }
.mode-btn.is-active { background: var(--gold); color: var(--ink); font-weight: 600; }

.icon-btn { background: transparent; border: 1px solid rgba(255,255,255,0.25); color: var(--chalk); width: 36px; height: 36px; border-radius: 50%; font-size: 16px; }
.ringer-toggle { position: relative; background: transparent; border: 0; padding: 0; }
.ringer-face {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9a6cd8, var(--purple-deep));
  color: #fff; font-family: var(--font-felt); font-weight: 600; font-size: 18px;
  border: 2px solid var(--gold);
}
.ringer-face.big { width: 44px; height: 44px; font-size: 22px; }
.ringer-badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

/* ----------------------------------------------------------------- stage */
.table-wrap { max-width: 1040px; margin: 0 auto; padding: 12px 12px 90px; }
.stage {
  position: relative; height: 200px; border-radius: 14px 14px 0 0;
  background: radial-gradient(ellipse at 50% 120%, var(--felt-light), var(--felt-deep));
  border: 6px solid var(--walnut); border-bottom: 0;
  overflow: hidden;
}
.stage-canvas { position: absolute; inset: 0; }
.stage-canvas canvas { display: block; width: 100% !important; height: 100% !important; }
.dice-2d { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 24px; }
.die {
  width: 64px; height: 64px; border-radius: 10px; position: relative;
  background: linear-gradient(145deg, #e04a3f, var(--red-deep));
  box-shadow: inset 0 0 12px rgba(255,255,255,0.25), 0 6px 14px rgba(0,0,0,0.5);
}
.die::after { content: ''; position: absolute; inset: 0; background-image: var(--pips); }
.die[data-value="1"] { --pips: radial-gradient(circle at 50% 50%, #fff 6px, transparent 7px); }
.die[data-value="2"] { --pips: radial-gradient(circle at 25% 25%, #fff 6px, transparent 7px), radial-gradient(circle at 75% 75%, #fff 6px, transparent 7px); }
.die[data-value="3"] { --pips: radial-gradient(circle at 25% 25%, #fff 6px, transparent 7px), radial-gradient(circle at 50% 50%, #fff 6px, transparent 7px), radial-gradient(circle at 75% 75%, #fff 6px, transparent 7px); }
.die[data-value="4"] { --pips: radial-gradient(circle at 25% 25%, #fff 6px, transparent 7px), radial-gradient(circle at 75% 25%, #fff 6px, transparent 7px), radial-gradient(circle at 25% 75%, #fff 6px, transparent 7px), radial-gradient(circle at 75% 75%, #fff 6px, transparent 7px); }
.die[data-value="5"] { --pips: radial-gradient(circle at 25% 25%, #fff 6px, transparent 7px), radial-gradient(circle at 75% 25%, #fff 6px, transparent 7px), radial-gradient(circle at 50% 50%, #fff 6px, transparent 7px), radial-gradient(circle at 25% 75%, #fff 6px, transparent 7px), radial-gradient(circle at 75% 75%, #fff 6px, transparent 7px); }
.die[data-value="6"] { --pips: radial-gradient(circle at 25% 22%, #fff 6px, transparent 7px), radial-gradient(circle at 75% 22%, #fff 6px, transparent 7px), radial-gradient(circle at 25% 50%, #fff 6px, transparent 7px), radial-gradient(circle at 75% 50%, #fff 6px, transparent 7px), radial-gradient(circle at 25% 78%, #fff 6px, transparent 7px), radial-gradient(circle at 75% 78%, #fff 6px, transparent 7px); }
.die.is-rolling { animation: tumble 0.25s linear infinite; }
@keyframes tumble { from { transform: rotate(0) translateY(0); } 50% { transform: rotate(180deg) translateY(-14px); } to { transform: rotate(360deg) translateY(0); } }

.puck {
  position: absolute; top: 12px; left: 12px; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-felt); font-weight: 600; font-size: 18px;
  background: #1a1a1a; color: #fff; border: 3px solid #444; box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  transition: background 0.3s, color 0.3s;
}
.puck.on { background: #fff; color: #111; border-color: #ccc; }
.puck.on .puck-text::after { content: attr(data-point); }
.shooter { position: absolute; top: 12px; right: 12px; font-size: 13px; color: var(--chalk-dim); }
.shooter.is-ringer { color: #c9a6ff; }
.last-roll { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-family: var(--font-felt); font-size: 16px; color: var(--chalk); letter-spacing: 0.05em; }

/* ---------------------------------------------------------------- ribbon */
.ribbon {
  display: flex; gap: 4px; overflow-x: auto; padding: 6px 8px;
  background: var(--walnut); border-left: 6px solid var(--walnut); border-right: 6px solid var(--walnut);
  scrollbar-width: none; position: sticky; top: 58px; z-index: 10;
}
.ribbon::-webkit-scrollbar { display: none; }
.ribbon:empty::before { content: 'Roll history appears here'; font-size: 12px; color: var(--chalk-dim); padding: 4px; }
.rb { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-felt); font-size: 14px; background: rgba(255,255,255,0.12); color: var(--chalk); position: relative; }
.rb.seven { background: var(--red); color: #fff; }
.rb.point-set { box-shadow: inset 0 0 0 2px var(--gold); }
.rb.point-hit { background: var(--ok); color: var(--ink); }
.rb.hard::after { content: ''; position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }

/* ------------------------------------------------------------------ felt */
.felt {
  background: radial-gradient(ellipse at 50% 30%, var(--felt-light), var(--felt) 60%, var(--felt-deep));
  border: 6px solid var(--walnut); border-top: 0; border-radius: 0 0 14px 14px;
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
  font-family: var(--font-felt); color: var(--chalk);
  user-select: none; -webkit-user-select: none;
}
.row { display: flex; gap: 8px; }
.box {
  position: relative; border: 2px solid var(--chalk-dim); border-radius: var(--radius);
  padding: 8px; min-height: 52px; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
  cursor: pointer;
}
.box:hover, .box:focus-visible { background: rgba(255,255,255,0.06); border-color: var(--chalk); }
.box.is-unavailable { opacity: 0.35; cursor: not-allowed; }
.box.is-unavailable:hover { background: transparent; border-color: var(--chalk-dim); }
.box.just-won { box-shadow: 0 0 0 3px var(--ok), 0 0 18px var(--ok); }
.box.just-lost { box-shadow: 0 0 0 3px var(--bad); opacity: 0.85; }
.box.take-target { border-style: dashed; border-color: var(--warn); }
.lbl { font-size: 18px; letter-spacing: 0.08em; }
.sub { font-size: 11px; opacity: 0.7; font-family: var(--font-body); letter-spacing: 0; }

.row-dc .box-dc { flex: 0 0 120px; }
.dc-numbers { display: flex; gap: 6px; flex: 1; }
.dcnum { flex: 1; min-height: 40px; padding: 4px; border-style: dashed; }
.dcnum .lbl { font-size: 14px; }

.row-numbers { gap: 6px; }
.numbox {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  border: 2px solid var(--chalk); border-radius: var(--radius); padding: 4px; background: rgba(0,0,0,0.08);
}
.numbox .num { font-size: 26px; text-align: center; letter-spacing: 0.06em; line-height: 1; padding: 2px 0; }
.numbox .num small { display: block; font-size: 10px; opacity: 0.6; letter-spacing: 0.1em; font-family: var(--font-body); }
.numbox.is-point { background: rgba(217,180,90,0.16); border-color: var(--gold); }
.slot-place { min-height: 46px; padding: 4px; }
.slot-place .lbl { font-size: 13px; }
.slot-mini { display: flex; gap: 4px; }
.mini { min-height: 30px; padding: 2px; font-size: 11px; letter-spacing: 0.08em; }
.come-zone {
  min-height: 34px; border: 2px dotted var(--chalk-dim); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: var(--chalk-dim); font-family: var(--font-body);
  position: relative;
}
.come-zone.has-bet { border-color: var(--gold); color: var(--chalk); }

.box-come { min-height: 46px; }
.box-field .field-nums { font-size: 20px; letter-spacing: 0.35em; }
.box-field .field-nums b { color: var(--gold); }
.row-line .box { min-height: 60px; }
.box-pass { flex: 2; }
.box-pass .lbl { font-size: 24px; letter-spacing: 0.2em; }
.box-dontpass { flex: 1; }

.odds-btn {
  margin-top: 4px; background: rgba(0,0,0,0.3); color: var(--gold); border: 1px solid var(--gold);
  border-radius: 12px; padding: 3px 10px; font-family: var(--font-body); font-size: 12px; font-weight: 600;
}
.odds-btn:hover { background: var(--gold); color: var(--ink); }
.odds-btn.mini-odds { position: absolute; right: 2px; top: 2px; margin: 0; padding: 1px 6px; font-size: 10px; }

.props { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--chalk-dim); }
.props-title { grid-column: 1 / -1; font-size: 12px; letter-spacing: 0.2em; opacity: 0.6; margin-top: 2px; }
.prop { min-height: 48px; padding: 4px; }
.prop .lbl { font-size: 13px; }
.prop.sucker { border-color: rgba(239,106,90,0.5); }

/* chip stacks on the felt */
.cstack {
  display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 5px; border-radius: 50%;
  font-family: var(--font-body); font-weight: 700; font-size: 12px; color: #fff;
  border: 3px dashed rgba(255,255,255,0.85); box-shadow: 0 3px 6px rgba(0,0,0,0.5);
  position: absolute; z-index: 2; pointer-events: none;
}
.cstack.player { background: var(--red); right: -6px; top: -8px; }
.cstack.ringer { background: var(--purple); left: -6px; top: -8px; }
.cstack.off { opacity: 0.55; border-style: dotted; }
.cstack.off::after { content: 'OFF'; position: absolute; bottom: -12px; font-size: 8px; color: var(--chalk); letter-spacing: 0.1em; }
.cstack .odds { display: block; font-size: 9px; font-weight: 400; opacity: 0.9; }
.grade {
  position: absolute; left: 4px; bottom: 3px; font-size: 10px; font-family: var(--font-body); font-weight: 700;
  padding: 0 5px; border-radius: 8px; background: rgba(0,0,0,0.35); color: var(--chalk-dim);
}
.grade.A { color: var(--ok); } .grade.B { color: #a4d97a; } .grade.C { color: var(--warn); } .grade.D, .grade.F { color: var(--bad); }
.hide-grades .grade { display: none; }

/* ------------------------------------------------------------------ rail */
.rail {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 25;
  background: linear-gradient(var(--walnut), var(--walnut-deep)); border-top: 2px solid var(--gold);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.chips { display: flex; gap: 8px; }
.chip {
  width: 44px; height: 44px; border-radius: 50%; border: 4px dashed rgba(255,255,255,0.85);
  color: #fff; font-weight: 700; font-size: 14px; box-shadow: 0 3px 8px rgba(0,0,0,0.5);
  transition: transform 0.1s;
}
.chip.c1 { background: #6d8ba6; } .chip.c5 { background: var(--red); } .chip.c10 { background: #2e6fbf; }
.chip.c25 { background: #2f8a4c; } .chip.c100 { background: #222; }
.chip.is-selected { transform: translateY(-6px) scale(1.08); box-shadow: 0 0 0 3px var(--gold), 0 6px 12px rgba(0,0,0,0.6); }
.rail-actions { display: flex; gap: 8px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.pill {
  background: transparent; color: var(--chalk); border: 1px solid rgba(255,255,255,0.35);
  padding: 8px 14px; border-radius: 20px; font-size: 14px;
}
.pill[aria-pressed="true"] { background: var(--warn); color: var(--ink); border-color: var(--warn); }
.pill.wide { display: block; width: 100%; margin-top: 8px; text-align: center; text-decoration: none; }
.pill.primary { background: var(--gold); color: var(--ink); border-color: var(--gold); font-weight: 600; }
.pill.fb { background: #1877f2; border-color: #1877f2; color: #fff; }
.roll {
  background: linear-gradient(#e2513f, var(--red-deep)); color: #fff; border: 2px solid #ffb3a7;
  font-family: var(--font-felt); font-size: 20px; letter-spacing: 0.15em; padding: 10px 34px; border-radius: 30px;
  box-shadow: 0 4px 14px rgba(200,53,46,0.5);
}
.roll:disabled { opacity: 0.5; cursor: wait; box-shadow: none; }
.link { background: none; border: 0; color: var(--gold); text-decoration: underline; font-size: 13px; padding: 0; }

.coach-line { min-height: 22px; margin: 10px 4px 0; font-size: 15px; color: var(--chalk); font-style: italic; }
.coach-line::before { content: 'Ringer: '; font-style: normal; color: #c9a6ff; font-weight: 600; }
.coach-line:empty::before { content: ''; }

.nudge { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--gold); border-radius: var(--radius); background: rgba(0,0,0,0.3); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.nudge p { margin: 0; flex: 1; }
.fb { background: #1877f2; color: #fff; text-decoration: none; padding: 8px 14px; border-radius: 20px; font-weight: 600; font-size: 14px; }

.foot { max-width: 1040px; margin: 0 auto; padding: 0 16px 110px; display: flex; gap: 16px; font-size: 13px; color: var(--chalk-dim); flex-wrap: wrap; }
.foot a { color: var(--gold); }

/* ---------------------------------------------------------------- drawer */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--drawer-w); max-width: 100%;
  background: var(--paper); color: var(--ink); z-index: 40;
  transform: translateX(105%); transition: transform 0.25s ease;
  display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(0,0,0,0.5);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--purple-deep); color: #fff; }
.ringer-id { display: flex; gap: 10px; align-items: center; flex: 1; }
.ringer-id div { display: flex; flex-direction: column; line-height: 1.2; }
.ringer-id span:not(.ringer-face) { font-size: 12px; opacity: 0.8; }
.drawer-head .icon-btn { color: #fff; }
.drawer-quick { display: flex; gap: 6px; padding: 10px 12px; flex-wrap: wrap; border-bottom: 1px solid #ddd3bd; }
.quick { background: #fff; border: 1px solid #cfc4a8; border-radius: 16px; padding: 6px 12px; font-size: 13px; color: var(--ink); }
.quick:hover { border-color: var(--purple); }
.chat { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; }
.msg.ringer { background: #fff; border: 1px solid #e0d7c0; align-self: flex-start; border-bottom-left-radius: 3px; }
.msg.you { background: var(--purple); color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.msg.lesson { background: #fff8e0; border: 1px solid var(--gold); }
.msg.lesson h4 { margin: 0 0 4px; font-family: var(--font-felt); font-size: 16px; letter-spacing: 0.05em; }
.msg.thinking { color: #777; font-style: italic; }
.ask { display: flex; gap: 6px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid #ddd3bd; background: #fff; }
.ask input { flex: 1; border: 1px solid #cfc4a8; border-radius: 20px; padding: 10px 14px; font-size: 15px; font-family: inherit; }
.ask button { background: var(--purple); color: #fff; border: 0; border-radius: 20px; padding: 0 18px; font-weight: 600; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 35; }

/* -------------------------------------------------------------- overlays */
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(0,0,0,0.45); pointer-events: none; }
.overlay-card { background: rgba(20,40,30,0.92); border: 2px solid var(--gold); border-radius: 16px; padding: 18px 32px; text-align: center; min-width: 240px; animation: pop 0.25s ease-out; }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ov-dice { display: flex; gap: 12px; justify-content: center; margin-bottom: 8px; }
.ov-dice .die { width: 44px; height: 44px; border-radius: 8px; }
.ov-dice .die::after { background-size: 100%; }
.ov-total { font-family: var(--font-felt); font-size: 54px; line-height: 1; color: #fff; }
.ov-event { font-family: var(--font-felt); font-size: 20px; letter-spacing: 0.15em; color: var(--gold); margin-top: 4px; }
.ov-nets { display: flex; gap: 18px; justify-content: center; margin-top: 8px; font-size: 15px; }
.ov-nets span:empty { display: none; }
.ov-nets .up { color: var(--ok); } .ov-nets .down { color: var(--bad); }

.sheet { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: rgba(0,0,0,0.6); padding: 16px; }
.sheet-card { background: var(--paper); color: var(--ink); border-radius: 14px; padding: 20px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; }
.sheet-card h2 { font-family: var(--font-felt); margin: 0 0 12px; letter-spacing: 0.05em; }
.sheet-card .pill { color: var(--ink); border-color: #bbb; }
.row-opt { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #e3dac4; font-size: 15px; }
.row-opt input { width: 20px; height: 20px; }
.howto { padding-left: 20px; margin: 0; font-size: 15px; line-height: 1.5; }
.howto li { margin-bottom: 10px; }
.gameover-card { text-align: center; }
.go-trophy { font-size: 60px; line-height: 1; }
.gameover-card p { font-size: 16px; line-height: 1.45; }
.go-actions { margin-top: 12px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #111; color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px; z-index: 50; max-width: 90vw; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .die.is-rolling { animation: none; }
  .overlay-card { animation: none; }
  .drawer { transition: none; }
}

/* ----------------------------------------------------------------- phone */
@media (max-width: 599px) {
  .topbar { gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
  .brand-title { font-size: 18px; } .brand-sub { font-size: 11px; }
  .bankrolls { gap: 6px; order: 5; width: 100%; margin-left: 0; }
  .bank { flex: 1; min-width: 0; padding: 3px 8px; }
  .bank-amt { font-size: 17px; }
  .mode-btn { padding: 5px 10px; font-size: 13px; }
  .table-wrap { padding: 8px 6px 120px; }
  .stage { height: 150px; }
  .puck { width: 46px; height: 46px; font-size: 15px; }
  .ribbon { top: 96px; }
  .felt { padding: 6px; gap: 6px; }
  .row { gap: 4px; }
  .row-dc .box-dc { flex: 0 0 74px; padding: 4px; }
  .row-dc .box-dc .lbl { font-size: 12px; }
  .dcnum { min-height: 32px; }
  .row-numbers { gap: 3px; }
  .numbox { padding: 2px; gap: 2px; }
  .numbox .num { font-size: 18px; }
  .numbox .num small { display: none; }
  .slot-place { min-height: 38px; } .slot-place .lbl { font-size: 11px; }
  .mini { min-height: 24px; font-size: 9px; padding: 1px; }
  .come-zone { min-height: 28px; font-size: 9px; }
  .lbl { font-size: 14px; }
  .box-pass .lbl { font-size: 18px; }
  .box-field .field-nums { font-size: 15px; letter-spacing: 0.2em; }
  .props { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .prop .lbl { font-size: 11px; }
  .cstack { min-width: 28px; height: 28px; font-size: 10px; border-width: 2px; }
  .rail { padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 6px; }
  .chip { width: 38px; height: 38px; font-size: 12px; border-width: 3px; }
  .chips { gap: 5px; }
  .rail-actions { gap: 5px; width: 100%; margin-left: 0; justify-content: space-between; }
  .pill { padding: 7px 10px; font-size: 12px; }
  .roll { padding: 8px 22px; font-size: 17px; }
  .drawer { top: auto; height: 78vh; width: 100%; border-radius: 16px 16px 0 0; transform: translateY(105%); }
  .drawer.open { transform: translateY(0); }
  .foot { padding-bottom: 130px; }
}

/* ---------------------------------------------------------- v1.1 fixes */
.puck { text-align: center; line-height: 1.05; }
.rail-actions { margin-left: auto; }
.rail > .roll { flex: 0 0 auto; }

/* chips live inside their box, vertically centred */
.cstack { position: absolute; top: 50%; transform: translateY(-50%); height: auto; min-height: 34px; border-radius: 17px; padding: 3px 6px; line-height: 1.1; }
.cstack.player { right: 4px; left: auto; top: 50%; }
.cstack.ringer { left: 4px; right: auto; top: 50%; }
.cstack.off::after { content: none; }
.cstack .odds { font-size: 9px; line-height: 1; }

/* come zones: everything flows, nothing overlaps */
.come-zone { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; padding: 2px; }
.come-zone .cstack { position: static; transform: none; min-height: 26px; height: auto; padding: 2px 6px; }
.come-zone .cz-lbl { flex: 0 0 auto; }
.come-zone.has-bet .cz-lbl { display: none; }
.come-zone .mini-odds { position: static; }
.dcnum { position: relative; }
.dcnum .mini-odds { position: static; margin-top: 2px; }
.dcnum .cstack { position: static; transform: none; min-height: 26px; padding: 2px 6px; }
.dcnum { flex-direction: column; }

/* box-dc label */
.box-dc .lbl { line-height: 1.05; }

@media (max-width: 599px) {
  /* rail: chips + roll on one row, pills below */
  .rail { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; row-gap: 6px; column-gap: 8px; align-items: center; }
  .chips { grid-column: 1; grid-row: 1; }
  .rail > .roll { grid-column: 2; grid-row: 1; padding: 8px 20px; }
  .rail-actions { grid-column: 1 / -1; grid-row: 2; width: 100%; margin: 0; justify-content: flex-start; }
  .rail-actions .pill { flex: 1; text-align: center; padding: 6px 4px; }
  .table-wrap { padding-bottom: 130px; }
  .foot { padding-bottom: 140px; }

  /* small slots: when a chip is down, the chip IS the label */
  .slot-place .grade, .box-dc .grade, .mini .grade { display: none; }
  .slot-place.has-bet .lbl, .slot-place.has-bet .sub, .mini.has-bet { color: transparent; }
  .slot-place .cstack, .mini .cstack { min-width: 26px; min-height: 22px; font-size: 9px; padding: 1px 4px; border-width: 2px; }
  .slot-place .cstack.player, .mini .cstack.player { right: 1px; }
  .slot-place .cstack.ringer, .mini .cstack.ringer { left: 1px; }
  .cstack { min-width: 28px; min-height: 26px; font-size: 10px; }
  .box-dc { flex: 0 0 62px; }
  .box-dc .lbl { font-size: 11px; }
  .box-dc .sub { display: none; }
  .come-zone .cstack { min-height: 20px; font-size: 9px; }
  .grade { font-size: 9px; left: 2px; bottom: 1px; }
  .dcnum .lbl { font-size: 12px; }
}

@media (max-width: 599px) {
  .box-pass.has-bet .lbl, .box-dontpass.has-bet .lbl, .box-come.has-bet .lbl, .box-field.has-bet .field-nums { padding-right: 56px; }
  .box-field.has-bet .sub { padding-right: 56px; }
  .ov-event { font-size: 16px; }
}
@media (max-width: 599px) {
  .box-pass.has-bet .odds-btn, .box-dontpass.has-bet .odds-btn { margin-right: 56px; }
}

/* ------------------------------------------------- v2: fold + docked coach */
.stage { height: 160px; }
.simple .adv { display: none !important; }
.props-wrap { margin-top: 4px; border-top: 1px dashed var(--chalk-dim); padding-top: 6px; }
.props-wrap > summary { cursor: pointer; font-size: 13px; letter-spacing: 0.08em; color: var(--chalk-dim); padding: 4px 2px; list-style: none; display: flex; align-items: center; gap: 8px; }
.props-wrap > summary::-webkit-details-marker { display: none; }
.props-wrap > summary::before { content: '+'; display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--chalk-dim); border-radius: 50%; font-size: 13px; }
.props-wrap[open] > summary::before { content: '−'; }
.props-wrap > summary:hover { color: var(--chalk); }
.props { margin-top: 0; border-top: 0; padding-top: 4px; }

@media (min-width: 1000px) {
  body.docked .drawer { transform: none; box-shadow: -4px 0 20px rgba(0,0,0,0.35); }
  body.docked .table-wrap, body.docked .foot { margin-right: var(--drawer-w); max-width: none; }
  body.docked .table-wrap { padding-left: 16px; padding-right: 16px; }
  body.docked .rail { right: var(--drawer-w); }
  body.docked .topbar { padding-right: calc(var(--drawer-w) + 16px); }
  body.docked .toast { left: calc(50% - var(--drawer-w) / 2); }
  body.docked .overlay { right: var(--drawer-w); }
  body.docked .ringer-toggle { display: none; }
}
@media (max-width: 599px) {
  .stage { height: 140px; }
  .props-wrap > summary { font-size: 12px; }
}

@media (min-width: 1000px) {
  body.docked .rail { flex-wrap: nowrap; gap: 8px; }
  body.docked .rail .pill { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
  body.docked .rail .roll { padding: 10px 24px; }
  body.docked .rail .chip { width: 40px; height: 40px; }
  body.docked .slot-place.has-bet .lbl, body.docked .slot-place.has-bet .sub { color: transparent; }
}

/* ------------------------------------------------------------- v3: tutorial */
body.tutorial .box:not(.tut-target), body.tutorial .odds-btn:not(.tut-target) { opacity: 0.3; pointer-events: none; }
body.tutorial .box.tut-target { opacity: 1; pointer-events: auto; }
body.tutorial .tut-target .box, body.tutorial .tut-target .odds-btn { opacity: 1; pointer-events: none; }
body.tutorial .chips, body.tutorial .rail .pill, body.tutorial .mode { pointer-events: none; opacity: 0.4; }
body.tutorial .box.is-unavailable.tut-target { opacity: 1; cursor: pointer; }
.tut-target { box-shadow: 0 0 0 3px var(--gold), 0 0 24px var(--gold) !important; animation: tutpulse 1.1s ease-in-out infinite; position: relative; z-index: 3; }
.odds-btn.tut-target { display: inline-block; }
@keyframes tutpulse { 0%, 100% { box-shadow: 0 0 0 3px var(--gold), 0 0 12px var(--gold); } 50% { box-shadow: 0 0 0 5px var(--gold), 0 0 30px var(--gold); } }
.msg.lesson-title { background: var(--purple-deep); color: #fff; font-family: var(--font-felt); letter-spacing: 0.08em; align-self: stretch; text-align: center; max-width: none; }
.msg.lesson p { margin: 0 0 8px; }
.msg.lesson p:last-child { margin-bottom: 0; }
.howto b { font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .tut-target { animation: none; } }
body.tutorial .odds-btn.tut-target { pointer-events: auto; opacity: 1; }
body.tutorial .box:has(> .odds-btn.tut-target) { opacity: 1; pointer-events: auto; }
body.tutorial .box:has(> .odds-btn.tut-target) { box-shadow: none; }