/* What the Fog Remembers v2. Noir pulp: ink, bone and lamplight; one spot colour per card type.
   Layout: phones in portrait first (HUD, rivals, the town, your tray); wide screens get side panels. */
@font-face { font-family: "Alfa Slab One"; src: url(fonts/AlfaSlabOne-Regular.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Libre Franklin"; src: url(fonts/LibreFranklin.ttf) format("truetype"); font-weight: 100 900; font-display: swap; }
:root {
  --night: #0d1213; --night2: #141c1d; --panel: rgba(22, 30, 31, .82); --panel-solid: #172021; --line: rgba(239, 230, 207, .14);
  --bone: #efe6cf; --bone2: #d9cfb5; --ink: #1b1916; --text: #e6e0cf; --muted: #9aa49c; --dim: #808a82;
  --lamp: #c8c15a; --gold: #d8b25c; --sea: #6fc39b; --blood: #c0453a; --rust: #a8402a; --violet: #9c84b8; --omen: #2b2038; --teal: #1f4f5a; --brass: #7a5c22;
  --you: #6fc39b; --rival: #d8b25c; --rival2: #b39ddb;
  --slab: "Alfa Slab One", Georgia, serif; --fell: "IM Fell English", "Iowan Old Style", Georgia, serif; --sc: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --ui: "Libre Franklin", "Helvetica Neue", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.3, 1.5, .5, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); overscroll-behavior: none; }
body { color: var(--text); font: 15px/1.4 var(--ui); overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  background: radial-gradient(120% 90% at 50% 40%, #1b2627 0%, #0d1213 60%, #070a0a 100%) fixed; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
.ico.i { width: 1.4em; height: 1.4em; vertical-align: -0.33em; }
#bgfog, #particles { position: fixed; inset: 0; pointer-events: none; }
#bgfog { z-index: 0; mix-blend-mode: screen; }
#particles { z-index: 60; }
#app { position: fixed; inset: 0; z-index: 1; }
#app.shake { animation: shake .45s var(--ease); }
@keyframes shake { 0%,100% { transform: none; } 15% { transform: translate(var(--shake), calc(var(--shake) * -.6)); } 30% { transform: translate(calc(var(--shake) * -.8), calc(var(--shake) * .5)); }
  45% { transform: translate(calc(var(--shake) * .5), calc(var(--shake) * .4)); } 60% { transform: translate(calc(var(--shake) * -.3), calc(var(--shake) * -.2)); } 80% { transform: translate(calc(var(--shake) * .15), 0); } }
.flash { position: fixed; inset: 0; z-index: 70; pointer-events: none; animation: flash .4s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.floater { position: fixed; z-index: 65; pointer-events: none; font: 900 22px var(--slab); color: var(--bone); text-shadow: 0 2px 0 #000, 0 0 12px rgba(0,0,0,.8); transform: translate(-50%, -50%); animation: floatUp 1.25s var(--ease) forwards; white-space: nowrap; }
.floater.I { color: #f6ef9a; } .floater.F { color: #ff9c86; } .floater.M { color: #9fe3c4; } .floater.X { color: #d8c4ff; } .floater.C { color: #f3dc8c; } .floater.D { color: #ff6b5b; font-size: 26px; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }

/* ---------------- buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; min-height: 44px; padding: 0 18px; border-radius: 10px; font-weight: 700; letter-spacing: .01em;
  background: linear-gradient(#2a3637, #1c2627); border: 1px solid rgba(239,230,207,.18); box-shadow: 0 2px 0 rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.06);
  transition: transform .12s var(--ease), filter .15s, opacity .2s; white-space: nowrap; }
a.btn { color: inherit; text-decoration: none; }
.btn:not(:disabled):hover { filter: brightness(1.18); }
.btn:not(:disabled):active { transform: translateY(1px) scale(.97); }
.btn:disabled { opacity: .42; }
.btn.primary { background: linear-gradient(#e2cd7a, #b8953f); color: #1b1608; border-color: #f2e2a0; box-shadow: 0 3px 0 #5e4a17, 0 0 24px rgba(216,178,92,.25), inset 0 1px 0 rgba(255,255,255,.5); }
.btn.danger { background: linear-gradient(#a8483c, #7a2a22); border-color: #d06a5d; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.big { min-height: 54px; font-size: 18px; padding: 0 28px; border-radius: 14px; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.icon-btn svg { width: 22px; height: 22px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px; background: rgba(0,0,0,.35); border: 1px solid var(--line); font-size: 12px; font-weight: 600; }

/* ---------------- title ---------------- */
.screen { position: absolute; inset: 0; overflow: auto; overflow-x: hidden; padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(24px + var(--safe-b)) calc(16px + var(--safe-l)); }
.title-screen { display: grid; place-items: center; text-align: center; }
.title-inner { max-width: 520px; width: 100%; display: grid; gap: 14px; justify-items: center; animation: rise 1.4s var(--ease) both; }
.title-art { width: min(64vw, 300px); aspect-ratio: 1; border-radius: 50%; background: url(art/title.webp) center/180% no-repeat; box-shadow: 0 0 0 2px rgba(239,230,207,.25), 0 0 80px rgba(200,193,90,.18), 0 30px 60px rgba(0,0,0,.7);
  animation: breathe 7s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 2px rgba(239,230,207,.35), 0 0 120px rgba(200,193,90,.3), 0 30px 60px rgba(0,0,0,.7); transform: scale(1.015); } }
.logo { font: 400 clamp(34px, 9vw, 58px)/1 var(--fell); letter-spacing: .01em; margin: 6px 0 0; color: var(--bone); text-shadow: 0 0 30px rgba(200,193,90,.25), 0 3px 0 #000; }
.logo em { display: block; font: italic 400 clamp(15px, 4vw, 20px) var(--fell); color: var(--muted); margin-top: 8px; letter-spacing: .04em; }
.menu-list { display: grid; gap: 10px; width: min(320px, 100%); margin-top: 10px; }
.menu-list .btn { width: 100%; }
.version { color: var(--dim); font-size: 12px; margin-top: 8px; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* ---------------- setup ---------------- */
.setup { max-width: 1040px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; animation: rise .6s var(--ease) both; }
.setup h2 { font: 400 28px var(--fell); margin: 0; }
.setup h3 { font: 700 12px var(--ui); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 0 0 8px; }
.topline { display: flex; align-items: center; gap: 12px; }
.topline h2 { flex: 1; }
.oo-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.oo-card { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 4/5; text-align: left; border: 2px solid transparent; background: #000 center/cover;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); transition: transform .25s var(--ease), border-color .2s; }
.oo-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 35%, rgba(0,0,0,.92)); }
.oo-card .txt { position: absolute; z-index: 1; left: 12px; right: 12px; bottom: 10px; }
.oo-card b { display: block; font: 400 clamp(17px, 3.6vw, 24px)/1.05 var(--fell); }
.oo-card small { color: var(--muted); font-size: 12px; line-height: 1.3; display: block; margin-top: 4px; }
.oo-card .tag { position: absolute; z-index: 1; top: 8px; left: 8px; }
.oo-card[aria-checked="true"] { border-color: var(--lamp); transform: translateY(-3px); box-shadow: 0 0 30px rgba(200,193,90,.25), 0 10px 30px rgba(0,0,0,.5); }
.oo-card.locked { filter: grayscale(1) brightness(.5); cursor: default; }
.tag-new { background: var(--lamp); color: #1b1608; border: 0; font-weight: 800; }
.inv-pick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.inv { display: grid; justify-items: center; gap: 6px; padding: 8px 4px; border-radius: 14px; border: 2px solid transparent; transition: transform .2s var(--ease), border-color .2s, background .2s; }
.inv .por { width: 100%; max-width: 92px; aspect-ratio: 1; border-radius: 50%; background: #000 center/cover; box-shadow: 0 0 0 2px rgba(239,230,207,.3), 0 6px 18px rgba(0,0,0,.6); }
.inv span { font-weight: 700; font-size: 13px; }
.inv[aria-checked="true"] { border-color: var(--you); background: rgba(111,195,155,.08); transform: translateY(-2px); }
.inv[aria-checked="true"] .por { box-shadow: 0 0 0 3px var(--you), 0 0 22px rgba(111,195,155,.4); }
.inv-detail { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.inv-detail h4 { margin: 0; font: 400 22px var(--fell); }
.inv-detail .role { color: var(--muted); font-style: italic; font-family: var(--fell); }
.inv-detail p { margin: 6px 0; }
.seg { display: inline-flex; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { min-height: 38px; padding: 0 14px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--bone); color: var(--ink); }
.opts { display: flex; flex-wrap: wrap; gap: 18px 28px; }
.opt small { display: block; color: var(--dim); font-size: 12px; margin-top: 4px; max-width: 280px; }
.start-row { display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; padding: 12px 0 4px; background: linear-gradient(transparent, var(--night) 40%); }

/* ---------------- game layout ---------------- */
#game { position: absolute; inset: 0; display: grid; grid-template-columns: 100%; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-areas: "hud" "rivals" "stage" "tray";
  padding: var(--safe-t) var(--safe-r) 0 var(--safe-l); }
.hud { grid-area: hud; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-areas: "menu round oo log" "doom doom doom doom"; align-items: center; gap: 4px 8px; padding: 6px 8px; }
.hud > [data-act="menu"] { grid-area: menu; } .hud > .round { grid-area: round; } .hud > .doom { grid-area: doom; } .hud > .oo-chip { grid-area: oo; justify-self: end; } .hud > [data-act="log"] { grid-area: log; }
@media (min-width: 900px) and (min-height: 560px) { .hud { grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-areas: "menu round doom log"; } }
.round { font: 400 15px var(--fell); color: var(--muted); white-space: nowrap; }
.round b { color: var(--bone); font: 400 20px var(--slab); margin-left: 3px; }
.doom { flex: 1; min-width: 0; display: grid; gap: 3px; cursor: pointer; }
.doom-top { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.doom-top b { color: #ff8a7a; font: 400 14px var(--slab); letter-spacing: 0; }
.doom-track { position: relative; height: 12px; border-radius: 6px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.06) 0 calc(100%/27 - 1px), rgba(0,0,0,.6) calc(100%/27 - 1px) calc(100%/27)); border: 1px solid rgba(255,255,255,.1); overflow: hidden; }
.doom-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #5d1e1a, #b1382c 70%, #ff6b4a); box-shadow: 0 0 12px rgba(255,80,60,.6); transition: width .8s var(--ease); }
.doom-last { position: absolute; inset: 0 0 0 auto; width: calc(300%/27); background: repeating-linear-gradient(45deg, rgba(255,80,60,.25) 0 3px, transparent 3px 6px); }
.doom.pulse .doom-fill { animation: doomPulse .9s ease-out; }
@keyframes doomPulse { 0% { filter: brightness(2.5); } 100% { filter: none; } }
.oo-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 12px; background: rgba(0,0,0,.35); border: 1px solid var(--line); min-height: 44px; }
.oo-chip .tok { width: 34px; height: 34px; border-radius: 8px; background: #000 center/cover; box-shadow: 0 0 0 1px rgba(239,230,207,.3); }
.oo-chip .tok.risen { box-shadow: 0 0 0 2px var(--blood), 0 0 12px rgba(192,69,58,.7); }
.oo-chip small { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); line-height: 1.1; }
.oo-chip b { font-size: 13px; white-space: nowrap; }

.rivals { grid-area: rivals; display: flex; gap: 6px; padding: 0 8px 4px; overflow-x: auto; scrollbar-width: none; }
.rv { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); text-align: left; transition: box-shadow .3s, border-color .3s; }
.rv.active { border-color: var(--rival); box-shadow: 0 0 18px rgba(216,178,92,.25); }
.rv.r2.active { border-color: var(--rival2); }
.rv .por { width: 34px; height: 34px; border-radius: 50%; background: #000 center/cover; box-shadow: 0 0 0 2px var(--rival); flex: none; }
.rv.r2 .por { box-shadow: 0 0 0 2px var(--rival2); }
.rv .nm { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv .st { display: flex; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.rv .st span { display: inline-flex; align-items: center; gap: 2px; }
.pips { display: inline-flex; gap: 2px; }
.pips i { width: 8px; height: 8px; transform: rotate(45deg); border: 1px solid var(--bone2); display: inline-block; }
.pips i.on { background: var(--lamp); border-color: var(--lamp); box-shadow: 0 0 6px var(--lamp); }
.pips.rite i.on { background: var(--violet); border-color: var(--violet); box-shadow: 0 0 6px var(--violet); }

.stage { grid-area: stage; position: relative; container-type: size; display: grid; place-items: center; min-height: 0; }
.board-frame { position: relative; width: min(100cqw - 16px, 100cqh - 34px); aspect-ratio: 1; }
.board { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); gap: 3px; padding: 3px;
  border-radius: 10px; background: #050707; box-shadow: 0 0 0 1px rgba(239,230,207,.12), 0 20px 50px rgba(0,0,0,.8), 0 0 90px rgba(200,193,90,.05); }
.banner { position: absolute; left: 50%; top: -2px; transform: translate(-50%, -100%); z-index: 8; white-space: nowrap; max-width: calc(100cqw - 16px); overflow: hidden; text-overflow: ellipsis;
  font: 700 12px var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 4px 10px; }
.banner.rival { color: var(--rival); }
.banner.choose { color: var(--lamp); animation: pulseText 1.6s ease-in-out infinite; }
@keyframes pulseText { 50% { opacity: .6; } }

/* cells */
.cell { position: relative; perspective: 600px; border-radius: 5px; min-width: 0; min-height: 0; }
.cell .flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .55s var(--ease); }
.cell.up .flip { transform: rotateY(180deg); }
.cell .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 5px; overflow: hidden; }
.cell .back { background-color: #111; background-image: url(art/back.webp); background-repeat: no-repeat; filter: brightness(.82) contrast(1.05); box-shadow: inset 0 0 0 1px rgba(0,0,0,.6), inset 0 0 14px rgba(0,0,0,.7); }
.cell .back::after { content: ""; position: absolute; inset: -20%; background: radial-gradient(closest-side, rgba(200,210,200,.14), transparent); animation: drift 14s ease-in-out infinite alternate; animation-delay: var(--d, 0s); }
@keyframes drift { from { transform: translate(-12%, 4%); } to { transform: translate(12%, -6%); } }
.cell .front { transform: rotateY(180deg); background: var(--bone) center/cover; box-shadow: inset 0 0 0 2px var(--ink); }
.cell .front .art { position: absolute; inset: 0; background: #222 center/cover; }
.cell .front .stripe { position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--kc); }
.cell .front .nm { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 3px 3px; font: 700 clamp(8px, 2.15cqw, 13px)/1.05 var(--ui); color: var(--bone); text-align: center;
  background: linear-gradient(transparent, rgba(0,0,0,.92) 45%); text-shadow: 0 1px 2px #000; overflow-wrap: anywhere; }
.cell .front .ty { position: absolute; left: 3px; top: 8px; font: 800 clamp(6px, 1.6cqw, 10px) var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--kt, var(--bone)); background: var(--kc); padding: 1px 4px; border-radius: 3px; }
.cell .front .stat { position: absolute; right: 3px; top: 8px; display: flex; gap: 2px; align-items: center; }
.cell.empty .front, .cell.empty .back { display: none; }
.cell.empty { background: radial-gradient(circle at 50% 50%, #1a2122, #0c1011); box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), inset 0 0 18px rgba(0,0,0,.8); }
.cell.empty::before { content: ""; position: absolute; inset: 30%; border-radius: 50%; background: radial-gradient(rgba(200,193,90,.06), transparent 70%); }
.known { position: absolute; z-index: 2; right: 6%; bottom: 6%; width: 26%; height: 26%; border-radius: 50%; background: radial-gradient(#e6cf83, #9d7a2c); box-shadow: 0 0 0 1.5px #2a210c, 0 2px 4px rgba(0,0,0,.7);
  display: grid; place-items: center; color: #2a210c; animation: stamp .45s var(--spring) both; }
.known svg { width: 72%; height: 72%; }
@keyframes stamp { from { transform: scale(2.2); opacity: 0; } to { transform: none; opacity: 1; } }
.cell.reach::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: 5px; border: 2px dashed rgba(192,69,58,.55);
  background: repeating-linear-gradient(45deg, rgba(192,69,58,.16) 0 4px, transparent 4px 9px); }
.cell.colour.reach::after { border-color: rgba(226,166,255,.6); background: repeating-linear-gradient(45deg, rgba(200,140,255,.16) 0 4px, transparent 4px 9px); }
.cell .lbl { position: absolute; z-index: 5; left: 50%; bottom: 6%; transform: translateX(-50%); padding: 2px 7px; border-radius: 99px; font: 800 clamp(8px, 2cqw, 12px) var(--ui); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; pointer-events: none; }
.cell .lbl.buy { background: linear-gradient(#f2dc8a, #c39b3e); color: #1b1608; box-shadow: 0 0 12px rgba(242,220,138,.7); animation: bob 1.6s ease-in-out infinite; }
.cell .lbl.blight { background: #2b1838; color: #e2a6ff; border: 1px dashed #e2a6ff; }
.cell .lbl.pick { background: var(--lamp); color: #1b1608; }
@keyframes bob { 50% { transform: translate(-50%, -3px); } }
.cell.can-move { cursor: pointer; }
.cell.can-move .hl, .cell.pick .hl { position: absolute; inset: -2px; z-index: 4; border-radius: 7px; pointer-events: none; box-shadow: 0 0 0 2px rgba(111,195,155,.85), 0 0 16px rgba(111,195,155,.55); animation: glow 1.5s ease-in-out infinite; }
.cell.pick .hl { box-shadow: 0 0 0 3px var(--lamp), 0 0 20px rgba(200,193,90,.7); }
.cell.search .hl { box-shadow: 0 0 0 2px rgba(216,178,92,.9), 0 0 16px rgba(216,178,92,.5); }
.cell.dim { filter: brightness(.45) saturate(.6); transition: filter .3s; }
@keyframes glow { 50% { opacity: .55; } }
.cell.engaged .face { box-shadow: 0 0 0 3px var(--blood), 0 0 22px rgba(192,69,58,.8); animation: throb 1.2s ease-in-out infinite; }
@keyframes throb { 50% { box-shadow: 0 0 0 3px var(--blood), 0 0 8px rgba(192,69,58,.4); } }
.cell.dealt .flip { animation: deal .55s var(--ease) both; }
@keyframes deal { from { transform: translateY(-40%) scale(1.35) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
.cell.chosen .face { box-shadow: 0 0 0 2px var(--lamp); }
.cell:focus-visible { z-index: 6; }

/* the Old One and pawns lie on top of the town */
.layer { position: absolute; inset: 3px; pointer-events: none; z-index: 10; }
.tok-boss { position: absolute; width: calc(100% / var(--n) - 3px); aspect-ratio: 1; border-radius: 8px; background: #000 center/cover; transition: left .9s var(--ease), top .9s var(--ease);
  box-shadow: 0 0 0 2px #1b1916, 0 0 0 4px var(--blood), 0 0 30px rgba(192,69,58,.7), 0 10px 25px rgba(0,0,0,.8); animation: bossGlow 3s ease-in-out infinite; pointer-events: auto; cursor: pointer; }
.tok-boss.colour { box-shadow: 0 0 0 2px #1b1916, 0 0 0 4px #c890ff, 0 0 30px rgba(200,144,255,.7), 0 10px 25px rgba(0,0,0,.8); }
.tok-boss span { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 2px 3px; text-align: center; font: 400 clamp(9px, 2.6cqw, 15px)/1 var(--fell); background: linear-gradient(transparent, rgba(0,0,0,.95)); border-radius: 0 0 8px 8px; }
.tok-boss.arrive { animation: bossRise 1.6s var(--ease) both, bossGlow 3s 1.6s ease-in-out infinite; }
@keyframes bossGlow { 50% { filter: brightness(1.2) saturate(1.2); } }
@keyframes bossRise { 0% { transform: scale(.2) rotate(-10deg); opacity: 0; filter: brightness(4); } 60% { transform: scale(1.25); opacity: 1; } 100% { transform: none; filter: none; } }
.pawn { position: absolute; width: calc(100% / var(--n) * .42); aspect-ratio: 1; margin: calc(100% / var(--n) * -.21) 0 0 calc(100% / var(--n) * -.21); border-radius: 50%; background: #000 center/cover;
  box-shadow: 0 0 0 2px #0d1213, 0 0 0 4px var(--pc), 0 6px 12px rgba(0,0,0,.8); transition: left .42s var(--ease), top .42s var(--ease), transform .3s; z-index: 2; }
.pawn.you { --pc: var(--you); z-index: 3; }
.pawn.r1 { --pc: var(--rival); } .pawn.r2 { --pc: var(--rival2); }
.pawn em { position: absolute; left: 50%; top: 100%; transform: translate(-50%, -3px); font: 800 clamp(7px, 1.9cqw, 11px) var(--ui); font-style: normal; letter-spacing: .05em; text-transform: uppercase; background: var(--pc); color: #0d1213; padding: 0 4px; border-radius: 4px; white-space: nowrap; }
.pawn.hop { animation: hop .42s var(--ease); }
@keyframes hop { 40% { transform: translateY(-30%) scale(1.12); } }
.pawn.active::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 2px solid var(--pc); opacity: .7; animation: ripple 1.6s ease-out infinite; }
@keyframes ripple { from { transform: scale(.8); opacity: .8; } to { transform: scale(1.4); opacity: 0; } }

/* ---------------- your tray ---------------- */
.tray { grid-area: tray; position: relative; z-index: 20; padding: 0 calc(8px) calc(6px + var(--safe-b)); background: linear-gradient(transparent, rgba(5,8,8,.92) 22%); }
.resbar { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.res { display: flex; gap: 4px; }
.r { display: flex; align-items: center; gap: 4px; min-width: 52px; height: 38px; padding: 0 8px; border-radius: 10px; background: rgba(0,0,0,.45); border: 1px solid var(--line); font: 400 20px var(--slab); }
.r svg { width: 22px; height: 22px; }
.r.M svg { color: #9fe3c4; } .r.I svg { color: #f6ef9a; width: 26px; height: 26px; } .r.F svg { color: #ff9c86; } .r.C svg { color: #f3dc8c; }
.r.zero { opacity: .72; }   /* still readable: 4.5:1 or better (contrast pass, Nov 10 2026) */
.r.bump { animation: bump .45s var(--spring); }
@keyframes bump { 40% { transform: scale(1.3); } }
.r small { font: 700 10px var(--ui); color: var(--muted); align-self: flex-end; margin-bottom: 6px; }
.actions { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; padding: 2px 0; mask-image: linear-gradient(90deg, #000 90%, transparent); }
.actions::-webkit-scrollbar { display: none; }
.act { flex: none; min-height: 38px; padding: 0 12px; border-radius: 10px; font-weight: 700; font-size: 13px; background: linear-gradient(#2a3637, #1c2627); border: 1px solid rgba(239,230,207,.18); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.act.hot { background: linear-gradient(#e2cd7a, #b8953f); color: #1b1608; border-color: #f2e2a0; box-shadow: 0 0 14px rgba(216,178,92,.4); }
.act.warn { background: linear-gradient(#b04a3d, #7a2a22); border-color: #e07a6c; }
.act.rite { background: linear-gradient(#6c4f96, #3e2b5c); border-color: #b39ddb; }
.act:disabled { opacity: .4; }
.hint { font-size: 13px; color: var(--muted); padding: 0 2px 2px; min-height: 18px; line-height: 1.3; }
.hint b { color: var(--bone); }
.handrow { display: grid; grid-template-columns: 54px minmax(0, 1fr) 76px; align-items: end; gap: 6px; }
.piles { display: grid; gap: 6px; justify-items: center; padding-bottom: 6px; }
.pile { position: relative; width: 46px; height: 62px; border-radius: 6px; background: url(art/back.webp) center/cover; box-shadow: 0 0 0 1px rgba(239,230,207,.3), 2px 2px 0 #222, 4px 4px 0 #111; }
.pile b { position: absolute; right: -6px; bottom: -6px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--bone); color: var(--ink); font: 800 12px/22px var(--ui); text-align: center; }
.pile.disc { background: #1b2324; box-shadow: 0 0 0 1px rgba(239,230,207,.2); width: 40px; height: 30px; display: grid; place-items: center; font-size: 10px; color: var(--muted); }
.pile.disc b { bottom: -8px; }
.hand { position: relative; height: calc(var(--hcw) * 1.4 + 16px); --hcw: 88px; }
.endwrap { display: grid; gap: 6px; justify-items: center; padding-bottom: 6px; }
.end-btn { width: 72px; height: 72px; border-radius: 50%; font: 400 15px/1 var(--fell); text-align: center; color: #1b1608; background: radial-gradient(circle at 35% 30%, #f6e6a6, #c19a3f 60%, #7a5d1c);
  box-shadow: 0 0 0 3px #1b1608, 0 0 0 5px rgba(242,220,138,.6), 0 8px 18px rgba(0,0,0,.7); transition: transform .15s var(--ease), filter .2s; }
.end-btn:not(:disabled):active { transform: scale(.94); }
.end-btn:disabled { filter: grayscale(.9) brightness(.55); }
.end-btn.ready { animation: endReady 1.8s ease-in-out infinite; }
.end-btn.confirm { background: radial-gradient(circle at 35% 30%, #ffb3a6, #c0453a 60%, #6e1d16); color: #fff; }
@keyframes endReady { 50% { box-shadow: 0 0 0 3px #1b1608, 0 0 0 5px rgba(242,220,138,.9), 0 0 30px rgba(242,220,138,.7), 0 8px 18px rgba(0,0,0,.7); } }
.undo-btn { width: 44px; height: 32px; border-radius: 8px; font-size: 12px; font-weight: 700; background: rgba(0,0,0,.4); border: 1px solid var(--line); }
.undo-btn:disabled { opacity: .3; }

/* hand cards */
.hc { position: absolute; left: 0; bottom: 4px; width: var(--hcw); transform-origin: 50% 120%; transition: transform .35s var(--ease), filter .2s; cursor: pointer; touch-action: none; will-change: transform; }
.hc .card { --cw: var(--hcw); }
.hc.playable .card { box-shadow: 0 0 0 2px rgba(111,195,155,.9), 0 0 14px rgba(111,195,155,.5), 0 8px 18px rgba(0,0,0,.7); }
.hc.mad .card { box-shadow: 0 0 0 2px rgba(179,157,219,.9), 0 0 14px rgba(179,157,219,.5), 0 8px 18px rgba(0,0,0,.7); }
.hc.dragging { transition: none; z-index: 50 !important; }
.hc.inactive { filter: brightness(.6) saturate(.5); }
.played { display: flex; gap: 4px; align-items: center; overflow-x: auto; scrollbar-width: none; min-height: 0; }
.played .lbl { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; white-space: nowrap; }
.pc { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px 0 3px; border-radius: 13px; background: rgba(0,0,0,.4); border: 1px solid var(--line); font-size: 12px; font-weight: 600; white-space: nowrap; animation: rise .35s var(--ease) both; }
.pc i { width: 20px; height: 20px; border-radius: 50%; background: #000 center/cover; display: inline-block; }
.pc .rm { margin-left: 2px; padding: 2px 6px; border-radius: 8px; background: rgba(192,69,58,.25); border: 1px solid rgba(192,69,58,.6); font-size: 11px; font-weight: 800; color: #ffb3a6; }

/* ---------------- the card face ---------------- */
.card { --cw: 200px; --kc: #5c6b66; --kt: var(--bone); position: relative; width: var(--cw); height: calc(var(--cw) * 1.4); font-size: calc(var(--cw) * .072); border-radius: calc(var(--cw) * .06);
  background: var(--bone); color: var(--ink); box-shadow: 0 0 0 calc(var(--cw) * .012) var(--ink), 0 8px 18px rgba(0,0,0,.6); overflow: hidden; display: flex; flex-direction: column; text-align: left; }
.card::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5; border-radius: inherit;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.18) 50%, transparent 60%); background-size: 250% 100%; background-position: 120% 0; }
.card.sheen::before, .hc:hover .card::before { animation: sheen 1.1s var(--ease); }
@keyframes sheen { to { background-position: -40% 0; } }
.c-title { background: var(--ink); color: var(--bone); font: 400 1.08em/1.1 var(--slab); padding: .42em .5em .36em; min-height: 2.6em; display: flex; align-items: center; letter-spacing: .01em; }
.c-title span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.c-art { position: relative; height: 38%; background: #222 center/cover; border-bottom: calc(var(--cw) * .01) solid var(--ink); }
.c-corner { position: absolute; left: .3em; top: .3em; display: grid; gap: .15em; }
.c-corner span { display: inline-flex; align-items: center; gap: .1em; background: rgba(13,18,19,.86); color: var(--bone); border-radius: .4em; padding: .05em .35em; font: 400 1.25em/1.2 var(--slab); box-shadow: 0 0 0 1px rgba(239,230,207,.3); }
.c-corner .ico { width: 1em; height: 1em; }
.c-band { display: flex; align-items: center; gap: .3em; background: var(--kc); color: var(--kt); padding: .25em .45em; min-height: 2.1em; border-bottom: calc(var(--cw) * .01) solid var(--ink); }
.c-type { flex: 1; font: 800 .82em var(--ui); letter-spacing: .12em; text-transform: uppercase; display: flex; align-items: center; gap: .3em; }
.c-text { flex: 1; padding: .45em .55em; font: 500 .96em/1.28 var(--ui); overflow: hidden; }
.c-text p { margin: 0 0 .3em; }
.c-gains { display: flex; flex-wrap: wrap; gap: .1em .6em; font: 400 1.15em var(--slab); }
.c-gains .ico { width: 1.05em; height: 1.05em; }
.c-set { font: 700 .6em var(--ui); letter-spacing: .1em; text-transform: uppercase; color: rgba(27,25,22,.55); padding: 0 .9em .5em; text-align: right; }
.c-reward { display: grid; grid-template-columns: 1fr 1fr; gap: .3em; margin-top: .3em; font-size: .86em; }
.c-reward > div { border: 1px solid rgba(27,25,22,.5); border-radius: .3em; padding: .2em .35em; }
.c-reward b { display: block; font-size: .78em; text-transform: uppercase; letter-spacing: .08em; }
.c-reward .herald { background: repeating-linear-gradient(45deg, rgba(156,132,184,.25) 0 2px, transparent 2px 5px); }
.c-reward .yours { box-shadow: inset 0 0 0 2px var(--ink); }
.muted-ink { color: rgba(27,25,22,.65); font-style: italic; }
.coin { display: inline-grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f6e6a6, #c9a24b 65%, #7f601f); color: #1b1608; font: 400 1.1em var(--slab);
  box-shadow: 0 0 0 .12em #1b1916, 0 0 0 .22em #efe6cf, 0 0 0 .3em #1b1916; }
.blob { position: relative; display: inline-grid; place-items: center; width: 2.1em; height: 2.1em; color: var(--bone); font: 400 1.05em var(--slab); }
.blob svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.blob b { position: relative; font-weight: 400; }
.terror { display: inline-flex; align-items: center; gap: .1em; font: 400 1em var(--slab); }
.cell .coin { font-size: clamp(8px, 2.1cqw, 13px); } .cell .blob { font-size: clamp(8px, 2cqw, 12px); } .cell .terror { font-size: clamp(8px, 2cqw, 12px); color: var(--bone); background: rgba(0,0,0,.7); border-radius: 6px; padding: 0 3px; }
.k-horror { --kc: var(--rust); } .k-ally { --kc: var(--teal); } .k-lore { --kc: var(--lamp); --kt: var(--ink); } .k-artifact, .k-clue { --kc: var(--brass); }
.k-omen { --kc: var(--omen); } .k-madness { --kc: var(--violet); --kt: var(--ink); } .k-boss { --kc: #0b0b0b; } .k-complication { --kc: #3a1414; }
.k-basic, .k-signature, .k-reserve { --kc: #45524e; }
.card.k-horror .c-band { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.18) 0 3px, transparent 3px 7px); }
.card.k-omen .c-band { background-image: radial-gradient(rgba(255,255,255,.18) 1px, transparent 1.4px); background-size: .6em .6em; }
.card.note .c-art { height: 22%; background: radial-gradient(circle, #2b3536, #0d1213); }
.card.big { --cw: min(300px, 68vw); }
.card.k-colour .c-art { filter: hue-rotate(0deg); }

/* ---------------- side panels (wide screens) ---------------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.side-l, .side-r, .side-r2 { display: none; }
.panel h3 { margin: 0 0 8px; font: 700 11px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.me-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.me-head .por { width: 56px; height: 56px; border-radius: 50%; background: #000 center/cover; box-shadow: 0 0 0 3px var(--you); flex: none; }
.me-head b { font: 400 18px/1.1 var(--fell); display: block; }
.me-head small { color: var(--muted); font-size: 12px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat { background: rgba(0,0,0,.3); border-radius: 10px; padding: 6px 8px; border: 1px solid var(--line); }
.stat small { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat b { font: 400 18px var(--slab); }
.ability { font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.35; }
.ability b { color: var(--bone); }
.wbar { position: relative; height: 10px; border-radius: 5px; background: rgba(0,0,0,.5); overflow: hidden; border: 1px solid var(--line); }
.wbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #8a6a2a, #f2dc8a); transition: width .6s var(--ease); }
.wbar.rite i { background: linear-gradient(90deg, #4a3570, #b39ddb); }
.wrow { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; font-size: 13px; margin: 6px 0; }
.wrow .wbar { grid-column: 1 / -1; }
.oo-panel .oo-art { height: 110px; border-radius: 10px; background: #000 center/cover; margin-bottom: 8px; position: relative; overflow: hidden; }
.oo-panel .oo-art span { position: absolute; left: 10px; bottom: 6px; font: 400 22px var(--fell); text-shadow: 0 2px 6px #000; }
.oo-panel .oo-art.asleep { filter: grayscale(.7) brightness(.5); }
.oo-line { font-size: 13px; color: var(--muted); margin: 6px 0; }
.oo-line b { color: var(--bone); }
.reserve-list { display: grid; gap: 8px; }
.res-item { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; background: rgba(0,0,0,.3); border: 1px solid var(--line); text-align: left; width: 100%; transition: border-color .2s, background .2s; }
.res-item:not(:disabled):hover { border-color: var(--gold); background: rgba(216,178,92,.08); }
.res-item .thumb { width: 54px; height: 40px; border-radius: 6px; background: #000 center/cover; flex: none; }
.res-item .info { flex: 1; min-width: 0; }
.res-item b { display: block; font-size: 14px; }
.res-item small { color: var(--muted); font-size: 12px; display: block; }
.res-item .coin { font-size: 13px; }
.res-item:disabled { opacity: .45; }
.left-n { font-size: 11px; color: var(--dim); }

/* ---------------- overlays: sheets, dialogs, notices ---------------- */
#overlay { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#overlay > * { pointer-events: auto; }
.scrim { position: fixed; inset: 0; background: rgba(3,5,5,.72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 88dvh; overflow: auto; background: linear-gradient(#1b2526, #111819); border-top: 1px solid rgba(239,230,207,.2); border-radius: 20px 20px 0 0;
  padding: 10px calc(16px + var(--safe-r)) calc(18px + var(--safe-b)) calc(16px + var(--safe-l)); box-shadow: 0 -20px 50px rgba(0,0,0,.6); animation: sheetIn .38s var(--ease) both; }
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: rgba(239,230,207,.25); margin: 0 auto 10px; }
@keyframes sheetIn { from { transform: translateY(100%); } }
.sheet h2, .dialog h2 { font: 400 26px/1.1 var(--fell); margin: 0 0 4px; }
.sheet .sub, .dialog .sub { color: var(--muted); margin: 0 0 12px; font-size: 14px; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; }
/* the title row stays put while a long sheet scrolls under it */
.sheet > .sheet-head { position: sticky; top: -10px; z-index: 3; margin: 0 -16px 6px; padding: 4px 16px 8px; background: #1b2526; border-bottom: 1px solid transparent; }
.sheet h3.sub { font-weight: 700; color: var(--bone2); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.sheet-head > div { flex: 1; }
.dialog { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; background: linear-gradient(#1d2829, #121a1b);
  border: 1px solid rgba(239,230,207,.2); border-radius: 20px; padding: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.8); animation: pop .35s var(--spring) both; }
@keyframes pop { from { transform: translate(-50%, -46%) scale(.92); opacity: 0; } }
.dialog .row, .sheet .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 14px; }
.list { display: grid; gap: 8px; }
.inspect { display: grid; justify-items: center; gap: 14px; padding-top: 6px; }
.inspect .card { animation: cardIn .45s var(--spring) both; }
@keyframes cardIn { from { transform: translateY(30px) rotate(-4deg) scale(.85); opacity: 0; } }
.inspect .row { justify-content: center; }
.choose-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.choose-grid .pickc { border-radius: 10px; transition: transform .2s var(--ease); }
.choose-grid .pickc:hover { transform: translateY(-4px); }
.choose-grid .card { --cw: 120px; }

/* notices: the moments that stop play */
.notice { position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; padding: calc(12px + var(--safe-t)) 12px calc(12px + var(--safe-b)); overflow: auto; }
.notice .nbg { position: fixed; inset: 0; background: radial-gradient(circle at 50% 40%, rgba(24,20,18,.9), rgba(0,0,0,.97)); animation: fade .3s both; }
.notice.omen .nbg { background: radial-gradient(circle at 50% 40%, rgba(40,22,62,.92), rgba(0,0,0,.97)); }
.notice.horror .nbg, .notice.complication .nbg { background: radial-gradient(circle at 50% 40%, rgba(62,14,10,.92), rgba(0,0,0,.97)); }
.notice.boss .nbg { background: radial-gradient(circle at 50% 45%, rgba(18,34,26,.93), rgba(0,0,0,.98)); }
.notice.peek .nbg { background: radial-gradient(circle at 50% 40%, rgba(18,30,50,.92), rgba(0,0,0,.97)); }
.ncontent { position: relative; margin: auto; display: grid; grid-template-columns: auto minmax(0, 340px); gap: 22px; align-items: center; max-width: 760px; animation: rise .5s var(--ease) both; }
.ncontent .card { --cw: min(230px, 52vw); animation: cardIn .6s var(--spring) both; }
.kicker { font: 800 11px var(--ui); letter-spacing: .18em; text-transform: uppercase; color: var(--lamp); }
.notice.horror .kicker, .notice.complication .kicker { color: #ff8a7a; }
.notice.omen .kicker { color: #c9b3ff; }
.ntitle { font: 400 clamp(26px, 6vw, 38px)/1.05 var(--fell); margin: 4px 0 10px; color: var(--bone); }
.nline { font-size: 15px; line-height: 1.45; color: var(--text); }
.nline ul, .howto { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; color: var(--text); }
.changes { display: grid; gap: 4px; margin-top: 12px; }
.chg { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(0,0,0,.4); border: 1px solid var(--line); font-size: 13px; animation: rise .4s var(--ease) both; }
.chg b { font: 400 15px var(--slab); white-space: nowrap; }
.chg .up { color: #ff8a7a; } .chg .down { color: var(--sea); }
.caption { background: #f2e9cf; color: #1b1916; font: italic 400 16px/1.35 var(--fell); padding: 10px 14px; border: 2px solid #1b1916; box-shadow: 4px 4px 0 #000; transform: rotate(-1deg); margin: 6px 0 12px; }
.caption cite { display: block; font: 700 10px var(--ui); font-style: normal; letter-spacing: .12em; text-transform: uppercase; margin-top: 6px; }
.notice.rise .ncontent { animation: rise .7s 1.5s var(--ease) both; }
.notice.rise .ncontent .card { animation: bossRise 1.4s 1.3s var(--ease) both; }
.risefx { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; }
.risefx .eyes { width: min(70vw, 520px); aspect-ratio: 2/1; background: radial-gradient(ellipse 16% 22% at 32% 50%, #ff5a3c, transparent 70%), radial-gradient(ellipse 16% 22% at 68% 50%, #ff5a3c, transparent 70%);
  filter: blur(2px); animation: eyes 2s ease-out both; }
.colour-rise .risefx .eyes { background: radial-gradient(ellipse 40% 40% at 50% 50%, #e6b0ff, #9fe07a 40%, transparent 70%); }
.risefx .word { position: absolute; font: 400 clamp(40px, 12vw, 110px)/1 var(--fell); letter-spacing: .06em; color: #f2e9cf; text-shadow: 0 0 40px rgba(255,90,60,.7); animation: word 2s ease-out both; text-align: center; padding: 0 12px; }
@keyframes eyes { 0% { opacity: 0; transform: scaleY(0); } 25% { opacity: 1; transform: scaleY(.1); } 45% { transform: scaleY(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes word { 0%, 30% { opacity: 0; transform: scale(1.4); filter: blur(10px); } 50% { opacity: 1; transform: none; filter: none; } 82% { opacity: 1; } 100% { opacity: 0; transform: scale(.94); } }
.notice.comic .ncontent { background: #efe6cf; color: #1b1916; padding: 18px; border: 3px solid #000; box-shadow: 8px 8px 0 #000; transform: rotate(-.6deg); }
.notice.comic .ntitle, .notice.comic .nline { color: #1b1916; }
.notice.comic .kicker { color: #a8402a; }
.notice.peek .ncontent .card { box-shadow: 0 0 0 3px #7fb2ff, 0 0 40px rgba(127,178,255,.5); }
.notice .ok { margin-top: 16px; position: sticky; bottom: 4px; min-width: 180px; }

/* end of game */
.endscr { position: fixed; inset: 0; z-index: 56; overflow: auto; display: grid; place-items: start center; padding: calc(24px + var(--safe-t)) 14px calc(24px + var(--safe-b));
  background: radial-gradient(circle at 50% 30%, rgba(30,40,34,.95), rgba(0,0,0,.98)); animation: fade .8s both; }
.endscr.win { background: radial-gradient(circle at 50% 25%, rgba(70,58,24,.96), rgba(0,0,0,.98)); }
.endscr.lose { background: radial-gradient(circle at 50% 25%, rgba(70,14,10,.96), rgba(0,0,0,.98)); }
.end-inner { width: min(640px, 100%); display: grid; gap: 14px; text-align: center; }
.end-word { font: 400 clamp(46px, 13vw, 92px)/1 var(--fell); color: var(--bone); animation: word2 1.4s var(--ease) both; text-shadow: 0 0 40px rgba(216,178,92,.4); }
.endscr.lose .end-word { text-shadow: 0 0 40px rgba(255,80,60,.5); }
@keyframes word2 { from { opacity: 0; transform: scale(1.3); filter: blur(8px); letter-spacing: .3em; } }
.end-sub { font: italic 18px/1.4 var(--fell); color: var(--text); animation: rise .8s .6s var(--ease) both; }
.end-table { width: 100%; border-collapse: collapse; font-size: 13px; animation: rise .8s .9s var(--ease) both; }
.end-table th, .end-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.end-table th:first-child, .end-table td:first-child { text-align: left; color: var(--muted); }
.end-table thead th { font: 700 11px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stars { display: flex; justify-content: center; gap: 6px; }
.stars button { font-size: 34px; line-height: 1; color: #3a4344; transition: transform .15s var(--spring), color .15s; min-width: 44px; min-height: 44px; }
.stars button.on { color: var(--gold); text-shadow: 0 0 12px rgba(216,178,92,.6); }
.stars button:active { transform: scale(1.2); }
textarea, input[type=text] { width: 100%; background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font: 15px var(--ui); padding: 10px; -webkit-user-select: text; user-select: text; }
.story { text-align: left; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font: 16px/1.5 var(--fell); animation: rise .8s 1.1s var(--ease) both; }
.story p { margin: 0 0 8px; }

/* settings, menus, how to play */
.set-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.set-row small { display: block; color: var(--dim); font-size: 12px; }
input[type=range] { width: 160px; accent-color: var(--gold); }
.switch { width: 52px; height: 30px; border-radius: 15px; background: #2b3536; position: relative; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--bone); transition: transform .2s var(--ease); }
.switch[aria-checked="true"] { background: var(--sea); }
.switch[aria-checked="true"]::after { transform: translateX(22px); }
.howto-page { display: grid; gap: 12px; min-height: 300px; animation: rise .35s var(--ease) both; }
.howto-page h2 { font: 400 28px var(--fell); margin: 0; }
.howto-page p { margin: 0; font-size: 15px; line-height: 1.5; }
.howto-vis { display: flex; gap: 10px; justify-content: center; align-items: flex-end; flex-wrap: wrap; padding: 8px 0; min-height: 150px; }
.howto-vis .card { --cw: 96px; }
.dots { display: flex; gap: 6px; justify-content: center; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #3a4344; }
.dots i.on { background: var(--gold); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
kbd { font: 700 12px var(--ui); background: #2b3536; border: 1px solid #45524e; border-bottom-width: 3px; border-radius: 6px; padding: 2px 7px; color: var(--bone); }
.log { font-size: 13px; line-height: 1.45; display: grid; gap: 3px; }
.log p { margin: 0; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.log .r { display: inline; min-width: 0; height: auto; padding: 0 6px 0 0; border: 0; background: none; font: 700 11px var(--ui); color: var(--muted); }
.log .bot { color: #e9d49a; } .log .doom { color: #ff9c86; } .log .you { color: #b6ead2; }
.tip { position: fixed; z-index: 58; left: 12px; right: 12px; margin: 0 auto; top: calc(150px + var(--safe-t)); max-width: 460px; background: #efe6cf; color: #1b1916; border: 2px solid #000;
  box-shadow: 5px 5px 0 #000; padding: 10px 12px; font-size: 14px; border-radius: 4px; animation: rise .4s var(--ease) both; }
.tip b { font-family: var(--fell); font-size: 17px; font-weight: 400; display: block; margin-bottom: 2px; }
.tip .x { position: absolute; right: 4px; top: 2px; font-size: 18px; padding: 4px 8px; }
#toast { position: fixed; left: 50%; top: calc(64px + var(--safe-t)); transform: translate(-50%, -10px); z-index: 80; max-width: min(520px, calc(100vw - 24px)); padding: 10px 16px; border-radius: 12px; background: rgba(20,28,29,.96);
  border: 1px solid rgba(239,230,207,.25); box-shadow: 0 10px 30px rgba(0,0,0,.6); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.rivalbar { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.rivalbar .feed { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.rivalbar .feed p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: rise .3s var(--ease) both; }
.rivalbar .feed p:last-child { color: var(--bone); }
.fog-timer { position: relative; overflow: hidden; }
.fog-timer i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--gold); transition: width .2s linear; }

/* ---------------- wide screens ---------------- */
@media (min-width: 900px) and (min-height: 560px) {
  #game { grid-template-columns: minmax(220px, 270px) minmax(0, 1fr) minmax(260px, 320px); grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "hud hud hud" "left stage rivals" "left stage right" "tray tray right"; column-gap: 12px; padding-left: calc(12px + var(--safe-l)); padding-right: calc(12px + var(--safe-r)); }
  .side-l { display: flex; flex-direction: column; grid-area: left; align-self: stretch; overflow: hidden; min-height: 0; }
  #g-me { flex: 0 1 auto; min-height: 0; overflow: auto; }
  #g-ctrl { flex: none; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
  #g-ctrl .resbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 0; }
  #g-ctrl .res { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #g-ctrl .r { min-width: 0; justify-content: center; padding: 0 4px; }
  #g-ctrl .actions { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  #g-ctrl .act { flex: 1 1 auto; justify-content: center; }
  #g-ctrl .hint { margin-top: 8px; }
  .side-r { padding-bottom: calc(8px + var(--safe-b)); }
  .tray { min-width: 0; }
  .side-r { display: grid; gap: 10px; grid-area: right; align-content: start; overflow: auto; min-height: 0; }
  .rivals { flex-direction: column; padding: 0; overflow: visible; }
  .rv { flex: none; }
  .hud { padding: 10px 0; }
  .hud .oo-chip { display: none; }
  .hand { --hcw: 118px; }
  .handrow { grid-template-columns: 70px minmax(0, 1fr) 96px; }
  .end-btn { width: 88px; height: 88px; font-size: 17px; }
  .tray { padding-left: 0; padding-right: 0; }
  .m-only { display: none !important; }
  .notice .ncontent .card { --cw: 260px; }
  .tip { top: 120px; }
  /* on wide screens a sheet is a centred, fully framed panel rather than a drawer cut off by the bottom edge */
  .sheet { left: 50%; right: auto; top: 50%; bottom: auto; width: min(720px, calc(100vw - 48px)); max-height: min(86dvh, 820px); transform: translate(-50%, -50%);
    border: 1px solid rgba(239,230,207,.2); border-radius: 20px; padding: 14px 22px 22px; box-shadow: 0 30px 80px rgba(0,0,0,.7); animation: sheetPop .3s var(--ease) both; }
  .sheet::before { display: none; }
  .sheet > .sheet-head { top: -14px; margin: -4px -22px 8px; padding: 10px 22px 10px; border-radius: 20px 20px 0 0; }
  .sheet.shop .reserve-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 899px), (max-height: 559px) { .d-only { display: none !important; } }
@media (max-width: 380px) { .hand { --hcw: 78px; } .r { min-width: 44px; padding: 0 6px; font-size: 18px; } .handrow { grid-template-columns: 48px minmax(0, 1fr) 68px; } .end-btn { width: 64px; height: 64px; font-size: 14px; } }
@media (max-width: 600px) {
  .oo-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ncontent { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 12px; }
  .ncontent .howto, .ncontent .changes { text-align: left; }
  .ncontent .card { --cw: min(150px, 42vw); }
  .ntitle { font-size: 26px; }
  .nline { font-size: 14px; }
  .inv-detail { grid-template-columns: 1fr; }
}
/* phones held sideways: shrink the tray */
@media (max-height: 520px) and (orientation: landscape) {
  #game { grid-template-columns: minmax(0, 1fr) minmax(300px, 44vw); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "hud hud" "stage rivals" "stage tray"; }
  .tray { align-self: end; }
  .hand { --hcw: 70px; }
  .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
.reduced *, .reduced *::before, .reduced *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .05s !important; }

/* small cards (hand, choices): art and gains, no rules text; long-press for the full card */
.card.mini .c-title { font-size: 1.32em; min-height: 2.5em; padding: .35em .45em; }
.card.mini .c-art { flex: 1; height: auto; }
.card.mini .c-corner span { font-size: 2em; padding: .02em .3em; }
.card.mini .c-band { min-height: 2.5em; padding: .2em .4em; }
.card.mini .c-type { font-size: 1.05em; letter-spacing: .06em; }
.card.mini .c-band .coin, .card.mini .c-band .blob { font-size: 1.35em; }
.card.mini .c-text, .card.mini .c-set { display: none; }
.card.mini .more { position: absolute; right: .4em; bottom: 3.2em; z-index: 2; background: var(--bone); color: var(--ink); border-radius: .6em; padding: 0 .5em; font: 800 1.15em var(--ui); box-shadow: 0 0 0 1px var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .hc .card { transition: transform .22s var(--ease), box-shadow .2s; transform-origin: 50% 100%; }
  .hc:not(.dragging):hover { z-index: 40 !important; }
  .hc:not(.dragging):hover .card { transform: translateY(-34%) scale(1.45); }
  .cell.up:hover .front { filter: brightness(1.15); }
}

/* ---------------- the guide (coach.js) ---------------- */
.btn.big small { display: block; font: 600 12px var(--ui); letter-spacing: .02em; opacity: .75; }
/* A big button's second line wraps instead of widening the page (Colin's iPhone, Nov 15 2026: the Sunday Daily Case line
   pushed the title screen wider than the phone, and Safari zoomed the whole page to fit). */
.btn.big small { white-space: normal; text-wrap: balance; line-height: 1.3; }
.btn.big:has(small) { min-width: 0; max-width: 100%; text-align: center; }
.title-inner > * { max-width: 100%; min-width: 0; }
.menu-list .btn.big:has(small) { flex-direction: column; gap: 0; padding-top: 6px; padding-bottom: 6px; }
.guided-offer { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(200,193,90,.14), rgba(200,193,90,.04)); border: 1px solid rgba(200,193,90,.4); }
.guided-offer small { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; margin-top: 2px; }
.guided-offer .btn { grid-column: 1 / -1; justify-self: start; }
@media (min-width: 640px) { .guided-offer { grid-template-columns: auto 1fr auto; } .guided-offer .btn { grid-column: auto; } }
.g-lamp { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; background: radial-gradient(#f3e7a6, #c8c15a 60%, #6d6824); color: #1b1608; box-shadow: 0 0 14px rgba(200,193,90,.55); flex: none; }
.g-lamp .ico { width: 20px; height: 20px; }

#guide { position: fixed; inset: 0; z-index: 58; pointer-events: none; display: none; }
#guide.on { display: block; }
#guide .g-catch { position: absolute; inset: 0; display: none; }
#guide.tour .g-catch { display: block; pointer-events: auto; cursor: pointer; }
#guide .g-ring { position: fixed; border-radius: 12px; pointer-events: none; transition: left .3s var(--ease), top .3s var(--ease), width .3s var(--ease), height .3s var(--ease), opacity .2s;
  box-shadow: 0 0 0 3px var(--lamp), 0 0 22px 4px rgba(200,193,90,.6); animation: gRing 1.5s ease-in-out infinite; }
#guide.tour .g-ring { box-shadow: 0 0 0 3px var(--lamp), 0 0 0 9999px rgba(3,6,6,.72), 0 0 30px 6px rgba(200,193,90,.5); animation: none; }
#guide .g-ring.nudge { animation: gNudge .45s ease-in-out 2; }
@keyframes gRing { 50% { box-shadow: 0 0 0 5px rgba(200,193,90,.55), 0 0 34px 8px rgba(200,193,90,.35); } }
@keyframes gNudge { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
#guide .g-bubble { position: fixed; pointer-events: auto; background: var(--bone); color: var(--ink); border-radius: 14px; padding: 12px 14px 10px; border: 2px solid #000;
  box-shadow: 0 12px 34px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.4); transition: left .3s var(--ease), top .3s var(--ease); }
#guide .g-bubble.in { animation: gIn .35s var(--ease) both; }
@keyframes gIn { from { opacity: 0; transform: translateY(8px) scale(.97); } }
#guide .g-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
#guide .g-head .g-lamp { width: 26px; height: 26px; }
#guide .g-who { font: 400 18px var(--fell); color: #3b3016; }
#guide .g-count { margin-left: auto; font: 700 12px var(--ui); color: #7b6c48; }
#guide p { margin: 0 0 8px; font-size: 15.5px; line-height: 1.42; }
#guide p b { color: #000; }
#guide .ico { color: #2f3b36; vertical-align: -3px; }
#guide .g-btns { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
#guide .g-btns .btn:not(.primary) { background: transparent; color: var(--ink); border-color: #8a8270; box-shadow: none; }
#guide .g-btns .btn.ghost { border-color: transparent; color: #5b5240; }
body.guide-lock #g-acts .act:not(.g-target), body.guide-lock .end-btn:not(.g-target), body.guide-lock .undo-btn,
body.guide-lock .hc:not(.g-target):not(.mad), body.guide-lock #g-res .res-item:not(.g-target) { opacity: .4; filter: saturate(.4); }
.hint.guide { display: flex; align-items: flex-start; gap: 8px; color: var(--text); background: rgba(200,193,90,.1); border: 1px solid rgba(200,193,90,.35); border-radius: 10px; padding: 6px 4px 6px 8px; margin: 2px 0 4px; font-size: 13.5px; }
.hint.guide .g-lamp { width: 22px; height: 22px; } .hint.guide .g-lamp .ico { width: 15px; height: 15px; }
.hint.guide .g-say { flex: 1; } .hint.guide .g-who { color: var(--lamp); font-weight: 800; margin-right: 2px; }
.hint.guide .ico { width: 15px; height: 15px; vertical-align: -3px; }
.hint.guide .g-hide { padding: 2px 8px; color: var(--muted); font-size: 15px; align-self: center; }

/* the picture book */
.guide-book .gb-who { font: 400 16px var(--fell); color: var(--lamp); }
.gb-text { text-align: left; font-size: 15.5px; line-height: 1.5; max-width: 470px; margin: 0 auto; }
.gb-text b { color: var(--bone); }
.gb-steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.gb-steps .ico { width: 17px; height: 17px; vertical-align: -3px; }
.gb-duel { display: flex; align-items: center; gap: 18px; justify-content: center; }
.gb-duel .por { width: 84px; height: 84px; border-radius: 50%; background: #000 center/cover; box-shadow: 0 0 0 3px var(--you), 0 0 26px rgba(111,195,155,.35); }
.gb-duel .por.rv { box-shadow: 0 0 0 3px var(--rival), 0 0 26px rgba(216,178,92,.35); }
.gb-duel b { font: 400 22px var(--fell); color: var(--muted); }
.gb-row { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.gb-stack { position: relative; width: 52px; height: 72px; }
.gb-back { position: absolute; left: calc(var(--k) * 1.4px); top: calc(var(--k) * -1.4px); width: 46px; height: 64px; border-radius: 5px; background: url(art/back.webp) center/cover; box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
.gb-fan { display: flex; } .gb-fan .card { margin-left: -14px; transform: rotate(calc((var(--i, 0) - 2) * 3deg)); } .gb-fan .card:first-child { margin-left: 0; }
.gb-arrow { font: 400 26px var(--fell); color: var(--lamp); }
.gb-cap { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.gb-cycle { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.gb-cycle span { display: grid; justify-items: center; gap: 3px; width: 62px; padding: 8px 0; border-radius: 12px; background: rgba(239,230,207,.07); border: 1px solid var(--line); }
.gb-cycle .ico { width: 28px; height: 28px; } .gb-cycle small { font-weight: 700; } .gb-cycle i { color: var(--lamp); font-style: normal; font-size: 20px; }
.gb-loop { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: center; }
.gb-pile { padding: 18px 6px; width: 70px; box-sizing: border-box; border-radius: 8px; background: url(art/back.webp) center/cover; color: var(--bone); font-weight: 800; font-size: 12px; text-shadow: 0 1px 3px #000; min-width: 64px; text-align: center; box-shadow: 0 0 0 1px rgba(239,230,207,.3); }
.gb-pile.inhand { background: var(--bone); color: var(--ink); text-shadow: none; } .gb-pile.disc { filter: grayscale(.4) brightness(.8); }
.gb-back-arrow { flex-basis: 100%; text-align: center; color: var(--lamp); font-size: 13px; font-weight: 700; }
.gb-lamp { display: grid; place-items: center; width: 80px; height: 80px; margin: 0 auto; border-radius: 50%; background: radial-gradient(#f3e7a6, #c8c15a 60%, #6d6824); color: #1b1608; box-shadow: 0 0 40px rgba(200,193,90,.6); }
.gb-lamp .ico { width: 50px; height: 50px; }
body.reduced #guide .g-ring { animation: none; transition: none; } body.reduced #guide .g-bubble { transition: none; }
.gb-card { width: 20px; height: 28px; border-radius: 3px; background: var(--bone); border-top: 5px solid var(--teal); display: block; }
.menu-list .btn:has(small) { flex-direction: column; gap: 0; } .menu-list .btn small { display: block; font: 600 11px var(--ui); opacity: .7; }
.more-tab { position: fixed; z-index: 21; transform: translateX(-50%); padding: 5px 12px; border-radius: 99px; background: var(--bone); color: var(--ink); font: 800 12px var(--ui); letter-spacing: .03em;
  box-shadow: 0 4px 14px rgba(0,0,0,.6); animation: moreBob 2.4s ease-in-out infinite; }
.more-tab[hidden] { display: none; }
@keyframes moreBob { 50% { transform: translate(-50%, 3px); } }
body.reduced .more-tab { animation: none; }
.side-r.more-below, #g-me.more-below { --fb: 46px; } .side-r.more-above, #g-me.more-above { --ft: 46px; }
.side-r, #g-me { -webkit-mask-image: linear-gradient(transparent, #000 var(--ft, 0px), #000 calc(100% - var(--fb, 0px)), transparent); mask-image: linear-gradient(transparent, #000 var(--ft, 0px), #000 calc(100% - var(--fb, 0px)), transparent); }
#guide .g-btns small { font-weight: 600; opacity: .8; margin-left: 3px; }

/* the end-of-game survey */
.survey h3 small, .sv-text small { font-weight: 400; color: var(--muted); }
.sv-q { margin: 12px 0 0; } .sv-q .qt { display: block; font-weight: 700; margin-bottom: 6px; }
.sv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sv-chips button { min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: rgba(239,230,207,.06); color: var(--text); font-weight: 600; }
.sv-chips button[aria-checked="true"] { background: var(--bone); color: var(--ink); border-color: var(--bone); }
.sv-chips button[aria-checked="true"]::before { content: "✓ "; }
.sv-chips.scale button { flex: 1; padding: 0 4px; letter-spacing: -1px; color: var(--lamp); font-size: 13px; }
.sv-chips.scale button[aria-checked="true"] { color: #5e4a17; }
.sv-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 3px; }
.sv-progress { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.sv-progress span { flex: 0 0 90px; height: 6px; border-radius: 3px; background: rgba(239,230,207,.12); overflow: hidden; } .sv-progress i { display: block; height: 100%; background: var(--lamp); }
.sv-text { display: block; margin-top: 10px; font-weight: 600; font-size: 14px; }
.sv-text textarea, .sv-text input { display: block; width: 100%; margin-top: 4px; box-sizing: border-box; }
.sv-chips.scale button[aria-checked="true"]::before { content: none; }

/* your own strip on wide screens: the rival's card, plus the numbers you check mid-turn */
.me-card { width: 100%; display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px solid var(--line); text-align: left; color: inherit; }
.me-card .por { width: 40px; height: 40px; border-radius: 50%; background: #000 center/cover; box-shadow: 0 0 0 2px var(--you); flex: none; }
.me-card .nm { display: block; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card .st { display: flex; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; } .me-card .st span { display: inline-flex; align-items: center; gap: 2px; }
.me-card .st .ico { width: 14px; height: 14px; }
.me-lines { display: grid; gap: 2px; margin-top: 8px; font-size: 13px; }
.me-lines div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 4px; border-bottom: 1px solid var(--line); }
.me-lines span { color: var(--muted); } .me-lines b { font-weight: 700; color: var(--bone); }
.me-lines .hot b { color: var(--lamp); }
/* overlapping cards: the one under the pointer comes to the front */
@media (hover: hover) and (pointer: fine) { .hc:hover { z-index: 40 !important; } }
@media (min-width: 900px) and (min-height: 560px) { .side-r .oo-panel .oo-art { height: 56px; } .side-r { gap: 8px; } .side-r .oo-panel .oo-line { margin: 6px 0; } }
@media (min-width: 900px) and (min-height: 560px) and (max-height: 760px) { .hand { --hcw: 100px; } }
@keyframes sheetPop { from { opacity: 0; transform: translate(-50%, -47%) scale(.97); } }
.sheet.shop .res-item { align-items: center; min-height: 64px; }
.sheet.shop .res-item small { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
@media (max-width: 899px), (max-height: 559px) { .sheet.shop .res-item small { display: block; -webkit-line-clamp: unset; overflow: visible; } }
.endscr .btn.big:has(small) { flex-direction: column; gap: 0; padding-top: 6px; padding-bottom: 6px; } .endscr .btn.big small { display: block; font: 600 12px var(--ui); opacity: .75; }
/* phones: no button hides off the right edge; when the counters fill the row, the buttons wrap onto their own line */
@media (max-width: 899px), (max-height: 559px) {
  .tray .resbar { flex-wrap: wrap; row-gap: 6px; }
  .tray .actions { flex: 1 1 auto; flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }
}
/* your strip in the phone's rival row */
.rv.me { border-color: rgba(111,195,155,.35); }
.rv.me .por { box-shadow: 0 0 0 2px var(--you); }
.rv.me.active { border-color: var(--you); box-shadow: 0 0 18px rgba(111,195,155,.25); }
@media (max-width: 899px), (max-height: 559px) {
  .rivals:has(.rv:nth-child(3)) .rv { padding-right: 6px; gap: 6px; }
  .rivals:has(.rv:nth-child(3)) .rv .por { width: 28px; height: 28px; }
  .rivals:has(.rv:nth-child(3)) .rv .st { gap: 5px; font-size: 11px; }
  .rivals:has(.rv:nth-child(3)) .rv .st .ico { width: 12px; height: 12px; }
  .rivals:has(.rv:nth-child(3)) .rv .pips i { width: 6px; height: 6px; }
}
/* phones: a roomier town and uncluttered spaces */
@media (max-width: 899px), (max-height: 559px) {
  .tray .r { min-width: 0; height: 34px; padding: 0 7px; gap: 3px; font-size: 17px; }
  .tray .r svg { width: 18px; height: 18px; }
  .cell .lbl { bottom: auto; top: 5%; }
  .pawn { width: calc(100% / var(--n) * .38); margin: calc(100% / var(--n) * -.19) 0 0 calc(100% / var(--n) * -.19); }
  .pawn.r1 em, .pawn.r2 em { display: none; }   /* rivals are known by their portrait, as in their strip; "You" keeps its tag */
  .rivals:has(.rv:nth-child(3)) .rv .st > span:last-child { display: none; }   /* three strips: drop the hand count, keep the portrait */
}

/* Quick sound switches in the pause menu */
.snd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.snd-row .btn { width: 100%; }
.snd-tog[aria-pressed="false"] { opacity: .75; border-style: dashed; }

/* Dagon's water (Nov 10 2026): a sea channel and drowned edges. Waves plus a label, never colour alone. */
.cell.water { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='14' viewBox='0 0 40 14'%3E%3Cpath d='M0 9 Q10 3 20 9 T40 9' fill='none' stroke='%239fd8c8' stroke-opacity='.45' stroke-width='1.6'/%3E%3C/svg%3E") 0 0 / 40px 14px repeat, linear-gradient(180deg, #1d4a4c, #12302f 55%, #0b2023);
  box-shadow: inset 0 0 0 1px rgba(150,210,200,.3), inset 0 0 20px rgba(0,0,0,.55); animation: tide 9s linear infinite; }
.cell.water::before { inset: 0; border-radius: 5px; background: linear-gradient(100deg, transparent 30%, rgba(220,255,245,.10) 45%, transparent 60%); background-size: 220% 100%; animation: shimmer 7s ease-in-out infinite alternate; }
@keyframes tide { from { background-position: 0 0, 0 0; } to { background-position: 40px 0, 0 0; } }
@keyframes shimmer { from { background-position: 0% 0; } to { background-position: 100% 0; } }
.cell .lbl.water { background: rgba(6,24,28,.85); color: #cdeee4; border: 1px solid rgba(160,215,205,.5); display: inline-flex; align-items: center; gap: 2px; padding: 1px 5px; }
.cell .lbl.water svg { width: 1.1em; height: 1.1em; }
.tok-boss.dagon { box-shadow: 0 0 0 2px #1b1916, 0 0 0 4px #6fc2b0, 0 0 30px rgba(111,194,176,.6), 0 10px 25px rgba(0,0,0,.8); }
.played .pc.kept { border: 1px solid rgba(200,193,90,.55); }
body.reduced .cell.water, body.reduced .cell.water::before { animation: none; }

/* Scenario briefing (Nov 10 2026): an Old One's own rules, before the first game against it and from its panel. */
.dialog.brief-dlg { width: min(560px, calc(100vw - 24px)); padding: 0; overflow: hidden auto; max-height: 92vh; }
.brief-art { position: relative; height: 150px; background: #000 center 30%/cover; display: flex; flex-direction: column; justify-content: flex-end; padding: 12px 18px; }
.brief-art::before { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 20%, rgba(0,0,0,.9)); }
.brief-art > * { position: relative; }
.brief-art .kicker { font: 800 11px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--lamp); }
.brief-art h2 { margin: 2px 0 0; font: 400 clamp(28px, 6vw, 38px)/1 var(--fell); }
.brief > p, .brief > div, .brief > ol { margin-left: 18px; margin-right: 18px; }
.brief-story { font: italic 400 17px/1.35 var(--fell); color: var(--muted); margin-top: 12px; }
.brief-ward { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.brief-ward svg { width: 26px; height: 26px; flex: none; }
.brief-rules { list-style: none; padding: 0; display: grid; gap: 10px; margin-top: 12px; }
.brief-rules li { display: grid; grid-template-columns: 112px 1fr; gap: 10px; align-items: start; line-height: 1.35; }
.brief-rules .when { font: 800 11px/1.3 var(--ui); letter-spacing: .08em; text-transform: uppercase; color: #1b1608; background: var(--lamp); border-radius: 6px; padding: 4px 6px; text-align: center; }
.brief .row { display: flex; justify-content: flex-end; padding: 6px 18px 16px; }
.brief-btn { width: 100%; margin: 8px 0 4px; }
@media (max-width: 520px) { .brief-rules li { grid-template-columns: 1fr; gap: 4px; } .brief-rules .when { justify-self: start; } }
.brief > p.sub { margin: 6px 18px 0; }

/* ---------------- case files: achievements and sign-in (profile.js) ---------------- */
.casefile .cf-box { background: rgba(0,0,0,.28); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 10px 0; }
.casefile .cf-box h3 { margin: 2px 0 6px; font-size: 15px; color: var(--bone); }
.casefile .cf-box p { margin: 0 0 8px; }
.casefile .row { justify-content: flex-start; flex-wrap: wrap; margin-top: 10px; }
.cf-who { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.cf-who b { font: 400 22px var(--slab); color: var(--bone); }
.cf-who small { color: var(--muted); }
.cf-ways { display: grid; gap: 6px; }
.cf-ways .res-item { padding: 8px 10px; }
.cf-msg { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: rgba(192,69,58,.16); border: 1px solid rgba(192,69,58,.5); color: var(--text); font-size: 14px; }
.cf-msg.ok { background: rgba(200,193,90,.12); border-color: rgba(200,193,90,.45); }
.cf-group { margin: 16px 0 6px; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.ach { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; border: 1px dashed var(--line); background: rgba(0,0,0,.22); }
.ach .ach-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(239,230,207,.06); border: 1px solid var(--line); color: var(--dim); }
.ach .ach-ico .ico { width: 18px; height: 18px; }
.ach .ach-txt { min-width: 0; }
.ach b { display: block; font-size: 14px; color: var(--muted); }
.ach small { display: block; font-size: 12px; color: var(--muted); }
.ach .ach-when { margin-top: 2px; color: var(--dim); }
.ach.got { border-style: solid; border-color: rgba(216,178,92,.55); background: rgba(216,178,92,.08); }
.ach.got .ach-ico { background: var(--gold); border-color: var(--gold); color: var(--ink); box-shadow: 0 0 14px rgba(216,178,92,.35); }
.ach.got b { color: var(--bone); }
.ach.got .ach-when { color: var(--gold); }
.ach-new { margin: 14px 0; padding: 12px; border-radius: 16px; border: 1px solid rgba(216,178,92,.6); background: rgba(216,178,92,.08); text-align: left; animation: achIn .7s var(--ease) both .9s; }
.ach-new h3 { margin: 0 0 8px; font: 400 18px var(--slab); color: var(--gold); text-align: center; }
@keyframes achIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
body.reduced .ach-new { animation: none; }
.cf-invite { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; font-size: 14px; color: var(--muted); }

/* ---------------- the Daily Case ---------------- */
.daily-btn { border-color: rgba(216,178,92,.6); background: linear-gradient(rgba(216,178,92,.16), rgba(216,178,92,.06)); }
.daily-btn.done { border-color: var(--line); background: rgba(0,0,0,.3); }
.daily-end { margin: 14px auto; padding: 12px; max-width: 520px; border-radius: 16px; border: 1px solid rgba(216,178,92,.5); background: rgba(0,0,0,.3); display: grid; gap: 4px; justify-items: center; }
.daily-end .kicker { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.daily-end b { font: 400 20px var(--slab); color: var(--bone); }
.daily-end small { color: var(--muted); font-size: 13px; }
.daily-end .row { margin-top: 6px; justify-content: center; }
.daily-mine { margin: 8px 0; }
table.daily-table { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 14px; }
table.daily-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.daily-table td { padding: 6px; border-bottom: 1px solid rgba(239,230,207,.07); }
table.daily-table td:first-child { width: 2.5em; color: var(--muted); }
table.daily-table tr.you td { background: rgba(216,178,92,.12); color: var(--bone); }
table.daily-table .chip { margin-left: 6px; font-size: 11px; padding: 1px 6px; }

/* the playtest gate (Nov 15 2026) */
.gate-lede { font: 400 18px/1.5 var(--fell); color: var(--text); margin: 4px 0 0; max-width: 26em; }
.gate-form { display: grid; gap: 10px; width: min(360px, 100%); }
.gate-form input[type=text] { font-size: 17px; text-align: center; letter-spacing: .06em; }
.gate-alt { color: var(--muted); font-size: 14px; } .gate-alt a { color: var(--gold); }
.gate-msg { color: #f0b0a4; font-weight: 600; margin: 0; }
.gate-agree { max-width: 560px; width: 100%; text-align: left; background: linear-gradient(#1d2829, #121a1b); border: 1px solid var(--line); border-radius: 16px; padding: 22px 20px; box-shadow: 0 30px 60px rgba(0,0,0,.6); animation: rise 1s var(--ease) both; }
.gate-agree h2 { font: 400 28px var(--fell); color: var(--bone); margin: 0 0 8px; }
.gate-agree p, .gate-agree li { font-size: 15px; line-height: 1.5; }
.gate-agree ul { padding-left: 18px; margin: 8px 0 16px; display: grid; gap: 8px; }
.gate-agree b { color: var(--bone); }
.gate-agree .gate-form { width: 100%; }
.gate-agree .gate-form input[type=text] { text-align: left; letter-spacing: 0; margin-top: 4px; }
.gate-agree label { display: block; font-weight: 700; font-size: 14px; } .gate-agree label small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.gate-check { display: flex !important; align-items: center; gap: 10px; font-weight: 600 !important; font-size: 15px !important; }
.gate-hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }
.gate-done { font-size: 16px !important; line-height: 1.6; margin: 8px 0 14px; }
.gate-check input { width: 22px; height: 22px; accent-color: var(--gold); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* The smallest phones (320–359 px wide, e.g. iPhone SE 1st gen): the strips' hand count was cut off, and the setup
   screen's bottom buttons ran off the left edge (Nov 15 2026). */
.start-row { flex-wrap: wrap; }
@media (max-width: 359px) {
  .rv .st { gap: 5px; } .rv .st > span:last-child { display: none; }
}
.cf-invite .row { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.cf-have { margin-top: 14px; }
.cf-have p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }

/* The lore recap on the end screen (recap.js): the game retold in the story world. Clipping in newsprint, then a book face. */
.lore-recap { text-align: left; display: grid; gap: 12px; animation: rise .8s 1.1s var(--ease) both; }
.lr-clip { background: #f2e9cf; color: #1b1916; border: 2px solid #1b1916; box-shadow: 4px 4px 0 #000; padding: 10px 14px 12px; transform: rotate(-.6deg); }
.lr-mast { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font: 400 15px/1.2 var(--sc); border-bottom: 3px double #1b1916; padding-bottom: 4px; margin-bottom: 8px; }
.lr-mast span { font: 700 10px/1.6 var(--ui); letter-spacing: .12em; text-transform: uppercase; }
.lr-head { font: 400 clamp(20px, 5.4vw, 28px)/1.1 var(--slab); letter-spacing: .01em; overflow-wrap: anywhere; }
.lr-dek { font: italic 15px/1.4 "Libre Caslon Text", var(--fell); margin-top: 6px; }
.lr-clip blockquote { margin: 10px 0 0; font: italic 15px/1.4 "Libre Caslon Text", var(--fell); }
.lr-clip cite { display: block; font: 700 10px var(--ui); font-style: normal; letter-spacing: .12em; text-transform: uppercase; margin-top: 4px; }
.lr-body { background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px 6px; font: 15.5px/1.6 "Libre Caslon Text", var(--fell); color: var(--text); }
.lr-body p { margin: 0 0 10px; }
.lr-body h4 { margin: 14px 0 6px; font: 800 11px var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.lr-body h4:first-of-type { margin-top: 10px; }
.lr-open { font: italic 17px/1.45 var(--fell); color: var(--bone); }
.lr-when { font-style: normal; font-family: var(--sc); }
.lr-inline { font: 400 .82em var(--slab); letter-spacing: .02em; color: var(--bone); }
