/* Neon Drifters: rain, chrome and neon. Dark grid, neon cyan, magenta and
   acid accents, a monospace display face. Every text colour keeps a WCAG AA
   contrast on the darkest surface it sits on; glow and scanlines are
   decoration only and stop with prefers-reduced-motion. */
:root {
  --bg: #06070d;
  --bg-raised: #10132a;
  --bg-sunken: #090b16;
  --panel: rgba(14, 17, 36, .9);
  --line: #2a3160;
  --line-bright: #3d4785;
  /* Outlines that carry meaning (free monitor boxes, empty pips): 3:1+ on every surface. */
  --line-box: #6470b8;
  --text: #e9ecf8;
  --text-soft: #c9cee6;
  --muted: #9ca5cc;
  --neon: #ff3bd4;
  --cyan: #2de2ff;
  --acid: #c6ff3d;
  --ok: #3df5a6;
  --ko: #ff5c7a;
  --warn: #ffc83d;
  --radius: 4px;
  --cut: 10px;
  --glow-neon: 0 0 6px rgba(255, 59, 212, .55), 0 0 18px rgba(255, 59, 212, .25);
  --glow-cyan: 0 0 6px rgba(45, 226, 255, .5), 0 0 18px rgba(45, 226, 255, .2);
  --mono: "JetBrains Mono", "Cascadia Code", "Fira Code", "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1100px 600px at 100% -10%, rgba(255, 59, 212, .14), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(45, 226, 255, .12), transparent 60%),
    linear-gradient(rgba(45, 226, 255, .045) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(45, 226, 255, .045) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.6 var(--sans);
  overflow-wrap: break-word;
}
/* Scanlines over the background, behind every surface. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px);
}
a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: #8ff0ff; }
h1, h2, h3 { font-family: var(--mono); letter-spacing: .03em; line-height: 1.2; }
h1 { font-size: clamp(1.4rem, 4.5vw, 1.9rem); margin: .2rem 0 1rem; text-transform: uppercase; text-shadow: var(--glow-neon); }
h2 { font-size: 1rem; margin: 1.8rem 0 .7rem; color: var(--cyan); text-transform: uppercase; letter-spacing: .12em; }
h2::before { content: "// "; color: var(--neon); }
.kicker { margin: 0; font: 600 .75rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: .18em; color: var(--neon); }
.lede { color: var(--text-soft); max-width: 90ch; }
.muted { color: var(--muted); margin: .2rem 0 0; font-size: .9rem; }
.fine { color: var(--muted); font-size: .85rem; }
.tag {
  display: inline-block; padding: .05rem .45rem; border: 1px solid var(--line-bright); border-radius: 2px;
  font: 500 .72rem/1.5 var(--mono); color: var(--text-soft); vertical-align: middle; text-transform: uppercase; letter-spacing: .05em;
}
.tag-warn { border-color: var(--warn); color: var(--warn); }
.tag-ok { border-color: var(--ok); color: var(--ok); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: .5rem; top: -3rem; z-index: 50; padding: .5rem .8rem; background: var(--acid); color: #06070d; font: 700 .9rem var(--mono); }
.skip:focus { top: .5rem; }

/* Focus: always visible, acid on dark. */
:focus-visible { outline: 2px solid var(--acid); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--acid); outline-offset: 1px; box-shadow: var(--glow-cyan); }

/* Layout: a sidebar with the runner and the menu, the page beside it. */
.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  display: flex; flex-direction: column; gap: 1.2rem; padding: 1.2rem;
  background: rgba(6, 7, 13, .92); border-right: 1px solid var(--line);
  box-shadow: inset -1px 0 0 rgba(255, 59, 212, .25);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .6rem; font: 700 1.05rem var(--mono); color: var(--text); text-decoration: none; text-transform: uppercase; letter-spacing: .08em; }
.brand-mark {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border: 2px solid var(--neon);
  color: var(--neon); font-size: .8rem; box-shadow: var(--glow-neon);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.brand-name { text-shadow: var(--glow-cyan); }
/* The page takes the whole width beside the sidebar: lists and grids fill
   it, running text keeps its own measure (.lede, .message). */
.main { padding: 2rem clamp(1rem, 3vw, 2.5rem); width: 100%; min-width: 0; }
.gate { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }

.status { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; }
.runner-id { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; font-family: var(--mono); }
.wallet { margin: 0; display: grid; gap: .5rem; }
.wallet { grid-template-columns: 1fr 1fr; margin-top: .8rem; }
.wallet dt { font: 600 .7rem var(--mono); text-transform: uppercase; color: var(--muted); letter-spacing: .08em; }
.wallet dd { margin: 0; font-family: var(--mono); font-size: .9rem; }
.gauge-monitor { margin-bottom: .6rem; }

.menu { display: grid; gap: .15rem; }
.menu a {
  display: flex; gap: .7rem; align-items: center; padding: .5rem .7rem; border-radius: 2px;
  color: var(--text); text-decoration: none; font-family: var(--mono); font-size: .92rem; letter-spacing: .03em;
}
.menu a:hover { background: var(--bg-raised); color: var(--cyan); }
.menu a[aria-current="page"] { background: linear-gradient(90deg, rgba(255, 59, 212, .18), transparent); box-shadow: inset 3px 0 0 var(--neon); color: #fff; }
.glyph { width: 1.2rem; text-align: center; color: var(--neon); }
.logout { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }

/* Condition monitor: rows of boxes, filled ones lit. */
.monitor { display: grid; gap: .3rem; }
.monitor-row { display: flex; align-items: center; gap: .5rem; }
.monitor-name { font: 600 .68rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); min-width: 4.2rem; }
.boxes { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.cbox { display: inline-block; width: .95rem; height: .95rem; border: 1px solid var(--line-box); background: var(--bg-sunken); transform: skewX(-12deg); }
.monitor-light .cbox-filled { background: var(--warn); border-color: var(--warn); box-shadow: 0 0 6px rgba(255, 200, 61, .5); }
.monitor-serious .cbox-filled { background: var(--ko); border-color: var(--ko); box-shadow: 0 0 6px rgba(255, 92, 122, .55); }
.monitor-incap .cbox-filled { background: var(--neon); border-color: var(--neon); box-shadow: var(--glow-neon); }

/* Panels and controls: angled corners, thin neon edges. */
.panel, .hero {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.1rem, 3vw, 2rem);
  box-shadow: inset 0 1px 0 rgba(45, 226, 255, .12), 0 0 0 1px rgba(0, 0, 0, .4);
}
.panel::after, .hero::after {
  content: ""; position: absolute; top: -1px; right: -1px; width: 28px; height: 28px; pointer-events: none;
  border-top: 2px solid var(--cyan); border-right: 2px solid var(--cyan);
}
.hero { max-width: 640px; text-align: center; }
.hero h1 {
  font-size: clamp(2.1rem, 8vw, 3.6rem); margin: .6rem 0; color: var(--neon);
  text-shadow: 0 0 18px rgba(255, 59, 212, .6), 0 0 2px #fff;
}
.providers { display: flex; flex-direction: column; gap: .7rem; align-items: center; margin: 1.6rem 0 1rem; }
.local-auth { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.2rem; text-align: left; margin-top: 1.4rem; }
.local-auth h2 { margin-top: 0; }
.stack { display: grid; gap: 1.1rem; max-width: 520px; }
label { display: grid; gap: .4rem; font: 600 .8rem var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
input, textarea, select {
  width: 100%; padding: .65rem .8rem; border-radius: 2px; border: 1px solid var(--line-bright);
  background: var(--bg-sunken); color: var(--text); font: 1rem var(--sans);
}
input:hover, textarea:hover, select:hover { border-color: var(--cyan); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font: 600 .8rem var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .5rem; padding: 0; }
.field { display: grid; gap: .4rem; }
.check { display: flex; align-items: flex-start; gap: .6rem; text-transform: none; letter-spacing: 0; font: 400 .92rem/1.45 var(--sans); color: var(--text); cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; margin: .15rem 0 0; flex: none; accent-color: var(--neon); }
.check:has(input:disabled) { color: var(--muted); cursor: not-allowed; }
.choice { display: flex; align-items: center; gap: .55rem; padding: .7rem; border: 1px solid var(--line); border-radius: 2px; cursor: pointer; color: var(--text); text-transform: none; letter-spacing: 0; font-size: .95rem; background: var(--bg-sunken); }
.choice input { width: auto; accent-color: var(--neon); margin-top: .2rem; }
.choice:hover { border-color: var(--line-bright); }
.choice:has(input:checked) { border-color: var(--neon); box-shadow: inset 0 0 0 1px var(--neon), 0 0 12px rgba(255, 59, 212, .25); }
.choice:has(input:focus-visible) { outline: 2px solid var(--acid); outline-offset: 2px; }
.choice-locked { cursor: not-allowed; opacity: .75; border-style: dashed; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-width: 11rem; max-width: 100%;
  padding: .75rem 1.3rem; border: 1px solid var(--neon); border-radius: 0; cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 59, 212, .28), rgba(255, 59, 212, .08));
  color: #fff; font: 700 .92rem var(--mono); text-decoration: none; letter-spacing: .08em; text-transform: uppercase;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
.button:hover:not(:disabled) { color: #fff; box-shadow: var(--glow-neon); background: linear-gradient(180deg, rgba(255, 59, 212, .45), rgba(255, 59, 212, .15)); }
.button:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button-small { min-width: 5.5rem; padding: .45rem .8rem; font-size: .8rem; --cut: 6px; }
.button-ghost { background: transparent; border-color: var(--line-bright); color: var(--text-soft); }
.button-ghost:hover:not(:disabled) { border-color: var(--cyan); box-shadow: var(--glow-cyan); background: rgba(45, 226, 255, .08); }
.button-danger { border-color: var(--ko); background: linear-gradient(180deg, rgba(255, 92, 122, .3), rgba(255, 92, 122, .08)); }
.button-danger:hover:not(:disabled) { box-shadow: 0 0 14px rgba(255, 92, 122, .5); background: linear-gradient(180deg, rgba(255, 92, 122, .45), rgba(255, 92, 122, .12)); }
.button-roll { border-color: var(--acid); background: linear-gradient(180deg, rgba(198, 255, 61, .28), rgba(198, 255, 61, .06)); min-width: 13rem; }
.button-roll:hover:not(:disabled) { box-shadow: 0 0 14px rgba(198, 255, 61, .5); background: linear-gradient(180deg, rgba(198, 255, 61, .42), rgba(198, 255, 61, .12)); }
.button-discord { border-color: #7c87ff; background: linear-gradient(180deg, rgba(88, 101, 242, .5), rgba(88, 101, 242, .18)); }
.button-google { border-color: #e9ecf8; background: linear-gradient(180deg, rgba(233, 236, 248, .2), rgba(233, 236, 248, .05)); }
.link { background: none; border: 0; color: var(--cyan); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

.flash { padding: .7rem 1rem; border-radius: 2px; border: 1px solid; border-left-width: 4px; margin: 0 0 1rem; background: var(--bg-sunken); }
.flash-error { border-color: var(--ko); background: rgba(255, 92, 122, .12); }
.flash-ok { border-color: var(--ok); background: rgba(61, 245, 166, .08); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .5rem; margin: 0; }
.stats div { background: var(--bg-sunken); border: 1px solid var(--line); border-left: 2px solid var(--cyan); padding: .45rem .7rem; }
.stats dt { font: 600 .7rem var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stats dd { margin: 0; font: 700 1.3rem var(--mono); color: var(--cyan); text-shadow: 0 0 8px rgba(45, 226, 255, .35); }
.stats-wide { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: .8rem; }
.gear { padding-left: 1.1rem; }
.gear li::marker { color: var(--neon); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1.2rem; }
.tile {
  display: grid; gap: .3rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--text); text-decoration: none;
}
.tile strong { font-family: var(--mono); color: var(--cyan); text-transform: uppercase; letter-spacing: .08em; }
.tile span { color: var(--muted); font-size: .9rem; }
.tile:hover { border-color: var(--cyan); box-shadow: var(--glow-cyan); color: var(--text); }
.tile-run { border-color: var(--neon); }
.tile-run strong { color: var(--neon); }
.tile-danger strong { color: var(--ko); }
.tile-danger:hover { border-color: var(--ko); box-shadow: 0 0 12px rgba(255, 92, 122, .35); }
.report, .debrief { border-left: 3px solid; padding: .2rem 1rem; margin: 1rem 0 1.4rem; background: var(--bg-sunken); }
.report-ok { border-color: var(--ok); }
.report-ko { border-color: var(--ko); }
.debrief h2::before { content: ""; }

/* Runner sheet. */
.sheet-top { display: grid; grid-template-columns: minmax(0, 256px) minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.sheet-vitals h2 { margin-top: 0; }
.atouts, .allies, .retired, .fixers, .catalogue, .advances { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.atout, .ally, .fixer, .item { padding: .7rem .9rem; border: 1px solid var(--line); background: var(--bg-sunken); border-radius: 2px; }
.atout p, .item p { margin: .3rem 0 0; }
.effects { display: block; color: var(--acid); font: 500 .82rem var(--mono); margin-top: .2rem; }
.ally { display: flex; gap: .9rem; align-items: flex-start; }
.ally p { margin: .2rem 0 0; }
.ally-portrait { width: 64px; height: 64px; flex: none; object-fit: cover; border: 1px solid var(--cyan); box-shadow: var(--glow-cyan); }
.storyline { border-left: 3px solid var(--neon); padding: .4rem 1rem; background: var(--bg-sunken); }
.storyline h3 { margin: 0 0 .4rem; color: var(--neon); text-transform: uppercase; }
.beats { margin: .4rem 0 0; padding-left: 1.3rem; color: var(--text-soft); }
.beats li::marker { color: var(--cyan); font-family: var(--mono); }

/* Improve, catalogue, fixers. */
.improve-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.improve-grid .box + .box { margin-top: 0; }
.improve-grid h2 { margin-top: 0; }
.advance { display: grid; grid-template-columns: minmax(0, 1fr) 2rem auto; align-items: center; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.advance:last-child { border-bottom: 0; }
.advance-name { font-family: var(--mono); font-size: .9rem; }
.advance-value { font: 700 1.1rem var(--mono); color: var(--cyan); text-align: center; }
.item-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.item-head strong { font-family: var(--mono); }
.item-buy { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .6rem; }
.price { font: 700 .95rem var(--mono); color: var(--acid); }
.owned { font: 700 .8rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--ok); }
.item-owned { border-color: rgba(61, 245, 166, .5); }
.fixer-locked { border-style: dashed; }
.tag-magic { border-color: var(--neon); color: var(--neon); }
.locked { font-size: .85rem; }
.catalogue-filter { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; margin: 1rem 0; }
.catalogue-filter select, .catalogue-filter input[type="search"] { min-width: 0; flex: 1 1 12rem; max-width: 100%; }
.catalogue-count { margin-bottom: .4rem; }
/* The skill and affordable filters, under the search; an entry the
   runner cannot buy now is greyed, its Buy button disabled, its reason
   beside it. */
.catalogue-refine { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin: 0 0 .8rem; }
.catalogue-refine select { min-width: 0; flex: 1 1 12rem; max-width: 22rem; }
.catalogue-refine .check { align-items: center; }
.item-refused { border-style: dashed; }
.item-refused .item-name, .item-refused .effects, .item-refused .item-desc, .item-refused .price { opacity: .55; }
.refusal { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.refusal .locked { color: var(--warn); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .8rem; margin-top: 1.2rem; }
.atout-locked { color: var(--warn); font-size: .85rem; margin: .3rem 0 0; }
.fixer-locked strong { color: var(--muted); }
.clinic { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.clinic .box + .box { margin-top: 0; }
.clinic h2 { margin-top: 0; }
.prices, .spent { margin: 0; display: grid; gap: .3rem; }
.prices div, .spent div { display: flex; justify-content: space-between; gap: 1rem; font-family: var(--mono); font-size: .9rem; }
.prices dt, .spent dt { color: var(--muted); }
.prices dd, .spent dd { margin: 0; }
.retire-form { margin-top: 1rem; }

/* The run: a chat with the game master. */
.run { display: flex; flex-direction: column; min-height: calc(100vh - 4rem); }
.run-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem 1rem; }
.run-header h1 { margin-bottom: .6rem; }
.log {
  flex: 1 1 auto; min-height: 18rem; max-height: calc(100dvh - 19rem); overflow-y: auto; display: flex; flex-direction: column; gap: 1rem;
  padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(6, 7, 13, .78);
  box-shadow: inset 0 0 24px rgba(45, 226, 255, .06);
}
.message { max-width: min(110ch, 100%); }
.message .who { margin: 0 0 .2rem; font: 700 .7rem var(--mono); text-transform: uppercase; letter-spacing: .14em; }
.message-gm { border-left: 2px solid rgba(255, 59, 212, .6); padding-left: .8rem; }
.message-gm .who { color: var(--neon); }
.message-player { align-self: flex-end; background: var(--bg-raised); border: 1px solid var(--line); border-right: 2px solid var(--cyan); padding: .6rem .9rem; }
.message-player .who { color: var(--cyan); }
/* The head of a scene: a wide picture of the place (cropped to a band,
   the same size while it is being drawn: no jump when it comes), the
   scene's number and title over a dark gradient at its bottom. */
.scene { position: relative; flex: none; width: 100%; max-width: 860px; margin: .4rem 0 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-sunken); }
.scene-picture { display: block; }
.scene-image { display: block; width: 100%; height: auto; aspect-ratio: 860 / 320; object-fit: cover; }
.scene-placeholder {
  display: grid; place-items: start end; padding: .7rem .9rem;
  background: linear-gradient(120deg, rgba(255, 59, 212, .14), rgba(45, 226, 255, .08) 55%, transparent), repeating-linear-gradient(0deg, rgba(45, 226, 255, .05) 0 1px, transparent 1px 32px), var(--bg-sunken);
}
/* A scene that gets no picture keeps its title, in a band. */
.scene-none { aspect-ratio: auto; height: 5.5rem; }
.scene-drawing { font: 600 .75rem var(--mono); color: var(--muted); animation: pulse 1.4s ease-in-out infinite; }
.scene-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2.2rem 1rem .7rem;
  background: linear-gradient(transparent, rgba(6, 7, 13, .72) 45%, rgba(6, 7, 13, .92)); pointer-events: none;
}
.scene-title { margin: .15rem 0 0; font-size: clamp(1.05rem, 3.2vw, 1.5rem); color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }
.scene-title::before { content: none; }
.scene-open { position: absolute; top: .6rem; right: .6rem; z-index: 1; background: rgba(6, 7, 13, .7); }
/* The whole picture, uncropped, over the page (a popover: Escape or a
   click outside closes it). */
.scene-full {
  width: min(96vw, 1200px); max-height: 92vh; padding: .6rem; margin: auto;
  border: 1px solid var(--cyan); border-radius: var(--radius); background: var(--bg-raised); color: var(--text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .7), 0 0 14px rgba(45, 226, 255, .25);
}
.scene-full::backdrop { background: rgba(6, 7, 13, .8); }
.scene-full-image { display: block; width: 100%; height: auto; max-height: calc(92vh - 4.5rem); object-fit: contain; background: var(--bg-sunken); }
.scene-full-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; margin-top: .5rem; }
.scene-full-title { font-family: var(--mono); color: var(--cyan); }
.prose p { margin: 0 0 .8rem; }
.prose p:last-child { margin-bottom: 0; }
.rolls { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .4rem; font-size: .9rem; }
.roll { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; padding: .5rem .7rem; background: var(--bg-sunken); border: 1px solid var(--line); }
.roll-ok strong, strong.ok { color: var(--ok); }
.roll-ko strong, strong.ko { color: var(--ko); }
.dice { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.die {
  display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 3px;
  border: 1px solid var(--line-bright); background: var(--bg); font: 700 .85rem var(--mono); color: var(--muted);
}
/* A hit is told by its border width and weight too, not by colour alone. */
.die-hit { border: 2px solid var(--ok); color: var(--ok); font-weight: 800; box-shadow: 0 0 6px rgba(61, 245, 166, .45); }
.die-risk { border-style: dashed; border-color: var(--neon); color: var(--text-soft); background: rgba(255, 59, 212, .1); }
.die-risk.die-hit { border: 2px dashed var(--ok); color: var(--ok); }
.die-one { border-color: var(--warn); color: var(--warn); box-shadow: 0 0 6px rgba(255, 200, 61, .45); }
.dice-risk { padding-left: .5rem; border-left: 1px solid var(--line-bright); }
.glitch { color: var(--warn); font-weight: 700; }
.damage { color: var(--ko); font-weight: 700; }
.composer { margin-top: .8rem; display: grid; gap: .5rem; }
.composer textarea { resize: vertical; min-height: 4.5rem; }
.composer-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .6rem 1rem; }
.composer-bar .check { flex: 1 1 18rem; font-size: .85rem; color: var(--text-soft); }
.run-over { margin: .8rem 0 0; color: var(--muted); }
.run-start { display: grid; gap: 1.4rem; margin-top: 1rem; }
.pays { font-family: var(--mono); color: var(--acid) !important; }

/* The roll panel: the test before the click, the dice after it. */
.roll-panel {
  margin-top: .8rem; padding: 1rem 1.1rem; border: 1px solid var(--acid); background: var(--bg-sunken);
  box-shadow: 0 0 0 1px rgba(198, 255, 61, .15), 0 0 22px rgba(198, 255, 61, .12);
  display: grid; gap: .8rem;
}
.roll-head h2 { margin: .2rem 0 0; color: var(--text); }
.roll-head h2::before { content: "⚄ "; color: var(--acid); }
.roll-head small { color: var(--muted); font-family: var(--sans); text-transform: none; letter-spacing: 0; }
.roll-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .5rem; margin: 0; }
.roll-facts div { border: 1px solid var(--line); padding: .35rem .6rem; }
.roll-facts dt { font: 600 .68rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.roll-facts dd { margin: 0; font: 700 1.1rem var(--mono); color: var(--cyan); }
.edge-advantage { color: var(--ok) !important; }
.edge-disadvantage { color: var(--ko) !important; }
.roll-form { display: grid; gap: .7rem; }
.roll-form .button { justify-self: start; }
.roll-result { display: grid; gap: .5rem; }
.roll-result p { margin: 0; }
.dice-line { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.dice-line .die { width: 2.2rem; height: 2.2rem; font-size: 1.05rem; }
.roll-score { font-family: var(--mono); }
.roll-actions { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.roll-actions form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

/* htmx: indicators show while their request runs. */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }
.thinking { color: var(--neon); font: 600 .9rem var(--mono); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* The brand flickers once in a while, like a tired sign. */
.brand-mark { animation: flicker 7s linear infinite; }
@keyframes flicker { 0%, 93%, 96%, 100% { opacity: 1; } 94%, 97% { opacity: .55; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .menu { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  /* The runner bar of the run page says the same: the run starts on the first screen. */
  .shell:has(#runner-bar) .sidebar .status { display: none; }
  .run { min-height: 70vh; }
  .log { max-height: 60vh; }
  .scene-caption { padding: 1.6rem .7rem .5rem; }
  .scene-open { top: .4rem; right: .4rem; }
  .sheet-top { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 1.2rem 1rem; }
}

/* Runner creation: a stepper on top, a step below. */
.wizard h3 { font: 700 .95rem var(--mono); margin: 1.4rem 0 .3rem; color: var(--text); text-transform: uppercase; letter-spacing: .06em; }
.wizard h3:first-child { margin-top: 0; }
.step-title { margin-top: 1.4rem; }
/* Each step as wide as its name, the connectors share what is left (at
   least 1rem each); short of room, the steps wrap rather than overlap. */
.stepper { display: flex; flex-wrap: wrap; list-style: none; padding: 0; margin: 1.2rem 0 0; gap: .5rem 0; }
.step { display: flex; align-items: center; flex: 1 1 auto; min-width: max-content; }
.step:first-child { flex: 0 0 auto; }
.step + .step::before { content: ""; flex: 1 1 1rem; min-width: 1rem; height: 2px; margin: 0 .6rem; background: var(--line); }
.step-done + .step::before { background: var(--cyan); box-shadow: var(--glow-cyan); }
.step a { display: flex; align-items: center; gap: .5rem; color: var(--muted); text-decoration: none; font: .85rem var(--mono); white-space: nowrap; }
.dot {
  display: grid; place-items: center; width: 1.7rem; height: 1.7rem; flex: none;
  border: 2px solid var(--line-bright); font-weight: 700; font-size: .8rem; transform: rotate(45deg);
}
.dot { text-indent: 0; }
.step-done a { color: var(--cyan); }
.step-done .dot { border-color: var(--cyan); background: var(--cyan); color: var(--bg); }
.step-now a { color: #fff; font-weight: 700; }
.step-now .dot { border-color: var(--neon); color: var(--neon); box-shadow: var(--glow-neon); }
.step a:hover .step-name { text-decoration: underline; }

.wizard-form { display: grid; gap: 1.2rem; }
.wizard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.2rem; align-items: start; }
/* Attributes beside the skills when the screen has room. */
.points-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(26rem, 100%), 1fr)); gap: 1rem; align-items: start; }
.points-grid .box + .box { margin-top: 0; }
.tally-column { position: sticky; top: 1rem; }
.box { background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0; }
.box + .box { margin-top: 1rem; }
.quick-create { margin-top: 1.4rem; }
.quick-create h3 { margin-top: 0; }
.quick-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem .8rem; align-items: center; margin-top: .6rem; }
.quick-fields .button { grid-column: 1 / -1; justify-self: start; }
.sub { margin: 0; font: 600 .7rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
/* Two buttons and their gap wrap on a phone, the next step staying on the right. */
.wizard-nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; }
.wizard-nav > button:last-child { margin-left: auto; }
.field-error { margin: .2rem 0 0; color: var(--ko); font-size: .85rem; grid-column: 1 / -1; }
[aria-invalid="true"] { border-color: var(--ko); }

.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: .6rem; }
.choices legend, .choices > .muted, .choices > .field-error { grid-column: 1 / -1; }
.choice-card { align-items: flex-start; }
/* A choice card is the whole radio: the input covers the card, unseen,
   and the card shows the choice (border, glow and a check). */
.choice-card { position: relative; padding-right: 2rem; transition: border-color .15s, box-shadow .15s; }
.choice-card input[type="radio"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice-card:has(input:checked) { background: rgba(255, 59, 212, .08); }
.choice-card:has(input:checked)::after { content: "✓"; position: absolute; top: .45rem; right: .6rem; color: var(--neon); font: 700 1rem var(--mono); }
.choice-card:has(input:checked) strong { color: var(--neon); }
.choice-card small { display: block; color: var(--muted); font-size: .8rem; margin-top: .2rem; }

.attr-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr) auto; align-items: center; gap: .3rem .8rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.attr-row:last-of-type { border-bottom: 0; }
.attr-name { text-transform: capitalize; color: var(--text); font-size: .85rem; }
.points-input { padding: .4rem .5rem; text-align: center; }
.locked { opacity: .6; }
.rating { display: flex; align-items: center; gap: .5rem; font-family: var(--mono); min-width: 0; }
.rating output { font-weight: 700; color: var(--cyan); }
.pips { display: flex; flex-wrap: wrap; gap: 3px; }
.pip { display: inline-block; width: .9rem; height: .9rem; border: 1px solid var(--line-box); background: var(--bg-raised); transform: skewX(-12deg); }
.pip-base { background: #4a5180; }
.pip-bonus { background: var(--cyan); border-color: var(--cyan); }
.pip-add { background: var(--neon); border-color: var(--neon); }
.pip-over { background: var(--ko); border-color: var(--ko); }
.pip-anarchy { background: var(--acid); border-color: var(--acid); box-shadow: 0 0 5px rgba(198, 255, 61, .5); }
.pip-anarchy-empty { background: transparent; border-color: rgba(198, 255, 61, .55); }
.spec { display: grid; grid-template-columns: 1fr 1fr auto; gap: .8rem; align-items: end; }
.spec-row { margin-bottom: .6rem; }
.spec-row .field-error { grid-column: 1 / -1; margin: 0; }
.spec-add { margin-top: .2rem; }

.tally { display: grid; gap: .3rem; }
.pool-line { margin: 0 0 .6rem; font-family: var(--mono); color: var(--muted); }
.pool { font: 700 1.7rem var(--mono); color: var(--acid); text-shadow: 0 0 10px rgba(198, 255, 61, .35); }
.pool-over { color: var(--ko); text-shadow: none; }

.identity { display: grid; gap: .5rem; }
.identity > label { margin-top: .6rem; }
.identity textarea { resize: vertical; }
.concept { display: grid; gap: .4rem; margin-top: .8rem; }
.concept legend { text-transform: none; }

.portrait { display: grid; gap: .6rem; justify-items: center; text-align: center; margin: 0; }
.portrait img { width: 100%; max-width: 256px; height: auto; border: 1px solid var(--cyan); box-shadow: var(--glow-cyan); }
.portrait figcaption { width: 100%; }
.appearance { white-space: pre-line; }
.summary .tag { margin-left: .3rem; }
.edit { font: 500 .75rem var(--mono); margin-left: .5rem; }
.prose-plain { white-space: pre-line; }
blockquote { margin: .3rem 0; padding-left: .8rem; border-left: 2px solid var(--neon); color: var(--text-soft); font-style: italic; }

@media (max-width: 760px) {
  .wizard-grid, .spec, .quick-fields { grid-template-columns: minmax(0, 1fr); }
  /* The nuyen left stays in sight at the bottom of the screen. */
  .tally-column { position: sticky; bottom: 0; z-index: 5; }
  .tally-column .tally { box-shadow: 0 -8px 24px rgba(0, 0, 0, .7); border-color: var(--acid); padding: .6rem .8rem; }
  .tally-column .tally .fine, .tally-column .spent, .choice-recap { display: none; }
  .stepper { flex-wrap: wrap; gap: .5rem; }
  .step, .step:first-child { flex: 0 0 auto; }
  .step + .step::before { display: none; }
  .step:not(.step-now) .step-name { display: none; }
  .attr-row { grid-template-columns: minmax(0, 1fr) auto; }
  .attr-row .rating { grid-column: 1 / -1; grid-row: 2; }
}

/* Runner bar above the run: compact, wraps on narrow screens. */
.runner-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; background: var(--bg-raised); border: 1px solid var(--line); border-top: 2px solid var(--cyan); padding: .6rem .8rem; margin-bottom: 1rem; }
.runner-bar-portrait { width: 56px; height: 56px; border: 1px solid var(--cyan); object-fit: cover; }
.runner-bar-id { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-family: var(--mono); }
.runner-bar-gauges { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem; }
.runner-bar-gauges .gauge-monitor { margin: 0; }
.gauge-anarchy { display: flex; align-items: center; gap: .5rem; font-family: var(--mono); }
.anarchy-pips { display: inline-flex; align-items: center; gap: 3px; }
.anarchy-pips b { margin-left: .3rem; color: var(--acid); }
.runner-bar dl { margin: 0; display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.runner-bar dt { font: 600 .65rem var(--mono); text-transform: uppercase; color: var(--muted); letter-spacing: .08em; }
.runner-bar dd { margin: 0; font: 600 .9rem var(--mono); }
.runner-bar-stats dd { color: var(--cyan); }
.runner-bar abbr { text-decoration: none; }

/* During a run the bar and the faces of who is present stick to the top of
   the screen while the page scrolls: one dense row on a wide screen, a few
   short rows on a phone. Solid, so the log never shows through. The page
   scrolls a focused field or a dice line out from under it. */
html:has(.run-sticky) { scroll-padding-top: 9rem; }
.run-sticky {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem;
  margin: 0 0 .8rem; padding: .4rem .7rem;
  background: var(--bg-raised); border: 1px solid var(--line); border-top: 2px solid var(--cyan);
  box-shadow: 0 6px 16px rgba(6, 7, 13, .85);
}
.run-sticky .runner-bar { flex: 1 1 auto; gap: .3rem .9rem; margin: 0; padding: 0; border: 0; background: none; }
.run-sticky .runner-bar-portrait { width: 40px; height: 40px; }
.run-sticky .runner-bar-id { flex-direction: column; align-items: flex-start; gap: .1rem; font-size: .9rem; line-height: 1.2; }
.run-sticky .runner-bar-id .tag { font-size: .62rem; padding: 0 .3rem; }
.run-sticky .runner-bar-gauges { gap: .3rem .9rem; }
.run-sticky .monitor { gap: .1rem; }
.run-sticky .monitor-name { min-width: 3.2rem; font-size: .6rem; }
.run-sticky .cbox, .run-sticky .pip { width: .7rem; height: .7rem; }
.run-sticky .runner-bar dl { gap: .2rem .7rem; }
.run-sticky .runner-bar dt { font-size: .6rem; line-height: 1.2; }
.run-sticky .runner-bar dd { font-size: .85rem; line-height: 1.2; }
.present { display: flex; align-items: center; gap: .35rem; margin-left: auto; min-width: 0; }
.present-title { font: 600 .6rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.present-list { display: flex; flex-wrap: wrap; gap: .3rem; list-style: none; margin: 0; padding: 0; }
.present-list:empty { display: none; }
.present-portrait { display: block; width: 32px; height: 32px; object-fit: cover; border: 1px solid var(--line-bright); border-radius: 2px; background: var(--bg-sunken); }
.present-fixer .present-portrait { border-color: var(--neon); }
@media (max-width: 760px) {
  html:has(.run-sticky) { scroll-padding-top: 12rem; }
  .run-sticky { gap: .3rem .7rem; padding: .35rem .5rem; }
  .run-sticky .runner-bar-portrait { width: 36px; height: 36px; }
  .run-sticky .runner-bar-id { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .1rem .3rem; max-width: 9rem; }
  .run-sticky .runner-bar dl { gap: .15rem .6rem; }
  .present { margin-left: 0; }
  .present-portrait { width: 28px; height: 28px; }
}

/* A portrait opens whole on hover, focus or a tap: the uncropped picture
   (contain) with the name and the summary, in a card like the codex's
   (below): fixed, so no scrolling strip clips it, at the bottom of a phone,
   beside the face where anchor positioning exists. */
.zoom { display: inline-flex; flex: 0 0 auto; cursor: zoom-in; border-radius: 2px; }
.zoom:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.zoom-card {
  position: fixed; z-index: 30; left: 1rem; right: 1rem; bottom: 1rem; margin: 0 auto;
  display: none; gap: .3rem; width: auto; max-width: 20rem;
  padding: .6rem; border: 1px solid var(--cyan); border-radius: var(--radius);
  background: var(--bg-raised); box-shadow: 0 6px 24px rgba(0, 0, 0, .6), 0 0 12px rgba(45, 226, 255, .25);
  color: var(--text); font: 400 .85rem/1.45 var(--sans); text-align: left; white-space: normal; overflow-wrap: anywhere;
}
.zoom:hover > .zoom-card, .zoom:focus-within > .zoom-card { display: grid; }
.zoom-image { display: block; width: 100%; height: auto; max-height: min(20rem, 38vh); object-fit: contain; background: var(--bg-sunken); border: 1px solid var(--line); }
.zoom-name { font-family: var(--mono); color: var(--cyan); }
.zoom-summary { color: var(--text-soft); }
@supports (anchor-scope: all) and (position-try-fallbacks: flip-block) {
  @media (min-width: 761px) {
    .zoom { anchor-name: --zoom; anchor-scope: --zoom; }
    .zoom-card {
      inset: auto; margin: .4rem 0; width: min(20rem, calc(100vw - 2rem));
      position-anchor: --zoom; position-area: bottom span-right;
      position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
      position-try-order: most-height;
    }
  }
}

/* Improve is locked during a run: the page says why, its forms are off. */
.flash-locked { border-color: var(--warn); background: rgba(255, 200, 61, .08); }
.improve-lock:disabled .advances, .improve-lock:disabled .spec { opacity: .6; }

/* Codex tooltips: a marked name in the narration holds a hidden card,
   shown on hover and on focus (keyboard, or a tap on mobile; app-5.js
   blurs the name on a tap elsewhere, which iOS does not do). By default the
   card sits at the bottom of the screen, always whole: a fixed card escapes
   the log's scrolling box.
   The card is display: none while closed, not visibility: hidden. A hidden
   card is still laid out, and Firefox then keeps the position fallback it
   chose while closed with the closed style: getComputedStyle (and so the
   accessibility tree and Playwright) reports the open card as hidden, while
   it is painted. Not laid out while closed, the card gets fresh styles. */
.codex-ref {
  color: var(--cyan); cursor: help;
  text-decoration: underline dotted rgba(45, 226, 255, .6); text-underline-offset: 3px;
}
.codex-ref:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 3px; }
.codex-card {
  position: fixed; z-index: 20; left: 1rem; right: 1rem; bottom: 1rem; margin: 0 auto;
  display: none; gap: .1rem .7rem; align-items: start;
  width: auto; max-width: 32rem;
  padding: .7rem .8rem; border: 1px solid var(--cyan); border-radius: var(--radius);
  background: var(--bg-raised); box-shadow: 0 6px 24px rgba(0, 0, 0, .6), 0 0 12px rgba(45, 226, 255, .25);
  color: var(--text); font: 400 .85rem/1.45 var(--sans); font-style: normal; text-align: left; white-space: normal;
  overflow-wrap: anywhere;
}
.codex-ref:hover > .codex-card, .codex-ref:focus-within > .codex-card { display: grid; }
.codex-card:has(.codex-portrait) { grid-template-columns: auto minmax(0, 1fr); }
.codex-card:has(.codex-portrait) > * { grid-column: 2; }
.codex-card > .codex-portrait { grid-column: 1; grid-row: 1 / span 3; }
.codex-kind { font: 600 .65rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--neon); }
.codex-name { font-family: var(--mono); color: var(--cyan); }
.codex-summary { color: var(--text-soft); }
.codex-portrait { width: 64px; height: 64px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; }

/* Where anchor positioning and anchor-scope exist (Chromium 131+), the card
   follows its name on wide screens and flips to stay inside the viewport. */
@supports (anchor-scope: all) and (position-try-fallbacks: flip-block) {
  @media (min-width: 761px) {
    .codex-ref { anchor-name: --codex-ref; anchor-scope: --codex-ref; }
    .codex-card {
      inset: auto; margin: .4rem 0; width: max-content; max-width: min(20rem, calc(100vw - 2rem));
      position-anchor: --codex-ref; position-area: bottom span-right;
      position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
    }
  }
}

/* The codex page. */
.codex-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.codex-entry { display: flex; gap: .9rem; align-items: flex-start; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-sunken); }
.codex-entry p { margin: .2rem 0 0; color: var(--text-soft); }

/* Shops (the wizard's atouts and gear, the catalogue): what you have and
   the nuyen left on the side, the offer and its filter on the rest. */
.shop { display: grid; grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr); gap: 1.2rem; align-items: start; margin-top: 1rem; }
/* The filter form is empty: its fields sit in both panes (form="shop-filter"). */
#shop-filter { display: none; }
.shop-side { position: sticky; top: 1rem; display: grid; gap: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
.shop-side .box + .box { margin-top: 0; }
.shop-side h3, .shop-main h3 { margin-top: 0; }
.shop-picks input[type="search"] { margin-bottom: .6rem; }
.shop-picks-list { display: grid; gap: .4rem; }
.shop-picks .sub { margin-top: .4rem; }
.shop-main { min-width: 0; }
.shop-main .catalogue-filter { margin-top: .4rem; }
.group-title { margin: 1.2rem 0 .5rem; color: var(--cyan); }
.catalogue-grid { grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); align-items: stretch; }
/* A card of a grid spans five rows of the grid (subgrid): name; level,
   Essence and requirement; effects; description; price. The same row lines
   up across the cards of a line, so the Essence is always at one height. */
.catalogue-grid { row-gap: .6rem; }
.catalogue-grid .item { display: grid; grid-template-rows: subgrid; grid-row: span 5; row-gap: .35rem; align-content: start; }
.catalogue-grid .item > p { margin: 0; }
.catalogue-grid .item-buy { margin-top: 0; align-self: end; padding-top: .3rem; }
.catalogue-compact { gap: .4rem; }
.catalogue-compact .item { padding: .5rem .7rem; }
.catalogue-compact .item-buy { margin-top: .3rem; }
.item-picked { border-color: rgba(255, 59, 212, .55); }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; border-bottom: 1px solid var(--line); margin-bottom: .6rem; }
.tab {
  padding: .5rem .9rem; color: var(--text-soft); text-decoration: none; font: 600 .85rem var(--mono);
  text-transform: uppercase; letter-spacing: .06em; border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px;
}
.tab:hover { color: var(--cyan); }
.tab[aria-current="page"] { color: #fff; border-color: var(--line); background: var(--panel); box-shadow: inset 0 2px 0 var(--neon); }

@media (max-width: 760px) {
  .shop { grid-template-columns: minmax(0, 1fr); }
  /* On a phone the side comes first and its tally stays in sight at the
     bottom of the screen, as on the attributes step. */
  .shop-side { display: contents; }
  .shop-side .tally { position: sticky; bottom: 0; z-index: 5; order: 9; box-shadow: 0 -8px 24px rgba(0, 0, 0, .7); border-color: var(--acid); padding: .6rem .8rem; }
  .shop-side .tally .fine, .shop-side .spent { display: none; }
}

/* Admin console */
.admin-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1rem 0; }
.admin-figures .box + .box { margin-top: 0; }
.admin-figures h2, .admin .box h2 { margin-top: 0; font-size: 1rem; }
.table-wrap { max-width: 100%; overflow-x: auto; margin: .6rem 0 1.2rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { font: 600 .75rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--cyan); }
.admin-table tbody tr:hover { background: var(--bg-sunken); }
.admin-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.admin-log { max-height: none; }
.cost-days meter { width: 100%; min-width: 6rem; }
.admin-login { margin-top: 1.4rem; text-align: left; }
.admin-login summary { cursor: pointer; font: 600 .8rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.admin-login form { margin-top: .8rem; max-width: 22rem; }

/* The game content of the admin console. */
.content-note { max-width: 72ch; font-size: .88rem; }
.content-form { display: grid; gap: 1rem; max-width: 960px; }
.content-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem 1rem; align-items: end; }
.content-fieldset { border: 1px solid var(--line); border-radius: 2px; padding: .8rem 1rem 1rem; margin: 0; }
.content-fieldset legend { padding: 0 .4rem; font: 600 .75rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--cyan); }
.content-json { font: .85rem/1.45 var(--mono); resize: vertical; min-height: 16rem; tab-size: 2; }
.content-reason { white-space: pre-line; font: .85rem/1.45 var(--mono); margin: .3rem 0 0; }
.content-error p { margin: 0; }

/* The AI cost chart: one line per kind of call, checked colours (OKLCH L
   0.48-0.67, 3:1+ on the dark surface, told apart under colour blindness);
   the name is always beside the colour. Hover or focus a day for its
   figures; untick a key to hide its line. */
:root { --chart-gm: #2a8fe0; --chart-portrait: #d93fa8; --chart-scene: #1fa88f; --chart-identity: #b08a00; }
.cost-chart { margin: 0 0 1.2rem; padding: 1rem; background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--radius); }
.chart-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin-bottom: .6rem; }
.chart-key { display: inline-flex; align-items: center; gap: .45rem; text-transform: none; letter-spacing: 0; font: 500 .9rem var(--mono); color: var(--text); cursor: pointer; }
.chart-key input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--cyan); }
.chart-swatch { display: inline-block; width: 1.4rem; height: 3px; border-radius: 2px; }
.chart-scroll { overflow-x: auto; }
.chart { display: block; width: 100%; min-width: 600px; height: auto; font-family: var(--mono); }
.chart-grid line { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 12px; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-gm { stroke: var(--chart-gm); fill: var(--chart-gm); background: var(--chart-gm); }
.series-portrait { stroke: var(--chart-portrait); fill: var(--chart-portrait); background: var(--chart-portrait); }
.series-scene { stroke: var(--chart-scene); fill: var(--chart-scene); background: var(--chart-scene); }
.series-identity { stroke: var(--chart-identity); fill: var(--chart-identity); background: var(--chart-identity); }
.chart-line.series-gm, .chart-line.series-portrait, .chart-line.series-scene, .chart-line.series-identity { fill: none; }
.chart-hit { fill: transparent; }
.chart-cross { stroke: var(--text-soft); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-dot { stroke: var(--bg-sunken); stroke-width: 2; }
.chart-tip rect { fill: var(--bg-raised); stroke: var(--line-bright); }
.chart-tip text { fill: var(--text); font-size: 12px; }
.chart-tip .chart-tip-title { fill: var(--cyan); font-weight: 700; }
.chart-tip .chart-tip-value { font-weight: 700; }
.chart-cross, .chart-dot, .chart-tip { visibility: hidden; pointer-events: none; }
.chart-day:hover .chart-cross, .chart-day:hover .chart-dot, .chart-day:hover .chart-tip,
.chart-day:focus .chart-cross, .chart-day:focus .chart-dot, .chart-day:focus .chart-tip { visibility: visible; }
.chart-day:focus { outline: none; }
.chart-day:focus-visible .chart-cross { stroke: var(--acid); stroke-width: 2; stroke-dasharray: none; }
.cost-chart:has(#show-gm:not(:checked)) :is(.chart-line, .chart-dot).series-gm,
.cost-chart:has(#show-portrait:not(:checked)) :is(.chart-line, .chart-dot).series-portrait,
.cost-chart:has(#show-scene:not(:checked)) :is(.chart-line, .chart-dot).series-scene,
.cost-chart:has(#show-identity:not(:checked)) :is(.chart-line, .chart-dot).series-identity,
.cost-chart:has(#show-gm:not(:checked)) .tip-gm,
.cost-chart:has(#show-portrait:not(:checked)) .tip-portrait,
.cost-chart:has(#show-scene:not(:checked)) .tip-scene,
.cost-chart:has(#show-identity:not(:checked)) .tip-identity { display: none; }
.cost-table { margin-bottom: 1.2rem; }
.cost-table summary { cursor: pointer; font: 600 .8rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* Random identity buttons of the creation wizard. */
.field-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .6rem; }
.suggest-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.concept > .suggest { justify-self: start; }
.button.suggest { min-width: 0; }

/* The − and + of a number of the wizard: the buttons appear with JavaScript. */
.spin { display: inline-flex; align-items: stretch; }
.spin .points-input { width: 3.6rem; border-radius: 0; -moz-appearance: textfield; appearance: textfield; }
.spin .points-input::-webkit-inner-spin-button, .spin .points-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.spin-btn { min-width: 2.2rem; padding: 0 .5rem; border: 1px solid var(--line-bright); background: var(--bg-raised); color: var(--cyan); font: 700 1.1rem var(--mono); cursor: pointer; }
.spin-btn:first-child { border-radius: 2px 0 0 2px; border-right: 0; }
.spin-btn:last-child { border-radius: 0 2px 2px 0; border-left: 0; }
.spin-btn:hover:not(:disabled) { color: var(--neon); border-color: var(--neon); }
.spin-btn:focus-visible { outline: 2px solid var(--acid); outline-offset: 1px; position: relative; }
.spin-btn:disabled { color: var(--muted); cursor: not-allowed; opacity: .5; }

/* The start of the creation: quick or full, side by side. */
.start-paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 1.2rem; margin-top: 1rem; align-items: start; }
.start-path { display: grid; gap: .7rem; margin: 0; }
.start-path h2 { margin: 0; }
.start-path > .button { justify-self: start; }
.start-steps { margin: 0; padding-left: 1.4rem; color: var(--text-soft); }
.start-steps li { padding: .1rem 0; }

/* A term of the rules (RR, DV...): the codex card, explained on hover or focus. */
.term abbr { text-decoration: none; }

/* The rows of a catalogue card (item-card). */
.item-name { font-family: var(--mono); }
.item-tags { display: flex; flex-wrap: wrap; gap: .35rem; min-height: 0; }
.item-tags:empty, .item > .effects:empty, .item > .item-desc:empty { min-height: 0; }
.catalogue-compact .item-desc, .catalogue-compact .item-tags:empty, .catalogue-compact .effects:empty { display: none; }
.item-keywords { margin: .3rem 0 0; color: var(--muted); font: .72rem var(--mono); letter-spacing: .04em; }
.catalogue-compact .item-keywords { display: none; }
.catalogue-compact .item { display: grid; gap: .25rem; }
.catalogue-compact .item > p { margin: 0; }

/* Quick filters of the catalogue: one chip per type, with its count. */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0 .8rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border: 1px solid var(--line-bright); border-radius: 999px; color: var(--text-soft); font: 500 .82rem var(--mono); text-decoration: none; background: var(--bg-sunken); }
.chip:hover { color: var(--cyan); border-color: var(--cyan); }
.chip:focus-visible { outline: 2px solid var(--acid); outline-offset: 2px; }
.chip[aria-current="true"] { color: #fff; border-color: var(--neon); background: rgba(255, 59, 212, .15); box-shadow: 0 0 10px rgba(255, 59, 212, .25); }
.chip-count { color: var(--muted); font-size: .75rem; }
.chip[aria-current="true"] .chip-count { color: var(--text-soft); }

/* The cast of the run: the fixer, then the characters met, the latest
   first. A strip that scrolls sideways on a phone, wrapping on a wide
   screen. The fixers' portraits, on their page and on the start form. */
.cast { margin: 0 0 1rem; min-width: 0; }
.cast-title { margin: 0 0 .4rem; font: 700 .7rem var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.cast-strip { display: flex; gap: .6rem; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-bottom: .3rem; }
.cast-list { display: flex; gap: .6rem; flex: 0 0 auto; list-style: none; margin: 0; padding: 0; }
.cast-member {
  flex: 0 0 auto; width: min(15rem, 72vw); display: flex; align-items: flex-start; gap: .6rem; padding: .5rem .6rem;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 2px; scroll-snap-align: start;
}
.cast-fixer { border-top: 2px solid var(--neon); }
.cast-portrait, .fixer-portrait { flex: 0 0 auto; object-fit: cover; border: 1px solid var(--line-bright); border-radius: 2px; background: var(--bg-sunken); }
.cast-portrait { width: 56px; height: 56px; }
.cast-text { min-width: 0; }
.cast-name { font-family: var(--mono); overflow-wrap: anywhere; }
.cast-summary {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  margin-top: .2rem; color: var(--muted); font-size: .8rem; line-height: 1.35;
}
.cast-empty { align-self: center; max-width: 18rem; font-size: .85rem; }
@media (min-width: 900px) {
  .cast-strip { flex-wrap: wrap; overflow-x: visible; }
  .cast-list { flex: 1 1 0; flex-wrap: wrap; min-width: 0; }
}
.fixers .fixer { display: flex; align-items: flex-start; gap: .8rem; }
.fixers .fixer > div { min-width: 0; }
.fixer .fixer-portrait { width: 72px; height: 72px; }
.choice-fixer .fixer-portrait { width: 56px; height: 56px; }
.choice-fixer > span { min-width: 0; }
.fixer-locked .fixer-portrait, .choice-locked .fixer-portrait { filter: grayscale(1); opacity: .7; }
/* On a phone the cast is a slim strip, so the run still starts on the
   first screen: smaller faces, a line of summary. */
@media (max-width: 760px) {
  .cast { margin-bottom: .7rem; }
  .cast-member { width: min(13rem, 66vw); padding: .35rem .5rem; gap: .5rem; }
  .cast-portrait { width: 44px; height: 44px; }
  .cast-summary { -webkit-line-clamp: 1; line-clamp: 1; }
}

/* The landing page: what the game is, how it plays, the ways in. */
.landing { display: grid; gap: 2.4rem; width: min(100%, 1040px); margin: 1rem auto 2rem; }
.landing .hero { margin: 0 auto; }
.landing-hero { max-width: 760px; }
.landing-links { margin: 0; font: 600 .85rem var(--mono); letter-spacing: .06em; }
.landing-section h2 { margin-top: 0; }
.features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 1rem; }
.feature, .how-steps li {
  padding: 1rem 1.1rem; background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--cyan); border-radius: var(--radius);
}
.feature h3, .how-steps h3 { margin: 0 0 .4rem; font-size: .95rem; color: var(--text); text-transform: uppercase; letter-spacing: .06em; }
.feature p, .how-steps p { margin: 0; color: var(--text-soft); font-size: .95rem; }
.how-steps { list-style: none; counter-reset: how; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1rem; }
.how-steps li { counter-increment: how; border-top-color: var(--neon); }
.how-steps li::before { content: counter(how, decimal-leading-zero); display: block; font: 700 1.6rem var(--mono); color: var(--neon); text-shadow: var(--glow-neon); margin-bottom: .2rem; }
.landing-cta { max-width: 760px; }
.landing-cta h2::before { content: ""; }

/* The tutorial: a panel at the top of the page, never in the way of the
   page itself, and the outline of what its tip is about. */
.tutorial {
  position: relative; margin: 0 0 1.2rem; padding: .9rem 1.1rem; max-width: 90ch;
  background: linear-gradient(90deg, rgba(198, 255, 61, .08), transparent 70%), var(--bg-sunken);
  border: 1px solid var(--line); border-left: 3px solid var(--acid); border-radius: 2px;
}
.tutorial-kicker { color: var(--acid); }
.tutorial-where { color: var(--muted); letter-spacing: .08em; }
.tutorial-title { margin: .3rem 0 .4rem; color: var(--text); letter-spacing: .06em; }
.tutorial-title::before { content: ""; }
.tutorial-title:focus { outline: none; }
.tutorial-title:focus-visible { outline: 2px solid var(--acid); outline-offset: 2px; }
.tutorial-text p { margin: 0 0 .5rem; color: var(--text-soft); }
.tutorial-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .6rem; }
.tutorial-skip { margin-left: auto; }
.tutorial-note { margin: 0 0 1.2rem; color: var(--muted); font-size: .9rem; }
.tutorial-note:empty { display: none; }
.tutorial-replay { font-size: .85rem; }
.tutorial-spot { outline: 2px dashed var(--acid); outline-offset: 4px; animation: tutorial-spot 1.6s ease-in-out 3; }
@keyframes tutorial-spot { 50% { box-shadow: 0 0 14px rgba(198, 255, 61, .45); } }
@media (max-width: 760px) {
  .tutorial-skip { margin-left: 0; }
  .landing { gap: 1.6rem; margin-top: 0; }
}

/* The language switch: in the sidebar above the logout, on the gate pages
   at the top right. */
.language-switch { display: flex; gap: .75rem; font-size: .85rem; }
.language-switch [aria-pressed="true"] { color: var(--neon); text-decoration: none; cursor: default; }
.sidebar .language-switch { margin-top: auto; }
.sidebar .language-switch + .logout { margin-top: .5rem; }
.gate .language-switch { justify-content: flex-end; margin-bottom: 1rem; }
