/* The Shop. Navy, blue, and one orange action. Red is only ever the revoke button. */
:root {
  --navy: #0a0e1a;
  --panel: #0e1528;
  --panel-2: #121b33;
  --line: #1d2947;
  --text: #e6ecff;
  --muted: #8f9dc2;
  --blue: #2563eb;
  --blue-soft: #60a5fa;
  --orange: #f97316;
  --red: #dc2626;
  --lamp-working: #22c55e;
  --lamp-waiting: #fbbf24;
  --lamp-idle: #6b7280;
  --radius: 12px;
  --tabbar: 64px;
  --disc: 44px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--navy); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
a { color: var(--blue-soft); }
:focus-visible { outline: 2px solid var(--blue-soft); outline-offset: 2px; }

/* ---- shell ---- */
.app { display: flex; flex-direction: column; min-height: 100%; }
.top { display: flex; align-items: center; gap: 20px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; }
.brand b { display: block; font-size: 18px; letter-spacing: .2px; }
.brand span { color: var(--muted); font-size: 12px; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav button, .tabbar button { background: none; border: 0; padding: 10px 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.nav button[aria-current="page"] { color: var(--text); border-bottom-color: var(--blue); }
.top .who { margin-left: auto; color: var(--muted); font-size: 13px; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); font-size: 12px; text-align: center; }
.count.has { border-color: var(--lamp-waiting); }
.disclosure { color: var(--muted); font-size: 12px; padding: 6px 12px; border-top: 1px solid var(--line); background: var(--navy); }
.disclosure a { margin-left: 6px; white-space: nowrap; }
main { flex: 1; min-height: 0; padding: 12px; display: flex; flex-direction: column; }
main > * { flex: 1; min-height: 0; }
@media (min-width: 1024px) { .app { height: 100vh; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.panel > header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text); }
.panel > header .sub { margin-left: auto; text-transform: none; letter-spacing: 0; color: var(--muted); }
.panel .body { padding: 0 12px 12px; overflow: auto; min-height: 0; flex: 1; }
.pad { padding: 0 14px 8px; flex: none; }
.pad-box { margin: 0 12px 8px; flex: none; }
.chip { padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.empty { color: var(--muted); padding: 14px 4px; }

/* ---- buttons ---- */
.btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; cursor: pointer; }
.btn:hover { border-color: var(--blue); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-wide { width: 100%; }
/* The one action that matters on a screen: Hand it over, or Confirm. Nothing else is orange. */
.btn-go { white-space: nowrap; background: var(--orange); border: 1px solid var(--orange); border-radius: 10px; padding: 10px 16px; color: #1a0f04; font-weight: 600; cursor: pointer; }
.btn-go:disabled { opacity: .5; cursor: default; }
/* Cutting a key. Nothing else is red. */
.btn-revoke { background: var(--red); border: 1px solid var(--red); border-radius: 10px; padding: 9px 14px; color: #fff; font-weight: 600; cursor: pointer; }

input[type="text"], input[type="search"], input[type="password"], input[type="email"], select, textarea { width: 100%; background: var(--navy); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
textarea { resize: vertical; min-height: 44px; }
label { display: block; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--text); }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--text); font-size: 14px; }
.check input { margin-top: 3px; }

/* ---- lamps: a dot AND words, always ---- */
.lamp { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.lamp i { width: 8px; height: 8px; border-radius: 50%; background: var(--lamp-idle); }
.lamp.working i { background: var(--lamp-working); }
.lamp.waiting i { background: var(--lamp-waiting); }
.lamp.working, .lamp.waiting { color: var(--text); }

/* ---- the living atom: plasma core, glowing orbits, wisps, stars ---- */
.atom-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.atom { display: block; flex: none; overflow: visible; }
.atom .spin { transform-box: view-box; transform-origin: 50px 50px; }
.atom .ring-glow { opacity: .55; }
.atom .ring { opacity: .85; }
.atom .halo { opacity: .8; }
.atom .wisps { opacity: .7; }
/* Idle is dormant: dim, and nothing moves. */
.atom.idle .ring-glow { opacity: .22; }
.atom.idle .ring { opacity: .42; }
.atom.idle .halo { opacity: .38; }
.atom.idle .core-glow, .atom.idle .rays { opacity: .35; }
.atom.idle .core { opacity: .7; }
.atom.idle .electron, .atom.idle .electron-dot { opacity: .45; }
.atom.idle .wisps { opacity: .28; }
.atom.idle .stars { opacity: .5; }
/* Waiting on you: awake, slow. */
.atom.waiting .spin { animation: atom-spin 11s linear infinite; }
.atom.waiting .halo { opacity: .6; }
/* Working: the core flares and breathes, the electrons race, the wisps drift. */
.atom.working .ring-glow { opacity: .95; }
.atom.working .ring { opacity: 1; }
.atom.working .halo { opacity: 1; animation: atom-breathe 1.8s ease-in-out infinite; }
.atom.working .wisps { opacity: .9; animation: atom-drift 5s ease-in-out infinite; transform-box: view-box; transform-origin: 50px 50px; }
.atom.working .spin { animation: atom-spin 2.1s linear infinite; }
.atom .spin.s2 { animation-duration: 2.9s; animation-direction: reverse; }
.atom .spin.s3 { animation-duration: 2.5s; }
.atom .spin.s4 { animation-duration: 1.6s; animation-direction: reverse; }
.atom .spin.s5 { animation-duration: 14s; }
.atom.waiting .spin.s2 { animation-duration: 14s; }
.atom.waiting .spin.s3 { animation-duration: 12s; }
.atom.waiting .spin.s4 { animation-duration: 9s; }
.atom.waiting .spin.s5 { animation-duration: 40s; }
.atom.offscreen .spin, .atom.offscreen .halo, .atom.offscreen .wisps { animation-play-state: paused; }
@keyframes atom-spin { to { transform: rotate(360deg); } }
@keyframes atom-breathe { 50% { opacity: .62; } }
@keyframes atom-drift { 50% { transform: rotate(7deg) scale(1.04); } }

/* ---- agent list ---- */
.agents .list { display: flex; flex-direction: column; gap: 2px; }
.agent { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 8px; background: none; border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.agent:hover { background: var(--panel-2); }
.agent[aria-pressed="true"] { border-color: var(--blue); background: var(--panel-2); }
.agent b { display: block; }
.agent .role { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); margin-left: 6px; }
.agents footer { padding: 12px; }

/* ---- network + helix ---- */
.network .stage { position: relative; flex: 1; min-height: 300px; overflow: hidden; border-radius: 0 0 var(--radius) var(--radius); }
.network canvas, .network svg.wires { position: absolute; inset: 0; width: 100%; height: 100%; }
.network svg.wires line { stroke: var(--blue-soft); stroke-width: 1.4; stroke-dasharray: 2 6; opacity: .45; }
.network svg.wires line.live { opacity: 1; stroke-width: 2; }
.node { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; text-align: left; padding: 4px; border-radius: 12px; }
.node b { display: block; font-size: 14px; }
.node .lamp { font-size: 11px; }
.helix-label { position: absolute; left: 14px; top: 4px; font-size: 13px; color: var(--muted); }
.composer-floor { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 8px; }
.composer-floor input { background: rgba(10, 14, 26, .85); }

/* ---- queue + log ---- */
.item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 4px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .t { font-size: 14px; }
.item time { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
button.item { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; }

/* ---- chat ---- */
.chat .msgs { display: flex; flex-direction: column; gap: 10px; padding: 4px 12px 12px; overflow: auto; flex: 1; min-height: 120px; }
.chat .msgs > * { flex: none; }
.msg { max-width: 88%; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: #13254f; border-color: #1f3a7a; }
.msg.note { align-self: stretch; max-width: none; color: var(--muted); font-size: 13px; background: none; border-style: dashed; }
.msg time { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.chat form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat form textarea { min-height: 42px; max-height: 140px; }

/* ---- AUTHORIZATION REQUIRED ---- */
.auth { border: 1px solid var(--lamp-waiting); border-radius: var(--radius); background: var(--panel-2); padding: 14px; }
.auth h3 { font-size: 12px; letter-spacing: 1.4px; color: var(--lamp-waiting); }
.auth .what { font-size: 16px; margin: 6px 0 10px; }
.auth dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0 0 12px; font-size: 13px; }
.auth dt { color: var(--muted); }
.auth dd { margin: 0; overflow-wrap: anywhere; }
.auth .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.msg .auth { margin-top: 8px; white-space: normal; }
.msg:has(.auth) { max-width: 100%; align-self: stretch; }
.auth dd.clip { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- the floor's revoke bar: who holds a key, and the one tap that cuts it ---- */
.keysbar { grid-column: 1 / -1; flex: none; }
.keysbar .body { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; padding: 0 14px 12px; overflow: visible; }
.keysbar .keyrow { border-top: 0; padding: 0; flex: 0 1 auto; min-width: 0; }
.keysbar .empty { padding: 0; }

/* ---- layouts ---- */
.shop { display: grid; gap: 12px; height: 100%; grid-template-columns: 290px minmax(0, 1fr) 360px; grid-template-rows: auto minmax(0, 1fr); }
.shop .center { display: grid; gap: 12px; grid-template-rows: minmax(320px, 1.5fr) minmax(170px, 1fr); min-height: 0; }
.shop .lower { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; min-height: 0; }
.station { display: grid; gap: 12px; height: 100%; grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: minmax(0, 1fr); }
.bench .tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.bench .tabs button { text-transform: none; letter-spacing: 0; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 12px; color: var(--muted); cursor: pointer; }
.bench .tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--blue); }
.bench .body { padding: 14px; }
.cols { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 14px; min-height: 0; }
.page-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.page-list button[aria-pressed="true"] { background: var(--panel-2); }
.rendered { border: 1px solid var(--line); border-radius: 10px; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.rendered .wl { background: none; border: 0; padding: 0; color: var(--blue-soft); text-decoration: underline; cursor: pointer; }
.rendered .wl.missing { text-decoration-style: dashed; color: var(--muted); }
.deck { max-width: 760px; width: 100%; margin: 0 auto; flex: none; overflow: visible; display: flex; flex-direction: column; gap: 12px; }
.keyrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.keyrow:first-child { border-top: 0; }
.banner { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); font-size: 13px; }
pre.mem { white-space: pre-wrap; background: var(--navy); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 6px 0 14px; font: 13px/1.5 ui-monospace, Menlo, monospace; }

/* ---- modal ---- */
.veil { position: fixed; inset: 0; background: rgba(4, 7, 15, .72); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal { width: min(560px, 100%); max-height: 92vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.modal h2 { font-size: 18px; }
.modal ul { margin: 4px 0 0; padding-left: 18px; }
.modal h3 { font-size: 13px; color: var(--muted); letter-spacing: .6px; text-transform: uppercase; }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ---- sign-in / simple pages ---- */
.center-card { max-width: 440px; width: 100%; flex: none; margin: 8vh auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.center-card h1 { font-size: 22px; }
.notice { color: var(--lamp-waiting); font-size: 13px; min-height: 18px; }

/* ---- phone: Muse's layout ---- */
.tabbar { display: none; }
.phone-only { display: none; }
@media (max-width: 1023px) {
  .nav, .top .who { display: none; }
  .phone-only { display: block; }
  .desk-only { display: none !important; }
  /* The 18+ / AI line is pinned just above the tab bar on every phone screen, and the page is padded to clear both. */
  .disclosure { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px)); z-index: 11; min-height: var(--disc); font-size: 11px; line-height: 1.3; padding: 5px 10px; display: flex; align-items: center; flex-wrap: wrap; }
  .app.no-tabs .disclosure { bottom: env(safe-area-inset-bottom, 0px); }
  main { padding: 10px 10px calc(var(--tabbar) + var(--disc) + env(safe-area-inset-bottom, 0px) + 16px); }
  .app.no-tabs main { padding-bottom: calc(var(--disc) + env(safe-area-inset-bottom, 0px) + 16px); }
  .app.no-tabs .tabbar { display: none; }
  main > * { flex: none; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px)); box-sizing: border-box; background: var(--panel); border-top: 1px solid var(--line); z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar button { border: 0; border-top: 2px solid transparent; font-size: 13px; }
  .tabbar button[aria-current="page"] { color: var(--text); border-top-color: var(--blue); }
  .shop, .station { display: flex; flex-direction: column; height: auto; }
  .shop .center, .shop .lower { display: flex; flex-direction: column; }
  /* Waiting-on-you first, the floor of stations next. No wide bench on a phone. */
  .waiting-first { order: -3; }
  .keysbar { order: -2; }
  .agents { order: -1; }
  .keysbar .keyrow { flex: 1 1 100%; }
  .network .stage { min-height: 200px; }
  .network .node, .network svg.wires, .composer-floor { display: none; }
  .agents .list { gap: 8px; }
  .agent { border-color: var(--line); background: var(--panel-2); padding: 12px 10px; }
  .chat { height: calc(100dvh - var(--tabbar) - var(--disc) - env(safe-area-inset-bottom, 0px) - 100px); min-height: 320px; }
  .cols { grid-template-columns: 1fr; }
  .bench .tabs { overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .atom .spin, .atom .halo, .atom .wisps { animation: none !important; }
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* The chat column keeps to its own height and scrolls inside. */
@media (min-width: 1024px) {
  [data-chat-slot], .station > .desk-only { display: flex; min-height: 0; }
  [data-chat-slot] > .chat, .station > .desk-only > .chat { flex: 1; min-height: 0; }
}

/* ---- terms ---- */
.terms { max-width: 720px; width: 100%; margin: 0 auto; padding: 22px; gap: 10px; flex: none; }
.terms h1 { font-size: 22px; }
.terms h2 { font-size: 15px; margin-top: 8px; }

#atom-stage { display: flex; gap: 12px; padding: 20px; background: var(--navy); }

/* ---- Autonomy, Model, receipts ---- */
.subpanel { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--panel-2); }
.row.wrap { flex-wrap: wrap; }
.btn[aria-pressed="true"] { border-color: var(--blue); color: var(--text); opacity: 1; }
.btn[role="tab"][aria-selected="true"] { border-color: var(--blue); }
.banner.warn { border-color: var(--lamp-waiting); }
.provider { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
dl.receipt { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0; font-size: 13px; }
dl.receipt dt { color: var(--muted); }
dl.receipt dd { margin: 0; overflow-wrap: anywhere; }
dl.receipt dd[data-unknown] { color: var(--muted); font-style: italic; }
input[type="date"] { width: 100%; background: var(--navy); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }

/* ---- Notebook graph ---- */
.notegraph { width: 100%; height: auto; max-height: 520px; border: 1px solid var(--line); border-radius: 10px; background: var(--navy); }
.notegraph .edge { stroke: var(--blue-soft); stroke-width: 1.2; opacity: .45; }
.notegraph .gnode { cursor: pointer; }
.notegraph .gnode circle { fill: var(--blue-soft); stroke: var(--navy); stroke-width: 2; }
.notegraph .gnode.missing circle { fill: var(--navy); stroke: var(--muted); stroke-dasharray: 3 3; }
.notegraph .gnode.current circle { fill: #fff; stroke: var(--blue); stroke-width: 3; }
.notegraph .gnode.hit circle { stroke: var(--lamp-waiting); stroke-width: 3; }
.notegraph .gnode text { fill: var(--text); font-size: 13px; }
.notegraph .gnode.missing text { fill: var(--muted); }
.notegraph .gnode:focus-visible circle { stroke: #fff; stroke-width: 3; }
.graphlist { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.graphlist .wl { background: none; border: 0; padding: 0; color: var(--blue-soft); text-decoration: underline; cursor: pointer; }
/* Things stacked in a column keep their own height; they never squash into each other. */
.stack > * { flex: none; }
.notegraph { display: block; aspect-ratio: auto; }
/* The whole dot-and-label is one tap target, so a thumb does not have to find the dot. */
.notegraph .gnode .tap { fill: transparent; }

/* ---- Twin Brain: sync in words, and both answers side by side ---- */
.stackright { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
/* Its own line under the role, so it never runs into the lamp or the role text. */
.sync { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync.stopped { color: var(--text); text-decoration: underline; }
.twin { border-top: 1px solid var(--line); padding-top: 10px; margin: 0 0 12px; font-size: 13px; }
.twin-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.twin-answer { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--navy); min-width: 0; overflow-wrap: anywhere; }
.twin-answer dl { margin: 6px 0; }
.twin-answer p { white-space: pre-wrap; }
.clip { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 520px) { .msg .twin-answers { grid-template-columns: 1fr; } }

/* ---------- Hive: the character sheet ---------- */
.hive { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 12px; align-items: start; }
.hive-main > header { flex-wrap: wrap; gap: 8px; }
.hive-main .body { display: flex; flex-direction: column; gap: 12px; outline: none; }
.hive-list .body { max-height: 60vh; overflow: auto; }
.hive .tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.hive .tabs button { text-transform: none; letter-spacing: 0; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 10px; cursor: pointer; font: inherit; }
.hive .tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--blue); }
.notice.pad { padding: 0 14px; margin: 0; min-height: 0; }
.notice.pad:empty { display: none; }
.sheet, .queen, .tasks, .providers { display: flex; flex-direction: column; gap: 12px; }
.sheet-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.sheet-head h1 { margin: 0; font-size: 22px; }
.sheet-head p { margin: 2px 0; }
.xp { height: 10px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; margin-top: 8px; max-width: 420px; }
.xp i { display: block; height: 100%; background: var(--blue); }
.points { display: grid; grid-template-columns: auto auto; gap: 2px 12px; margin: 0; font-size: 13px; }
.points dt { color: var(--muted); }
.points dd { margin: 0; font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.pick { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 10px 12px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font: inherit; min-height: 44px; }
.pick[aria-checked="true"] { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.pick[aria-checked="true"] b::after { content: " (selected)"; font-weight: 400; color: var(--muted); font-size: 12px; }
.pick:focus-visible, .pips:focus-visible, .hive .tabs button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.note-line { color: var(--lamp-waiting); }
.why summary, details summary { cursor: pointer; }
.layer { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.layer.off { opacity: 0.72; }
.layer-name { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.bees, .gear { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; grid-column: 2; }
.gear select { max-width: 100%; min-height: 36px; }
.btn.step { min-width: 40px; min-height: 40px; padding: 0; font-size: 18px; }
.pips { display: inline-flex; gap: 4px; padding: 6px; border-radius: 8px; }
.pips i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); box-sizing: border-box; }
.pips i.on { background: var(--lamp-waiting); border-color: var(--lamp-waiting); }
.hive .check input { width: 18px; height: 18px; flex: none; }
.lockline { flex-basis: 100%; }
.orbit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
.orbit .core { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; }
.orbit .sat { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.orbit .sat.off { opacity: 0.6; }
.orbit .sat-0, .orbit .sat-1, .orbit .sat-2 { grid-column: 1; }
.orbit .sat-3, .orbit .sat-4, .orbit .sat-5 { grid-column: 3; }
.orbit .sat-0, .orbit .sat-3 { grid-row: 1; }
.orbit .sat-1, .orbit .sat-4 { grid-row: 2; }
.orbit .sat-2, .orbit .sat-5 { grid-row: 3; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }
.timeline { display: flex; flex-direction: column; gap: 6px; }
.tl { border-left: 3px solid var(--line); padding: 4px 0 4px 10px; }
.tl.ok { border-left-color: var(--blue); }
.tl.failed_schema, .tl.failed_model, .tl.timed_out, .tl.stopped_loop, .tl.skipped_cap { border-left-color: var(--lamp-waiting); }
.tl p { margin: 2px 0; overflow-wrap: anywhere; }
.tl-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cand { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
.cand p { margin: 2px 0; }
.clip { max-height: 4.5em; overflow: hidden; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0; }
.squads { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.squad { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.squad.landed { border-color: var(--blue); }
.squad.missing, .squad.timed_out, .squad.skipped_cap, .squad.dropped_pre_start { border-color: var(--lamp-waiting); }
.progress { margin: 0; padding-left: 18px; }
.tasks textarea { width: 100%; box-sizing: border-box; }
.hive-empty { max-width: 560px; }
.hive-disc { margin: 4px 0 0; }
.decided { margin: 6px 0 0; }
@media (prefers-reduced-motion: no-preference) {
  .xp.pulse { animation: xp-glow 1.6s ease-out 1; }
  @keyframes xp-glow { 0% { box-shadow: 0 0 0 0 var(--blue); } 60% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
}
@media (max-width: 1023px) {
  .hive { grid-template-columns: minmax(0, 1fr); }
  .hive-list .body { max-height: 180px; }
  .layer { grid-template-columns: minmax(0, 1fr); }
  .bees, .gear { grid-column: 1; }
  .layer-name { flex-direction: row; align-items: center; justify-content: space-between; }
  .orbit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .orbit .core { grid-column: 1 / span 2; grid-row: auto; }
  .orbit .sat { grid-column: auto !important; grid-row: auto !important; }
  .tabbar button { font-size: 12px; padding: 10px 2px; }
  .gear select { width: 100%; }
}
/* Desktop: the Hive fits the frame like the Shop does. Its panels scroll inside, so the 18+ / AI line never leaves the screen. */
@media (min-width: 1024px) {
  .hive { align-items: stretch; grid-template-rows: minmax(0, 1fr); min-height: 0; overflow: hidden; }
  .hive-main, .hive-list { min-height: 0; }
  .hive-list { align-self: start; max-height: 100%; }
}

.practice-row { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.practice-row .grow { min-width: 200px; flex: 1; }

/* ---------- Hive scoring ---------- */
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.job { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); }
.job.own { border-color: var(--blue); }
.job p { margin: 6px 0; }
.taskset { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; padding: 6px 10px; display: flex; flex-direction: column; gap: 6px; }
.taskset legend { color: var(--muted); font-size: 12px; padding: 0 4px; }
.cap-field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 13px; }
.cap-field input { max-width: 160px; min-height: 40px; }
.rules { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.chart { width: 100%; max-width: 640px; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .range { stroke: var(--muted); stroke-width: 2; }
.chart .dot { fill: var(--panel-2); stroke: var(--blue); stroke-width: 2; }
.chart .num { fill: var(--text); font-size: 10px; font-weight: 700; }
.chart .base .dot { fill: var(--blue); }
.chart .base .halo { fill: none; stroke: var(--text); stroke-width: 2; }
.results .item.base { border-color: var(--blue); }
/* Rows in the Hive wrap: a long label and its figures never share a squeezed line. */
.hive .item { flex-wrap: wrap; row-gap: 4px; height: auto; }
.hive .item > .grow { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.hive .item > .small, .hive .item > time { flex: 0 1 auto; }

/* Ledger panel: plain tables that scroll sideways on a narrow screen instead of squeezing. */
.ledger-table { width: 100%; border-collapse: collapse; font-size: 13px; display: block; overflow-x: auto; }
.ledger-table caption { text-align: left; padding: 4px; }
.ledger-table th, .ledger-table td { text-align: left; vertical-align: top; padding: 8px 6px; border-top: 1px solid var(--line); font-weight: normal; }
.ledger-table thead th { color: var(--muted); border-top: 0; white-space: nowrap; }

/* OAuth consent: where you are sent back to is the thing to read, so it is the largest text on the screen. */
.consent-card { max-width: 520px; }
.redirect-host { font-size: 26px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; margin: 0; }
.consent-scopes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Hive: the brain hologram and saved loadouts ---------- */
.sheet-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 12px; align-items: start; }
.sheet-main, .sheet-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sheet-side { position: sticky; top: 8px; }
@media (max-width: 1100px) { .sheet-grid { grid-template-columns: minmax(0, 1fr); } .sheet-side { position: static; order: -1; } }
.holo { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.holo-stage { position: relative; height: 320px; border-radius: 10px; overflow: hidden; border: 1px solid #1e3a8a; background: radial-gradient(ellipse at 50% 85%, rgba(37, 99, 235, .22), transparent 60%), linear-gradient(180deg, #060a16, #0a1124 70%, #08102a); box-shadow: inset 0 0 40px rgba(37, 99, 235, .18), 0 0 0 1px rgba(96, 165, 250, .06); }
.holo.compact .holo-stage { height: 200px; }
.holo-canvas { display: block; width: 100%; height: 100%; }
.holo-corner { position: absolute; width: 14px; height: 14px; border-color: var(--blue-soft); border-style: solid; opacity: .7; pointer-events: none; }
.holo-corner.tl { top: 6px; left: 6px; border-width: 1px 0 0 1px; }
.holo-corner.br { right: 6px; bottom: 6px; border-width: 0 1px 1px 0; }
.holo-caption { color: #93c5fd; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; font-size: 11.5px; }
.modal-holo { margin: 4px 0 8px; }
.detail-holo { margin-top: 8px; max-width: 420px; }
.loadout-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.loadout { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.loadout.current { border-color: var(--blue); box-shadow: inset 3px 0 0 var(--blue); }
.loadout-name { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.loadout-actions { gap: 4px; flex-wrap: wrap; }
.loadout-actions .btn, .loadouts form .btn { min-height: 36px; }
.loadouts form input { flex: 1 1 160px; min-height: 36px; }
.chip.on { color: var(--text); border-color: var(--blue); }
.btn-quiet { background: none; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--text); }
.btn-confirm-delete { border-color: var(--muted); }

/* Skill tiers: each glows its own colour (gray common, purple epic, gold legendary). Locked skills are dim and say what unlocks them. */
/* The page's CSP allows no inline style, so each tier's colour is a class. Same values as RARITY_COLOR in catalog.ts. */
.rarity-common { --rarity: #9aa3ad; }
.rarity-epic { --rarity: #a855f7; }
.rarity-legendary { --rarity: #f5b301; }
.skills-panel .skill-tier { display: grid; gap: 8px; margin: 8px 0; }
.hive .check.skill { border: 1px solid color-mix(in srgb, var(--rarity) 55%, transparent); border-left: 4px solid var(--rarity); border-radius: 8px; padding: 8px 10px; box-shadow: 0 0 10px color-mix(in srgb, var(--rarity) 30%, transparent); }
.hive .check.skill.rarity-legendary { box-shadow: 0 0 14px color-mix(in srgb, var(--rarity) 45%, transparent); }
.hive .check.skill.locked { opacity: 0.6; box-shadow: none; }
.rarity-tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--rarity); }
.skill-progress { margin: 8px 0 0; padding-left: 18px; }
