:root {
  color-scheme: dark;
  font: 16px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --paper: #070712;
  --panel: #111225;
  --ink: #f7f7ff;
  --muted: #979dbb;
  --line: rgba(114, 241, 255, .17);
  --border: rgba(114, 241, 255, .22);
  --orange: #ff4fa3;
  --yellow: #ffd75a;
  --blue: #5cf3ff;
  --violet: #8a6bff;
  --coral: #ff947d;
  --tide: #68dfcf;
  --shadow: 0 24px 60px rgba(0, 0, 0, .38), 0 0 35px rgba(92, 243, 255, .08);
  background: var(--paper);
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--paper); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 9% 4%, rgba(255, 79, 163, .16), transparent 28rem),
    radial-gradient(circle at 94% 19%, rgba(92, 243, 255, .13), transparent 30rem),
    linear-gradient(rgba(92, 243, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 243, 255, .025) 1px, transparent 1px),
    var(--paper);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
main { width: min(1200px, calc(100% - 48px)); margin: 0 auto; padding-bottom: 3rem; }
a { color: inherit; }
button, input, select, summary { font: inherit; min-height: 44px; }
button, input, select { color: inherit; background: #0c0d1f; border: 1px solid var(--border); border-radius: 12px; padding: .5rem .8rem; }
button { cursor: pointer; font-weight: 750; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
button:disabled { opacity: .55; cursor: default; }
button:not(:disabled):hover { border-color: rgba(92, 243, 255, .45); }
button.primary { color: #061013; background: var(--blue); border-color: var(--blue); }
button.primary:not(:disabled):hover { background: #8ff8ff; }
button:focus-visible, input:focus-visible, summary:focus-visible, [role="radio"]:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
input, select { width: 100%; min-width: 0; }
label { display: block; margin-bottom: .25rem; font-weight: 650; }
small, .rules, .field-note { color: var(--muted); }
h1, h2 { margin: 0; letter-spacing: -.03em; }
p { margin: .6rem 0; }
form { display: grid; gap: .6rem; }
summary { cursor: pointer; padding: .6rem .25rem; font-weight: 700; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }

.masthead { display: flex; align-items: center; gap: 1rem; min-height: 68px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.masthead .brand { text-decoration: none; font: 900 1.25rem ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.04em; color: #fff; text-transform: uppercase; }
.eyebrow { margin: 0 0 .5rem; color: var(--blue); font: 750 .72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; }
.intro { margin: 2rem 0 1.5rem; }
.intro h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1; letter-spacing: -.05em; }
#notice { color: var(--orange); font-weight: 650; }

.name-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.name-row label { margin: 0; color: var(--muted); }
.name-row input { width: min(20rem, 100%); }
.lobby { display: grid; gap: 1.25rem; }
#entry-actions { display: grid; gap: 1.25rem; }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.game-grid .game-card { grid-column: auto; cursor: pointer; width: 100%; padding: 0; font: inherit; text-align: left; }
.game-grid .game-card .game-art { height: 190px; }
.game-grid .game-card .card-svg { max-height: 88%; }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 21rem); gap: 1.25rem; align-items: start; }
.panel, .game, .chat, .share {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(23, 25, 50, .95), rgba(12, 13, 29, .98));
  border-radius: 22px;
  padding: clamp(1rem, 3vw, 1.5rem);
  box-shadow: 0 1px rgba(255, 255, 255, .04) inset;
}
.setup { gap: .9rem; }
.setup-head h2 { font: 850 1.6rem/1.05 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.setup-head .eyebrow { margin-bottom: .35rem; }
.setup-head .rules { margin: .5rem 0 0; font-size: .95rem; }
.field-label { display: block; margin-bottom: .45rem; color: var(--muted); font: 750 .72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; text-transform: uppercase; }
.segments { display: flex; flex-wrap: wrap; gap: 8px; }
.segments button { flex: 1 1 auto; border-radius: 10px; background: #0c0d1f; }
.segments button[aria-checked="true"] { color: #061013; background: var(--blue); border-color: var(--blue); }
.setup button.primary { width: 100%; margin-top: .2rem; }
.setup .owner { margin-top: .2rem; }
#room-stats { margin: 0; color: var(--muted); font-size: .9rem; }
.join-panel form { gap: .6rem; }
.join-panel h2 { font-size: 1.2rem; }
.join-panel button { width: 100%; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, .65fr); gap: 1.25rem; align-items: start; margin-top: 1.5rem; }
.players { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; margin: .7rem 0; }
.player { padding: .6rem .75rem; border: 2px solid var(--border); border-radius: 14px; overflow-wrap: anywhere; background: rgba(12, 13, 29, .6); }
.player.active { border-color: currentColor; }
.player strong { display: block; font-size: 1.6rem; }
.player-0 { color: var(--coral); }
.player-1 { color: var(--tide); }
#turn { font-weight: 750; min-height: 1.45em; }
.paper { display: grid; place-items: center; background: #f8edcf; border-radius: 18px; padding: clamp(15px, 5vw, 32px); margin-bottom: .8rem; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.rules { margin-top: .9rem; }
.side { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.share { display: grid; justify-items: center; gap: .7rem; text-align: center; }
.share h2 { margin: 0; font-size: 1.1rem; }
.share p { margin: 0; color: var(--muted); }
.share-code strong { display: block; color: #fff; font: 800 1.5rem ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; }
.share button { width: 100%; }
#qr { width: min(100%, 15rem); padding: .75rem; background: #fff; border-radius: 16px; }
#qr canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.chat ol { min-height: 5rem; max-height: 22rem; overflow: auto; padding: 0; list-style: none; overflow-wrap: anywhere; }
.chat li { margin: .5rem 0; }
.chat form { grid-template-columns: minmax(0, 1fr) auto; }
.chat summary { color: var(--ink); }

@media (max-width: 960px) {
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lobby-grid, .layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  main { width: calc(100% - 28px); }
  .game-grid { grid-template-columns: 1fr; }
  .game-grid .game-card .game-art { height: clamp(190px, 60vw, 240px); }
}
@media (hover: hover) and (pointer: fine) {
  .game-grid .game-card:hover { transform: translateY(-4px); }
}


/* Board pieces */
#board { position: relative; aspect-ratio: 1; width: min(100%, 440px); }
.dot, .box, .edge { position: absolute; }
.dot { z-index: 2; width: 9px; height: 9px; background: #263c44; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.box { display: grid; place-items: center; color: #263c44; font-weight: 800; pointer-events: none; }
.box[data-seat="0"] { background: #ff947d90; }
.box[data-seat="1"] { background: #68dfcfad; }
.edge { background: transparent; border: 0; border-radius: 2px; padding: 0; z-index: 1; min-height: 0; touch-action: manipulation; }
.edge.h { height: 28px; transform: translateY(-50%); }
.edge.v { width: 28px; transform: translateX(-50%); }
.edge::before { content: ""; position: absolute; inset: 0; margin: auto; border-radius: 4px; background: #a29a84; opacity: .32; }
.edge.h::before { height: 4px; }
.edge.v::before { width: 4px; }
.edge:not(:disabled):hover::before, .edge:not(:disabled):focus-visible::before { background: #37494a; opacity: 1; }
.edge[data-seat] { opacity: 1; }
.edge[data-seat="0"]::before { background: #bd4b33; opacity: 1; }
.edge[data-seat="1"]::before { background: #087a70; opacity: 1; }

.paper.fourfold-paper { background: #204752; padding: clamp(8px, 2.5vw, 20px); }
#board.fourfold-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(2px, 1vw, 7px);
  aspect-ratio: 7 / 6;
}
.fourfold-column {
  display: grid;
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: clamp(2px, 1vw, 7px);
  min-width: 0;
  padding: 3px;
  border: 1px solid transparent;
  background: transparent;
}
.fourfold-column:disabled { opacity: 1; }
.fourfold-column:not(:disabled):hover { background: #315e68; border-color: #a9ced1; }
.fourfold-column span {
  align-self: center;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #132e37;
  box-shadow: inset 0 2px 3px #0b2128;
}
.fourfold-column span[data-seat="0"] { background: var(--coral); box-shadow: inset 0 -4px 0 #c85c48; }
.fourfold-column span[data-seat="1"] { background: var(--tide); box-shadow: inset 0 -4px 0 #2a998b; }
.fourfold-column span.winning { outline: 2px solid #fff4da; outline-offset: -3px; }

.paper.go-paper { background: #dbac6d; padding: clamp(5px, 2vw, 18px); }
#board.go-board {
  display: grid;
  grid-template-columns: repeat(var(--go-size), minmax(0, 1fr));
  grid-template-rows: repeat(var(--go-size), minmax(0, 1fr));
  width: min(100%, 560px);
}
.go-player-color { display: block; font-weight: 800; }
.go-point {
  display: grid;
  place-items: center;
  position: relative;
  min-height: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  touch-action: manipulation;
}
.go-point::before, .go-point::after {
  position: absolute;
  content: "";
  background: #694928;
  pointer-events: none;
}
.go-point::before { inset: calc(50% - .5px) 0 auto; height: 1px; }
.go-point::after { inset: 0 auto 0 calc(50% - .5px); width: 1px; }
.go-point.go-left::before { left: 50%; }
.go-point.go-right::before { right: 50%; }
.go-point.go-top::after { top: 50%; }
.go-point.go-bottom::after { bottom: 50%; }
.go-point span { z-index: 1; width: 86%; aspect-ratio: 1; border-radius: 50%; pointer-events: none; }
.go-point .go-star { width: 16%; background: #694928; }
.go-point[data-stone] span, .go-point[aria-disabled="false"]:hover span { width: 86%; }
.go-point[data-stone="1"] span { background: #1b2124; box-shadow: inset 0 0 0 1px #3f474c; }
.go-point[data-stone="2"] span { background: #fff4e2; box-shadow: inset 0 0 0 1px #baa58a; }
.go-point.last-move span { outline: 2px solid #b7462d; outline-offset: -2px; }
.go-point[aria-disabled="false"]:hover span { background: #69492870; }
.go-point[aria-disabled="true"] { cursor: default; }
.go-point:focus-visible { z-index: 2; }

.players.memory-players { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); }
.player-2 { color: #ffcc77; }
.player-3 { color: #9cd4ff; }
.player-4 { color: #ddb9ff; }
#remove-player { width: auto; max-width: 100%; }
.paper.memory-paper { background: #173641; }
#board.memory-board {
  display: grid;
  grid-template-columns: repeat(var(--memory-columns), minmax(0, 1fr));
  gap: clamp(3px, 1.4vw, 10px);
  aspect-ratio: auto;
}
button.memory-card {
  min-width: 0;
  aspect-ratio: 4 / 5;
  padding: 0;
  background: repeating-linear-gradient(135deg, #215b65 0 7px, #1e505b 7px 14px);
  border-color: #699ca2;
  font-size: clamp(1rem, 5vw, 2rem);
}
button.memory-card.face-up { opacity: 1; background: #ffedd1; color: #1a343d; border-color: #ffedd1; }
button.memory-card[data-owner="0"] { background: var(--coral); }
button.memory-card[data-owner="1"] { background: var(--tide); }
button.memory-card[data-owner="2"] { background: #ffcc77; }
button.memory-card[data-owner="3"] { background: #9cd4ff; }
button.memory-card[data-owner="4"] { background: #ddb9ff; }

.paper.northstar-paper { background: #16333e; padding: clamp(7px, 2vw, 14px); }
#board.northstar-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: .75rem;
  width: 100%;
  aspect-ratio: auto;
}
.northstar-board h3 { margin: 0 0 .5rem; font-size: 1rem; }
.northstar-sea { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 2px; }
.northstar-cell {
  display: grid;
  place-items: center;
  background: #254b5b;
  color: #f9f3e4;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 0;
  border-radius: 2px;
  border: 0;
  padding: 0;
  font-size: clamp(.6rem, 2.8vw, 1.05rem);
  line-height: 1;
  touch-action: manipulation;
}
.northstar-cell:disabled { opacity: 1; }
.northstar-cell[data-ship="yes"] { background: #446f79; }
.northstar-cell[data-shot="hit"] { background: #ac402d; }
.northstar-cell[data-shot="miss"] { background: #203943; }
button.northstar-cell:not(:disabled):hover { background: #44788a; }
.northstar-board .actions, .northstar-report { grid-column: 1 / -1; }
.northstar-report { margin: 0; color: var(--muted); }
.northstar-report:empty { display: none; }

.paper.iron-paper { display: block; background: #16333e; padding: clamp(6px, 2vw, 14px); }
#board.iron-board { display: grid; gap: .75rem; width: 100%; aspect-ratio: auto; }
.iron-map { position: relative; border-radius: .6rem; overflow: hidden; }
.iron-map svg { display: block; width: 100%; height: auto; aspect-ratio: 944 / 618; touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; }
.iron-map.zoomed svg { touch-action: none; }
.iron-map .water { fill: #a9c9d4; }
.iron-map .sea, .iron-preview .sea { fill: #a9c9d4; stroke: #8f7d5e; stroke-width: 1.2; }
.iron-map .grat, .iron-preview .grat { stroke: rgba(80, 110, 120, .15); stroke-width: .6; }
.iron-map .land { fill: #eadfc2; stroke: #8f7d5e; stroke-width: 1.2; }
.iron-map .lake { fill: #a9c9d4; stroke: #8fa9b2; stroke-width: .8; }
.iron-map .border { fill: none; stroke: #a8936c; stroke-width: 1; stroke-dasharray: 4 3; }
.iron-map .route .hit { stroke: transparent; stroke-width: 18; fill: none; pointer-events: stroke; cursor: pointer; }
.iron-map .route .out { fill: none; stroke: #2c241b; stroke-width: 8.5; }
.iron-map .route .car { fill: none; stroke-width: 6; }
.iron-map .route.claimed .out { stroke: #fff; stroke-width: 9.5; }
.iron-map .route.claimed .car { stroke-width: 7; }
.iron-map .route.blocked { opacity: .28; }
.iron-map .route.sel .out { stroke: #ffcf3f; stroke-width: 12; }
.iron-map .route .bore { display: none; fill: none; stroke-width: 2.5; stroke-dasharray: 2 3; pointer-events: none; }
.iron-map .route.tunnel .bore { display: initial; }
.iron-map .city circle { fill: #fffaf0; stroke: #3a2f22; stroke-width: 2; pointer-events: none; }
.iron-map .city.hi circle { fill: #ffcf3f; stroke: #7a3d00; stroke-width: 2.5; }
.iron-map .city.done circle { fill: #8fd6a5; }
.iron-map .city.picked circle { fill: #ffcf3f; stroke: #7a3d00; stroke-width: 3; }
.iron-map .city .station { stroke: #2c241b; stroke-width: 1.5; pointer-events: none; }
.iron-map.station-pick svg { cursor: crosshair; }
.iron-map.station-pick .route .hit { pointer-events: none; }
.iron-map .city text { font: 700 10.5px ui-rounded, system-ui, sans-serif; fill: #2b2218; paint-order: stroke; stroke: #faf4e6e6; stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.iron-map .city.hi text { font-weight: 900; fill: #7a3d00; }
.iron-zoom { position: absolute; right: .4rem; bottom: .4rem; display: flex; gap: .3rem; }
.iron-zoom button { min-width: 44px; padding: .3rem .5rem; background: #152d36e6; }
.iron-banner { margin: 0; padding: .5rem .75rem; border-radius: .6rem; background: #5a3b1a; color: #ffe2a8; font-weight: 750; }
.iron-panel { display: grid; gap: .6rem; }
.iron-panel h3 { margin: .3rem 0 0; font-size: 1rem; }
.iron-panel h4 { margin: .6rem 0 .3rem; }
.iron-instruction { margin: 0; font-weight: 650; }
.iron-choose, .iron-claim, .iron-results { display: grid; gap: .5rem; padding: .75rem; border: 1px solid var(--border); border-radius: .75rem; background: #1a343d; }
.iron-claim h3, .iron-claim p { margin: 0; }
.iron-claim select { min-height: 44px; font-size: 16px; }
.iron-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.iron-actions button { flex: 1 1 12rem; }
.iron-revealed { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.iron-revealed .iron-card { min-width: 64px; min-height: 52px; }
.iron-preview { display: block; width: 100%; aspect-ratio: 8 / 5; border-radius: 6px; background: #a9c9d4; pointer-events: none; }
.iron-preview .land { fill: #eadfc2; stroke: #8f7d5e; stroke-width: 1.2; }
.iron-map .abroad, .iron-preview .abroad { fill: #ddd5c0; stroke: none; }
.iron-preview .water, .iron-preview .lake { fill: #a9c9d4; }
.iron-preview .border { fill: none; stroke: #a8936c; stroke-width: 1; stroke-dasharray: 4 3; }
.iron-preview .track { fill: none; stroke-width: 1; vector-effect: non-scaling-stroke; }
.iron-preview .stop { fill: #fffaf0; stroke: #3a2f22; stroke-width: 2; }
.sheet .segments.map-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sheet .segments.map-options .map-choice { position: relative; display: grid; min-width: 0; }
.sheet .segments.map-options [role="radio"] { display: grid; gap: .3rem; padding: .4rem; text-align: center; }
.sheet .segments.map-options [role="radio"] small { font-size: .74rem; font-weight: 650; }
.sheet .segments.map-options [role="radio"][aria-checked="true"] small { color: inherit; }
.sheet .segments.map-options .peek-btn { position: absolute; top: .55rem; right: .55rem; display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; border-color: rgba(40, 30, 20, .35); border-radius: 10px; background: rgba(250, 244, 230, .92); color: #2b2218; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); }
.sheet .segments.map-options .peek-btn svg { width: 20px; height: 20px; }
@media (pointer: fine) {
  .sheet .segments.map-options .peek-btn { width: 34px; min-height: 34px; }
  .sheet .segments.map-options .peek-btn svg { width: 18px; height: 18px; }
}
/* Full-size map peek, opened over the setup sheet. The map fits the screen at its own aspect ratio. */
.sheet.peek-sheet { width: min(1100px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); }
.peek-sheet[open] { flex-direction: column; gap: .75rem; padding: 1rem 1.1rem calc(1rem + env(safe-area-inset-bottom)); }
.peek-head { display: flex; align-items: flex-start; gap: .75rem; }
.peek-head > div { flex: 1 1 auto; min-width: 0; }
.peek-head h2 { font-size: 1.4rem; }
.peek-head p { margin: .25rem 0 0; color: var(--muted); font-size: .86rem; }
.peek-head .sheet-close { position: static; flex: none; }
.iron-peek { align-self: center; flex: none; width: min(100%, calc(max(180px, 100dvh - 15rem) * var(--ar, 1.6))); background: #a9c9d4; }
.iron-peek svg { touch-action: none; cursor: grab; }
.iron-peek .route .hit { pointer-events: none; }
.peek-foot { display: flex; gap: .6rem; }
.peek-foot button { min-height: 48px; }
.peek-foot .primary { flex: 1 1 auto; }
.iron-market { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.iron-card {
  position: relative; display: grid; place-items: center; align-content: center; gap: 2px; min-width: 0; min-height: 60px;
  padding: 4px 2px; border: 2px solid #ffffff40; border-radius: .55rem; background: var(--cc); color: var(--ct);
  font-size: .72rem; font-weight: 800; overflow-wrap: anywhere; text-align: center;
}
.iron-card .sym { font-size: 1.2rem; line-height: 1; }
.iron-card.loco { background: conic-gradient(from 30deg, #d83a3a, #ef8a24, #f2cf2e, #2f9e57, #2f6fdb, #8c55d6, #d83a3a); color: #fff; text-shadow: 0 1px 2px #000b; }
.iron-card.deck { background: repeating-linear-gradient(135deg, #4a3c2c 0 6px, #3b3023 6px 12px); color: #e8b04b; }
.iron-card.empty { background: #ffffff0a; border-style: dashed; color: var(--muted); }
.iron-card .n { position: absolute; top: 3px; right: 5px; font-size: .65rem; }
.iron-card:disabled { opacity: .4; }
.iron-hand { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 5px; }
.iron-hand .iron-card { min-height: 52px; }
.iron-hand .iron-card.zero { opacity: .22; }
.iron-hand .iron-card b { font-size: .95rem; }
@media (max-width: 420px) { .iron-hand { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.iron-tickets { display: grid; gap: 6px; }
.iron-ticket {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .5rem; min-height: 44px;
  padding: .45rem .6rem; border: 1px solid #c9b48a; border-radius: .6rem; background: #f3e8cf; color: #2b2218; text-align: left;
}
.iron-ticket b { display: block; font-size: .85rem; }
.iron-ticket small { color: #6c5b40; font-size: .72rem; }
.iron-ticket .pts { min-width: 34px; padding: 6px 7px; border-radius: 8px; background: #2b2218; color: #f3e8cf; font: 900 .85rem/1 ui-monospace, monospace; text-align: center; }
.iron-ticket.done { background: #cdebd3; }
.iron-ticket.done .pts { background: #1f7a3c; }
.iron-ticket.lost { background: #e9c8c0; }
.iron-ticket.sel { box-shadow: 0 0 0 3px #e8b04b; }
.iron-ticket.pick { grid-template-columns: auto minmax(0, 1fr) auto; margin: 0; cursor: pointer; font-weight: 400; }
.iron-ticket.pick input { width: 22px; min-height: 22px; height: 22px; accent-color: #b8322a; }
.iron-more summary { color: var(--muted); }
.iron-route-list { display: grid; gap: 4px; max-height: 16rem; overflow: auto; }
.iron-route-list button { display: flex; align-items: center; gap: .5rem; text-align: left; font-weight: 650; }
.iron-route-list small { margin-left: auto; }
.pip { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--cc); border: 1px solid #fff6; }
.iron-rivals { margin: 0; padding: 0; list-style: none; font-size: .9rem; }
.iron-rivals li { margin: .2rem 0; }
.iron-rivals b, .iron-log b { color: inherit; }
.iron-log { margin: 0; padding-left: 1.1rem; font-size: .9rem; color: var(--muted); }
.iron-results table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.iron-results th, .iron-results td { padding: .35rem .3rem; border-bottom: 1px solid var(--border); text-align: right; }
.iron-results th:first-child, .iron-results td:first-child { text-align: left; }

/* ---------- Landlord ---------- */
.player-5 { color: #a8e07a; }
.paper.landlord-paper { display: block; background: #0d2f25; padding: clamp(6px, 2vw, 14px); }
#board.landlord-board { display: grid; gap: .8rem; width: 100%; aspect-ratio: auto; }
.ll-board {
  --b: 600px;
  position: relative; width: 100%; aspect-ratio: 1; display: grid; gap: 1px; padding: 1px;
  grid-template-columns: 1.55fr repeat(9, minmax(0, 1fr)) 1.55fr;
  grid-template-rows: 1.55fr repeat(9, minmax(0, 1fr)) 1.55fr;
  border-radius: 6px; background: #2b3a31; box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.ll-sp {
  position: relative; min-width: 0; min-height: 0; display: flex; overflow: hidden;
  padding: 0; border: 0; border-radius: 0; background: #f3eedd; color: #1f2420; font-weight: 400; transition: none;
  font-size: max(7px, calc(var(--b) * .0148)); line-height: 1.1;
}
.ll-sp:not(:disabled):hover { background: #fff8d8; }
.ll-sp:focus-visible { outline: 3px solid #e2a72e; outline-offset: -3px; z-index: 3; }
.ll-sp.owned { box-shadow: inset 0 0 0 max(2px, calc(var(--b) * .0055)) var(--oc); }
.ll-sp.focus { background: #fff8d8; }
.ll-sp.focus::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 2px #e2a72e; pointer-events: none; }
.ll-sp .strip { flex: 0 0 22%; display: flex; align-items: center; justify-content: center; gap: 1px; background: var(--gc); }
.ll-sp.side-b { flex-direction: column; }
.ll-sp.side-t { flex-direction: column-reverse; }
.ll-sp.side-l { flex-direction: row-reverse; }
.ll-sp.side-r { flex-direction: row; }
.ll-sp.side-l .strip, .ll-sp.side-r .strip { flex-direction: column; }
.ll-sp .lbl { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 2px; text-align: center; }
.ll-sp .nm { font-weight: 700; overflow-wrap: anywhere; }
.ll-sp .pr { font: 700 .92em/1 ui-monospace, monospace; opacity: .75; }
.ll-sp .ic { font-size: 1.6em; line-height: 1; }
.ll-sp.corner .lbl { justify-content: flex-start; padding-top: 14%; font: 900 1.05em/1.05 ui-monospace, monospace; text-transform: uppercase; }
.ll-sp.corner .ic { font-size: 2em; }
.ll-board.compact .ll-sp .nm { display: none; }
.ll-board.compact .ll-sp.corner .nm { display: block; font-size: .7em; white-space: nowrap; }
.ll-board.compact .ll-sp .ic { font-size: 1.35em; }
.ll-sp.mort .lbl { opacity: .35; }
.ll-sp.mort::before { content: "M"; position: absolute; top: 2px; right: 2px; padding: 1px 3px; border-radius: 3px; background: #b8322a; color: #fff; font: 800 .75em/1 ui-monospace, monospace; z-index: 1; }
.ll-sp .hs { width: max(4px, calc(var(--b) * .012)); height: max(4px, calc(var(--b) * .012)); border-radius: 1px; background: #1f9d55; box-shadow: 0 0 0 1px rgba(0, 0, 0, .45); }
.ll-sp .ht { width: max(9px, calc(var(--b) * .026)); height: max(5px, calc(var(--b) * .014)); border-radius: 1px; background: #d63a2f; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.ll-sp.side-l .ht, .ll-sp.side-r .ht { width: max(5px, calc(var(--b) * .014)); height: max(9px, calc(var(--b) * .026)); }
.ll-sp .tk { position: absolute; left: 0; right: 0; bottom: 1px; display: flex; flex-wrap: wrap; justify-content: center; gap: 1px; pointer-events: none; z-index: 2; }
.ll-sp.side-t .tk { bottom: auto; top: 1px; }
.ll-piece {
  flex: none; width: max(12px, calc(var(--b) * .03)); height: max(12px, calc(var(--b) * .03));
  display: inline-grid; place-items: center; border-radius: 50%;
  background: var(--pc); color: #10261f; font-size: max(8px, calc(var(--b) * .018)); line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .6), 0 0 0 1.5px #fff;
}
.ll-piece.jailed { box-shadow: 0 1px 3px rgba(0, 0, 0, .6), 0 0 0 1.5px #222, 0 0 0 3px #fff; }
.ll-piece.active { animation: ll-bob 1.1s ease-in-out infinite; }
@keyframes ll-bob { 50% { transform: translateY(-2px) scale(1.12); } }
.ll-panel .ll-piece, .ll-chip .ll-piece { width: 26px; height: 26px; font-size: 14px; }
.ll-piece.big { width: 40px; height: 40px; font-size: 20px; box-shadow: 0 0 0 3px rgba(255, 255, 255, .85); }
.ll-center {
  grid-row: 2 / 11; grid-column: 2 / 11; min-width: 0; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--b) * .022);
  padding: calc(var(--b) * .03); background: radial-gradient(circle at 50% 40%, #e7efe0, #cfdcc8 70%); color: #1f2420; text-align: center;
}
.ll-logo {
  padding: calc(var(--b) * .012) calc(var(--b) * .04); border-radius: 6px; background: #b8322a; color: #fff; transform: rotate(-8deg);
  font: 900 calc(var(--b) * .062)/1 "Iowan Old Style", Palatino, Georgia, serif; letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 0 0 0 max(2px, calc(var(--b) * .004)) #f3eedd inset;
}
.ll-dice { display: flex; gap: calc(var(--b) * .02); }
.ll-die {
  width: calc(var(--b) * .085); height: calc(var(--b) * .085); min-width: 24px; min-height: 24px;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 14%;
  border-radius: 18%; background: #fff; box-shadow: 0 3px 0 #b9c2b5, 0 6px 14px rgba(0, 0, 0, .25);
}
.ll-die i { display: block; margin: 12%; border-radius: 50%; }
.ll-die i.on { background: #1f2420; }
.ll-die.roll { animation: ll-roll-die .45s ease-out; }
@keyframes ll-roll-die { 0% { transform: rotate(-90deg) scale(.6); } 70% { transform: rotate(12deg) scale(1.08); } }
.ll-msg, .ll-round { max-width: 92%; margin: 0; font: 600 max(10px, calc(var(--b) * .021))/1.35 system-ui, sans-serif; }
.ll-msg { min-height: 2.6em; }
.ll-round { color: #556157; font: 800 max(9px, calc(var(--b) * .017))/1 ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.ll-card { max-width: 82%; padding: calc(var(--b) * .02) calc(var(--b) * .03); border-radius: 8px; background: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); font: 600 max(10px, calc(var(--b) * .019))/1.35 system-ui, sans-serif; }
.ll-card b { display: block; margin-bottom: 4px; font: 900 .85em/1 ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }
.ll-card.fortune b { color: #d9721e; }
.ll-card.fund b { color: #2c6fb5; }

.ll-panel { display: grid; gap: .7rem; }
.ll-panel h3, .ll-panel h4 { margin: 0; }
.ll-panel p { margin: 0; }
.ll-now { display: flex; align-items: center; gap: .75rem; }
.ll-now > div { flex: 1 1 auto; min-width: 0; }
.ll-now b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; }
.ll-now small, .ll-small { color: var(--muted); font-size: .8rem; }
.ll-now small { display: block; }
.ll-cash { font: 900 1.3rem/1 ui-monospace, monospace; color: #f6c453; }
.ll-instruction { font-weight: 650; }
.ll-panel button.danger { color: #fff; background: #c9402f; border-color: #c9402f; }
.ll-box { display: grid; gap: .5rem; padding: .75rem; border: 1px solid var(--border); border-radius: .75rem; background: #123b2f; }
.ll-offer, .ll-trade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (max-width: 520px) { .ll-trade { grid-template-columns: 1fr; } }
.ll-offer ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.ll-bid-now { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: .6rem; }
.ll-bid-now strong { font: 900 1.6rem/1 ui-monospace, monospace; color: #f6c453; }
.ll-bids { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
.ll-bids button { padding: .3rem; }
.ll-bids small { display: block; font: 700 .7rem ui-monospace, monospace; opacity: .7; }
.ll-standings { margin: 0; padding: 0; list-style: none; display: grid; gap: .35rem; }
.ll-standings li { display: flex; align-items: center; gap: .6rem; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: .6rem; }
.ll-standings b { flex: 1 1 auto; }
.ll-deed { overflow: hidden; border-radius: .75rem; background: #f3eedd; color: #1f2420; }
.ll-deed .head { padding: .75rem 1rem; background: var(--gc, #3b4a40); color: var(--gt, #fff); text-align: center; }
.ll-deed .head small { display: block; font: 800 .65rem/1 ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; opacity: .8; }
.ll-deed .head strong { display: block; margin-top: .3rem; font: 900 1.2rem/1.1 "Iowan Old Style", Palatino, Georgia, serif; text-transform: uppercase; }
.ll-deed .body { padding: .6rem 1rem .9rem; font-size: .9rem; }
.ll-deed table { width: 100%; border-collapse: collapse; }
.ll-deed td { padding: 3px 0; border-bottom: 1px dashed rgba(0, 0, 0, .12); }
.ll-deed td:last-child { text-align: right; font: 700 .85rem ui-monospace, monospace; }
.ll-deed tr.now td { color: #b8322a; font-weight: 800; }
.ll-deed .owner { margin-top: .5rem; color: #3b453e; font-weight: 700; text-align: center; }
.ll-title { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ll-plist, .ll-props, .ll-tlist { display: grid; gap: .35rem; }
.ll-pl {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .6rem;
  padding: .35rem .6rem; text-align: left; font-weight: 400;
}
.ll-pl.cur { border-color: currentColor; }
.ll-pl.out { opacity: .4; }
.ll-pl .nm { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }
.ll-pl .sub { display: block; color: var(--muted); font-size: .75rem; }
.ll-pl .sw { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 3px; }
.ll-pl .sw i { width: 7px; height: 7px; border-radius: 2px; background: var(--gc); }
.ll-pl .sw i.m { opacity: .35; }
.ll-pl .money { font: 800 .9rem/1 ui-monospace, monospace; color: var(--ink); }
.ll-prow { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: .6rem; text-align: left; font-weight: 650; }
.ll-prow i, .ll-titem i { width: 10px; height: 24px; border-radius: 3px; background: var(--gc); }
.ll-prow small { display: block; color: var(--muted); font-weight: 400; }
.ll-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.ll-chip { display: inline-flex; align-items: center; gap: .45rem; border-radius: 999px; padding: .25rem .8rem .25rem .3rem; }
.ll-chip[aria-pressed="true"] { border-color: #f6c453; background: #f6c45322; }
.ll-titem { display: flex; align-items: center; gap: .55rem; min-height: 44px; padding: 0 .6rem; border: 1px solid var(--border); border-radius: .6rem; cursor: pointer; font-size: .9rem; }
.ll-titem:has(input:checked) { border-color: #f6c453; background: #f6c45314; }
.ll-titem input { width: 18px; min-height: 18px; height: 18px; accent-color: #f6c453; }
.ll-titem span { flex: 1 1 auto; min-width: 0; }
.ll-titem small { color: var(--muted); }
.ll-cash-in { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.ll-cash-in input { width: 100%; }
.ll-log-wrap summary { color: var(--muted); }
.ll-log { margin: 0; padding-left: 1.1rem; max-height: 16rem; overflow: auto; font-size: .88rem; color: #c9d6cc; }
.ll-log li { margin: .15rem 0; }

/* ---------- Conquest ---------- */
.paper.conquest-paper { display: block; background: #0a1626; padding: clamp(6px, 2vw, 14px); }
#board.conquest-board { display: grid; gap: .8rem; width: 100%; aspect-ratio: auto; }
.cq-map {
  position: relative; width: 100%; aspect-ratio: 58 / 31; min-height: 200px; overflow: hidden; border-radius: 10px;
  background: radial-gradient(circle at 30% 20%, #132a46, #0a1626 70%); touch-action: none; overscroll-behavior: contain;
}
@media (max-width: 600px) { .cq-map { aspect-ratio: 1 / 1; } }
.cq-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.cq-svg.dragging { cursor: grabbing; }
.cq-terr { cursor: pointer; outline: none; }
.cq-fill { shape-rendering: crispEdges; transition: opacity .18s; }
.cq-terr.dim .cq-fill { opacity: .38; }
.cq-lane { stroke: rgba(170, 205, 245, .45); stroke-width: 2; stroke-dasharray: 5 6; fill: none; }
.cq-wrap { fill: rgba(170, 205, 245, .7); font: 700 11px ui-monospace, monospace; pointer-events: none; }
.cq-borders { stroke: rgba(6, 14, 26, .78); stroke-width: 1.6; fill: none; pointer-events: none; }
.cq-cont-borders { stroke: rgba(6, 14, 26, .95); stroke-width: 3.2; fill: none; pointer-events: none; }
.cq-coast { stroke: rgba(210, 230, 255, .55); stroke-width: 1.6; fill: none; pointer-events: none; }
.cq-outline { fill: none; stroke: transparent; stroke-width: 3.5; pointer-events: none; }
.cq-outline.target { stroke: #fff; stroke-dasharray: 6 5; animation: cq-march 1s linear infinite; }
.cq-outline.attack { stroke: #ff6b6b; stroke-width: 4.5; }
.cq-outline.move { stroke: #ffd75a; stroke-width: 4.5; }
.cq-outline.sel { stroke: #fff; stroke-width: 4.5; }
.cq-outline.focus { stroke: #ff4fa3; stroke-width: 4; stroke-dasharray: none; animation: none; }
@keyframes cq-march { to { stroke-dashoffset: -22; } }
.cq-badge { pointer-events: none; }
.cq-badge circle { stroke: rgba(6, 14, 26, .85); stroke-width: 2; }
.cq-badge .num { font: 800 12px/1 ui-monospace, monospace; text-anchor: middle; dominant-baseline: central; fill: #10131f; }
.cq-badge .add { font: 900 10px/1 ui-monospace, monospace; fill: #ffd75a; paint-order: stroke; stroke: #0a1626; stroke-width: 3px; }
.cq-badge .lbl { font: 700 8.5px/1 system-ui, sans-serif; text-anchor: middle; fill: rgba(240, 246, 255, .92); paint-order: stroke; stroke: rgba(6, 14, 26, .85); stroke-width: 2.6px; opacity: 0; transition: opacity .2s; }
.cq-svg.show-labels .cq-badge .lbl { opacity: 1; }
.cq-badge.dim { opacity: .55; }
.cq-zoom { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.cq-zoom button { width: 44px; padding: 0; background: rgba(10, 22, 38, .85); font: 800 1.1rem/1 ui-monospace, monospace; }
.cq-hint {
  position: absolute; left: 8px; top: 8px; max-width: calc(100% - 16px); padding: .4rem .6rem; border: 1px solid var(--border); border-radius: .6rem;
  background: rgba(10, 22, 38, .9); font-size: .8rem; pointer-events: none; opacity: 0; transition: opacity .15s;
}
.cq-hint.show { opacity: 1; }
.cq-hint .sw { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.cq-panel { display: grid; gap: .7rem; align-content: start; }
.cq-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.cq-steps span { padding: .45rem .2rem; border-radius: .5rem; background: #ffffff0d; color: var(--muted); font: 800 .66rem/1 ui-monospace, monospace; letter-spacing: .1em; text-align: center; text-transform: uppercase; }
.cq-steps span.on { background: var(--pc, #ffd75a); color: #10131f; }
.cq-steps span.wide { grid-column: 1 / -1; }
.cq-steps span.done { color: var(--ink); }
.cq-round { margin: 0; color: var(--muted); font-size: .85rem; }
.cq-instruction { margin: 0; line-height: 1.45; }
.cq-flash { margin: 0; padding: .5rem .7rem; border-radius: .6rem; background: #ffd75a; color: #1d1500; font-weight: 700; font-size: .88rem; }
.cq-warn { margin: 0; padding: .5rem .7rem; border-radius: .6rem; background: #ff7a7a1f; color: #ffd2d2; font-size: .88rem; }
.cq-small { margin: 0; color: var(--muted); font-size: .82rem; }
.cq-panel button.danger { color: #fff; background: #e5484d; border-color: #e5484d; }
.cq-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.cq-row small, .cq-dice div > span:first-child, .cq-drawer summary { color: var(--muted); font: 800 .66rem/1 ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }
.cq-big { display: block; margin-top: .25rem; font: 900 1.8rem/1 ui-monospace, monospace; color: #ffd75a; }
.cq-seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 12px; background: #ffffff0f; }
.cq-seg button { min-width: 44px; border: 0; background: transparent; color: var(--muted); font-family: ui-monospace, monospace; }
.cq-seg button[aria-pressed="true"] { background: var(--ink); color: #0a1626; }
.cq-stepper { display: flex; align-items: center; gap: .4rem; }
.cq-stepper button { width: 44px; padding: 0; font: 800 1.1rem/1 ui-monospace, monospace; }
.cq-stepper output { min-width: 3ch; text-align: center; font: 900 1.6rem/1 ui-monospace, monospace; color: #ffd75a; }
.cq-stepper small { color: var(--muted); font-size: .8rem; }
.cq-matchup { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; padding: .6rem; border: 1px solid var(--border); border-radius: .75rem; background: #142540; }
.cq-matchup div:last-child { text-align: right; }
.cq-matchup span { display: block; font-size: .85rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cq-matchup b { font: 900 1.4rem/1.2 ui-monospace, monospace; color: var(--pc); }
.cq-matchup em { color: var(--muted); font: 900 .75rem/1 ui-monospace, monospace; }
.cq-dice { display: grid; gap: .35rem; padding: .6rem; border-radius: .75rem; background: #ffffff0a; }
.cq-dice div { display: flex; align-items: center; gap: .35rem; }
.cq-dice div > span:first-child { width: 4.5rem; }
.cq-dice p { margin: 0; font-size: .85rem; }
.cq-die { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; font: 900 .95rem/1 ui-monospace, monospace; }
.cq-die.att { background: #e5484d; color: #fff; }
.cq-die.def { background: #efe9dc; color: #1b1b1b; }
.cq-die.lost { opacity: .35; }
.cq-box { display: grid; gap: .5rem; padding: .75rem; border: 1px solid var(--border); border-radius: .75rem; background: #142540; }
.cq-box h3, .cq-box p { margin: 0; }
.cq-standings { margin: 0; padding: 0; list-style: none; display: grid; gap: .35rem; }
.cq-standings li { display: grid; grid-template-columns: 12px auto 1fr; align-items: center; gap: .5rem; font-size: .9rem; }
.cq-standings li span { text-align: right; color: var(--muted); }
.cq-standings i, .cq-pl i { width: 12px; height: 12px; border-radius: 3px; background: var(--pc); }
.cq-cards { display: flex; flex-wrap: wrap; gap: 6px; margin-top: .4rem; }
.cq-card { width: 58px; min-height: 70px; padding: 5px 4px; display: grid; align-content: space-between; justify-items: center; gap: 3px; border: 1px solid var(--border); border-radius: 9px; background: linear-gradient(160deg, #1b2f4f, #13223a); text-align: center; }
.cq-card.owned { border-color: #ffd75a; }
.cq-card small { font: 800 .5rem/1 ui-monospace, monospace; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.cq-card span { font-size: 1.2rem; line-height: 1; }
.cq-card em { font-style: normal; font-size: .6rem; line-height: 1.15; color: #c7d3e6; }
.cq-plist { display: grid; gap: .35rem; }
.cq-pl { display: grid; grid-template-columns: 12px minmax(0, 1fr); align-items: center; gap: .6rem; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: .6rem; }
.cq-pl.cur { border-color: var(--pc); background: #ffffff0a; }
.cq-pl.out { opacity: .45; }
.cq-pl b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cq-pl small { display: block; color: var(--muted); font-size: .76rem; }
.cq-drawer summary { display: flex; align-items: center; min-height: 44px; }
.cq-conts { display: grid; gap: .3rem; }
.cq-cont { display: flex; width: 100%; align-items: center; gap: .55rem; min-height: 40px; padding: .3rem .7rem; text-align: left; font-weight: 600; font-size: .88rem; }
.cq-cont span { flex: 1 1 auto; min-width: 0; }
.cq-cont i { flex: 0 0 auto; }
.cq-cont[aria-pressed="true"] { border-color: #ffd75a; background: #ffd75a18; }
.cq-cont .cq-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cc); }
.cq-cont b { color: #ffd75a; font-family: ui-monospace, monospace; }
.cq-cont .holder { width: 14px; height: 14px; border-radius: 4px; border: 1px dashed var(--border); background: var(--hc); }
.cq-cont .holder.held { border: 0; }
.cq-log { margin: 0; padding: 0; list-style: none; display: grid; gap: .35rem; max-height: 16rem; overflow: auto; font-size: .85rem; color: #c9d4e6; }
.cq-log li { padding-left: .6rem; border-left: 3px solid var(--lc); }
@media (prefers-reduced-motion: reduce) { .cq-outline.target { animation: none; } }

/* Team Side Quests landing page */
:root {
  --paper: #081722;
  --panel: #10232e;
  --ink: #f3f8f5;
  --muted: #a2b8bb;
  --line: rgba(161, 220, 208, .16);
  --border: rgba(161, 220, 208, .24);
  --orange: #f29c73;
  --yellow: #f5d68a;
  --blue: #8be4c4;
  --violet: #799bb4;
  --shadow: 0 24px 60px rgba(0, 0, 0, .32), 0 0 35px rgba(139, 228, 196, .06);
}
body { background: radial-gradient(ellipse at 74% 0%, rgba(74, 153, 136, .16), transparent 38rem), var(--paper); }
main { width: min(1280px, calc(100% - 48px)); }
button, input, select { background-color: #0b1d27; }
button:not(:disabled):hover { border-color: rgba(139, 228, 196, .55); }
button.primary { color: #09211d; }
button.primary:not(:disabled):hover { background: #a4efd3; }
.masthead { justify-content: flex-start; }
.masthead .brand { display: flex; align-items: center; gap: .6rem; color: var(--blue); font-size: 1rem; letter-spacing: .08em; }
.masthead .brand::before { content: "✦"; display: grid; place-items: center; width: 1.55rem; height: 1.55rem; border-radius: .5rem; background: var(--blue); color: #09211d; font: 900 1rem/1 ui-sans-serif, system-ui, sans-serif; }
.intro {
  display: grid;
  grid-template-columns: minmax(20rem, .95fr) minmax(0, 1.05fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  margin: clamp(1.5rem, 4vw, 3rem) 0 1rem;
}
.intro h1 { font-size: clamp(2.75rem, 5.4vw, 5rem); line-height: .95; letter-spacing: -.05em; font-weight: 850; text-wrap: balance; }
.intro-description { max-width: 32rem; margin: 1rem 0 0; color: #bfd0cf; font-size: clamp(1rem, 1.4vw, 1.15rem); line-height: 1.55; text-wrap: pretty; }
.intro-description strong { color: var(--blue); }
.intro-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1.6rem; }
.hero-art { display: block; width: 100%; height: auto; border-radius: 1.4rem; border: 1px solid var(--line); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: .6rem 1.4rem; border: 1px solid var(--border); border-radius: 12px; font-weight: 750; text-decoration: none; transition: background .15s ease; }
.button.primary { color: #09211d; background: var(--blue); border-color: var(--blue); }
.button.primary:hover { background: #a4efd3; }
.button:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.join-row { display: grid; grid-template-columns: minmax(0, 9rem) auto; gap: .5rem; margin: 0; }
.join-row input { min-height: 48px; font-size: 16px; letter-spacing: .12em; text-transform: uppercase; }
.join-row input::placeholder { letter-spacing: normal; text-transform: none; }
.join-row button { min-height: 48px; padding-inline: 1.1rem; }
#room-stats { margin: .9rem 0 0; color: var(--muted); font-size: .84rem; }
.panel, .game, .chat, .share { background: linear-gradient(145deg, rgba(20, 44, 54, .97), rgba(11, 29, 39, .99)); }
#notice { margin: .4rem 0; }
#invite { width: min(100%, 24rem); margin-top: clamp(1.25rem, 4vw, 2.5rem); padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: linear-gradient(145deg, rgba(20, 44, 54, .97), rgba(11, 29, 39, .99)); }
#invite h2 { font-size: 1.25rem; }
#invite button { width: 100%; }
#invite .name-row, .sheet .name-row { display: grid; gap: .35rem; margin: 0; }
#invite .name-row input, .sheet .name-row input { width: 100%; font-size: 16px; }
.name-row label { color: var(--muted); font-size: .9rem; }

/* Game library */
.game-picker { margin-top: clamp(1.5rem, 4vw, 2.75rem); scroll-margin-top: 1rem; }
.gallery-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1rem; margin-bottom: .9rem; }
.gallery-title { margin: 0; font-size: 1.35rem; }
.gallery-hint { margin: 0; color: var(--muted); font-size: .9rem; }
.game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.game-grid .game-card .game-art { height: 145px; }
.game-grid .game-card .card-svg { max-height: 88%; }
.game-grid .game-copy { flex: 1 1 auto; grid-template-rows: 1fr auto; }
.game-grid .game-card:active { transform: scale(.98); }
@media (min-width: 1200px) {
  .game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Setup sheet: a centred dialog, or a bottom sheet on phones. */
.sheet {
  width: min(32rem, calc(100% - 2rem));
  max-height: min(46rem, calc(100dvh - 2rem));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(160deg, #142c36, #0b1d27);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
.sheet[open] { display: flex; }
.sheet::backdrop { background: rgba(2, 9, 14, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
html:has(.sheet[open]) { overflow: hidden; }
.sheet form { position: relative; display: flex; flex-direction: column; gap: 0; width: 100%; min-height: 0; }
.sheet-art { flex: none; height: clamp(120px, 22vh, 170px); border-bottom: 1px solid var(--line); }
.sheet-art .game-art { height: 100%; }
.sheet-art .card-svg { max-height: 90%; }
.sheet-close { position: absolute; top: .75rem; right: .75rem; z-index: 5; width: 44px; height: 44px; padding: 0; border-radius: 50%; background: rgba(6, 15, 21, .7); font-size: 1rem; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet-body { display: grid; gap: 1.1rem; padding: 1.25rem 1.4rem; overflow-y: auto; overscroll-behavior: contain; }
.sheet .setup-head h2 { margin: 0; font-size: 1.6rem; letter-spacing: -.03em; }
.sheet .setup-head .eyebrow { margin: 0 0 .35rem; }
.sheet .setup-head .rules { margin: .5rem 0 0; font-size: .92rem; line-height: 1.5; }
.sheet .field-label { font-size: .68rem; }
.sheet .segments { gap: 6px; }
.sheet .segments button { flex: 1 1 auto; min-height: 44px; padding: .35rem .5rem; background: #0b1d27; }
.sheet .segments button[aria-checked="true"] { color: #09211d; background: var(--blue); border-color: var(--blue); }
.sheet .field-note { margin: 0; font-size: .88rem; }
.owner-details summary { min-height: 0; padding: 0; color: var(--muted); font-size: .86rem; font-weight: 650; }
.owner-details summary:hover { color: var(--ink); }
.owner-details .owner { display: grid; gap: .35rem; margin-top: .6rem; }
.owner-details label { color: var(--muted); font-size: .9rem; }
.owner-details input { font-size: 16px; }
#create-notice { margin: 0; padding: .6rem .8rem; border-radius: .6rem; background: rgba(242, 156, 115, .14); color: #ffd2bf; font-weight: 650; }
.sheet-foot { flex: none; padding: .9rem 1.4rem calc(.9rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(8, 23, 34, .6); }
.sheet-foot button { width: 100%; min-height: 50px; font-size: 1.05rem; }
@media (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: sheet-in .22s ease-out; }
  .sheet[open]::backdrop { animation: fade-in .22s ease-out; }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }

#room-title { margin: 0 0 1rem; font-size: clamp(1.7rem, 4vw, 2.7rem); }
.intro[hidden] { display: none; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem 1.5rem; margin-top: clamp(2rem, 5vw, 3.5rem); padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--blue); text-decoration-color: rgba(139, 228, 196, .4); text-underline-offset: 3px; }
.site-footer a:hover { text-decoration-color: currentColor; }
.site-footer a:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 4px; }

@media (max-width: 1023px) {
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Phones and narrow tablets: one column, art under the copy. */
@media (max-width: 760px) {
  .intro { grid-template-columns: 1fr; gap: 1.25rem; margin: 1.1rem 0 .5rem; }
  .hero-art { width: min(560px, 100%); margin: 0 auto; }
  .game-grid { gap: 10px; }
  .game-grid .game-card .game-art { height: 125px; }
}
@media (max-width: 560px) {
  main { width: calc(100% - 28px); }
  .masthead { min-height: 52px; }
  .masthead .brand { font-size: .86rem; }
  .intro h1 { font-size: clamp(2.5rem, 11.5vw, 3.6rem); }
  .intro-description { margin-top: .7rem; font-size: 1rem; }
  .intro-actions { display: grid; grid-template-columns: 1fr; gap: .6rem; margin-top: 1.2rem; }
  .join-row { grid-template-columns: minmax(0, 1fr) auto; }
  .hero-art { border-radius: 1rem; }
  .gallery-title { font-size: 1.2rem; }
  .gallery-hint { font-size: .84rem; }
  /* Compact two-up cards: art, name and player count. */
  .game-grid .game-card { border-radius: 16px; }
  .game-grid .game-card .game-art { height: clamp(84px, 27vw, 120px); }
  .game-grid .art-label, .game-grid .game-copy p, .game-grid .play-arrow, .game-grid .game-meta span + span { display: none; }
  .game-grid .game-copy { grid-template-columns: 1fr; gap: 7px; padding: 11px 12px 13px; }
  .game-grid .game-copy h3 { margin: 0; font-size: 15px; }
  /* Bottom sheet */
  .sheet { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-width: 1px 0 0; border-radius: 22px 22px 0 0; }
  .sheet-body { padding: 1.1rem 1.1rem 1.25rem; }
  .sheet-foot { padding-inline: 1.1rem; }
  .sheet .setup-head h2 { font-size: 1.4rem; }
  .site-footer { flex-direction: column; font-size: .84rem; }
}
@media (max-width: 560px) and (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: sheet-up .26s cubic-bezier(.2, .8, .3, 1); }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
