/* Cut Card: warm felt and neon, phone-first (390px), portrait. */
:root {
  --felt: #0b2a1f;
  --felt-2: #123c2d;
  --felt-3: #1a4f3b;
  --line: rgba(255, 255, 255, 0.10);
  --ink: #f6efe0;
  --ink-dim: rgba(246, 239, 224, 0.62);
  --ink-mute: rgba(246, 239, 224, 0.42);
  --amber: #ffb347;
  --amber-2: #ff8c42;
  --pink: #ff5fa2;
  --cyan: #3ee0d0;
  --violet: #b57bff;
  --red: #ff5c5c;
  --green: #5ff09a;
  --card: #fbf7ec;
  --card-ink: #17151a;
  --card-red: #d5322f;
  --radius: 14px;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--felt); color: var(--ink); }
body {
  font-family: -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.3;
  min-height: 100vh;
  background:
    radial-gradient(120% 60% at 50% -10%, #1f6a4d 0%, transparent 60%),
    radial-gradient(80% 40% at 50% 110%, #07130e 0%, transparent 70%),
    var(--felt);
  overscroll-behavior-y: contain;
  -webkit-user-select: none; user-select: none;
}
input, code { -webkit-user-select: text; user-select: text; }
#app { max-width: 480px; margin: 0 auto; padding: 10px 12px calc(28px + var(--safe-b)); }
.screen { display: flex; flex-direction: column; gap: 12px; }
[hidden] { display: none !important; }
h1 { margin: 0; font-size: 42px; letter-spacing: 0.5px; font-weight: 800; line-height: 1;
  background: linear-gradient(90deg, var(--amber), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.title { text-align: center; padding: 22px 0 6px; }
.tagline { color: var(--ink-dim); margin-top: 8px; }
.version { color: var(--ink-mute); font-size: 12px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-mute); font-size: 14px; }
.center { text-align: center; }
.sub { font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; justify-content: center; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.small { margin-top: 4px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
code { background: rgba(0,0,0,0.3); padding: 2px 8px; border-radius: 6px; font-size: 16px; letter-spacing: 1px; }

/* Buttons */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--felt-3); color: var(--ink);
  font: inherit; font-weight: 700; font-size: 17px; padding: 12px 16px; border-radius: var(--radius);
  min-height: 48px; cursor: pointer; box-shadow: 0 2px 0 rgba(0,0,0,0.25); transition: transform 80ms, filter 120ms, opacity 120ms;
}
.btn:active { transform: translateY(1px); filter: brightness(1.1); }
.btn:disabled { opacity: 0.35; cursor: default; box-shadow: none; }
.btn.primary { background: linear-gradient(180deg, var(--amber), var(--amber-2)); color: #2a1600; border-color: transparent; }
.btn.big { font-size: 20px; min-height: 58px; }
.btn.small { font-size: 14px; min-height: 38px; padding: 8px 12px; }
.btn.danger { color: var(--red); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg .btn { flex: 1 1 auto; min-height: 42px; font-size: 15px; padding: 8px 10px; }
.seg .btn.on { background: var(--cyan); color: #032a26; border-color: transparent; }
.seg .btn.locked { opacity: 0.45; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-dim); }
.hint { font-size: 13px; color: var(--ink-dim); min-height: 1.2em; }
.setup { display: flex; flex-direction: column; gap: 14px; padding: 12px; background: rgba(0,0,0,0.18); border-radius: var(--radius); border: 1px solid var(--line); }
.seedrow { display: flex; gap: 6px; }
.seedrow input { flex: 1; min-width: 0; font: inherit; font-size: 18px; letter-spacing: 2px; text-transform: uppercase; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,0.3); color: var(--ink); }
.seedrow input:focus { outline: 2px solid var(--cyan); }

/* HUD */
#hud { display: grid; grid-template-columns: 1fr 1.2fr 1fr; align-items: center; gap: 6px; padding: 8px 10px; background: rgba(0,0,0,0.28); border-radius: var(--radius); border: 1px solid var(--line); position: sticky; top: 6px; z-index: 5; backdrop-filter: blur(6px); }
.hud-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hud-cell.center { align-items: center; text-align: center; }
.hud-cell.right { align-items: flex-end; text-align: right; }
.clock { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.balance { font-size: 26px; font-weight: 800; color: var(--amber); font-variant-numeric: tabular-nums; line-height: 1; }
.balance.flash-up { animation: flashUp 500ms ease-out; }
.balance.flash-down { animation: flashDown 500ms ease-out; }
@keyframes flashUp { 0% { color: var(--green); transform: scale(1.12); } 100% { color: var(--amber); transform: none; } }
@keyframes flashDown { 0% { color: var(--red); transform: scale(0.94); } 100% { color: var(--amber); transform: none; } }
.heat { position: relative; }
.face { font-size: 24px; line-height: 1; }
.meter { width: 100%; max-width: 96px; height: 8px; border-radius: 6px; background: rgba(0,0,0,0.45); overflow: hidden; border: 1px solid var(--line); }
.meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--amber) 55%, var(--red)); transition: width 300ms; }
.heat.hot .meter-fill { box-shadow: 0 0 10px var(--red); }
body.instant .meter-fill { transition: none; }

/* Table */
#table { display: flex; flex-direction: column; gap: 8px; padding: 10px; min-height: 230px; background: radial-gradient(100% 80% at 50% 0%, var(--felt-3), var(--felt-2) 70%); border-radius: 18px; border: 1px solid var(--line); box-shadow: inset 0 0 0 6px rgba(0,0,0,0.12); }
.hand { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 12px; border: 1px solid transparent; }
.hand.active { border-color: var(--amber); background: rgba(255, 179, 71, 0.07); }
.hand.done { opacity: 0.85; }
.hand-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 1px; }
.hand-head .total { font-weight: 800; color: var(--ink); font-size: 15px; letter-spacing: 0; text-transform: none; }
.hand-head .res { font-weight: 800; text-transform: none; letter-spacing: 0; }
.res.win { color: var(--green); } .res.lose { color: var(--red); } .res.push { color: var(--ink-dim); } .res.natural { color: var(--amber); }
.cards { display: flex; gap: 6px; flex-wrap: wrap; min-height: 74px; }
.card { width: 52px; height: 74px; border-radius: 8px; background: var(--card); color: var(--card-ink); display: flex; flex-direction: column; justify-content: space-between; padding: 5px 6px; font-weight: 800; box-shadow: 0 3px 8px rgba(0,0,0,0.35); position: relative; font-size: 18px; line-height: 1; }
.card .r { font-size: 20px; }
.card .s { font-size: 22px; align-self: flex-end; }
.card.red { color: var(--card-red); }
.card.back { background: repeating-linear-gradient(45deg, #7b2d5e 0 6px, #5e1f47 6px 12px); border: 3px solid var(--card); }
.card.wild { background: linear-gradient(160deg, #5b2a9e, #9b4fd6); color: #fff; }
.card.wild .r { font-size: 10px; letter-spacing: 0.5px; line-height: 1.05; }
.card.wild .s { font-size: 22px; }
.card.ad { background: linear-gradient(160deg, #ffe066, #ffb347); color: #3a2a00; }
.card.ad .r { font-size: 11px; line-height: 1.05; }
.card.new { animation: reveal 180ms ease-out both; }
body.instant .card.new { animation: none; }
@keyframes reveal { 0% { transform: translateY(-8px) rotateY(70deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.msg { min-height: 26px; text-align: center; font-weight: 800; font-size: 20px; }
.msg.win { color: var(--green); } .msg.lose { color: var(--red); } .msg.push { color: var(--ink-dim); } .msg.natural { color: var(--amber); text-shadow: 0 0 12px rgba(255,179,71,0.6); }

/* Actions */
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.actions .btn { min-height: 60px; font-size: 19px; padding: 8px 4px; }
.actions .btn[data-act="hit"] { background: linear-gradient(180deg, #37c58f, #219a6b); color: #03150d; border-color: transparent; }
.actions .btn[data-act="stand"] { background: linear-gradient(180deg, #ff6b6b, #d64545); color: #2a0303; border-color: transparent; }
.actions.five { grid-template-columns: repeat(5, 1fr); }
.actions.five .btn { font-size: 16px; }
.prompt { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: rgba(0,0,0,0.25); border-radius: var(--radius); border: 1px solid var(--violet); text-align: center; }
.wild-values { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.wild-values .btn { min-height: 46px; padding: 6px; font-size: 18px; }
.wild-values .btn.best { border-color: var(--violet); box-shadow: 0 0 10px rgba(181,123,255,0.45); }
.cheat { padding: 8px 12px; border-radius: 10px; background: rgba(62,224,208,0.08); border: 1px dashed var(--cyan); font-size: 14px; color: var(--ink); }
.cheat b { color: var(--cyan); }

/* Bets */
.betrow { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: rgba(0,0,0,0.22); border-radius: var(--radius); border: 1px solid var(--line); }
.chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.chips .btn { min-height: 44px; font-size: 15px; padding: 6px 4px; border-radius: 999px; background: var(--felt-3); }
.chips .btn.on { background: var(--amber); color: #2a1600; border-color: transparent; }
.betline { display: grid; grid-template-columns: 52px 1fr 52px 1.5fr; gap: 8px; align-items: stretch; }
.bet-amt { display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; background: rgba(0,0,0,0.3); border-radius: 12px; font-variant-numeric: tabular-nums; }
.btn.nudge { font-size: 26px; padding: 0; }
.btn.deal { font-size: 20px; }
.betrow.locked .chips .btn, .betrow.locked .nudge { opacity: 0.35; pointer-events: none; }

/* Voucher tray */
.tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tray.four { grid-template-columns: repeat(4, 1fr); }
.slot { min-height: 84px; border-radius: 12px; border: 1px dashed var(--line); display: flex; flex-direction: column; justify-content: space-between; padding: 8px; background: rgba(0,0,0,0.18); cursor: pointer; position: relative; overflow: hidden; }
.slot.empty { align-items: center; justify-content: center; color: var(--ink-mute); font-size: 13px; cursor: default; }
.slot .vname { font-weight: 800; font-size: 14px; line-height: 1.15; }
.slot .vmeta { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-dim); }
.slot .exp { font-weight: 800; }
.slot.soon .exp { color: var(--red); }
.slot.cat-outcome { border-color: var(--amber); border-style: solid; }
.slot.cat-shoe { border-color: var(--cyan); border-style: solid; }
.slot.cat-rule { border-color: var(--violet); border-style: solid; }
.slot.burn { animation: burn 500ms ease-in both; }
@keyframes burn { 0% { opacity: 1; } 100% { opacity: 0; transform: scale(0.8) rotate(-6deg); filter: sepia(1) brightness(0.4); } }
.pending { display: flex; flex-wrap: wrap; gap: 6px; }
.pending:empty { display: none; }
.pill { font-size: 13px; padding: 5px 10px; border-radius: 999px; background: rgba(255,179,71,0.15); border: 1px solid var(--amber); color: var(--ink); }
.pill.rule { background: rgba(181,123,255,0.15); border-color: var(--violet); }
.pill.heatfx { background: rgba(255,92,92,0.15); border-color: var(--red); }
.peek { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(62,224,208,0.1); border: 1px solid var(--cyan); font-size: 14px; }
.peek .mini { display: inline-flex; gap: 4px; }
.mini .card { width: 34px; height: 46px; font-size: 13px; padding: 3px 4px; }
.mini .card .r { font-size: 14px; } .mini .card .s { font-size: 14px; }

/* Shoe board */
#board { background: rgba(0,0,0,0.22); border-radius: var(--radius); border: 1px solid var(--line); padding: 8px 10px; }
#board summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 800; list-style: none; }
#board summary::-webkit-details-marker { display: none; }
.board-summary { font-size: 13px; color: var(--ink-dim); font-weight: 600; font-variant-numeric: tabular-nums; }
.board-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 8px; }
.cell { display: flex; flex-direction: column; align-items: center; padding: 6px 0 4px; border-radius: 8px; background: rgba(255,255,255,0.05); font-variant-numeric: tabular-nums; }
.cell .rk { font-size: 12px; color: var(--ink-dim); }
.cell .n { font-size: 19px; font-weight: 800; }
.cell.low { background: rgba(62,224,208,0.12); } .cell.low .rk { color: var(--cyan); }
.cell.high { background: rgba(255,179,71,0.14); } .cell.high .rk { color: var(--amber); }
.cell.zero .n { color: var(--ink-mute); }
.cell.tens { cursor: pointer; border: 1px solid var(--line); }
.board-grid.expanded { grid-template-columns: repeat(13, 1fr); }
.board-grid.expanded .cell .n { font-size: 16px; }
.board-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 13px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.board-foot b { color: var(--ink); }
.board-foot .rc.pos b { color: var(--green); } .board-foot .rc.neg b { color: var(--red); }
.sp { display: inline-flex; align-items: center; gap: 4px; }
.sp .dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.sp .dot.wild { background: var(--violet); } .sp .dot.ad { background: #ffe066; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(2, 10, 7, 0.78); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 12px; backdrop-filter: blur(4px); }
@media (min-width: 600px) { .modal { align-items: center; } }
.modal-card { width: 100%; max-width: 460px; max-height: 88vh; overflow: auto; background: var(--felt-2); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); animation: rise 160ms ease-out; }
body.instant .modal-card { animation: none; }
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
.modal h2 { margin: 0; font-size: 22px; }
.modal .flavor { color: var(--ink-dim); font-style: italic; font-size: 14px; }
.offer { display: flex; flex-direction: column; gap: 8px; }
.vcard { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,0.22); cursor: pointer; }
.vcard:active { filter: brightness(1.15); }
.vcard .vtop { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.vcard .vname { font-weight: 800; font-size: 17px; }
.vcard .tag { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; padding: 2px 8px; border-radius: 999px; }
.tag.outcome { background: rgba(255,179,71,0.2); color: var(--amber); }
.tag.shoe { background: rgba(62,224,208,0.2); color: var(--cyan); }
.tag.rule { background: rgba(181,123,255,0.2); color: var(--violet); }
.tag.cursed { background: rgba(255,92,92,0.2); color: var(--red); }
.vcard .vdesc { font-size: 14px; color: var(--ink); }
.vcard .vflavor { font-size: 13px; color: var(--ink-dim); font-style: italic; }
.vcard .vfoot { display: flex; gap: 12px; font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.vcard.cat-outcome { border-color: var(--amber); } .vcard.cat-shoe { border-color: var(--cyan); } .vcard.cat-rule { border-color: var(--violet); } .vcard.cat-cursed { border-color: var(--red); }
.vcard.selected { outline: 2px solid var(--amber); }
.rankpick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.rankpick .btn { min-height: 42px; padding: 4px; font-size: 15px; }

/* Toasts */
.toasts { position: fixed; left: 0; right: 0; top: 66px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 40; padding: 0 12px; }
.toast { background: rgba(10, 30, 22, 0.94); border: 1px solid var(--line); color: var(--ink); padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; box-shadow: var(--shadow); animation: toastIn 160ms ease-out, toastOut 300ms ease-in 2.2s both; max-width: 100%; }
.toast.good { border-color: var(--green); color: var(--green); }
.toast.bad { border-color: var(--red); color: var(--red); }
.toast.heat { border-color: var(--amber); color: var(--amber); }
.toast.cash { border-color: var(--amber); background: linear-gradient(180deg, var(--amber), var(--amber-2)); color: #2a1600; font-size: 17px; animation-delay: 0s, 3.2s; }
body.instant .toast { animation: toastOut 1ms linear 1.6s both; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

/* End, stats, settings, help */
.end-text { text-align: center; font-size: 18px; color: var(--ink-dim); }
.score { text-align: center; font-size: 46px; font-weight: 800; color: var(--amber); font-variant-numeric: tabular-nums; }
.seedline { text-align: center; color: var(--ink-dim); }
.end-stats, .stats-table { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px; background: rgba(0,0,0,0.2); border-radius: var(--radius); border: 1px solid var(--line); font-size: 15px; }
.end-stats span:nth-child(even), .stats-table span:nth-child(even) { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-h { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-dim); margin: 10px 0 4px; }
.history { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.history .h { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 6px 10px; background: rgba(0,0,0,0.18); border-radius: 8px; }
.history .h .sub { display: block; }
.toggle { display: flex; align-items: center; gap: 12px; padding: 12px; background: rgba(0,0,0,0.2); border-radius: var(--radius); border: 1px solid var(--line); cursor: pointer; }
.toggle input { width: 22px; height: 22px; accent-color: var(--amber); }
.help p { margin: 0 0 12px; font-size: 15px; }
.help b { color: var(--amber); }
.unlock { display: flex; justify-content: space-between; padding: 6px 10px; background: rgba(0,0,0,0.18); border-radius: 8px; font-size: 14px; }
.unlock.done { color: var(--green); }

@media (max-width: 360px) {
  .card { width: 46px; height: 66px; }
  .board-grid { gap: 3px; }
  .cell .n { font-size: 16px; }
}
@media (min-width: 600px) {
  body { font-size: 18px; }
  #app { padding-top: 20px; }
}
