/* Rogue Doppelkopf game screens. Black, white, greys. Sprites scale by integer --px; motion is sub-pixel. */
/* note: sprite canvases carry an inline --w (their pixel width), so colours on a canvas itself use #fff, not var(--w) */
:root { --hud: 44px; --font: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
body { font-family: var(--font); background: linear-gradient(rgb(0 0 0 / .3), rgb(0 0 0 / .3)), var(--wood, none) repeat var(--k); background-size: auto, 640px auto; image-rendering: pixelated; }
#app { min-height: 100dvh; }
#app .sprite { width: calc(var(--w) * var(--px) * 1px); height: calc(var(--h) * var(--px) * 1px); max-width: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pt { display: inline-block; --px: 2; vertical-align: middle; }
h1, h2, h3 { margin: 0 0 .5em; font-weight: 700; color: var(--w); }
h2 { font-size: 1rem; } h3 { font-size: .9rem; }
p { margin: 0 0 .5em; }
.muted { color: var(--m); }
.chalk { color: var(--w); text-shadow: 0 0 1px var(--l); }

/* ---------- buttons: hard pixel edges ---------- */
.btn {
  font: inherit; font-weight: 700; color: var(--k); background: var(--l); border: 2px solid var(--k);
  box-shadow: 3px 3px 0 var(--k); padding: .45em .9em; cursor: pointer; min-height: 44px;
  transition: transform 120ms, box-shadow 120ms, background 120ms;
}
.btn:hover:not(:disabled) { background: var(--w); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--k); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--k); }
.btn.primary { background: var(--w); }
.btn.on { background: var(--k); color: var(--w); border-color: var(--w); }
.btn:disabled { background: var(--d); color: var(--m); cursor: not-allowed; box-shadow: none; }
.btn.small { min-height: 36px; padding: .25em .7em; font-size: .85rem; }
.btn.pulse { animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { background: var(--k); color: var(--w); outline: 3px solid var(--w); } }
:focus-visible { outline: 3px solid var(--w); outline-offset: 3px; }
button { font: inherit; color: inherit; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: .6em 0; }
.col { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

/* ---------- hud ---------- */
.hud {
  height: var(--hud); display: flex; align-items: center; gap: 16px; padding: 0 12px;
  background: var(--k); border-bottom: 2px solid var(--d); color: var(--l); font-size: .85rem; position: relative; z-index: 30;
}
.hud .logo { margin-right: auto; }
.hud .seed { color: var(--m); }

/* ---------- cards as buttons ---------- */
.pc, .kr { position: relative; background: none; border: 0; padding: 0; cursor: pointer; line-height: 0; }
.pc canvas, .kr canvas, .flyer canvas { filter: drop-shadow(calc(var(--px) * 1px) calc(var(--px) * 2px) 0 rgb(0 0 0 / .55)); }
.pc[aria-disabled="true"], .kr[aria-disabled="true"] { cursor: default; }
.illegal canvas { filter: brightness(.45) contrast(.8); }
.pc.illegal, .kr.illegal { cursor: not-allowed; }
.key {
  position: absolute; left: -6px; top: -6px; line-height: 1; font-size: .75rem; font-weight: 700;
  background: var(--k); color: var(--w); border: 2px solid var(--w); padding: 2px 5px;
}
.flyer { position: fixed; z-index: 50; pointer-events: none; line-height: 0; }
.flyer canvas { width: 100%; height: 100%; }
.won canvas, .flyer.won canvas { outline: 3px solid #fff; outline-offset: 2px; }

/* ---------- fight layout ---------- */
.fight {
  --px: 2; position: relative; display: grid; gap: 8px 16px; padding: 10px 14px 64px;
  grid-template-columns: 220px minmax(0, 1fr) 360px; grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "side table krem" "side hand krem"; min-height: calc(100dvh - var(--hud)); overflow-x: clip;
}
@media (min-width: 761px) { .fight { overflow-y: clip; } } /* draw-in animations start below the fold; no transient scrollbar */
.f-side { grid-area: side; display: flex; flex-direction: column; gap: 10px; }
.f-table { grid-area: table; position: relative; min-height: 360px; }
.f-hand { grid-area: hand; container-type: inline-size; display: flex; justify-content: center; align-items: flex-end; min-height: 220px; }
.f-krempel { grid-area: krem; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; }

.slate { --px: 2; align-self: flex-start; }
.props { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.props figure, .facts { background: rgb(0 0 0 / .6); padding: 4px 6px; }
.props figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .75rem; color: var(--l); }
.facts { font-size: .75rem; color: var(--l); display: flex; flex-direction: column; gap: 4px; width: 100%; }
.facts p { margin: 0; }
.inv { display: flex; flex-wrap: wrap; gap: 6px; --px: 1; }
.inv figure { margin: 0; padding: 4px; background: rgb(0 0 0 / .35); }

.seats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; justify-items: center; }
.seat { display: flex; flex-direction: column; align-items: center; }
.npc { position: relative; display: flex; flex-direction: column; align-items: center; }
.who { font-size: .75rem; background: var(--k); color: var(--w); padding: 1px 6px; margin-top: -8px; position: relative; z-index: 1; }
.slot { margin-top: -10px; transform: rotate(var(--r, 0deg)); transition: transform 200ms var(--ease-lift); }
.targeting .slot:not([aria-disabled]) { cursor: crosshair; }
.targeting .slot:not([aria-disabled]):hover { transform: rotate(0) translateY(-8px); }
.slot.deal { animation: deal 380ms cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i) * 90ms); }
@keyframes deal { from { transform: translateY(-80px) rotate(calc(var(--r) + 30deg)) scale(1.1); opacity: 0; } }
.tag {
  position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); line-height: 1.2; white-space: nowrap;
  font-size: .72rem; font-weight: 700; padding: 2px 6px; background: var(--k); color: var(--w); border: 2px solid var(--w);
}
.tag-leads { background: var(--l); color: var(--k); border-color: var(--k); }
.tag-leads.tag-winning { background: var(--w); }
.mine { position: absolute; left: 50%; bottom: 0; width: 128px; height: 140px; transform: translateX(-50%); }
.callout { margin: 0; font-size: .85rem; line-height: 1.35; background: rgb(0 0 0 / .8); border: 2px solid var(--d); padding: 6px 8px; }
.callout:empty { display: none; }
.peek { margin-bottom: auto; display: flex; gap: 8px; justify-content: center; }
.peek-row { position: relative; display: flex; gap: 4px; align-items: center; --px: 1; background: rgb(0 0 0 / .75); border: 2px solid var(--d); padding: 4px; }
.peek-label { font-size: .7rem; font-weight: 700; color: var(--w); writing-mode: vertical-rl; transform: rotate(180deg); }
.peek-cards { display: flex; line-height: 0; }
.peek-cards .sprite + .sprite { margin-left: -34px; }
.peek-row .btn { position: absolute; left: 50%; bottom: 4px; transform: translateX(-40%); min-height: 28px; padding: 2px 8px; }

.hand { display: flex; align-items: flex-end; padding-top: 30px; }
.hand-card { --cw: calc(64px * var(--px)); margin: 0 0 0 clamp(calc(var(--cw) * -0.75), calc((100cqw - 24px - var(--n) * var(--cw)) / max(1, var(--n) - 1)), -10px); transform: translateY(var(--y)) rotate(var(--r)); transition: transform 180ms var(--ease-lift); }
.hand-card:hover, .hand-card:focus-visible, .hand-card.sel, .hand-card.sel-tap { transform: translateY(calc(var(--y) - 26px)) rotate(calc(var(--r) * .3)) scale(1.04); z-index: 5; }
.hand-card.dealt { animation: drawn 420ms cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: 150ms; }
@keyframes drawn { from { transform: translate(120px, 160px) rotate(25deg); opacity: 0; } }
.hand-card.from-table { animation-name: from-table; }
@keyframes from-table { from { transform: translate(-40px, -320px) rotate(-30deg) scale(.6); opacity: 0; } }
.pv {
  position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%); width: max-content; max-width: 220px;
  line-height: 1.3; font-size: .78rem; font-weight: 700; padding: 3px 8px; background: var(--w); color: var(--k); border: 2px solid var(--k);
  opacity: 0; pointer-events: none; transition: opacity 120ms;
}
.hand-card:hover .pv, .hand-card:focus-visible .pv, .hand-card.sel-tap .pv { opacity: 1; }
.hand-card:first-child .pv { left: 0; transform: none; }
.hand-card:last-child:not(:first-child) .pv { left: auto; right: 0; transform: none; }
.hand-card.illegal .pv { background: var(--k); color: var(--w); border-color: var(--w); }

.armed { position: relative; z-index: 3; display: flex; gap: 6px; align-items: center; min-height: 40px; --px: 1; flex-wrap: wrap; justify-content: center; }
.armed-label { font-size: .75rem; color: var(--w); width: 100%; text-align: center; }
.armed-kr { margin: 0 6px 14px; transform: rotate(var(--r)); animation: arm 300ms cubic-bezier(.2, .8, .2, 1); }
@keyframes arm { from { transform: translateY(120px) rotate(0); opacity: 0; } }
.coaster { position: relative; display: grid; place-items: center; }
.coaster-bg { grid-area: 1 / 1; }
.side-hand { grid-area: 1 / 1; display: flex; align-items: center; justify-content: center; position: relative; }
.kr { margin: 0 4px; transform: translateY(var(--y)) rotate(var(--r)); transition: transform 180ms var(--ease-lift); }
.coaster.small .side-hand { --px: 1; flex-wrap: wrap; max-width: 300px; gap: 10px 0; }
.cost.up { background: var(--w); color: var(--k); border-color: var(--k); }
.kr:hover, .kr:focus-visible, .kr.sel, .kr.sel-tap { transform: translateY(calc(var(--y) - 20px)) rotate(0) scale(1.04); z-index: 5; }
.kr .key { left: auto; right: -4px; }
.cost, .now { position: absolute; left: 50%; transform: translateX(-50%); bottom: -8px; line-height: 1.2; font-size: .7rem; font-weight: 700;
  padding: 1px 5px; background: var(--k); color: var(--w); border: 2px solid var(--w); white-space: nowrap; }
.now { bottom: auto; top: -8px; background: var(--w); color: var(--k); border-color: var(--k); }
.empty { color: var(--d); font-weight: 700; max-width: 160px; text-align: center; }
.coaster-info { font-size: .72rem; color: var(--l); }

.tip {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0; min-height: 52px; padding: 8px 16px;
  background: var(--k); border-top: 2px solid var(--d); color: var(--w); font-size: .9rem; line-height: 1.4;
}
.cancel { position: fixed; right: 12px; bottom: 60px; z-index: 21; }

.spick { position: absolute; left: 14px; bottom: 70px; z-index: 25; max-width: 420px; }
.paper { background: var(--w); color: var(--k); border: 2px solid var(--k); box-shadow: 6px 6px 0 rgb(0 0 0 / .6); padding: 12px 14px; transform: rotate(-1deg); }
.paper h3 { color: var(--k); }

.overlay {
  position: absolute; left: 50%; top: 16%; transform: translateX(-50%); z-index: 70; width: min(480px, calc(100vw - 24px));
  background: var(--k); color: var(--l); border: 3px solid var(--w); box-shadow: 8px 8px 0 rgb(0 0 0 / .7); padding: 16px 18px;
  animation: pop 220ms cubic-bezier(.2, .9, .25, 1.15);
}
.overlay.tut { top: 8px; left: auto; right: 14px; transform: none; width: min(360px, calc(100vw - 24px)); animation: none; }
.overlay.end { top: 10%; width: min(560px, calc(100vw - 24px)); }
.overlay .math { font-size: 1.1rem; color: var(--w); font-weight: 700; }
.overlay .rule { border-left: 3px solid var(--w); padding-left: 8px; color: var(--w); }
.overlay .gt .btn { margin: 0 6px 6px 0; }
.landlord, .gain { display: flex; gap: 12px; align-items: flex-start; --px: 1; }
@keyframes pop { from { transform: translateX(-50%) scale(.92); opacity: 0; } }

/* ---------- map ---------- */
.map { display: flex; gap: 24px; padding: 12px 16px 24px; justify-content: center; align-items: flex-start; }
.map-main { display: flex; flex-direction: column; align-items: center; }
.town { position: relative; --px: 2; line-height: 0; border: 3px solid var(--k); box-shadow: 6px 6px 0 rgb(0 0 0 / .6); }
.town > canvas { display: block; }
.map-lines { position: absolute; inset: 0; }
.node { position: absolute; transform: translate(-50%, -50%); background: none; border: 0; padding: 6px; cursor: default; line-height: 0; border-radius: 50%; --px: 2; }
.node canvas { filter: brightness(.55); transition: transform 160ms var(--ease-lift); }
.node.reach { cursor: pointer; }
.node.reach canvas, .node.visited canvas, .node.here canvas { filter: none; }
.node.reach::after { content: ""; position: absolute; inset: 0; border: 3px solid var(--k); border-radius: 50%; animation: pulse-ring 900ms ease-in-out infinite alternate; }
@keyframes pulse-ring { to { inset: -6px; } }
.node.reach:hover canvas, .node.reach:focus-visible canvas { transform: scale(1.12) rotate(-4deg); }
.node.here::before { content: "YOU"; position: absolute; left: 50%; top: -14px; transform: translateX(-50%); line-height: 1.2; font-size: .7rem; font-weight: 700;
  background: var(--k); color: var(--w); padding: 1px 4px; }
.map-side { width: min(440px, 100%); display: flex; flex-direction: column; gap: 10px; }
.map-tip { position: static; min-height: 4.5em; border: 2px solid var(--d); }
.toast { background: var(--k); border: 2px solid var(--w); padding: 8px 10px; margin: 0; }

/* ---------- status & plain pages ---------- */
.status { background: rgb(0 0 0 / .78); border: 2px solid var(--d); padding: 12px; color: var(--l); font-size: .85rem; }
.status-top { display: flex; gap: 12px; align-items: center; --px: 2; }
.status-top p { margin: 0; } .big { font-size: 1.2rem; color: var(--w); font-weight: 700; }
.status h3 { margin-top: 12px; }
.deck { display: flex; flex-wrap: wrap; gap: 4px; --px: 1; }
.pc.mini { line-height: 0; }
.pc.pick { cursor: pointer; outline: 2px dashed var(--w); outline-offset: 2px; }
.pc.pick:hover { transform: translateY(-4px); }
.things { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.things li { display: flex; gap: 8px; align-items: flex-start; }
.things .tiny { --px: 1; flex: none; }
.page { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; padding: 16px 20px 32px; align-items: start; }
.page .main { background: rgb(0 0 0 / .78); border: 2px solid var(--d); padding: 16px 20px; color: var(--l); }
.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.offers.cards { display: flex; gap: 16px; --px: 2; }
.offer { display: flex; gap: 12px; align-items: flex-start; background: rgb(255 255 255 / .06); border: 2px solid var(--d); padding: 10px; --px: 1; }
.offer h3 { margin-bottom: .2em; }
.offer-card { transition: transform 160ms var(--ease-lift); }
.offer-card:hover:not(:disabled), .offer-card.sel { transform: translateY(-8px) rotate(-2deg); }
.offer-card.sel canvas { outline: 3px solid #fff; }
.offer-card:disabled canvas { filter: brightness(.45); }
.page > .overlay { position: fixed; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .fight { grid-template-columns: 200px minmax(0, 1fr); grid-template-areas: "side table" "hand hand" "krem krem"; }
  .f-krempel { flex-direction: row; justify-content: center; }
}
@media (max-width: 760px) {
  .hud { gap: 10px; font-size: .75rem; } .hud .logo { display: none; } .hud span:first-of-type { margin-right: auto; }
  .fight { --px: 1; grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "table" "hand" "krem"; padding: 8px 8px 96px; }
  .f-side { display: grid; grid-template-columns: auto 1fr; gap: 6px; align-items: start; }
  .props { --px: 1; flex-direction: column; align-items: stretch; gap: 6px; }
  .props figure { font-size: .7rem; }
  .facts, .inv { grid-column: 1 / -1; }
  .facts { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
  .f-table { min-height: 210px; }
  .f-table { padding-bottom: 84px; }
  .callout { grid-column: 1 / -1; }
  .mine { width: 64px; height: 70px; }
  .f-hand { --px: 2; min-height: 230px; }
  .f-krempel { flex-direction: column; --px: 2; }
  .armed { --px: 1; }
  .tag { font-size: .6rem; padding: 1px 3px; }
  .spick { left: 8px; right: 8px; top: 8px; }
  .tip { font-size: .8rem; min-height: 64px; }
  .cancel { bottom: 72px; }
  .map { flex-direction: column; align-items: center; padding: 8px; }
  .page { grid-template-columns: minmax(0, 1fr); padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* small coaster mode: labels sit under each Krempel so the sprite stays readable */
.coaster.small .kr { display: flex; flex-direction: column; align-items: center; gap: 3px; margin: 0 6px; }
.coaster.small .cost, .coaster.small .now { position: static; transform: none; }
.coaster.small .now { order: 2; }

.hand-card:first-child { margin-left: 0; }

/* ---------- tug-of-war tally ---------- */
.tally { margin: 0 auto 8px; max-width: 620px; }
.tally-head { display: flex; align-items: baseline; gap: 10px; font-size: .8rem; font-weight: 700; color: var(--w); line-height: 1.2; }
.tally-head .who-you, .tally-head .who-tab { background: var(--k); padding: 2px 6px; white-space: nowrap; }
.tally-head .who-you { background: var(--w); color: var(--k); }
.tally-say { flex: 1; text-align: center; background: rgb(0 0 0 / .75); padding: 2px 6px; }
.tally.reached .tally-say, .tally.won .tally-say { background: var(--w); color: var(--k); }
.bar { position: relative; height: 32px; margin-top: 4px; border: 3px solid var(--k); outline: 2px solid var(--l);
  background: repeating-linear-gradient(90deg, var(--k) 0 6px, #1c1c1c 6px 12px); }
.bar .fill, .bar .ghost { position: absolute; top: 0; bottom: 0; transition: width 450ms cubic-bezier(.2, .8, .2, 1), left 450ms, right 450ms; }
.bar .fill.you { left: 0; width: var(--you); background: var(--w); }
.bar .fill.tab { right: 0; width: var(--tab); background: repeating-conic-gradient(var(--l) 0 25%, var(--m) 0 50%) 0 0 / 4px 4px; box-shadow: inset 2px 0 0 var(--k); }
.bar .ghost.you { left: var(--you); width: var(--gy, 0%); background: repeating-linear-gradient(45deg, var(--w) 0 3px, transparent 3px 6px); }
.bar .ghost.tab { right: var(--tab); width: var(--gt, 0%); background: repeating-linear-gradient(-45deg, var(--m) 0 3px, transparent 3px 6px); }
.bar .goal { position: absolute; top: -9px; bottom: -9px; left: var(--goal); width: 4px; margin-left: -2px; background: var(--w); border: 1px solid var(--k); z-index: 2; }
.bar .goal b { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: .7rem; line-height: 1.2; white-space: nowrap;
  background: var(--w); color: var(--k); border: 2px solid var(--k); padding: 0 4px; }
.bar.flash-you .fill.you, .bar.flash-tab .fill.tab { animation: flash 700ms steps(2, jump-none) 3; }
@keyframes flash { 50% { filter: invert(1); } }
@media (max-width: 760px) { .tally-head { font-size: .7rem; flex-wrap: wrap; } .tally-say { order: 3; flex-basis: 100%; } .tally-head .who-tab { margin-left: auto; } }

/* ================= phone portrait: html.phone is set by ui.js for (max-width: 760px) and (orientation: portrait) ================= */
html.phone, .phone body { overscroll-behavior: none; }
html.phone:has(.fight) { overflow: hidden; }
.phone :is(button, summary, a) { touch-action: manipulation; }
.phone :is(.hud, .fight, .btn, .node, .pc, .kr, summary) { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.phone .btn, .phone .btn.small { min-height: 44px; }
.phone .hud { height: calc(var(--hud) + env(safe-area-inset-top, 0px)); gap: 12px; font-size: .8rem;
  padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px)); }
.phone .hud .logo { display: inline-block; margin-right: auto; }
.menu { position: relative; }
.menu summary { list-style: none; display: grid; place-items: center; min-width: 44px; min-height: 40px; cursor: pointer; color: var(--w); font-size: 1.1rem; border: 2px solid var(--d); }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { background: var(--w); color: var(--k); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 80; display: flex; flex-direction: column; gap: 8px; min-width: 200px;
  background: var(--k); border: 2px solid var(--w); box-shadow: 6px 6px 0 rgb(0 0 0 / .6); padding: 10px; }
.menu-pop p { margin: 0; color: var(--m); }

/* fight: three panels side by side, the track snaps to one at a time */
.phone .fight { display: block; height: calc(100dvh - var(--hud) - env(safe-area-inset-top, 0px)); min-height: 0; padding: 0; overflow: hidden; touch-action: pan-x pan-y; }
.phone .track { display: flex; height: 100%; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
.phone .track::-webkit-scrollbar { display: none; }
.phone .panel { flex: 0 0 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow-y: auto; overscroll-behavior-y: contain;
  padding: 8px max(8px, env(safe-area-inset-right, 0px)) max(22px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
.phone .p-flow { padding: 12px 44px calc(28px + env(safe-area-inset-bottom, 0px)) 12px; } .phone .p-kit { padding: 12px 12px calc(28px + env(safe-area-inset-bottom, 0px)) 44px; }
.phone .p-flow, .phone .p-kit { background: rgb(0 0 0 / .82); color: var(--l); font-size: .85rem; }
.phone .p-flow h3, .phone .p-kit h3 { margin-top: 14px; }
.facts-list { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; }
.facts-list dt { color: var(--m); } .facts-list dd { margin: 0; color: var(--w); font-weight: 700; }
.hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hist li { border-top: 2px solid var(--d); padding-top: 6px; }
.hist p { margin: 0 0 4px; }
.hcards { display: flex; gap: 6px; --px: 1; margin-bottom: 4px; }
.hcards figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .75rem; }
.hcards figure.won canvas { outline: 3px solid #fff; outline-offset: 1px; }
.rules { margin: 0; padding-left: 1.1em; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips span { background: var(--w); color: var(--k); font-weight: 700; padding: 1px 6px; }
.p-kit .paper { transform: none; margin-top: 4px; }

/* centre: bar, status, trick, callout, then the thumb zone (Krempel row, preview line, hand) */
.phone .p-table { display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.phone .p-table .tally { width: 100%; max-width: none; margin: 0; flex: none; }
.phone .tally-head, .phone .bar .goal b, .phone .peek-label { font-size: .75rem; }
.phone .bar { height: 24px; }
.phone .ph-status { margin: 16px 0 0; flex: none; font-size: .78rem; line-height: 1.3; color: var(--w); text-align: center; background: rgb(0 0 0 / .65); padding: 2px 6px; }
.phone .p-table .f-table { flex: 1 1 auto; min-height: 0; padding: 0 30px; display: flex; align-items: center; justify-content: center; }
.phone .seats { grid-template-columns: repeat(4, 64px); gap: 8px; }
.phone .npc .sprite { display: none; }
.phone .who { margin: 0 0 3px; font-size: .75rem; white-space: nowrap; }
.phone .slot { margin-top: 0; }
.phone .mine { position: static; transform: none; width: 64px; height: 96px; border: 2px dashed var(--m); background: rgb(0 0 0 / .35); }
.phone .tag { font-size: .75rem; padding: 1px 4px; white-space: normal; width: max-content; max-width: 72px; text-align: center; }
.phone .callout { flex: none; font-size: .8rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.phone .callout:empty { display: none; }
.phone .peek { flex: none; margin: 0; --px: 1; }
.phone .peek-row .btn { min-height: 44px; }
.phone .thumb { flex: none; display: flex; flex-direction: column; gap: 6px; }
.phone .tray-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.phone .tray { display: flex; align-items: flex-end; gap: 6px; flex: 1; min-width: 0; --px: 1; }
.phone .tk { flex: 0 1 56px; min-width: 44px; height: 84px; margin: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; transform: none; }
.phone .tk:is(:hover, :focus-visible, .sel, .sel-tap) { transform: none; }
.phone .tk canvas { flex: none; }
.phone .tk .cost { bottom: 0; font-size: .75rem; }
.phone .tk.on { transform: translateY(-6px); outline: 3px solid var(--w); outline-offset: -3px; }
.phone .tk.on .cost { background: var(--w); color: var(--k); border-color: var(--k); }
.phone .tk.sel { outline: 3px dashed var(--w); outline-offset: -3px; }
.phone .tray .empty { margin: 0; font-size: .8rem; color: var(--l); background: rgb(0 0 0 / .6); padding: 2px 6px; max-width: none; }
.phone .ph-hud { display: flex; gap: 6px; align-items: flex-end; flex: none; --px: 1; }
.phone .ph-hud figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .75rem; color: var(--l); background: rgb(0 0 0 / .6); padding: 2px 4px; }
.phone .say { display: flex; gap: 8px; align-items: stretch; min-height: 44px; }
.phone .say .tip { position: static; flex: 1; min-height: 0; margin: 0; padding: 4px 8px; font-size: .8rem; line-height: 1.3; border: 2px solid var(--d); background: rgb(0 0 0 / .8); }
.phone .say .btn { flex: none; }
.phone .p-table .f-hand { --px: 2; min-height: 0; flex: none; }
.phone .p-table .f-hand.many { --px: 1; }
@media (max-height: 740px) { .phone .p-table .f-hand { --px: 1; } }
.phone .hand { padding-top: 22px; }
.phone .hand-card .pv { display: none; }
.phone .key { font-size: .75rem; }

/* paging controls: labelled edge tabs (the way in without swiping) and page dots */
.phone .edge { position: absolute; top: 38%; z-index: 15; width: 30px; min-height: 96px; padding: 10px 0; writing-mode: vertical-rl;
  font: inherit; font-size: .75rem; font-weight: 700; line-height: 1; background: var(--k); color: var(--w); border: 2px solid var(--w); cursor: pointer; }
.phone .edge::after { content: ""; position: absolute; inset: -8px -14px; }
.phone .edge.prev { left: env(safe-area-inset-left, 0px); border-left: 0; transform: rotate(180deg); }
.phone .edge.next { right: env(safe-area-inset-right, 0px); border-right: 0; }
.phone .edge[hidden] { display: none; }
.phone .dots { position: absolute; left: 50%; bottom: max(6px, calc(env(safe-area-inset-bottom, 0px) - 14px)); transform: translateX(-50%); z-index: 15; display: flex; gap: 8px; pointer-events: none; padding: 3px 5px; background: rgb(0 0 0 / .7); }
.phone .dots i { width: 8px; height: 8px; background: var(--d); border: 1px solid var(--k); }
.phone .dots i.on { background: var(--w); }

/* sheets: overlays, the Krempel sheet and page actions sit at the bottom, above the home indicator */
.phone .overlay { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; transform: none; max-height: 82dvh; overflow-y: auto;
  border-width: 3px 0 0; box-shadow: 0 -6px 0 rgb(0 0 0 / .6); padding: 14px max(14px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
  animation: sheet 220ms cubic-bezier(.2, .9, .25, 1); }
.phone .overlay .row { position: sticky; bottom: 0; margin-bottom: 0; padding: 6px 0 2px; background: var(--k); }
.phone .overlay.tut { left: 0; right: 0; width: auto; }
.phone .overlay.tut.high { top: calc(var(--hud) + env(safe-area-inset-top, 0px)); bottom: auto; border-width: 0 0 3px; box-shadow: 0 6px 0 rgb(0 0 0 / .6); padding-bottom: 10px; }
.phone .overlay.tut.high .row { position: static; }
@keyframes sheet { from { transform: translateY(30px); opacity: 0; } }
.ksheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; gap: 12px; align-items: flex-start; --px: 1; max-height: 75dvh; overflow-y: auto;
  background: var(--k); color: var(--l); font-size: .85rem; border-top: 3px solid var(--w); box-shadow: 0 -6px 0 rgb(0 0 0 / .6);
  padding: 14px max(14px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)); animation: sheet 200ms cubic-bezier(.2, .9, .25, 1); }
.ksheet .sprite { flex: none; }

/* other screens: one column, scroll vertically, main action pinned at the bottom */
.phone .page { padding: 8px max(8px, env(safe-area-inset-right, 0px)) calc(84px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); gap: 10px; }
.phone .page .main { padding: 12px; }
.phone .offers { grid-template-columns: minmax(0, 1fr); }
.phone .offers.cards { flex-wrap: wrap; justify-content: center; }
.phone .actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; margin: 0; background: var(--k); border-top: 2px solid var(--d);
  padding: 10px max(12px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
.phone .actions .btn { flex: 1; }
.phone .map { padding: 6px 4px calc(16px + env(safe-area-inset-bottom, 0px)); gap: 10px; }
.phone .map-side { width: 100%; }
.phone .node.here::before { font-size: .75rem; }
.status-fold > summary { min-height: 44px; display: flex; align-items: center; padding: 0 12px; cursor: pointer; font-weight: 700; color: var(--w); background: rgb(0 0 0 / .78); border: 2px solid var(--d); }
.status-fold[open] > summary { border-bottom: 0; }
.phone .p-table > .callout, .phone .p-table > .peek { margin-inline: 30px; }
/* no sticky hover lift on touch: only the tapped selection lifts */
.phone .hand-card:not(.sel-tap, .sel, :focus-visible) { transform: translateY(var(--y)) rotate(var(--r)); }
/* the trick never shrinks under other content; if a rare extra (Hohepriesterin peek) does not fit, the panel scrolls rather than overlap */
.phone .p-table { overflow-y: auto; }
.phone .p-table .f-table { flex: 1 0 auto; }
@media (max-height: 760px) {
  .phone .ph-status { margin-top: 12px; }
  .phone .p-table { gap: 4px; }
  .phone #app .peek-cards .sprite { height: 52px; object-fit: cover; object-position: top; } /* corner indices stay readable */
  .phone .p-table:has(.peek) > .callout { display: none; }
}
@media (max-height: 860px) { .phone .p-table:has(.peek) .f-hand { --px: 1; } }
.phone .p-table > .callout { padding-bottom: 0; border-bottom-width: 4px; } /* clamped lines must not peek through the padding */
