/* Layout: one column of ledger "sheets"; in play, a journal card, the big T beside the running books, the account tray, and a sticky posting bar. */
:root {
  --paper: #EFF3EC;
  --sheet: #FBFCF8;
  --ink: #17241E;
  --muted: #5A6B62;
  --rule: #D3DDD4;
  --rule-soft: #E3EAE2;
  --ledger: #1E6B49;
  --dr: #2453A3;
  --dr-wash: #E3EBF8;
  --cr: #9C5B00;
  --cr-wash: #F7EBD6;
  --good: #1E7A4C;
  --bad: #B3261E;
  --bad-wash: #F8E2DF;
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E1512; --sheet: #151E1A; --ink: #E3ECE5; --muted: #93A59B; --rule: #2A3732; --rule-soft: #1F2925;
    --ledger: #5DC597; --dr: #86ABF2; --dr-wash: #1B2A42; --cr: #E6AA4E; --cr-wash: #362915;
    --good: #5DC597; --bad: #F2796C; --bad-wash: #3A1D1A; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: var(--ledger); text-underline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ledger); outline-offset: 2px; }
.wrap { position: relative; z-index: 1; max-width: 1040px; margin: 0 auto; padding-block: max(16px, env(safe-area-inset-top, 0px)) 120px; display: grid; gap: 24px; }
#world-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#world-bg:empty { display: none; }
body[data-screen="play"] .wrap { padding-bottom: 55vh; }
.col { display: grid; gap: 20px; min-width: 0; align-content: start; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.eyebrow { font: 600 11px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--bad); font-size: 14px; margin: 0; }
.error:empty { display: none; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: clamp(32px, 6vw, 48px); line-height: 1; font-weight: 800; }
h2 { font-size: 22px; line-height: 1.15; }
h3 { font-size: 17px; }
p { margin: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--sheet);
  padding: 10px 18px; border-radius: 6px; font-weight: 600; line-height: 1.2;
}
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--ledger); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; justify-self: start; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-flex; gap: 6px; align-items: baseline; font: 500 12px/1 var(--mono); border: 1px solid var(--rule); border-radius: 999px; padding: 6px 10px; color: var(--ink); background: var(--sheet); }
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 18px; display: grid; gap: 14px; min-width: 0; align-content: start; }
.empty { color: var(--muted); font-size: 14px; }

/* Header */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand .mark { width: 26px; height: 26px; color: var(--ledger); flex: none; }
.brand b { font: 800 20px/1 var(--display); letter-spacing: -0.02em; }
.brand span { font: 500 12px/1 var(--mono); color: var(--muted); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--ink); font-weight: 500; padding: 6px 10px; border-radius: 6px; }
.nav a:hover { background: var(--rule-soft); }
.nav a.on { background: var(--ink); color: var(--sheet); }
body[data-screen="play"] .nav { display: none; }
.stats { display: flex; gap: 16px; align-items: baseline; }
.stat { display: grid; justify-items: end; }
.stat .num { font-size: 18px; font-weight: 600; }

/* Page heads, heroes */
.hero { display: grid; gap: 10px; }
.hero h1 { font-size: clamp(40px, 8vw, 72px); line-height: .95; }
.hero h1 em, .auth h1 em { font-style: normal; color: var(--ledger); }
.hero p { max-width: 58ch; color: var(--muted); font-size: 17px; }
.page-head { display: grid; gap: 8px; }
.lede { max-width: 62ch; color: var(--muted); font-size: 16px; }
.back { font-size: 13px; justify-self: start; }
.back::before { content: "← "; }

/* Auth */
.auth { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; align-items: center; padding-top: 12px; }
@media (max-width: 760px) { .auth { grid-template-columns: 1fr; } }
.auth-form { gap: 12px; }
.field { display: grid; gap: 6px; }
.field span { font: 600 11px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field input { font: 500 15px/1.2 var(--body); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 10px; width: 100%; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 1px solid var(--rule); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.tab[aria-selected="true"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }

/* Home: two modes, each a full-bleed card with one big title */
.home-hero { padding-top: 8px; }
@property --mode-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --mode-spot { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 760px) { .modes { grid-template-columns: 1fr; gap: 16px; } }
.mode {
  --mx: 50%; --my: 40%; --glow: #F2C14E;
  position: relative; isolation: isolate; display: flex; align-items: flex-end; min-height: clamp(220px, 34vw, 380px);
  border-radius: 16px; overflow: hidden; text-decoration: none; color: #fff; background: #0B0F14;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 10px 30px rgba(15, 25, 20, .14);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s;
}
.mode-compete { --glow: #7FE0B0; background: #0F1B15; }
.mode-bg { position: absolute; inset: 0; z-index: -2; transition: transform .8s cubic-bezier(.2, .8, .2, 1), filter .5s; filter: saturate(.9) brightness(.85); }
/* Legibility (darker toward the title), plus a soft spotlight under the pointer on hover */
.mode::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; transition: --mode-spot .4s;
  background:
    radial-gradient(360px circle at var(--mx) var(--my), color-mix(in srgb, var(--glow) var(--mode-spot), transparent), transparent 70%),
    linear-gradient(to top, rgba(0, 0, 0, .8), rgba(0, 0, 0, .3) 45%, rgba(0, 0, 0, 0) 72%); }
/* Hover: a light running round the edge (a conic gradient masked down to a 2px ring) */
.mode::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit; padding: 2px; opacity: 0; transition: opacity .4s;
  background: conic-gradient(from var(--mode-a), transparent 0 55%, color-mix(in srgb, var(--glow) 60%, transparent) 72%, #fff 80%, var(--glow) 86%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.mode:hover, .mode:focus-visible { transform: translateY(-4px); box-shadow: 0 22px 50px rgba(10, 20, 15, .28), 0 0 0 1px color-mix(in srgb, var(--glow) 35%, transparent); outline: none; }
.mode:hover::before, .mode:focus-visible::before { --mode-spot: 24%; }
.mode:hover::after, .mode:focus-visible::after { opacity: 1; animation: mode-orbit 3.2s linear infinite; }
.mode:hover .mode-bg, .mode:focus-visible .mode-bg { transform: scale(1.05); filter: saturate(1.1) brightness(1); }
@keyframes mode-orbit { to { --mode-a: 360deg; } }

.mode-title { position: relative; z-index: 2; margin: 0; padding: clamp(18px, 3vw, 30px); padding-right: 84px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 .26em;
  font: 800 clamp(38px, 4.4vw, 58px)/.95 var(--display); letter-spacing: -0.03em; color: #fff; text-shadow: 0 2px 24px rgba(0, 0, 0, .45);
  transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.mode-title span:first-child { color: var(--glow); }
.mode-arrow { position: absolute; z-index: 2; right: clamp(18px, 3vw, 30px); bottom: clamp(18px, 3vw, 30px); width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; font: 600 24px/1 var(--body); color: #0B0F14; background: var(--glow); box-shadow: 0 0 24px color-mix(in srgb, var(--glow) 60%, transparent);
  opacity: 0; transform: translateX(-14px) scale(.8); transition: opacity .35s, transform .45s cubic-bezier(.2, .8, .2, 1); }
.mode:hover .mode-title, .mode:focus-visible .mode-title { transform: translateY(-6px); }
.mode:hover .mode-arrow, .mode:focus-visible .mode-arrow { opacity: 1; transform: none; }

/* Story: the two worlds meet on a diagonal seam that slides on hover */
.mode-world { position: absolute; inset: 0; transition: clip-path .8s cubic-bezier(.2, .8, .2, 1); }
.mode-world .poster { aspect-ratio: auto; height: 100%; }
.mode-world-starship { clip-path: polygon(60% 0, 100% 0, 100% 100%, 40% 100%); }
.mode-world-starship .poster { background: radial-gradient(120% 120% at 70% 20%, #120C26, #05040A 60%); }
.mode-seam { position: absolute; inset: 0; background: linear-gradient(to bottom, #fff, var(--glow)); opacity: .75;
  clip-path: polygon(59.7% 0, 60.3% 0, 40.3% 100%, 39.7% 100%); transition: clip-path .8s cubic-bezier(.2, .8, .2, 1), opacity .4s; }
.mode-story:hover .mode-world-starship, .mode-story:focus-visible .mode-world-starship { clip-path: polygon(68% 0, 100% 0, 100% 100%, 46% 100%); }
.mode-story:hover .mode-seam, .mode-story:focus-visible .mode-seam { clip-path: polygon(67.7% 0, 68.3% 0, 46.3% 100%, 45.7% 100%); opacity: 1; }

/* Compete: a ledger page; on hover the figures run and the T lights up */
.mode-ledger { width: 100%; height: 100%; display: block; background: radial-gradient(120% 90% at 50% 0%, #1B3226, #0C1611 70%); }
.mode-ledger pattern line { stroke: rgba(127, 224, 176, .1); stroke-width: 1; }
.mode-ledger .ml-t { fill: none; stroke: rgba(127, 224, 176, .45); stroke-width: 5; stroke-linecap: square; transition: stroke .4s, filter .4s; }
.mode-ledger .ml-side { font: 600 22px var(--mono); fill: rgba(127, 224, 176, .5); letter-spacing: .08em; }
.mode-ledger .ml-figs { font: 500 19px var(--mono); fill: rgba(231, 239, 233, .3); animation: ml-run 9s linear infinite paused; }
.mode-ledger .ml-figs + .ml-figs { animation-direction: reverse; }
@keyframes ml-run { to { transform: translateY(-408px); } }
.mode-compete:hover .ml-figs, .mode-compete:focus-visible .ml-figs { animation-play-state: running; fill: rgba(231, 239, 233, .55); }
.mode-compete:hover .ml-t, .mode-compete:focus-visible .ml-t { stroke: #7FE0B0; filter: drop-shadow(0 0 8px rgba(127, 224, 176, .8)); animation: ml-draw .9s cubic-bezier(.2, .8, .2, 1); }
@keyframes ml-draw { from { stroke-dasharray: 1; stroke-dashoffset: 1; } to { stroke-dasharray: 1; stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .mode, .mode-bg, .mode-title, .mode-arrow, .mode-world, .mode-seam { transition: none; }
  .mode:hover::after, .mode:focus-visible::after { animation: none; }
  .mode-ledger .ml-figs, .mode-compete:hover .ml-t { animation: none !important; }
  .mode:hover, .mode:focus-visible { transform: none; }
}

/* Campaign */
.scenarios { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .scenarios { grid-template-columns: 1fr; } }
.scenario { text-decoration: none; color: var(--ink); gap: 10px; }
.scenario:hover { border-color: var(--ink); }
.scenario h2 { font-size: 30px; font-weight: 800; }
.scenario-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.setting { font: 500 13px/1.3 var(--mono); color: var(--muted); }
.progress-bar { height: 6px; background: var(--rule-soft); border-radius: 3px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--ledger); }
.story-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .story-grid { grid-template-columns: 1fr; } }
.prose { display: grid; gap: 10px; font-size: 16px; line-height: 1.6; max-width: 65ch; }
.prose p { margin: 0; }
.chapters { display: grid; }
.chapter { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 13px 10px; margin: 0 -10px; border-top: 1px solid var(--rule-soft); text-decoration: none; color: var(--ink); border-radius: 6px; }
.chapter.next { background: color-mix(in srgb, var(--ledger) 10%, transparent); }
.c-next { font: 600 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ledger); white-space: nowrap; }
.c-next::after { content: " →"; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chapter-head { display: grid; gap: 8px; }
.chapter.locked { opacity: .5; }
.chapter:not(.locked):hover h3 { text-decoration: underline; }
.chapter .n { font: 600 12px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ledger); }
.chapter p { font-size: 13px; color: var(--muted); }
.stars { font: 600 13px/1 var(--mono); letter-spacing: 2px; color: var(--ledger); white-space: nowrap; }
.intro { gap: 18px; max-width: 780px; }
.lesson { display: grid; gap: 6px; border-left: 3px solid var(--ledger); padding-left: 14px; }
.lesson p { font-size: 16px; }
.lesson b { color: var(--ledger); }
.new-accs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.new-acc { display: grid; gap: 2px; border: 1px solid var(--rule); border-radius: 6px; padding: 8px 12px; }
.intro-ex { display: grid; gap: 10px; border-top: 1px solid var(--rule-soft); padding-top: 14px; }
.intro-ex p { font-weight: 500; }
.ending { gap: 18px; }
.final-books { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 24px; }
@media (max-width: 700px) { .final-books { grid-template-columns: 1fr; } }
table.pl { width: 100%; border-collapse: collapse; margin: 8px 0; }
.pl td { padding: 6px 4px; border-bottom: 1px solid var(--rule-soft); }
.pl tfoot td { font-weight: 700; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }

/* Story picker: one portal per world */
.portals { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 760px) { .portals { grid-template-columns: 1fr; } }
.portal { display: grid; align-content: start; text-decoration: none; border-radius: 12px; overflow: hidden; border: 1px solid var(--rule); transition: transform .2s, box-shadow .2s; }
.portal:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(0, 0, 0, .18); }
.poster { position: relative; aspect-ratio: 1200 / 440; overflow: hidden; }
.poster svg { width: 100%; height: 100%; display: block; }
.portal-body { padding: 18px 22px 24px; display: grid; gap: 8px; }
.portal-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.portal-progress { font: 500 12px/1 var(--mono); opacity: .75; }
.portal h2 { font-size: 34px; line-height: 1; }
.portal-cta { font-weight: 700; margin-top: 6px; }
.portal-starship { background: linear-gradient(#0E0A1C, #06050C); color: #E8E4F0; border-color: rgba(232, 194, 106, .35); }
.portal-starship h2 { font-family: "Cinzel", Georgia, serif; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  background: linear-gradient(180deg, #FFF6DA, #F0CD7A 55%, #B9832E); -webkit-background-clip: text; background-clip: text; color: transparent; }
.portal-starship .setting, .portal-starship .pill { color: #C9B17A; border-color: rgba(232, 194, 106, .35); background: transparent; font-family: "Share Tech Mono", var(--mono); }
.portal-starship .portal-cta { color: #E8C26A; font-family: "Cinzel", Georgia, serif; text-transform: uppercase; letter-spacing: .2em; }
.portal-starship .poster { background: radial-gradient(120% 120% at 70% 20%, #120C26, #05040A 60%); }
.portal-saloon { background: #F4E6C8; color: #2E1D12; border-color: #CDB58C; }
.portal-saloon h2 { font-family: "Rye", Georgia, serif; font-weight: 400; color: #5A1C14; }
.portal-saloon p { font-family: "Lora", Georgia, serif; }
.portal-saloon .setting, .portal-saloon .pill { color: #7A5E44; border-color: #CDB58C; background: transparent; font-family: "Courier Prime", var(--mono); }
.portal-saloon .portal-cta { color: #8E2A1B; font-family: "Rye", Georgia, serif; font-weight: 400; }

/* A world's hero banner */
.world-hero { border-radius: 12px; overflow: hidden; position: relative; }

/* Arrival overlays (each world styles its own) */
.arrival { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; cursor: pointer; transition: opacity .6s ease; overflow: hidden; }
.arrival.leaving { opacity: 0; }
.arrival-skip { position: absolute; z-index: 3; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: transparent; border: 1px solid currentColor; border-radius: 4px; padding: 6px 12px; font: 600 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; opacity: .7; }

/* An overture that waits for the viewer: the continue button appears when it's ready; clicking early fast-forwards. */
.arrival-continue { opacity: 0; pointer-events: none; transition: opacity .8s ease, transform .8s ease; }
.arrival.ready { cursor: default; }
.arrival.ready .arrival-continue { opacity: 1; pointer-events: auto; cursor: pointer; }
.arrival.ff *, .arrival.ff *::before, .arrival.ff *::after { animation-delay: 0s !important; animation-duration: 1ms !important; }

/* Results */
.result { gap: 16px; }
.end-top { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.end-top .stars { font-size: 24px; }
.big { font: 800 clamp(48px, 10vw, 80px)/0.9 var(--display); letter-spacing: -0.03em; }
.stamp { display: inline-block; font: 700 13px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--good); border: 2px solid var(--good); padding: 6px 10px; border-radius: 4px; transform: rotate(-3deg); }
.lb-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Daily Close */
.daily-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .daily-grid { grid-template-columns: 1fr; } }
.today { background: #13201A; color: #E7EFE9; border-color: #13201A; }
.today .eyebrow, .today .muted { color: #93B3A2; }
.today h2 { font-size: 34px; font-weight: 800; color: #fff; }
.today .big { color: #fff; }
.today .btn { background: #7FE0B0; border-color: #7FE0B0; color: #0D1712; }
.tiers { display: flex; flex-wrap: wrap; gap: 4px; }
.tier { font: 600 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 5px 8px; border-radius: 4px; color: var(--muted); border: 1px solid var(--rule-soft); }
.tier.on { color: var(--sheet); background: var(--ledger); border-color: var(--ledger); }
.zone { font-weight: 700; }
.zone.up { color: var(--good); }
.zone.down { color: var(--bad); }
table { width: 100%; border-collapse: collapse; }
.lb td, .lb th { padding: 8px 4px; border-bottom: 1px solid var(--rule-soft); text-align: left; font-size: 14px; }
.lb th { font: 600 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lb .r { text-align: right; }
.lb tr.me td { background: color-mix(in srgb, var(--ledger) 12%, transparent); }
.lb .rank { width: 32px; color: var(--muted); }
.lb .who { overflow-wrap: anywhere; }

/* Profile, team */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tile { display: grid; gap: 4px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px; min-width: 0; }
.tile b { font: 700 26px/1.1 var(--display); overflow-wrap: anywhere; }
.tile b.num { font-family: var(--mono); font-weight: 600; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 800px) { .profile-grid { grid-template-columns: 1fr; } }
.mastery-group { margin-top: 6px; }
.mastery { display: grid; gap: 8px; }
.m-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(60px, 1fr) 88px; gap: 10px; align-items: center; font-size: 14px; }
.m-row .num { font-size: 12px; text-align: right; }
.m-bar { height: 8px; border-radius: 4px; background: var(--rule-soft); overflow: hidden; }
.m-bar span { display: block; height: 100%; border-radius: 4px; }
.m-bar.good span { background: var(--good); }
.m-bar.mid span { background: var(--cr); }
.m-bar.low span { background: var(--bad); }
.camp-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; padding: 6px 0; border-top: 1px solid var(--rule-soft); }
.camp-stars { display: flex; flex-wrap: wrap; gap: 2px 0; }
.camp-stars .stars { font-size: 11px; letter-spacing: 0; }
.camp-stars .sep { width: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .two { grid-template-columns: 1fr; } }
.invite b { letter-spacing: .12em; }

/* ---------- Admin ---------- */
.admin-tabs { gap: 6px; }
.admin-tabs .tab { text-decoration: none; color: var(--ink); }
.admin-tabs .tab[aria-selected="true"] { color: var(--sheet); }
.admin-body { gap: 20px; }
.admin-body .tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .admin-grid { grid-template-columns: 1fr; } }
.admin-filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.admin-filters .field { min-width: 220px; }
.field select, .inline-form select { font: 500 15px/1.2 var(--body); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 9px 10px; width: 100%; }
.table-scroll { overflow-x: auto; }
.admin-table { min-width: 760px; }
.admin-table.round { min-width: 820px; }
.admin-table td { vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td, tr.clickable:focus td { background: color-mix(in srgb, var(--ledger) 7%, transparent); }
.badge { display: inline-block; font: 600 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 3px 6px; border-radius: 3px; background: color-mix(in srgb, var(--ledger) 15%, transparent); color: var(--ledger); }
.badge.warn { background: var(--bad-wash); color: var(--bad); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.player-name { font-size: 30px; }
.actions-panel { gap: 12px; }
.inline-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 200px; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.danger-text { color: var(--bad) !important; border-color: var(--bad) !important; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 45%, var(--rule)); }
.confirm { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.audit { list-style: none; margin: 0; padding: 0; display: grid; }
.audit li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--rule-soft); font-size: 14px; }
.team-manage { display: grid; gap: 12px; padding: 6px 0 10px; }
.member-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.m-row.tight { grid-template-columns: minmax(60px, 1fr) auto; }
.m-row.tight .num { white-space: nowrap; }
.round .answer .ln { display: flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 13px; }
.chart { position: relative; margin: 6px 0 0; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 10px var(--mono); fill: var(--muted); }
.chart .grid { stroke: var(--rule-soft); stroke-width: 1; }
.chart .axis { stroke: var(--rule); stroke-width: 1; }
.chart .bar path { fill: var(--ledger); }
.chart .bar .zero { fill: var(--rule); }
.chart .bar:hover path, .chart .bar:focus path { fill: color-mix(in srgb, var(--ledger) 75%, var(--ink)); }
.chart .bar:focus { outline: none; }
.chart-tip { position: absolute; top: -6px; width: 150px; text-align: center; font: 12px/1.3 var(--mono); background: var(--ink); color: var(--sheet); border-radius: 4px; padding: 5px 8px; pointer-events: none; }

/* ---------- Play ---------- */
.play { display: grid; gap: 20px; }
.journal {
  background: var(--sheet); border: 1px solid var(--rule); border-left: 4px solid var(--ledger);
  border-radius: 8px; padding: 18px 22px 22px; display: grid; gap: 12px; position: relative; overflow: hidden;
}
.journal .meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.journal .event { font: 600 clamp(19px, 3.2vw, 26px)/1.3 var(--display); max-width: 40ch; text-wrap: balance; }
.journal .event .num { font-weight: 600; color: var(--ledger); white-space: nowrap; }
.dots { display: flex; gap: 4px; flex-wrap: wrap; }
.dot { width: 18px; height: 6px; border-radius: 2px; background: var(--rule); }
.dot.ok { background: var(--good); }
.dot.no { background: var(--bad); }
.dot.now { background: var(--ink); }
.clock { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--ledger); width: 100%; transform-origin: left; }
.clock.run { animation: drain 16s linear forwards; }
@keyframes drain { to { transform: scaleX(0); } }
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.desk { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) {
  .desk { display: contents; }
  .play > .journal { order: 1; } .bigt { order: 2; } .play > .board-head { order: 3; } .tray { order: 4; } .books { order: 5; }
}
.bigt { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 16px 18px 18px; min-width: 0; }
.t-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-bottom: 10px; border-bottom: 3px solid var(--ink); }
.t-total { font-size: 22px; font-weight: 600; }
.t-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.t-col { padding: 12px 14px 6px 0; min-height: 168px; display: grid; align-content: start; gap: 10px; min-width: 0; transition: background .12s; }
.t-col.cr { border-left: 3px solid var(--ink); padding: 12px 0 6px 14px; }
.t-col.over.dr { background: var(--dr-wash); }
.t-col.over.cr { background: var(--cr-wash); }
.t-lbl { font: 600 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; display: flex; gap: 6px; }
.t-lbl span { opacity: .6; }
.t-lbl.dr { color: var(--dr); }
.t-lbl.cr { color: var(--cr); justify-content: flex-end; }
.slot { display: grid; gap: 4px; justify-items: center; border: 1.5px dashed var(--rule); background: transparent; border-radius: 6px; min-height: 76px; color: var(--muted); font-size: 13px; padding: 10px; text-align: center; }
.slot .pl-amt { font-size: 15px; font-weight: 600; color: inherit; }
.slot.next.dr { border-color: var(--dr); color: var(--dr); background: var(--dr-wash); }
.slot.next.cr { border-color: var(--cr); color: var(--cr); background: var(--cr-wash); }
.placed { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px; row-gap: 2px; align-items: center;
  border: 1.5px solid var(--rule); border-radius: 6px; padding: 10px 12px; text-align: left; min-height: 76px; width: 100%; }
.placed.dr { border-color: var(--dr); background: var(--dr-wash); }
.placed.cr { border-color: var(--cr); background: var(--cr-wash); }
.pl-name { font: 600 17px/1.2 var(--display); overflow-wrap: anywhere; }
.pl-amt { font-size: 14px; color: var(--muted); grid-row: 2; }
.pl-mark { grid-column: 2; grid-row: 1 / span 2; font: 600 18px/1 var(--mono); color: var(--muted); }
.placed:disabled { cursor: default; }
.placed.ok { border-color: var(--good); }
.placed.ok .pl-mark { color: var(--good); }
.placed.no { border-color: var(--bad); background: var(--bad-wash); }
.placed.no .pl-name { text-decoration: line-through; text-decoration-thickness: 2px; }
.placed.no .pl-mark { color: var(--bad); }
.placed.mini { min-height: 0; padding: 8px 12px; }
.placed.locked { opacity: .85; }
.placed.locked .pl-mark { font: 500 10.5px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.fix { display: grid; gap: 6px; }
.bigt.static { padding: 0; border: 0; background: transparent; }
.bigt.static .t-cols { border-top: 3px solid var(--ink); }
.bigt.static .t-col { min-height: 0; padding-bottom: 0; }
.bigt.static .placed { min-height: 0; }

.books { gap: 8px; }
.tb { overflow-x: auto; }
.tb table { min-width: 320px; }
.tb td, .tb th { padding: 6px 8px; border-bottom: 1px solid var(--rule-soft); font-size: 14px; }
.tb th { font: 600 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: left; }
.tb .r { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tb tfoot td { font-weight: 600; border-bottom: 3px double var(--ink); border-top: 1px solid var(--ink); }
.tb table.compact { min-width: 0; }
.tb table.compact td, .tb table.compact th { padding: 5px 4px; font-size: 13px; }
.tb tr.just td { background: var(--rule-soft); }

.tray { display: flex; flex-wrap: wrap; gap: 16px 24px; }
.grp { display: grid; gap: 6px; align-content: start; min-width: 0; }
.grp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.acc { position: relative; display: grid; gap: 2px; text-align: left; background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px;
  padding: 9px 12px; cursor: grab; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.acc:hover:not(:disabled) { border-color: var(--ink); }
.acc:disabled { cursor: default; opacity: .6; }
.acc-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.acc-type { font: 500 10.5px/1.2 var(--mono); color: var(--muted); }
.up-dr { color: var(--dr); }
.up-cr { color: var(--cr); }
.hide-rules .grow { display: none; }
.acc.used { border-style: dashed; color: var(--muted); }
.acc-tag { position: absolute; top: -8px; right: -6px; font: 600 10px/1 var(--mono); padding: 3px 5px; border-radius: 3px; color: var(--sheet); }
.acc-tag.dr { background: var(--dr); }
.acc-tag.cr { background: var(--cr); }
.acc.ghost { position: fixed; z-index: 30; pointer-events: none; margin: 0; cursor: grabbing; transform: rotate(-2deg); box-shadow: 0 10px 28px rgba(0, 0, 0, .22); opacity: .95; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; }

/* Posting bar */
.post {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--sheet); border-top: 1px solid var(--rule);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.post-in { max-width: 1000px; margin: 0 auto; display: grid; gap: 10px; max-height: 55vh; overflow-y: auto; }
#post-note:empty { display: none; }
.entry-line { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-family: var(--mono); font-size: 14px; }
.entry-line .dr { color: var(--dr); }
.entry-line .cr { color: var(--cr); }
.entry-line .gap { color: var(--muted); }
.post-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.verdict { font: 800 22px/1.1 var(--display); }
.verdict.ok { color: var(--good); }
.verdict.no { color: var(--bad); }
.why { display: grid; gap: 4px; font-size: 14px; max-width: 75ch; }
.why .k { font-family: var(--mono); font-weight: 600; }
.why .k.dr { color: var(--dr); }
.why .k.cr { color: var(--cr); }
.pts { font: 600 15px/1 var(--mono); color: var(--good); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 40;
  background: var(--ink); color: var(--sheet); padding: 10px 16px; border-radius: 6px; font-size: 14px; max-width: calc(100vw - 32px); }

@media (prefers-reduced-motion: reduce) {
  .clock.run { animation: none; }
  .t-col, .portal { transition: none; }
}
.camp-admin { gap: 4px; }
.camp-story { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--rule-soft); }
.camp-story-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.camp-story-head .link { margin-left: auto; font-size: 13px; }
.camp-chs { display: flex; flex-wrap: wrap; gap: 6px; }
.camp-ch { display: grid; justify-items: center; gap: 3px; min-width: 64px; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper);
  font: inherit; color: var(--ink); cursor: pointer; }
.camp-ch .n { font: 600 10.5px/1 var(--mono); letter-spacing: .05em; color: var(--muted); }
.camp-ch .stars { font-size: 11px; letter-spacing: 0; }
.camp-ch .x { font: 600 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--bad); visibility: hidden; }
.camp-ch:hover, .camp-ch:focus-visible { border-color: var(--bad); }
.camp-ch:hover .x, .camp-ch:focus-visible .x { visibility: visible; }
.camp-ch.empty { cursor: default; border-style: dashed; opacity: .55; }
.camp-chs .confirm { flex-basis: 100%; }
