/* Short Fuse. A dock at night: dark steel, safety orange, cream shipping labels for the cards.
   One fixed screen for a phone held upright; wider screens get the same table with bigger cards. */
:root {
  --bg: #0d1216; --surface: #171e24; --raised: #212a32; --edge: #3a464f;
  --ink: #e6e9e4; --ink-soft: #94a0a6;
  --accent: #ff7a3d; --on-accent: #1a0d05;
  --danger: #ff4d3d; --ok: #3fbf8f;
  --label: #efe7d3; --label-ink: #1d2428;
  --display: "Saira Stencil One", "Stencil", "Impact", sans-serif;
  --ui: "Saira Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --cw: clamp(60px, 18.5vw, 92px); --ch: calc(var(--cw) * 1.42);
  --p: 0;
  color-scheme: dark;
}
@media (min-width: 700px) and (min-height: 760px) { :root { --cw: 104px; } }
@media (max-height: 640px) { :root { --cw: clamp(54px, 16vw, 76px); } }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
body {
  background: var(--bg); color: var(--ink); overflow: hidden;
  font-family: var(--ui); font-size: 17px; line-height: 1.3;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
#app { height: 100vh; height: 100dvh; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
h2 { font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1.05; margin: 0; letter-spacing: 0.02em; text-wrap: balance; }
h3 { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); margin: 8px 0 0; }
p { margin: 0; }
.k { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.soft { color: var(--ink-soft); } .small { font-size: 14px; } .center { text-align: center; }
.err { color: #ffb4a8; background: rgba(255, 77, 61, 0.12); border-left: 3px solid var(--danger); padding: 8px 10px; }

.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; padding: 8px 16px;
  background: var(--raised); border: 1px solid var(--edge); border-radius: 4px;
  font-size: 19px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; text-align: center;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.quiet { background: none; border-color: transparent; color: var(--ink-soft); font-size: 16px; min-height: 44px; }
.btn.small { width: auto; min-height: 40px; font-size: 15px; padding: 4px 14px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:not(:disabled):active { transform: translateY(1px); filter: brightness(0.92); }
.ghost-btn { background: none; border: 0; color: var(--ink-soft); font-size: 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; min-height: 40px; padding: 0 6px; }
.field { width: 100%; height: 52px; padding: 0 14px; background: var(--surface); border: 1px solid var(--edge); border-radius: 4px; font-size: 20px; font-weight: 600; user-select: text; -webkit-user-select: text; }
.field.code { font-family: var(--display); letter-spacing: 0.3em; text-align: center; text-transform: uppercase; }

/* --- screens around the table --- */
.page { height: 100%; max-width: 480px; margin: 0 auto; padding: 20px 16px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.page.middle { justify-content: center; }
.page section { display: flex; flex-direction: column; gap: 8px; }
.lead { font-size: 19px; color: var(--ink-soft); text-wrap: pretty; }
.lead b { color: var(--ink); }
.logo { font-family: var(--display); font-size: clamp(64px, 23vw, 104px); line-height: 0.86; letter-spacing: 0.01em; display: flex; flex-direction: column; margin-bottom: 10px; }
.logo span:last-child { color: var(--accent); position: relative; align-self: flex-start; }
.logo i { position: absolute; left: 100%; top: 6%; width: 0.16em; height: 0.16em; margin-left: 0.08em; border-radius: 50%; background: #ffd27a; box-shadow: 0 0 0.2em 0.08em #ff7a3d, 0 0 0.6em 0.2em rgba(255, 122, 61, 0.5); animation: spark 0.5s infinite alternate; }
@keyframes spark { from { transform: scale(0.7); opacity: 0.75; } to { transform: scale(1.25); opacity: 1; } }
.joinrow { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }
.sticky { position: sticky; bottom: -16px; display: flex; flex-direction: column; gap: 8px; padding: 14px 0 16px; margin: auto 0 -16px; background: linear-gradient(transparent, var(--bg) 14px); }
.rules { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; color: var(--ink-soft); }
.rules b { color: var(--ink); }
.cardlist, .page.lobby section { gap: 6px; }
.cardlist { display: flex; flex-direction: column; }
.cl, .st { display: flex; gap: 10px; align-items: center; background: var(--surface); border-left: 4px solid var(--tone, var(--edge)); padding: 8px 10px; }
.cl p, .st p { font-size: 14px; color: var(--ink-soft); }
.cl-i { flex: none; width: 30px; height: 30px; color: var(--tone-ink, var(--ink)); }
.cl-i svg { width: 100%; height: 100%; display: block; }
.st > div:not(.stepper) { flex: 1; min-width: 0; }
.stepper { display: flex; align-items: center; gap: 2px; flex: none; }
.stepper button { width: 42px; height: 42px; background: var(--raised); border: 1px solid var(--edge); border-radius: 4px; font-size: 22px; font-weight: 700; }
.stepper output { width: 34px; text-align: center; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

.l-head { display: flex; justify-content: space-between; align-items: flex-end; }
.roomcode { font-family: var(--display); font-size: 56px; line-height: 0.9; letter-spacing: 0.08em; color: var(--accent); user-select: text; -webkit-user-select: text; }
.l-btns { display: flex; gap: 6px; }
.l-seats { display: flex; flex-direction: column; gap: 6px; }
.l-seat { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 10px; background: var(--surface); border: 1px solid transparent; border-radius: 4px; text-align: left; }
.l-seat b { font-size: 19px; }
.l-seat .tag { margin-left: auto; }
.l-seat.off { opacity: 0.5; }
.l-seat.add { border: 1px dashed var(--edge); background: none; color: var(--ink-soft); justify-content: center; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 15px; }
.tag { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; }
.x-btn { width: 40px; height: 40px; background: none; border: 0; font-size: 24px; color: var(--ink-soft); }
.manifests { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mf { display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; align-items: baseline; text-align: left; padding: 10px; background: var(--surface); border: 1px solid transparent; border-radius: 4px; }
.mf b { font-size: 18px; }
.mf p { grid-column: 1 / -1; font-size: 14px; color: var(--ink-soft); line-height: 1.2; }
.mf.on { border-color: var(--accent); background: rgba(255, 122, 61, 0.1); }
.mf:disabled { cursor: default; grid-column: 1 / -1; }
.mf-detail { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 6px; background: var(--surface); border-left: 3px solid var(--tone); font-size: 14px; font-weight: 600; }
.chip svg { width: 16px; height: 16px; color: var(--tone-ink); }
.chip b { color: var(--accent); }

/* avatars: one colour per seat */
.av { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--seat, #5c666b); color: #fff; font-family: var(--display); font-size: 22px; position: relative; }
.c0 { --seat: #2f62b0; } .c1 { --seat: #c2452f; } .c2 { --seat: #4f9a4a; } .c3 { --seat: #8a5aa8; } .c4 { --seat: #b8891a; }

/* --- cards --- */
.tone-danger { --tone: #d43a2f; --tone-ink: #ff8a70; } .tone-safe { --tone: #14857a; --tone-ink: #4fd1c1; } .tone-stamp { --tone: #a8201a; --tone-ink: #ff7b6e; }
.tone-hot { --tone: #cf5216; --tone-ink: #ff9a5c; } .tone-cool { --tone: #2f62b0; --tone-ink: #7fb0ff; } .tone-sea { --tone: #1f7f9e; --tone-ink: #62c8e6; }
.tone-scan { --tone: #3f8a3a; --tone-ink: #86d77f; } .tone-take { --tone: #7a4a9a; --tone-ink: #c79bff; } .tone-cargo { --tone: #a87d12; --tone-ink: #f0c453; }
.card { width: var(--cw); height: calc(var(--cw) * 1.42); border-radius: calc(var(--cw) * 0.08); border: 2px solid #0a0d10; overflow: hidden; flex: none; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 6px 14px rgba(0, 0, 0, 0.35); }
.card.face { background: var(--label); color: var(--label-ink); display: grid; grid-template-rows: auto 1fr auto; }
.c-name { background: var(--tone); color: #fff; font-family: var(--display); font-size: calc(var(--cw) * 0.14); line-height: 1.02; min-height: 2.5em; padding: 0.25em 0.2em; display: grid; place-items: center; text-align: center; text-transform: uppercase; letter-spacing: 0.02em; }
.c-art { display: grid; place-items: center; min-height: 0; color: var(--tone); }
.c-art svg { width: 58%; height: auto; max-height: 100%; }
.c-short { font-size: calc(var(--cw) * 0.125); font-weight: 600; line-height: 1.08; text-align: center; padding: 0 0.35em 0.5em; min-height: 2.7em; display: grid; place-items: center; color: #414c52; }
.card.tone-danger { background: #2b0d0a; color: #ffd9d0; border-color: #ff4d3d; }
.card.tone-danger .c-art { color: #ffb347; } .card.tone-danger .c-short { color: #ffb4a8; }
.card.tone-safe { background: #e3f1ee; }
.card.back { background: #232d35; border-color: #0a0d10; padding: calc(var(--cw) * 0.07); }
.b-in { width: 100%; height: 100%; border: 2px solid #46545e; border-radius: calc(var(--cw) * 0.04); display: grid; place-items: center; background: repeating-linear-gradient(135deg, transparent 0 9px, rgba(255, 122, 61, 0.16) 9px 18px); }
.b-in span { font-family: var(--display); font-size: calc(var(--cw) * 0.34); color: #6b7a85; }

/* --- the table --- */
.table { --hw: min(100vw, 780px); height: 100%; max-width: 780px; margin: 0 auto; position: relative; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto auto; padding: 0 0 8px; }
.table::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at 50% 40%, transparent 35%, rgba(255, 60, 40, 0.3) 100%); transition: opacity 1s; }
.table.sudden::before { opacity: 1; animation: pulse 1.1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.45; } to { opacity: 1; } }
.t-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 10px; }
.t-room { font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.t-room b { color: var(--ink); font-family: var(--display); font-weight: 400; letter-spacing: 0.14em; }

.seats { display: flex; justify-content: space-evenly; align-items: flex-start; gap: 4px; padding: 4px 8px 0; min-height: 96px; }
.seat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; width: 76px; padding: 4px 0; background: none; border: 0; border-radius: 6px; cursor: default; }
.seat .av { width: 48px; height: 48px; }
.seat .av::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; opacity: 0; background: conic-gradient(var(--accent) calc(var(--p) * 360deg), rgba(255, 255, 255, 0.12) 0); -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); mask: radial-gradient(closest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); }
.seat.waiting .av::before { opacity: 1; }
.s-name { font-size: 15px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-cards { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.s-cards i { width: 10px; height: 14px; border-radius: 2px; background: #33414b; border: 1px solid #5a6a75; }
.seat.out { opacity: 0.38; filter: grayscale(1); }
.seat.out .s-cards { color: var(--danger); letter-spacing: 0.1em; }
.seat.off .av { outline: 2px dashed var(--ink-soft); outline-offset: 2px; }
.seat .x { position: absolute; top: 0; right: 4px; background: var(--accent); color: var(--on-accent); font-family: var(--display); font-weight: 400; font-size: 15px; padding: 0 5px; border-radius: 3px; }
.seat.pick { cursor: pointer; background: rgba(255, 122, 61, 0.14); outline: 2px solid var(--accent); animation: nudge 0.7s ease-in-out infinite alternate; }
@keyframes nudge { to { transform: translateY(-4px); } }

.mid { position: relative; display: grid; grid-template-columns: auto auto; grid-template-rows: 1fr auto; justify-content: center; align-content: center; align-items: center; column-gap: calc(var(--cw) * 0.5); row-gap: 14px; padding: 16px 0 6px; }
.dir { position: absolute; left: 14px; top: 8px; width: 30px; height: 30px; color: var(--ink-soft); transition: transform 0.5s; }
.dir.rev { transform: scaleX(-1); color: var(--accent); }
.mid { --cw: clamp(78px, 25vw, 124px); }
.pile { position: relative; width: var(--cw); height: calc(var(--cw) * 1.42); }
.pile .card { position: absolute; inset: 0; }
.stack .l1 { transform: translate(-2px, 3px); } .stack .l2 { transform: translate(-4px, 6px); } .stack .l3 { transform: translate(-6px, 9px); } .stack .l4 { transform: translate(-8px, 12px); }
.stack { touch-action: none; }
.stack.live { cursor: pointer; }
.stack.live .l0 { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 122, 61, 0.5), 0 0 26px rgba(255, 122, 61, 0.55); animation: glow 0.9s ease-in-out infinite alternate; }
@keyframes glow { from { box-shadow: 0 0 0 2px rgba(255, 122, 61, 0.3), 0 0 12px rgba(255, 122, 61, 0.3); } }
.stack.live::after { content: attr(data-hint); position: absolute; left: 50%; top: calc(100% + 16px); transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 700; letter-spacing: 0.16em; color: var(--accent); }
.count { position: absolute; right: -10px; top: -10px; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 15px; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.hold-ring { position: absolute; left: 50%; top: 50%; width: calc(var(--cw) * 1.15); height: calc(var(--cw) * 1.15); transform: translate(-50%, -50%) rotate(-90deg); opacity: 0; pointer-events: none; }
.hold-ring circle { fill: rgba(13, 18, 22, 0.55); stroke: var(--accent); stroke-width: 7; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--hold, 0) * 100); }
.holding .hold-ring { opacity: 1; }
.holding .stack .l0 { transform: translateY(calc(var(--hold, 0) * -14px)) scale(calc(1 + var(--hold, 0) * 0.06)); animation: none; }
.stack.scanning .l0 { box-shadow: 0 0 0 2px #86d77f, 0 0 30px #86d77f; }
.stack.scanning::before { content: ""; position: absolute; left: -8px; right: -8px; height: 4px; top: 0; background: #b6ffb0; box-shadow: 0 0 14px 4px #86d77f; z-index: 2; animation: sweep 0.65s ease-in-out; }
@keyframes sweep { from { top: 0; } 50% { top: 100%; } to { top: 0; } }
.discard .d1 { transform: rotate(-7deg) translate(-3px, 2px); } .discard .d2 { transform: rotate(6deg) translate(4px, 3px); }
.discard.pending .d0 { box-shadow: 0 0 0 2px #fff, 0 0 30px rgba(255, 255, 255, 0.45); transform: scale(1.08); }
.slot { position: absolute; inset: 0; border: 2px dashed var(--edge); border-radius: calc(var(--cw) * 0.08); display: grid; place-items: center; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.stamped, .pop.stamp { font-family: var(--display); color: #ff3b2b; border: 4px solid #ff3b2b; border-radius: 6px; padding: 0 8px; background: rgba(20, 6, 4, 0.72); letter-spacing: 0.06em; white-space: nowrap; }
.stamped { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-14deg); font-size: calc(var(--cw) * 0.3); z-index: 3; }
.stamped.ok, .pop.stamp.ok { color: #48e0a0; border-color: #48e0a0; background: rgba(4, 20, 14, 0.72); }
.odds { grid-column: 1 / -1; text-align: center; margin-top: 22px; font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.odds b { color: var(--ink); font-size: 17px; }
.sudden .odds span { color: var(--danger); font-weight: 700; font-size: 17px; }

.banner { position: relative; text-align: center; padding: 6px 16px 9px; min-height: 62px; }
.b-a { font-family: var(--display); font-size: 21px; line-height: 1.1; letter-spacing: 0.02em; text-wrap: balance; }
.b-b { font-size: 15px; color: var(--ink-soft); min-height: 1.3em; }
.banner.mine .b-a { color: var(--accent); }
.clock { position: absolute; left: 16px; right: 16px; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.08); border-radius: 2px; overflow: hidden; }
.clock i { display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--accent); }
.detail { min-height: 40px; padding: 5px 16px 0; font-size: 14px; line-height: 1.25; color: var(--ink-soft); text-align: center; text-wrap: pretty; }
.detail b { color: var(--ink); }

.hand { min-height: calc(var(--ch) + 26px); display: flex; align-items: flex-end; justify-content: center; }
.h-row { display: flex; justify-content: center; padding: 20px 10px 4px; width: 100%; }
.h-row .card { position: relative; cursor: pointer; transition: transform 0.12s ease-out, box-shadow 0.12s; }
.h-row .card + .card { margin-left: min(5px, calc((var(--hw) - 24px - var(--n) * var(--cw)) / (var(--n) - 1))); }
.h-row .card.sel { transform: translateY(-22px); box-shadow: 0 0 0 3px var(--accent), 0 14px 22px rgba(0, 0, 0, 0.5); z-index: 2; }
/* a crowded hand overlaps, so each card keeps its name and drawing on the edge that stays visible */
.h-row.tight .card:not(:last-child):not(.sel) .c-name { place-items: center start; text-align: left; padding-left: 0.35em; }
.h-row.tight .card:not(:last-child):not(.sel) .c-art { justify-items: start; padding-left: 8%; }
.h-row.tight .card:not(:last-child):not(.sel) .c-art svg { width: 44%; }
.h-row.tight .card:not(:last-child):not(.sel) .c-short { visibility: hidden; }
.h-note { align-self: center; padding: 0 24px; text-align: center; color: var(--ink-soft); }
.bar { min-height: 60px; padding: 8px 16px 0; display: flex; align-items: center; justify-content: center; }
.stampbtn { background: #c6281d; border-color: #ff6a5c; color: #fff; font-family: var(--display); font-weight: 400; font-size: 26px; letter-spacing: 0.08em; animation: thud 0.4s ease-in-out infinite alternate; }
.stampbtn.ok { background: #14805a; border-color: #48e0a0; }
@keyframes thud { to { transform: scale(1.03); } }
.emotes { display: flex; gap: 6px; }
.emotes button { width: 46px; height: 46px; border-radius: 50%; background: var(--surface); border: 1px solid var(--edge); font-size: 22px; padding: 0; }

/* sheets that slide over the table: hiding the crate, restacking, a scan, the result */
.over { position: absolute; inset: 0; display: none; align-items: flex-end; background: rgba(6, 9, 11, 0.74); z-index: 20; }
.over.on { display: flex; }
.sheet { width: 100%; max-height: 92%; overflow-y: auto; background: var(--surface); border-top: 3px solid var(--accent); border-radius: 14px 14px 0 0; padding: 18px 16px 16px; display: flex; flex-direction: column; gap: 10px; animation: rise 0.22s ease-out; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet.win { text-align: center; border-top-color: #ffd27a; }
.sheet.win h2 { font-size: 44px; color: #ffd27a; }
.row-cards { display: flex; justify-content: center; gap: 8px; padding: 6px 0; overflow-x: auto; }
.row-cards .card { --cw: clamp(52px, 17vw, 86px); }
.rc { display: flex; flex-direction: column; align-items: center; gap: 4px; border-radius: 8px; padding: 4px; }
.rc span { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.rc:first-child span { color: var(--accent); }
.rc[data-act] { cursor: pointer; }
.rc.sel { background: rgba(255, 122, 61, 0.2); outline: 2px solid var(--accent); }
.ins { width: 100%; height: 44px; accent-color: var(--accent); }
.ins-label { font-size: 20px; font-weight: 700; text-align: center; min-height: 1.3em; }
.ins-ends { display: flex; justify-content: space-between; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); margin-top: -8px; }
.sheet .chips { justify-content: center; }
.sheet .chips button { min-height: 40px; padding: 0 12px; background: var(--raised); border: 1px solid var(--edge); border-radius: 4px; font-weight: 600; }
.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kinds button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; background: var(--raised); border: 1px solid var(--edge); border-bottom: 3px solid var(--tone); border-radius: 4px; font-size: 13px; font-weight: 600; line-height: 1.1; }
.kinds svg { width: 26px; height: 26px; color: var(--tone-ink); }

/* --- things that fly over the page --- */
.ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; will-change: transform; }
.flipper { perspective: 700px; }
.f-in { position: relative; width: var(--cw); height: var(--ch); transform-style: preserve-3d; }
.f-in .card { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.f-front { transform: rotateY(180deg); }
.pop { position: fixed; z-index: 60; pointer-events: none; font-family: var(--display); font-size: 24px; white-space: nowrap; color: #fff; text-shadow: 0 2px 0 #000, 0 0 18px rgba(0, 0, 0, 0.9); }
.pop.hot { color: #ff9a5c; } .pop.cool { color: #8cc4ff; } .pop.scan { color: #9dee96; } .pop.take { color: #d4b0ff; }
.pop.big { font-size: 52px; } .pop.small { font-size: 15px; letter-spacing: 0.1em; } .pop.emote { font-size: 46px; }
.pop.stamp { font-size: 46px; text-shadow: none; rotate: -12deg; }
.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 150px); transform: translateX(-50%); z-index: 65; max-width: min(92vw, 420px); padding: 9px 14px; background: #f1ece0; color: #1d2428; border-radius: 4px; font-weight: 600; text-align: center; pointer-events: none; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.flash { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
body.offline::after { content: attr(data-offline); position: fixed; top: calc(env(safe-area-inset-top, 0px) + 6px); left: 50%; transform: translateX(-50%); z-index: 90; padding: 4px 12px; background: var(--danger); color: #fff; border-radius: 4px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 13px; }

/* the Lit Crate scene */
.doom { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 42%, rgba(96, 18, 8, 0.97), rgba(8, 4, 3, 0.98) 70%); }
.doom-in { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; text-align: center; width: min(100%, 420px); }
.doom-who { font-size: 20px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #ffd9d0; }
.doom-title { font-family: var(--display); font-size: clamp(54px, 17vw, 84px); line-height: 0.9; color: #ff5a3c; text-shadow: 0 0 34px rgba(255, 90, 60, 0.8); animation: flicker 0.13s infinite alternate; }
@keyframes flicker { to { opacity: 0.82; } }
.fuse { position: relative; width: calc(var(--cw) * 2.5); height: calc(var(--cw) * 2.5); display: grid; place-items: center; margin: 14px 0; }
.fuse .card { --cw: clamp(96px, 30vw, 140px); animation: tremble 0.09s infinite alternate; }
@keyframes tremble { from { transform: translate(-1px, 1px) rotate(-1.2deg); } to { transform: translate(1px, -1px) rotate(1.2deg); } }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: #ffb347; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p) * 100); filter: drop-shadow(0 0 6px #ff7a3d); }
.doom-sub { font-size: 19px; font-weight: 600; color: #ffd9d0; }
.doom-sub.none { color: #ff8a70; letter-spacing: 0.1em; text-transform: uppercase; }
.btn.water { background: #1f9fd0; border-color: #8fe0ff; color: #04202c; font-size: 21px; min-height: 60px; animation: thud 0.35s ease-in-out infinite alternate; }

@media (prefers-reduced-motion: reduce) {
  .doom-title, .fuse .card, .stampbtn, .btn.water, .seat.pick, .table.sudden::before, .logo i, .stack.live .l0 { animation: none; }
}

/* the language switch, top right of every screen */
.page { position: relative; }
.lang { position: absolute; top: 10px; right: 12px; z-index: 2; min-height: 36px; padding: 0 12px; background: var(--surface); border: 1px solid var(--edge); border-radius: 18px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.lang:lang(ko), .ghost-btn:lang(ko) { font-family: -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif; letter-spacing: 0; }
.l-head { padding-right: 0; margin-top: 34px; }

/* Korean: its own faces, words never split mid-syllable-block, and none of the wide tracking made for capitals */
:root:lang(ko) {
  --display: "Black Han Sans", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --ui: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}
:lang(ko) body { word-break: keep-all; font-size: 16px; line-height: 1.4; }
:lang(ko) .logo, :lang(ko) .roomcode, :lang(ko) .t-room b, :lang(ko) .field.code, :lang(ko) .b-in span, :lang(ko) .av { font-family: "Saira Stencil One", "Stencil", "Impact", sans-serif; }
:lang(ko) .lang:lang(en), :lang(ko) .ghost-btn:lang(en) { font-family: "Saira Condensed", "Arial Narrow", sans-serif; }
:lang(ko) :is(.k, .tag, .btn, .ghost-btn, .t-room, .odds, .slot, .rc span, .ins-ends, .l-seat.add, .doom-who, .doom-sub.none, .stampbtn, .pop.small, h3) { letter-spacing: 0; }
:lang(ko) .stack.live::after { letter-spacing: 0.02em; font-size: 13px; }
:lang(ko) :is(.k, .tag, h3) { font-size: 13px; }
:lang(ko) .btn { font-size: 18px; }
:lang(ko) .btn.small { font-size: 15px; }
:lang(ko) h2 { font-size: 27px; line-height: 1.2; }
:lang(ko) .lead { font-size: 17px; line-height: 1.5; }
:lang(ko) .c-name { font-size: calc(var(--cw) * 0.185); letter-spacing: 0; line-height: 1.1; }
:lang(ko) .c-short { font-size: calc(var(--cw) * 0.12); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
:lang(ko) .b-a { font-size: 20px; line-height: 1.25; }
:lang(ko) .b-b, :lang(ko) .detail { font-size: 14px; }
:lang(ko) .s-name { font-size: 14px; }
:lang(ko) .doom-title { font-size: clamp(56px, 19vw, 92px); line-height: 1.05; }
:lang(ko) .sheet.win h2 { font-size: 40px; }
:lang(ko) .pop.big { font-size: 46px; } :lang(ko) .pop.stamp { font-size: 50px; }
:lang(ko) .stampbtn { font-size: 28px; }
:lang(ko) .mf p, :lang(ko) .cl p, :lang(ko) .st p { font-size: 13.5px; line-height: 1.4; }
:lang(ko) .rules { line-height: 1.55; }

/* short screens: a small phone with the browser bars showing */
@media (max-height: 620px) {
  :root { --cw: clamp(50px, 15.5vw, 70px); }
  .mid { --cw: clamp(64px, 20vw, 88px); padding: 10px 0 2px; row-gap: 8px; }
  .seats { min-height: 82px; padding-top: 0; }
  .seat .av { width: 40px; height: 40px; font-size: 19px; }
  .odds { margin-top: 24px; }
  .stack.live::after { top: calc(100% + 9px); }
  .toast { top: calc(env(safe-area-inset-top, 0px) + 44px); }
  .banner { min-height: 50px; padding: 2px 16px 7px; }
  .b-a, :lang(ko) .b-a { font-size: 18px; }
  .detail { min-height: 34px; padding-top: 3px; font-size: 13px; }
  .h-row { padding-top: 18px; }
  .bar { min-height: 54px; padding-top: 6px; }
  .btn { min-height: 46px; }
  .t-head .ghost-btn { min-height: 34px; }
}

/* inside the scrolling column, controls keep their height */
.page > .btn, .page > .field, .page .joinrow, .sticky .btn { flex: none; }
