@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

/* Cataterra — storyboard wireframes, BLUEPRINT direction.
   Committed direction propagated from docs/ui-ux/prototype-blueprint.html:
   engineering-drawing identity, desaturated slate-teal, flat hairlines, no page-
   wide grid. Type: IBM Plex Sans for labels/headers/UI, IBM Plex Mono for numeric
   data only. Comfortable type scale + chat rail styling carried over from the
   prototype. See docs/ui-ux/decisions.md + design-direction.md. */

:root{
  --bg:#121a20; --panel:#19232b; --panel-2:#212d36; --sink:#0e151a;
  --line:#2e3e48; --line-2:#22303a; --rule:#3b4f5b;
  --text:#eef3f6; --muted:#b8c7d0; --faint:#90a1ab;
  --accent:#5fb0c2; --accent-ink:#06141a; --accent-2:#d6e2e9;
  --warn:#e0b252; --bad:#e58a86; --good:#5cbf94;
  --radius:2px;
  --ui:"IBM Plex Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
  --mono:"IBM Plex Mono",ui-monospace,"Cascadia Code",Consolas,monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--ui);
  color: var(--text); background: var(--bg); line-height: 1.5; font-size: 15px;
  -webkit-font-smoothing: antialiased;
  /* baked UI scale (~110%) — matches the prototype's size so the storyboard and
     the high-fidelity reference read at the same zoom. See decisions.md. */
  zoom: 1.1;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono, code, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
h1,h2,h3,h4 { font-family: var(--ui); font-weight: 650; margin: 0; }

/* wireframe ribbon (top of every page) — dev annotation */
.wf-ribbon {
  background: var(--sink); color: var(--muted); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; padding: 5px 12px; font-family: var(--mono); border-bottom: 1px solid var(--line);
}
.wf-ribbon a { color: var(--accent); }

/* top status bar */
.topbar { display: flex; align-items: center; gap: 16px; background: var(--panel); border-bottom: 1px solid var(--rule); padding: 9px 16px; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: .02em; }
.brand .logo { display:inline-block; width: 14px; height: 14px; background: var(--accent); vertical-align:-2px; margin-right:8px; }
.chips { display: flex; gap: 8px; margin-left: auto; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; align-items:center; }
.chip { border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 8px; background: var(--sink); color: var(--muted); }
.chip b { color: var(--text); }
.chip.acct { border:0; background:none; padding-left: 10px; border-left:1px solid var(--line); }
/* energy = the always-visible core resource meter; emphasised */
.chip.energy { border-color:var(--rule); background:var(--sink); font-weight:600; display:flex; align-items:center; gap:6px; padding:2px 10px; color:var(--text); }
.chip.energy .ebar { width:54px; height:8px; background:var(--bg); border:1px solid var(--line); border-radius:4px; overflow:hidden; }
.chip.energy .ebar > span { display:block; height:100%; background:var(--accent); }

/* layout */
.layout { display: flex; align-items: stretch; min-height: calc(100vh - 92px); }
.sidebar { width: 210px; flex: none; background: var(--panel); border-right: 1px solid var(--rule); padding: 12px 0; }
.navgroup { margin-bottom: 12px; }
.navgroup h4 { margin: 0 0 3px; padding: 0 14px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); font-family: var(--ui); font-weight: 600; }
.sidebar a { display: block; padding: 4px 14px; color: var(--text); font-size: 14px; }
.sidebar a:hover { background: var(--panel-2); text-decoration: none; }
.sidebar a.active { background: var(--panel-2); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.skillmini { margin: 6px 14px 0; border-top: 1px dashed var(--line); padding-top: 8px; }
.skillmini .sk { display:flex; align-items:center; gap:6px; margin:3px 0; font-size:12px; font-family: var(--mono); }
.skillmini .sk .bar { flex:1; }

.main { flex: 1; min-width: 0; padding: 18px 22px; }
.crumbs { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--faint); margin-bottom: 6px; text-transform: uppercase; }
.page-title { margin: 0 0 4px; font-size: 24px; }
.page-sub { margin: 0 0 16px; color:var(--muted); font-size: 14px; }

/* boxes + placeholders */
.box { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.box > h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-family: var(--ui); font-weight: 600; }
.ph { border: 1px dashed var(--rule); background: var(--sink); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; text-align: center; color: var(--faint); font-family: var(--mono); font-size: 13px; padding: 14px; min-height: 56px; }
.ph.tall { min-height: 150px; }
.ph.short { min-height: 34px; padding: 7px; }

/* grids */
.grid { display: grid; gap: 12px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3,1fr); }
.cols-4 { grid-template-columns: repeat(4,1fr); }
.cols-side { grid-template-columns: 2fr 1fr; }
@media (max-width: 760px){ .grid { grid-template-columns: 1fr; } }

/* buttons (real links) */
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items:center; }
.btn { display: inline-block; border: 1px solid var(--line); background: var(--sink); color: var(--text); padding: 7px 13px; border-radius: var(--radius); font-size: 14px; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 3px 9px; font-size: 13px; }
.btn.disabled { color:var(--faint); border-color:var(--line-2); background:var(--panel); }

/* misc primitives */
.muted { color: var(--muted); font-size: 13px; }
.note { color:var(--muted); font-size:13px; font-style:italic; }
.tag { display:inline-block; border:1px solid var(--line); background:var(--sink); border-radius: var(--radius); padding:1px 8px; font-size: 12px; color:var(--muted); margin:2px 2px 2px 0; }
.bar { height: 8px; background:var(--bg); border:1px solid var(--line); border-radius: 4px; overflow:hidden; }
.bar > span { display:block; height:100%; background:var(--accent); }
.rows > div { display:flex; justify-content: space-between; gap:10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.rows > div:last-child { border-bottom: 0; }
.icongrid { display:grid; grid-template-columns: repeat(8, 1fr); gap:6px; }
.icongrid .cell { aspect-ratio: 1; border:1px solid var(--line); background:var(--sink); border-radius:var(--radius); display:flex; align-items:center; justify-content:center; color:var(--accent-2); font-family: var(--mono); font-size:11px; text-align:center; }
.icongrid .cell.locked { background:var(--panel); color:var(--faint); border-style:dashed; }
table.wf { width:100%; border-collapse: collapse; font-size: 14px; margin: 6px 0; }
table.wf th, table.wf td { border:1px solid var(--line); padding:6px 8px; text-align:left; }
table.wf th { background:var(--sink); font-family: var(--ui); font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.08em; color:var(--faint); }
.tabs { display:flex; gap:4px; border-bottom:1px solid var(--rule); margin-bottom:12px; flex-wrap:wrap; }
.tabs a { padding:6px 12px; border:1px solid var(--line); border-bottom:0; border-radius:var(--radius) var(--radius) 0 0; background:var(--sink); color:var(--muted); font-size:14px; }
.tabs a.active { background:var(--panel); color:var(--text); font-weight:600; position:relative; top:1px; }
.state { border:1px solid var(--line); border-left:3px solid var(--accent); background:var(--panel); border-radius:var(--radius); padding:12px 14px; margin-bottom:14px; }
.state-label { font-family: var(--mono); font-size:12px; color:var(--accent-ink); background:var(--accent); display:inline-block; padding:2px 8px; border-radius:var(--radius); margin-bottom:10px; letter-spacing:.05em; }
.arrow { text-align:center; color:var(--faint); font-size:22px; margin:-6px 0 8px; }
.linkto { color:var(--accent); font-family: var(--mono); font-size:12px; }
.flag { background:rgba(224,178,82,.1); border:1px solid var(--warn); border-radius:var(--radius); padding:8px 10px; font-size:13px; color:var(--warn); margin:8px 0; }

/* labeled square tiles — items / skills / recipes share one language
   (migrated from prototype-blueprint.html). Set --tile-cols per grid; the box
   holds a short mono code (icon stand-in), an optional .badge (qty), then a name
   and optional .lv (level). */
.tiles { display:grid; grid-template-columns:repeat(var(--tile-cols,6),1fr); gap:9px; }
.tile { text-align:center; color:var(--text); }
a.tile:hover { text-decoration:none; }
.tile .box { position:relative; height:52px; border:1px solid var(--line); background:var(--sink); border-radius:var(--radius); display:flex; align-items:center; justify-content:center; color:var(--accent-2); font-family:var(--mono); font-size:12px; letter-spacing:.04em; }
.tile:hover .box { border-color:var(--accent); }
.tile.out .box { border-color:var(--accent); color:var(--accent); }
.tile.short .box { border-style:dashed; border-color:var(--bad); color:var(--bad); }
.tile .badge { position:absolute; right:-1px; bottom:-1px; font-family:var(--mono); font-size:11px; line-height:1.5; color:var(--text); background:var(--panel-2); border:1px solid var(--line); border-right:0; border-bottom:0; padding:0 4px; }
.tile.short .badge { color:var(--bad); border-color:var(--bad); }
.tile .nm { display:block; font-size:12px; color:var(--muted); margin-top:5px; line-height:1.2; }
.tile .lv { display:block; font-family:var(--mono); font-size:12px; color:var(--accent); margin-top:2px; }
.tile.locked .box, .tile.empty .box { border-style:dashed; color:var(--faint); }
.tile.locked .nm, .tile.locked .lv { color:var(--faint); }

/* energy cost convention — mono, amber, used inline next to actions */
.ecost { font-family:var(--mono); color:var(--warn); white-space:nowrap; }

/* ===========================================================================
   SIGNATURE COMPONENTS — ported from prototype-blueprint.html so the storyboard
   matches the verified screens. (1) hub-list launcher, (2) location anchor +
   NOTES bar + statline + action list, (3) NPC dossier. See decisions.md.
   =========================================================================== */

/* (1) HUB-LIST launcher (dashboard home) — icon + label + meta + chevron rows */
.hub { border:1px solid var(--line); background:var(--panel); border-radius:var(--radius); overflow:hidden; margin-bottom:14px; }
.hub a { display:flex; align-items:center; gap:14px; padding:10px 16px; border-top:1px solid var(--line-2); color:var(--text); }
.hub a:first-child { border-top:0; }
.hub a:hover { background:var(--panel-2); text-decoration:none; }
.hub .ic { width:36px; height:36px; flex:none; border:1px solid var(--line); background:var(--sink); display:flex; align-items:center; justify-content:center; font-family:var(--mono); font-size:12px; font-weight:700; color:var(--accent); }
.hub .lab { flex:1; min-width:0; }
.hub .lab .t { font-size:16px; font-weight:600; }
.hub .lab .d { color:var(--muted); font-size:13px; margin-top:1px; }
.hub .meta { font-family:var(--mono); font-size:12px; color:var(--accent-2); white-space:nowrap; }
.hub .chev { color:var(--faint); font-family:var(--mono); }

/* (2a) LOCATION ANCHOR — full-width blueprint site drawing; flavour in NOTES bar */
.scene { border:1px solid var(--rule); background:var(--sink); border-radius:var(--radius); margin-bottom:14px; overflow:hidden; }
.scene .draw { position:relative;
  background-image:repeating-linear-gradient(0deg, rgba(150,170,180,.05) 0 1px, transparent 1px 18px),
                   repeating-linear-gradient(90deg, rgba(150,170,180,.05) 0 1px, transparent 1px 18px); }
.scene .draw svg { display:block; width:100%; height:auto; }
.scene .corner { position:absolute; left:0; top:0; font-family:var(--mono); font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--accent); background:rgba(14,21,26,.88); border-right:1px solid var(--rule); border-bottom:1px solid var(--rule); padding:4px 8px; }
.scene .titleblock { position:absolute; right:0; bottom:0; display:flex; font-family:var(--mono); font-size:11px; letter-spacing:.04em; color:var(--muted); background:rgba(14,21,26,.88); border-left:1px solid var(--rule); border-top:1px solid var(--rule); }
.scene .titleblock span { padding:4px 7px; border-left:1px solid var(--line-2); }
.scene .titleblock span:first-child { border-left:0; color:var(--accent-2); }
.scene .notes { display:flex; align-items:baseline; gap:14px; padding:11px 16px; background:var(--panel); border-top:1px solid var(--rule); }
.scene .notes .lbl { flex:none; font-family:var(--mono); font-size:11px; letter-spacing:.18em; text-transform:uppercase; color:var(--accent); }
.scene .notes p { margin:0; flex:1; min-width:0; font-size:14px; line-height:1.5; color:var(--text); }
.scene .notes .ref { flex:none; margin-left:auto; font-family:var(--mono); font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:var(--faint); white-space:nowrap; }
@media(max-width:680px){ .scene .notes{ flex-wrap:wrap; gap:6px; } .scene .notes .ref{ margin-left:0; } }

/* (2b) STATLINE — a row of labelled readouts (skill req / energy / hazard / drop) */
.statline { display:flex; border:1px solid var(--line); background:var(--panel); border-radius:var(--radius); margin-bottom:14px; }
.statline .cell { flex:1; padding:10px 14px; border-right:1px solid var(--line-2); }
.statline .cell:last-child { border-right:0; }
.statline .l { font-family:var(--mono); font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--faint); }
.statline .v { font-family:var(--mono); font-size:16px; margin-top:6px; color:var(--text); }
.statline .v small { color:var(--muted); font-size:12px; }
.statline .v b { color:var(--accent); }
.statline .v.energy { color:var(--warn); }
@media(max-width:680px){ .statline{ flex-wrap:wrap; } .statline .cell{ flex:1 1 50%; } }

/* (2c) ACTION LIST — icon + label + right-aligned cost (energy/xp/gate) + sub */
.acts { border:1px solid var(--line); background:var(--panel); border-radius:var(--radius); overflow:hidden; margin-bottom:14px; }
.acts a { display:flex; align-items:center; gap:14px; padding:10px 16px; border-top:1px solid var(--line-2); color:var(--text); }
.acts a:first-child { border-top:0; }
.acts a:hover { background:var(--panel-2); text-decoration:none; }
.acts a.primary { background:rgba(95,176,194,.07); }
.acts .ic { width:30px; height:30px; flex:none; border:1px solid var(--line); background:var(--sink); display:flex; align-items:center; justify-content:center; font-family:var(--mono); font-size:13px; color:var(--accent); }
.acts .lab { flex:1; min-width:0; }
.acts .lab .t { font-size:15px; font-weight:600; }
.acts .lab .d { color:var(--muted); font-size:13px; margin-top:1px; }
.ameta { text-align:right; white-space:nowrap; min-width:96px; }
.ameta .top { font-family:var(--mono); font-size:15px; font-weight:700; color:var(--text); }
.ameta .top.energy { color:var(--warn); }
.ameta .top.xp { color:var(--good); }
.ameta .top.gate { color:var(--faint); font-weight:400; font-size:13px; }
.ameta .sub { font-family:var(--mono); font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--faint); margin-top:3px; }

/* (3) NPC DOSSIER — id-photo + role + meta + diegetic quote */
.dossier { border:1px solid var(--line); background:var(--panel); border-radius:var(--radius); padding:14px 16px; margin-bottom:14px; }
.dossier .row { display:flex; gap:14px; }
.dossier .idphoto { width:78px; height:96px; flex:none; border:1px solid var(--line); background:var(--sink); position:relative; overflow:hidden; }
.dossier .idphoto .ref { position:absolute; left:0; right:0; bottom:0; font-family:var(--mono); font-size:9px; color:var(--muted); background:rgba(10,26,41,.85); padding:1px 4px; border-top:1px solid var(--line); }
.dossier .nm { font-size:16px; font-weight:650; }
.dossier .role { font-family:var(--mono); font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--accent-2); margin:2px 0 8px; }
.dossier .meta { font-family:var(--mono); font-size:11.5px; color:var(--muted); line-height:1.7; }
.dossier .meta b { color:var(--text); }
.dossier .quote { margin-top:11px; padding-top:11px; border-top:1px dashed var(--line); font-size:14px; color:var(--text); font-style:italic; }
.dossier .quote::before { content:"\201C"; } .dossier .quote::after { content:"\201D"; }

/* (craft) APPARATUS drawing — the craft-screen equivalent of the location anchor:
   a drawn schematic of the process + a flavour caption. */
.apparatus { display:flex; gap:16px; align-items:center; padding:6px 0 14px; border-bottom:1px dashed var(--line); margin-bottom:14px; }
.apparatus svg { flex:none; }
.apparatus .cap { font-size:13.5px; color:var(--muted); line-height:1.5; }
.apparatus .cap b { color:var(--text); font-weight:600; }
.apparatus .cap .pill { font-family:var(--mono); font-size:11px; border:1px solid var(--line); padding:1px 6px; color:var(--muted); margin-right:4px; }

/* persistent right chat rail — full-height, present on every in-game page.
   Style carried from the prototype: presence count, mono usernames + timestamps,
   system lines, trade badges, a real Send button. Reserve a gutter for the fixed
   rail; :has() means only pages with a .chatdock get it. */
body:has(.chatdock) { padding-right: 290px; }

.chatdock { position: fixed; top: 0; right: 0; bottom: 0; width: 290px; background:var(--panel); border-left:1px solid var(--rule); font-size:14px; z-index:60; display:flex; flex-direction:column; }
.chatdock > summary { flex:none; list-style:none; cursor:default; pointer-events:none; padding:9px 14px; background:var(--panel); border-bottom:1px solid var(--line); display:flex; align-items:center; gap:8px; font-family:var(--ui); font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--muted); font-weight:700; }
.chatdock > summary::-webkit-details-marker { display:none; }
.chatdock .cd-on { margin-left:auto; font-family:var(--mono); font-size:11px; letter-spacing:0; text-transform:none; color:var(--muted); font-weight:400; display:flex; align-items:center; gap:5px; }
.chatdock .cd-pip { width:6px; height:6px; border-radius:50%; background:var(--good); display:inline-block; }
.chatdock .cd-hint { display:none; }
.chatdock .cd-body { flex:1; min-height:0; display:flex; flex-direction:column; padding:10px 12px; }
.chatdock .cd-tabs { flex:none; display:flex; gap:4px; margin-bottom:8px; flex-wrap:wrap; }
.chatdock .cd-tabs a { font-family:var(--ui); font-size:12px; padding:2px 8px; border:1px solid var(--line); border-radius:var(--radius); background:var(--sink); color:var(--muted); }
.chatdock .cd-tabs a.active { background:var(--panel-2); border-color:var(--accent); color:var(--accent); font-weight:600; }
.chatdock .cd-log { flex:1; min-height:0; overflow:auto; padding:2px 2px 0; }
.chatdock .cd-log p { margin:0 0 10px; line-height:1.4; font-size:13px; }
.chatdock .cd-log p b { font-family:var(--mono); color:var(--accent); font-weight:700; font-size:12px; }
.chatdock .cd-ts { font-family:var(--mono); color:var(--faint); font-size:11px; margin-left:5px; }
.chatdock .cd-sys { color:var(--muted); font-style:italic; font-family:var(--mono); font-size:12px; }
.chatdock .cd-trade { display:inline-block; font-family:var(--mono); font-size:11px; border:1px solid var(--warn); color:var(--warn); border-radius:var(--radius); padding:0 4px; margin-right:4px; }
.chatdock .cd-input { flex:none; display:flex; gap:6px; margin-top:8px; align-items:center; border-top:1px solid var(--line); padding-top:8px; }

/* ---- responsive: keep balance across browser widths ---- */
@media (min-width: 1500px){
  body:has(.chatdock) { padding-right: 330px; }
  .chatdock { width: 330px; }
}
@media (max-width: 1080px){
  body:has(.chatdock) { padding-right: 0; }
  .chatdock { position: static; width: auto; border-left:0; border-top:1px solid var(--rule); }
  .chatdock .cd-log { flex:none; height: 150px; }
}
@media (max-width: 760px){
  .layout { flex-direction: column; min-height: 0; }
  .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--rule); padding: 8px 0; }
  .main { padding: 14px 16px; }
}

/* ===========================================================================
   APP ADDITIONS — runtime-only chrome the storyboard CSS doesn't carry:
   guest banner, Django messages, and the centered auth card (pre-game pages).
   Same Blueprint tokens; no new register.
   =========================================================================== */
.guest-banner { background:rgba(224,178,82,.1); border-bottom:1px solid var(--warn); color:var(--warn); font-size:13px; padding:7px 16px; display:flex; gap:10px; align-items:center; }
.guest-banner a { color:var(--warn); font-weight:600; text-decoration:underline; }

.beta-banner { background:rgba(95,176,194,.1); border-bottom:1px solid var(--accent); color:var(--accent-2); font-size:13px; padding:7px 16px; text-align:center; }

.authcard form .errorlist { color:var(--bad); }
.authcard .field-error { color:var(--bad); font-size:13px; margin:-6px 0 10px; }

.messages { list-style:none; margin:0; padding:10px 22px 0; }
.messages li { border:1px solid var(--line); border-left:3px solid var(--accent); background:var(--panel); border-radius:var(--radius); padding:9px 12px; margin-bottom:8px; font-size:14px; }
.messages li.error { border-left-color:var(--bad); color:var(--bad); }
.messages li.success { border-left-color:var(--good); }

.authwrap { display:flex; justify-content:center; padding:48px 16px; }
.authcard { width:100%; max-width:380px; border:1px solid var(--rule); background:var(--panel); border-radius:var(--radius); padding:22px 24px; }
.authcard h1 { font-size:20px; margin-bottom:14px; }
.authcard form p { margin:0 0 12px; }
.authcard label { display:block; font-size:12px; letter-spacing:.08em; text-transform:uppercase; color:var(--faint); margin-bottom:4px; }
.authcard input { width:100%; background:var(--sink); border:1px solid var(--line); border-radius:var(--radius); color:var(--text); font-family:var(--ui); font-size:15px; padding:8px 10px; }
.authcard input:focus { outline:none; border-color:var(--accent); }
.authcard .errorlist { list-style:none; margin:0 0 10px; padding:0; color:var(--bad); font-size:13px; }
.authcard .alt { margin-top:14px; font-size:13px; color:var(--muted); }
.authcard .helptext, .authcard .helptext li { color:var(--faint); font-size:12px; }

