/* Dealdeck — a street card table. Dark felt, one gold accent, cream cards. The CA strip hangs at the top; the bump
   slip comes first, the deck right under it (beside it on a desktop), the tape and the rules in the rail. */
:root {
  --ground: #0C1512; --felt: #12271E; --felt-hi: #1A3528; --seam: #24402F;
  --ink: #EEF0E6; --dim: #93A69C; --faint: #5F7468;
  --gold: #E8B94A; --gold-lo: #8C6E2A;
  --card: #F3ECD8; --card-ink: #15211B; --card-dim: #6B6450;
  --strip: 74px;
  --disp: 'Syne', 'Work Sans', system-ui, sans-serif;
  --text: 'Work Sans', system-ui, -apple-system, sans-serif;
  --mono: 'DM Mono', ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 15px/1.5 var(--text); padding-top: calc(var(--strip) + 14px); min-height: 100vh; }
code, .mono { font-family: var(--mono); }
button { font: inherit; cursor: pointer; }
a { color: var(--gold); }
[hidden] { display: none !important; }

/* ---------- the CA strip (fixed, top) ---------- */
.castrip { position: fixed; top: 0; left: 0; right: 0; z-index: 40; background: rgba(12, 21, 18, .96); border-bottom: 1px solid var(--seam); backdrop-filter: blur(8px); }
.castrip-row { max-width: 1180px; margin: 0 auto; padding: 9px 14px 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: var(--strip); }
.castrip-mark { border-radius: 7px; flex: 0 0 auto; }
.castrip-name { font: 700 15px/1 var(--disp); letter-spacing: .01em; }
.castrip-k { margin-left: auto; font: 500 11px/1 var(--mono); color: var(--ground); background: var(--gold); padding: 4px 6px; border-radius: 4px; }
.castrip-addr { order: 5; flex: 1 1 100%; font: 500 12.5px/1.25 var(--mono); color: var(--ink); word-break: break-all; user-select: all; -webkit-user-select: all; }
.castrip-addr.is-waiting { color: var(--dim); user-select: text; -webkit-user-select: text; font-size: 12px; }
.castrip-copy { background: var(--gold); color: var(--ground); border: 0; border-radius: 6px; padding: 6px 12px; font-weight: 700; font-size: 13px; }
.castrip-copy:disabled { background: var(--seam); color: var(--dim); cursor: default; }
.castrip-copy.is-done { background: var(--ink); }
.castrip-gm { font: 500 12px/1 var(--mono); color: var(--dim); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- the table ---------- */
.felt { max-width: 1180px; margin: 0 auto; padding: 0 14px 28px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

/* the bump slip: the action, first */
.bumpslip { background: var(--felt); border: 1px solid var(--seam); border-radius: 16px; padding: 16px 16px 14px; }
.bumpslip-moment { margin: 0; font: 700 18px/1.25 var(--disp); }
.bumpslip-moment b { color: var(--gold); font-weight: 800; }
.bumpslip-say { margin: 6px 0 12px; color: var(--dim); font-size: 14px; }
.bumpslip-say b { color: var(--ink); }
.stakeline { display: flex; align-items: center; gap: 8px; background: var(--ground); border: 1px solid var(--seam); border-radius: 12px; padding: 4px 6px 4px 12px; }
.stakeline:focus-within { border-color: var(--gold); }
.stakeline-k { font-size: 12px; color: var(--faint); white-space: nowrap; }
.stakeline-in { flex: 1; min-width: 0; background: none; border: 0; color: var(--ink); font: 700 24px/1.6 var(--disp); text-align: right; outline: none; padding: 2px 0; }
.stakeline-tk { font: 500 11px/1 var(--mono); color: var(--dim); }
.slipmath { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 10px 0; }
.slipmath-cell { background: var(--felt-hi); border-radius: 9px; padding: 7px 9px; display: flex; flex-direction: column; min-width: 0; }
.slipmath-k { font-size: 11px; color: var(--dim); }
.slipmath-v { font: 600 15px/1.3 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slipacts { display: flex; gap: 8px; }
.takebtn { flex: 1; background: var(--gold); color: var(--ground); border: 0; border-radius: 11px; padding: 13px 14px; font: 800 16px/1 var(--disp); letter-spacing: .01em; }
.takebtn:disabled { opacity: .45; cursor: default; }
.dealbtn { background: none; color: var(--gold); border: 1px solid var(--gold-lo); border-radius: 11px; padding: 12px 14px; font-weight: 700; }
.slipnote { margin: 9px 0 0; font-size: 13px; color: var(--dim); }
.slipnote b { color: var(--ink); }
.credit { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--felt-hi); border: 1px solid var(--gold-lo); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.credit button { background: var(--gold); color: var(--ground); border: 0; border-radius: 7px; padding: 6px 12px; font-weight: 700; }

/* the deck: the object */
.pile { background: radial-gradient(120% 90% at 50% 0%, var(--felt-hi), var(--felt) 70%); border: 1px solid var(--seam); border-radius: 18px; padding: 14px 14px 18px; overflow-x: clip; }
.pile-hd { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.pile-t { font: 800 13px/1 var(--disp); white-space: nowrap; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.pile-meta { font: 500 12px/1.3 var(--mono); color: var(--dim); text-align: right; }

.topcard { position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "k pip" "stake stake" "who who" "next next"; gap: 2px 8px;
  background: var(--card); color: var(--card-ink); border-radius: 14px; padding: 14px 16px 14px; border: 2px solid var(--gold);
  box-shadow: 0 1px 0 var(--gold-lo), 0 5px 0 -1px var(--card), 0 6px 0 0 var(--gold-lo), 0 10px 0 -1px var(--card), 0 11px 0 0 var(--gold-lo), 0 18px 30px rgba(0,0,0,.45);
  margin-bottom: 26px; transform-origin: 50% 0; }
.topcard-pip { grid-area: pip; font-size: 22px; line-height: 1; color: var(--gold-lo); }
.topcard-k { grid-area: k; font: 600 12px/1.2 var(--mono); color: var(--card-dim); text-transform: uppercase; letter-spacing: .06em; }
.topcard-stake { grid-area: stake; font: 800 clamp(40px, 12vw, 64px)/1.02 var(--disp); letter-spacing: -.02em; }
.topcard-who { grid-area: who; font: 500 13px/1.35 var(--mono); color: var(--card-ink); word-break: break-all; }
.topcard-next { grid-area: next; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #CFC4A4; font-size: 13.5px; color: var(--card-ink); }
.topcard-next b { font-weight: 700; }
.topcard.is-ghost { background: transparent; color: var(--ink); border-style: dashed; box-shadow: 0 0 0 4px rgba(232, 185, 74, .12); animation: beckon 2.4s ease-in-out infinite; }
.topcard.is-ghost .topcard-k, .topcard.is-ghost .topcard-who { color: var(--dim); }
.topcard.is-ghost .topcard-stake { color: var(--gold); }
.topcard.is-ghost .topcard-next { color: var(--ink); border-top-color: var(--seam); }
.topcard.is-flip { animation: flipin .55s cubic-bezier(.2, .8, .25, 1); }
@keyframes beckon { 50% { box-shadow: 0 0 0 9px rgba(232, 185, 74, .05); } }
@keyframes flipin { from { transform: rotateX(80deg) translateY(-18px); opacity: .2; } to { transform: none; opacity: 1; } }

.under { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.under-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; background: #E6DEC6; color: var(--card-ink); border-radius: 10px; padding: 9px 12px; border-left: 5px solid var(--gold-lo); }
.under-card:nth-child(2n) { margin-left: 8px; }
.under-card:nth-child(3n) { margin-left: 4px; }
.under-n { font: 600 11px/1 var(--mono); color: var(--card-dim); }
.under-who { font: 500 13px/1.3 var(--mono); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.under-stake { font: 700 15px/1.2 var(--disp); text-align: right; }
.under-paid { grid-column: 2 / 4; font-size: 12.5px; color: #3B4A40; }
.under-paid b { color: #7A5A12; }
.under-back { background: repeating-linear-gradient(45deg, #183527 0 6px, #1E4130 6px 12px); border: 1px solid var(--seam); border-radius: 10px; min-height: 34px; line-height: 1.3; padding-top: 6px; padding-bottom: 6px; display: flex; align-items: center; padding: 0 12px; font-size: 12px; color: var(--dim); }
.under-back:nth-child(2) { margin: 0 6px; height: 28px; }
.under-back:nth-child(3) { margin: 0 12px; height: 22px; }

/* the rail */
.rail { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tapebox, .howto, .dealt { background: var(--felt); border: 1px solid var(--seam); border-radius: 14px; padding: 12px 14px; }
.tapebox-hd { display: flex; align-items: center; justify-content: space-between; font: 700 12px/1 var(--disp); text-transform: uppercase; letter-spacing: .14em; color: var(--dim); margin-bottom: 8px; }
.tapebox-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: beckon 1.6s infinite; }
.tapebox-ls { list-style: none; margin: 0; padding: 0; font: 400 12.5px/1.45 var(--mono); max-height: 300px; overflow-y: auto; }
.tapebox-ls li { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; padding: 5px 0; border-bottom: 1px dotted var(--seam); }
.tapebox-ls li:last-child { border-bottom: 0; }
.tapebox-ls time { color: var(--faint); }
.tapebox-ls .is-bump span { color: var(--ink); }
.tapebox-ls .is-bump b { color: var(--gold); font-weight: 500; }
.tapebox-ls .is-quiet, .dealt-ls .is-quiet { display: block; color: var(--dim); font-family: var(--text); }
.tapebox-ls .is-print { animation: print .7s steps(14, end); }
@keyframes print { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.howto-t, .dealt-t { margin: 0 0 8px; font: 800 17px/1.2 var(--disp); }
.howto-ls { margin: 0; padding-left: 18px; font-size: 14px; color: var(--dim); }
.howto-ls li { margin-bottom: 7px; }
.howto-ls b { color: var(--ink); }
.worked { margin-top: 10px; background: var(--ground); border-left: 3px solid var(--gold); border-radius: 0 10px 10px 0; padding: 9px 12px; font-size: 13.5px; }
.worked p { margin: 0 0 6px; }
.worked p:last-child { margin: 0; }
.worked-t { font: 700 11px/1 var(--mono) !important; color: var(--gold); text-transform: uppercase; letter-spacing: .1em; }
.dealt-ls { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.dealt-ls li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dotted var(--seam); }
.dealt-ls li:last-child { border: 0; }

.tail { max-width: 1180px; margin: 0 auto; padding: 18px 14px 40px; border-top: 1px solid var(--seam); font-size: 12.5px; color: var(--faint); display: grid; gap: 6px; }
.tail code { color: var(--dim); word-break: break-all; }
.tail nav { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 4px; }
.tail nav a { color: var(--dim); }

.tray { position: fixed; inset: 0; z-index: 60; background: rgba(4, 8, 6, .72); display: flex; align-items: flex-end; justify-content: center; }
.tray-card { width: min(560px, 100%); max-height: 80vh; overflow-y: auto; background: var(--felt); border: 1px solid var(--seam); border-radius: 18px 18px 0 0; padding: 14px 16px 24px; }
.tray-hd { display: flex; justify-content: space-between; align-items: center; font: 700 16px/1 var(--disp); margin-bottom: 10px; }
.tray-hd button { background: none; border: 1px solid var(--seam); color: var(--dim); border-radius: 8px; padding: 5px 10px; }
.walletpick { display: grid; gap: 8px; }
.walletpick button { display: flex; align-items: center; gap: 10px; background: var(--felt-hi); color: var(--ink); border: 1px solid var(--seam); border-radius: 10px; padding: 10px 12px; }
.walletpick img { width: 24px; height: 24px; }
.pop { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; background: var(--card); color: var(--card-ink); border-radius: 10px; padding: 9px 14px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.4); }

/* ---------- tablet: one column, wider measure ---------- */
@media (min-width: 720px) {
  :root { --strip: 52px; }
  .castrip-addr { order: 0; flex: 0 1 auto; font-size: 13.5px; }
  .castrip-k { margin-left: 18px; }
  .felt { max-width: 760px; padding: 0 22px 32px; gap: 18px; }
  .bumpslip { padding: 20px 22px 18px; }
  .bumpslip-moment { font-size: 22px; }
  .topcard { padding: 18px 22px; }
  .topcard-stake { font-size: 72px; }
  .tail { max-width: 760px; padding: 18px 22px 40px; }
}

/* ---------- desktop: split pane — the deck on the left, the slip and the tape on the right ---------- */
@media (min-width: 1000px) {
  .felt { max-width: 1180px; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); grid-template-areas: "pile slip" "pile rail"; align-items: start; gap: 22px; padding: 0 28px 40px; }
  .bumpslip { grid-area: slip; }
  .pile { grid-area: pile; position: sticky; top: calc(var(--strip) + 14px); padding: 22px 26px 28px; min-height: 620px; }
  .rail { grid-area: rail; }
  .pile-t { font-size: 15px; }
  .topcard { padding: 24px 28px 22px; border-radius: 18px; }
  .topcard-stake { font-size: 96px; }
  .topcard-who { font-size: 15px; }
  .topcard-next { font-size: 15px; }
  .under-card { padding: 11px 16px; }
  .under-stake { font-size: 18px; }
  .tapebox-ls { max-height: 340px; }
  .tail { max-width: 1180px; padding: 20px 28px 44px; grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
