/* Modernist, like a subway map: pure black, white type in Inter, and a bright color for
   each player, used the same way everywhere. */
@font-face { font-family: "Inter"; src: url("fonts/InterVariable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter Display"; src: url("fonts/InterDisplay-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter Display"; src: url("fonts/InterDisplay-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
:root {
  --bg: #000;
  --surface: #0d0d0d;
  --line: #262626;
  --text: #fff;
  --dim: #a3a3a3;
  --faint: #636363;
  /* the players' colors, as on the map */
  --p1: #ee352e; --p2: #0062cf; --p3: #00933c; --p4: #fccc0a; --p5: #ff6319; --p6: #b933ad;
  --card-w: 96px;
  --land-w: 70px;
  --hand-w: 76px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
  font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-optical-sizing: auto;
  font-feature-settings: "tnum" 0, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
#seat-p1, .p1 { --pc: var(--p1); } #seat-p2, .p2 { --pc: var(--p2); } #seat-p3, .p3 { --pc: var(--p3); }
#seat-p4, .p4 { --pc: var(--p4); --pc-ink: #000; } #seat-p5, .p5 { --pc: var(--p5); } #seat-p6, .p6 { --pc: var(--p6); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
body { overflow: hidden; }
button, select, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.fill { fill: currentColor; stroke: none; }

#app { display: flex; height: 100dvh; }
#board { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ------------------------------------------------------------------ top bar */
#bar { display: flex; align-items: center; gap: 14px; padding: 12px 20px; color: var(--dim); font-size: 13px; }
#picker { position: relative; color: var(--text); font-weight: 500; cursor: pointer; }
#picker::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0 3px 8px; border: solid var(--dim); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
#game-pick { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#live { font-size: 12px; color: var(--dim); display: inline-flex; align-items: center; gap: 6px; }
#live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #e5484d; }
#live.behind::before { background: var(--faint); }
/* the next game being set up: a quiet pill, and a card over the table */
#next { font-size: 12px; color: var(--dim); display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap; }
#next::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dim); animation: wait 1.6s ease-in-out infinite; }
#next.open, #next:hover { color: var(--text); }
#middle { flex-direction: column; align-items: center; gap: 10px; }
.prep { width: min(340px, 100%); padding: 14px 16px; background: #000000f0; border-radius: 12px; box-shadow: 0 8px 30px #000a; animation: pop .28s var(--ease); font-size: 13px; }
.prep .hd { display: flex; align-items: baseline; gap: 10px; }
.prep .hd b { font-size: 15px; font-weight: 600; }
.prep .stage { color: var(--dim); }
.prep .stage::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--dim); margin: 0 6px 1px 0; animation: wait 1.6s ease-in-out infinite; }
.prep ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.prep li { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; }
.prep li .who { color: var(--faint); }
.prep li .deck { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prep li .note { grid-column: 2; color: var(--dim); font-size: 12px; }
.prep p { margin: 10px 0 0; color: var(--dim); font-size: 12px; line-height: 1.4; }
#where { margin-left: auto; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#picker, #live, #clock { flex: none; white-space: nowrap; }
#clock { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ table */
#table { flex: 1; min-height: 0; overflow-y: auto; position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 4px 20px; }
.seat { display: flex; flex-direction: column; gap: 10px; padding: 8px 12px; margin: 0 -12px; }
.seat.bottom { flex-direction: column-reverse; }
.who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; white-space: nowrap; min-width: 0; }
.who .name { font-size: 13px; color: var(--dim); }
/* whose turn: their seat is lit, their name and step are bright */
.seat { border-radius: 14px; transition: background-color .35s var(--ease, ease); }
.seat.turn { background: transparent; }
.seat.turn .who .name { color: var(--text); }
.who .phase { font-size: 12px; color: var(--text); }
/* who the table is waiting on: a softly pulsing dot before the name */
.who .name.waiting::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--text); margin: 0 7px 1px 0; animation: wait 1.6s ease-in-out infinite; }
@keyframes wait { 0%, 100% { box-shadow: 0 0 0 0 #ececec55; } 50% { box-shadow: 0 0 0 4px #ececec00; } }
@media (prefers-reduced-motion: reduce) { .who .name.waiting::before { animation: none; } }
.who .life { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.who .life { display: inline-block; }
.life-float { position: fixed; z-index: 50; font-size: 13px; font-weight: 600; color: var(--text); pointer-events: none; }
.who .meta { margin-left: auto; display: flex; gap: 14px; font-size: 12px; color: var(--faint); }
.who .meta button { color: var(--faint); }
.who .meta button:hover { color: var(--text); }
.who .trace-link { font-size: 12px; color: var(--dim); }
.who .trace-link:hover { color: var(--text); }

.rows { display: flex; flex-direction: column; gap: 8px; }
.seat.top .rows { flex-direction: column-reverse; }
.row { display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; min-width: 0; }
.row:empty { display: none; }
.row.lands { --card-w: var(--land-w); gap: 4px; }
.row.hand { --card-w: var(--hand-w); padding-left: 12px; gap: 0; }
.row.hand .card { margin-left: -12px; }
.row.hand .card:hover { transform: translateY(-6px); z-index: 2; }

/* ------------------------------------------------------------------ cards */
.card { position: relative; width: var(--card-w); aspect-ratio: 63 / 88; border-radius: 5%; background: #222; flex: none; box-shadow: 0 1px 2px #0009, 0 4px 14px #0004; cursor: zoom-in; }
.card img { width: 100%; height: 100%; border-radius: 5%; display: block; }
.card.tapped { transform: rotate(90deg); margin: 0 calc(var(--card-w) * .2); }
.card.tapped .note { display: none; }
.card.attacking { transform: translateY(-10px); }
.card.tapped.attacking { transform: translateY(-10px) rotate(90deg); }
.card .badge { position: absolute; right: -5px; bottom: 10%; min-width: 22px; text-align: center; background: #000000ee; border-radius: 10px; padding: 1px 6px; font-size: 11px; font-weight: 600; }
.card .badge.damage { right: auto; left: -5px; }
.card .note { position: absolute; left: 4%; right: 4%; bottom: 4%; background: #000000e6; font-size: 10px; line-height: 1.25; padding: 3px 4px; border-radius: 3px; }

/* ------------------------------------------------------------------ middle: stack and result float over the table, taking no room */
#middle { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 20; display: flex; justify-content: center; pointer-events: none; padding: 0 12px; }
#middle > * { pointer-events: auto; }
.stack { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; background: #000000f0; border-radius: 10px; box-shadow: 0 6px 24px #000c; max-width: 100%; font-size: 12px; color: var(--dim); }
.stack .card { --card-w: 34px !important; box-shadow: none; }
.stack .top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.stack .top div { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack .top b { color: var(--text); font-weight: 500; }
.stack .under { display: flex; gap: 3px; padding-left: 10px; border-left: 1px solid var(--line); }
.stack .under .card { --card-w: 24px !important; opacity: .75; }
.stack, .result { animation: pop .28s var(--ease); }
@keyframes pop { from { opacity: 0; scale: .96; } }
.result { text-align: center; padding: 14px 22px; background: #000000ee; border-radius: 12px; box-shadow: 0 8px 30px #000a; }
.result b { display: block; font-size: 20px; font-weight: 600; }
.result span { color: var(--dim); font-size: 13px; }

/* ------------------------------------------------------------------ controls */
#controls { display: flex; align-items: center; gap: 2px; padding: 8px 14px 12px; }
#controls button { color: var(--dim); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; }
#controls button:hover { color: var(--text); background: #ffffff0a; }
#controls #play { color: var(--text); }
/* the timeline: played part bright, key moments marked on the track, a label while you drag */
#timeline { position: relative; flex: 1; margin: 0 10px; min-width: 0; height: 28px; display: flex; align-items: center; }
#scrub { position: relative; z-index: 1; width: 100%; margin: 0; height: 28px; accent-color: var(--text); -webkit-appearance: none; appearance: none; background: transparent; touch-action: none; }
#scrub::-webkit-slider-runnable-track { height: 3px; background: transparent; }
/* the rail sits under the range input, so the thumb rides over the marks */
#marks { position: absolute; left: 6px; right: 6px; top: 50%; height: 3px; margin-top: -1.5px; z-index: 0; pointer-events: none; border-radius: 2px;
  background: linear-gradient(to right, #ffffff55 var(--p, 0%), var(--line) var(--p, 0%)); }
#marks i { position: absolute; top: -3px; width: 2px; height: 9px; margin-left: -1px; border-radius: 1px; background: var(--dim); }
#marks i.strong { background: var(--text); }
#tip { position: absolute; bottom: 30px; z-index: 5; width: max-content; max-width: min(260px, 80vw); padding: 5px 9px; border-radius: 8px; background: var(--surface); color: var(--dim); font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 6px 20px #000a; pointer-events: none; }
#tip.key { color: var(--text); white-space: normal; }
#scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--text); margin-top: -5px; }
#scrub::-moz-range-track { height: 3px; background: transparent; }
#scrub::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: var(--text); }
#speed { font-size: 12px; font-variant-numeric: tabular-nums; width: 36px; }

/* ------------------------------------------------------------------ trace */
#trace { width: 380px; flex: none; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--surface); min-height: 0; }
#tabs { display: flex; gap: 18px; padding: 14px 18px 0; font-size: 13px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
#tabs button { color: var(--dim); padding: 0 0 11px; border-bottom: 1.5px solid transparent; white-space: nowrap; }
#tabs button.on { color: var(--text); border-color: var(--text); }
#tabs .close { display: none; margin-left: auto; padding-bottom: 11px; }
#feed { flex: 1; overflow-y: auto; padding: 14px 18px 28px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; line-height: 1.5; }
#calls { display: none; gap: 8px; align-items: center; padding: 10px 18px; font-size: 12px; color: var(--dim); border-top: 1px solid var(--line); }
#trace.player #calls { display: flex; }
#calls input { accent-color: var(--text); margin: 0; }

.e { white-space: pre-wrap; overflow-wrap: anywhere; }
.e.hidden { display: none; }
.e.log, .e.note { color: var(--dim); font-size: 12.5px; }
.e.turn { color: var(--text); font-weight: 600; font-size: 12px; margin-top: 10px; }
.e .by { color: var(--faint); font-size: 11.5px; display: block; margin-bottom: 1px; }
.e.think { color: var(--dim); font-style: italic; }
/* what a player writes that only they (and we) can see stays dim; table chatter is bright */
.e.say { color: var(--dim); }
.e.chat { color: var(--text); }
.e.ruling { color: var(--dim); cursor: pointer; }
/* the booth: bright like table talk, set off by a hairline; the call a little firmer */
.e.booth { border-left: 2px solid var(--faint); padding-left: 10px; color: var(--text); }
.e.booth.call-line { font-weight: 600; }
.e.call { font: 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--faint); display: none; }
#feed.calls .e.call { display: block; }
.e.call.bad { text-decoration: line-through; }
.e.sec { color: var(--text); font-weight: 600; margin-top: 12px; }
.e.empty { color: var(--faint); }
/* tabs filter the one feed */
/* thinking lives in each player's own tab */
/* All is the story of the game: what happens on the table and what players say to each other */
#feed[data-tab="all"] .e:not(.story):not(.turn) { display: none; }
/* All: plain actions flow together as one line; everything else keeps its own row */
#feed[data-tab="all"] { display: block; }
#feed[data-tab="all"] .e { margin: 10px 0; }
#feed[data-tab="all"] .e.log.story:not(.hidden) { display: inline; margin: 0; white-space: normal; }
#feed[data-tab="all"] .e.log.story.next::after { content: " "; }
#feed[data-tab="all"] .e.log.story.more::after { content: ", "; }
#feed[data-tab="all"] .e.log.story.same .s, #feed[data-tab="all"] .e.log.story.more .p { display: none; }
#feed[data-tab="log"] .e:not(.log):not(.note):not(.chat):not(.turn):not(.ruling) { display: none; }
#feed[data-tab="p1"] .e:not(.p1),
#feed[data-tab="p2"] .e:not(.p2),
#feed[data-tab="p3"] .e:not(.p3),
#feed[data-tab="p4"] .e:not(.p4),
#feed[data-tab="p5"] .e:not(.p5),
#feed[data-tab="p6"] .e:not(.p6),
#feed[data-tab="judge"] .e:not(.judge) { display: none !important; }
#feed:not([data-tab="all"]) .e .by { display: none; }

/* ------------------------------------------------------------------ card peek */
#peek { position: fixed; z-index: 60; width: 280px; pointer-events: none; }
#peek img { width: 100%; border-radius: 4.5%; display: block; box-shadow: 0 14px 40px #000c; }
#peek .o { margin-top: 10px; padding: 12px 14px; background: var(--surface); border-radius: 10px; font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; box-shadow: 0 14px 40px #000a; }
#peek .o .h { display: flex; justify-content: space-between; font-weight: 600; }
#peek .o .tl { color: var(--dim); margin: 1px 0 6px; }
#peek .o .set { color: var(--faint); font-size: 11px; margin-top: 8px; }
#peek.zone { pointer-events: auto; width: auto; max-width: min(640px, 92vw); padding: 16px; background: var(--surface); border-radius: 14px; box-shadow: 0 14px 40px #000c; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); }
#peek.zone .t { color: var(--dim); font-size: 12px; margin-bottom: 10px; }
#peek.zone .row { --card-w: 74px; max-height: 60vh; overflow-y: auto; }

#scrim, #strip { display: none; }

/* ------------------------------------------------------------------ phone */
@media (max-width: 860px) {
  :root { --card-w: 52px; --land-w: 38px; --hand-w: 44px; }
  #bar { padding: 10px 14px 4px; gap: 10px; font-size: 12px; }
  #table { padding: 0 14px; }
  .seat { gap: 6px; padding: 6px 8px; margin: 0 -8px; }
  .rows, .row { gap: 4px; }
  .row.hand { padding-left: 8px; }
  .row.hand .card { margin-left: -8px; }
  .who { gap: 9px; }
  .who .life { font-size: 21px; }
  .who .meta { gap: 9px; font-size: 11px; }
  .who .deck, .who .trace-link { font-size: 11px; }
  .card { box-shadow: 0 1px 2px #0009; }
  .card .badge { font-size: 9.5px; padding: 0 4px; min-width: 16px; }
  .card .note { display: none; }

  /* the latest lines rise from the bottom, fading out toward the top */
  #strip { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; height: 92px; flex: none; overflow: hidden; padding: 0 16px 4px; font-size: 12.5px; line-height: 1.4; cursor: pointer;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 70%); mask-image: linear-gradient(to bottom, transparent, #000 70%); }
  #strip .e { flex: none; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
  #strip .e .by { display: inline; margin: 0 4px 0 0; }
  #strip .e.in { animation: rise .4s var(--ease); }
  @keyframes rise { from { transform: translateY(12px); opacity: 0; } }
  #controls { padding: 2px 8px calc(8px + env(safe-area-inset-bottom)); }
  #controls button { width: 34px; }
  /* a phone gets the timeline across the full width, above the buttons, like a video */
  #controls { flex-wrap: wrap; }
  #timeline { order: -1; flex: 0 0 calc(100% - 12px); margin: 0 6px; height: 22px; }
  #scrub { height: 22px; }
  #clock { margin-left: auto; }

  /* the full trace is a sheet over the darkened board */
  #trace { position: fixed; left: 0; right: 0; bottom: 0; top: 10vh; width: auto; z-index: 40; border: 0; border-radius: 16px 16px 0 0;
    transform: translateY(105%); transition: transform .32s var(--ease); box-shadow: 0 -10px 40px #000a; }
  body.sheet #trace { transform: none; }
  #scrim { display: block; position: fixed; inset: 0; z-index: 30; background: #000; opacity: 0; pointer-events: none; transition: opacity .32s var(--ease); }
  body.sheet #scrim { opacity: .6; pointer-events: auto; }
  #tabs { gap: 16px; padding: 16px 16px 0; }
  #tabs .close { display: block; }
  #feed { padding: 14px 16px calc(28px + env(safe-area-inset-bottom)); }
  #peek { width: min(250px, 70vw); left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); }
  #peek, #peek.zone { box-shadow: 0 0 0 100vmax #0009; border-radius: 12px; }
  #peek .o { max-height: 30vh; overflow-y: auto; }
}
.who .deck { font-size: 12px; color: var(--faint); }

/* markdown in the players' and judge's words */
.e p, .e ul, .e ol { white-space: normal; margin: 0 0 6px; }
.e > :last-child { margin-bottom: 0; }
.e ul, .e ol { padding-left: 18px; }
.e li { margin: 2px 0; }
.e strong { font-weight: 600; }
.e code { font: 12px ui-monospace, monospace; }
.e .md-h { font-weight: 600; margin-top: 8px; }
@media (max-width: 860px) {
  #strip .e p, #strip .e ul, #strip .e ol, #strip .e li { display: inline; margin: 0; padding: 0; }
  #strip .e li::before { content: "· "; }
  #strip .e p::after { content: " "; }
  #strip .e .md-h, #strip .e strong { font-weight: inherit; color: inherit; }
  #strip .e .md-h::after { content: " · "; }
  #strip .e .md-h + ul > li:first-child::before, #strip .e .md-h + ol > li:first-child::before { content: ""; }
}

/* ------------------------------------------------------------------ more than two players */
/* four quadrants around the table; top seats face down, bottom seats face up */
#table.multi { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); grid-template-rows: 1fr 1fr; column-gap: 0; padding: 4px 8px; row-gap: 0; }
#table.multi .seat { min-width: 0; min-height: 0; overflow: hidden; margin: 0; }
#table.multi .seat.top { justify-content: flex-start; }
#table.multi .seat.bottom { justify-content: flex-start; }
.seat.out { opacity: .35; }
#table.no-hands .row.hand { display: none; }
/* attackers lean toward the middle of the table */
#table.multi .seat.top .card.attacking { transform: translateY(10px); }
#table.multi .seat.top .card.tapped.attacking { transform: translateY(10px) rotate(90deg); }
#table.multi .row { flex-wrap: wrap; row-gap: 4px; column-gap: 4px; }
#table.multi .row.hand .card { margin-left: 0; }
#table.multi .row.hand { padding-left: 0; }
.card.command { opacity: .55; }
.card.command:hover { opacity: 1; }
#tabs { overflow-x: auto; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }
@media (max-width: 860px) {
  #table.multi { padding: 0 6px; }
  #table.multi .seat { margin: 0; }
  #table.multi .who { flex-wrap: wrap; row-gap: 0; column-gap: 8px; }
  #table.multi .who .deck, #table.multi .who .trace-link { display: none; }   /* the strip opens every trace */       /* the commander card says it */
  #table.multi .who .meta { width: 100%; margin-left: 0; gap: 2px 7px; font-size: 10.5px; flex-wrap: wrap; }
  #table.multi .who .life { font-size: 19px; }
}
#table.multi .card .note { display: none; }       /* too small to read; the close-up shows it */

/* a card with no art: its name, rules text and power/toughness, scaled to the card; a
   small card keeps just the name and power/toughness */
.card.text-only { background: #2a2b2e; padding: calc(var(--card-w) * .08); container-type: inline-size; overflow: hidden; color: var(--dim); display: flex; flex-direction: column; justify-content: space-between; }
.card.text-only b { display: block; color: var(--text); font-size: max(7px, 14cqi); line-height: 1.15; font-weight: 600; overflow-wrap: normal; max-height: 3.45em; overflow: hidden; flex: none; }
.card.text-only .rules { flex: 1; min-height: 0; margin-top: 4%; font-size: 10.5cqi; line-height: 1.25; overflow: hidden; }
.card.text-only .pt { flex: none; align-self: flex-end; color: var(--text); font-weight: 600; font-size: max(7px, 14cqi); }
@container (max-width: 64px) { .card.text-only .rules { display: none; } }

/* ------------------------------------------------------------------ attachments */
/* An Aura or Equipment tucks behind its host with its name strip showing above it. */
.card.host { isolation: isolate; margin-top: calc(var(--att) * var(--step) * var(--card-w)); }
.card.host.tapped { margin-top: 0; margin-right: calc(var(--card-w) * (.2 + var(--att) * var(--step))); }
.card > .card.attached { position: absolute; left: 0; top: calc(var(--i) * var(--step) * var(--card-w) * -1); width: 100%; margin: 0; z-index: -1; box-shadow: 0 1px 2px #0009; }
.card.attached .badge, .card.attached .note { display: none; }
.row.hand .card.attached:hover { transform: none; }
#peek .att { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#peek .att img { width: calc((100% - 18px) / 4); border-radius: 4.5%; box-shadow: 0 8px 20px #000a; }
#peek .att .att-name { padding: 8px 10px; background: var(--surface); border-radius: 8px; font-size: 12px; }
.card.host.text-only { overflow: visible; }

/* ------------------------------------------------------------------ key moments */
/* One small shape per kind of moment, the same on the timeline and beside its line in the
   log: a speech bubble for the booth's call, a crown for a commander cast, a cross for a
   knockout, a star for the win, a bolt for a big hit, a ring for a board wipe, a diamond
   for a judge's ruling. */
[data-icon="call"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 1.5h8v5.5H4.5L2 9.2V7H1z'/%3E%3C/svg%3E"); }
[data-icon="commander"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M.8 8.6h8.4L9.4 2.6 6.8 4.8 5 1.4 3.2 4.8.6 2.6z'/%3E%3C/svg%3E"); }
[data-icon="out"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2.2 1 5 3.8 7.8 1 9 2.2 6.2 5 9 7.8 7.8 9 5 6.2 2.2 9 1 7.8 3.8 5 1 2.2z'/%3E%3C/svg%3E"); }
[data-icon="win"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M5 .4l1.4 3.1 3.3.3-2.5 2.2.8 3.3L5 7.6 2 9.3l.8-3.3L.3 3.8l3.3-.3z'/%3E%3C/svg%3E"); }
[data-icon="hit"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M6.2 .3 1.6 5.9h3.1L3.8 9.7l4.6-5.6H5.3z'/%3E%3C/svg%3E"); }
[data-icon="wipe"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath fill-rule='evenodd' d='M5 .8a4.2 4.2 0 1 0 0 8.4A4.2 4.2 0 1 0 5 .8zm0 2.2a2 2 0 1 1 0 4 2 2 0 1 1 0-4z'/%3E%3C/svg%3E"); }
[data-icon="judge"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M5 .6 9.4 5 5 9.4.6 5z'/%3E%3C/svg%3E"); }
#marks i.ico { position: absolute; top: auto; bottom: 5px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 0; background: var(--dim);
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
#marks i.ico.strong { background: var(--text); }
#feed .e[data-icon]::before, #strip .e[data-icon]::before { content: ""; display: inline-block; width: .8em; height: .8em; margin: 0 .45em -.05em 0; background: currentColor; opacity: .8;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
/* a line with a header (a judge's ruling) carries its mark on the header */
#feed .e[data-icon]:has(> .by)::before, #strip .e[data-icon]:has(> .by)::before { display: none; }
#feed .e[data-icon] > .by::before, #strip .e[data-icon] > .by::before { content: ""; display: inline-block; width: .9em; height: .9em; margin: 0 .45em -.1em 0; background: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }

/* a token copy of a card: the card's art with a small copy mark (two stacked cards), and
   the copy's own power/toughness beside it when it differs from the print */
.card .copy-mark { position: absolute; left: -4px; top: 8%; display: flex; align-items: center; gap: 3px; background: #000000ee; border-radius: 10px; padding: 2px 5px; font-size: 11px; font-weight: 600; line-height: 1; }
.card .copy-mark i { width: 10px; height: 10px; background: var(--text); flex: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath fill-rule='evenodd' d='M3 0h7v8H3zM4 1v6h5V1zM0 2h2v1H1v6h5V8h1v2H0z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath fill-rule='evenodd' d='M3 0h7v8H3zM4 1v6h5V1zM0 2h2v1H1v6h5V8h1v2H0z'/%3E%3C/svg%3E") center / contain no-repeat; }
@media (max-width: 860px) { .card .copy-mark { font-size: 9.5px; padding: 1px 4px; } .card .copy-mark i { width: 8px; height: 8px; } }

/* ------------------------------------------------------------------ the 3D table (/3d)
   The flat layout still places everything; its cards are hidden and drawn on the canvas
   underneath, and clicks fall through the seats to it. */
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.three #gl { display: block; }
.three #table { overflow: hidden; }
.three #table > .seat { position: relative; z-index: 1; }
.three #table > #middle { z-index: 21; }
.three #middle .stack { opacity: 0; pointer-events: none; animation: none; }
.three .seat { pointer-events: none; background: none !important; overflow: visible !important; }
.three .seat .who, .three .seat .who button { pointer-events: auto; }
.three .seat .card { visibility: hidden; animation: none !important; transition: none !important; }
.three .seat.out { opacity: 1; }
.three .seat.out .who { opacity: .35; }
.three .who { text-shadow: 0 1px 6px #000c; }
.row.zones { --card-w: var(--land-w); gap: 8px; }
#reset-view { position: absolute; right: 12px; bottom: 10px; z-index: 22; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: #000000cc; color: var(--dim); box-shadow: 0 2px 10px #0008; transition: opacity .25s var(--ease); }
#reset-view:hover { color: var(--text); }
#reset-view[hidden] { display: grid !important; opacity: 0; pointer-events: none; }
#reset-view svg { width: 16px; height: 16px; }
#gl { touch-action: none; }
#view { font-size: 12px; color: var(--faint); flex: none; }
#view:hover { color: var(--text); }
#cards { font-size: 12px; color: var(--faint); flex: none; text-decoration: underline; text-underline-offset: 2px; padding: 0; }
#cards:hover { color: var(--text); }
/* room between a seat's name line and its piles for the zone names that float over them */
.three .seat.top .who { padding-bottom: 18px; }
.three .seat.bottom .who { padding-top: 18px; }

/* ------------------------------------------------------------------ the subway look */
/* each player's bullet: a solid circle in their color with their number, like a line's */
.bullet { display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 50%; flex: none; align-self: center;
  background: var(--pc, #fff); color: var(--pc-ink, #fff); font: 700 12px/1 "Inter Display", "Inter", sans-serif; font-variant-numeric: tabular-nums; }
/* who the table waits on: their bullet pulses */
.bullet.waiting { animation: bullet 1.6s ease-in-out infinite; }
@keyframes bullet { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pc) 70%, transparent); } 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--pc) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) { .bullet.waiting { animation: none; box-shadow: 0 0 0 2px #fff; } }
.who .name.waiting::before { display: none; }
.who { align-items: center; column-gap: 9px; }
.who .name { color: var(--text); font-weight: 600; }
.who .life { font-family: "Inter Display", "Inter", sans-serif; font-weight: 700; letter-spacing: -.01em; }
.who .phase { font-weight: 600; }
/* the seat whose turn it is takes on its player's color */
.seat.turn { background: color-mix(in srgb, var(--pc) 13%, transparent); }
.three .seat.turn { background: none !important; }
#picker { font-weight: 700; font-family: "Inter Display", "Inter", sans-serif; font-size: 15px; }
/* panels over the table read like signs: black, with a white rule across the top */
.result, .prep, .stack, #peek .o, #peek.zone, #tip { background: #000; border: 1px solid #2a2a2a; border-top: 4px solid #fff; border-radius: 6px; }
.result b { font: 700 24px/1.2 "Inter Display", "Inter", sans-serif; }
.prep .hd b { font: 700 17px/1.2 "Inter Display", "Inter", sans-serif; }
#marks { background: linear-gradient(to right, #fff var(--p, 0%), #333 var(--p, 0%)); }
#marks i { background: #777; }
#marks i.strong { background: #fff; }
#tabs button { font-weight: 600; }
#tabs button.on { border-bottom-width: 2px; }
#trace { background: #000; }
.e.booth { border-left-color: #fff; }
.e.turn { font-weight: 700; font-size: 13px; }
/* a player's lines carry their color, as a small bullet before the name */
.e .by::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--pc, transparent); margin: 0 6px 1px 0; vertical-align: middle; }
.prep li .who::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--pc, transparent); margin: 0 6px 1px 0; }

/* what points at what, on the flat table: subway lines over the seats, under the stack */
#links { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 19; pointer-events: none; overflow: visible; }
#links path { fill: none; stroke: var(--lc); stroke-width: 3.5; stroke-linecap: round; }
#links .from { fill: var(--lc); }
#links .to { fill: #fff; stroke: var(--lc); stroke-width: 3; }
#links .fresh path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: link-draw .42s var(--ease) forwards; }
#links .fresh .to { opacity: 0; animation: link-end .2s .34s forwards; }
@keyframes link-draw { to { stroke-dashoffset: 0; } }
@keyframes link-end { to { opacity: 1; } }

/* the hand: one fanned line, set off from the battlefield by a short white rule */
.row.hand { flex-wrap: nowrap !important; gap: 0 !important; position: relative; margin-top: 10px; padding-top: 8px; }
.row.hand::before { content: ""; position: absolute; left: 0; top: 0; width: 24px; height: 2px; background: var(--pc, #fff); }
.row.hand:empty { display: none; }
.row.hand .card { rotate: calc(var(--fan, 0) * 1deg); translate: 0 var(--dip, 0px); box-shadow: 0 2px 8px #000c; }
.row.hand .card:hover { transform: translateY(-8px); z-index: 2; }
.three .row.hand::before { display: none; }

/* ------------------------------------------------------------------ the analyst's notes */
#board { position: relative; }
#read-btn { font-size: 12px; color: var(--text); flex: none; padding: 0; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
#read { position: absolute; z-index: 45; top: 44px; right: 12px; width: min(360px, calc(100% - 24px)); padding: 14px 16px 12px;
  background: #000; border: 1px solid #2a2a2a; border-top: 4px solid #fff; border-radius: 6px; box-shadow: 0 12px 40px #000c; animation: pop .22s var(--ease); }
#read .head { margin: 0 0 12px; font: 600 16px/1.3 "Inter Display", "Inter", sans-serif; color: #fff; }
#read ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
#read li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; }
#read li .bullet { width: 20px; height: 20px; font-size: 11px; margin-top: 1px; }
#read li b { font-weight: 600; font-size: 13px; margin-right: 6px; }
#read .plan { display: block; color: var(--dim); font-size: 12.5px; line-height: 1.35; margin-top: 2px; }
#read .asof { margin: 12px 0 0; color: var(--faint); font-size: 11px; }
#read .role { color: var(--dim); font-size: 12px; }
/* the recap under the result: jump to the key moments */
.result .recap { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid #2a2a2a; text-align: left; display: grid; gap: 4px; pointer-events: auto; max-width: 320px; }
.result .recap button { display: grid; grid-template-columns: 52px 1fr; gap: 8px; width: 100%; text-align: left; padding: 4px 2px; color: var(--text); font-size: 12.5px; line-height: 1.3; border-radius: 4px; }
.result .recap button:hover { background: #ffffff12; }
.result .recap .t { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 11.5px; padding-top: 1px; }
/* a near miss: what didn't happen */
#feed .e.near, #strip .e.near { color: var(--text); }
#feed .e.near > .by, #strip .e.near > .by { color: var(--faint); }
[data-icon="near"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath fill-rule='evenodd' d='M1 1h8v8H1zM2.7 2.7v4.6h4.6V2.7z'/%3E%3C/svg%3E"); }
[data-icon="key"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='3.8'/%3E%3C/svg%3E"); }
