:root {
  --bg: #0f1a14;
  --panel: #16241b;
  --panel2: #1d3025;
  --line: #2a4232;
  --ink: #eef4e8;
  --ink2: #c3cfc4;
  --muted: #93a896;
  --accent: #f2b441;
  --mem: #7de8ff;
  --brain: #3987e5;
  /* outcome colors: validated categorical slots (dark) */
  --o-blocked: #d95926;
  --o-move: #199e70;
  --o-collision: #c98500;
  --o-ride: #3987e5;
  --o-harvest: #d55181;
  --drawer-h: 78px;
  --board: min(calc(100vw - 16px), calc(100svh - 250px), 720px);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 700px at 30% 0%, #1f3b29 0%, var(--bg) 60%) fixed;
  color: var(--ink);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  overflow-x: hidden;
  padding-bottom: calc(var(--drawer-h) + env(safe-area-inset-bottom) + 12px);
  -webkit-tap-highlight-color: transparent;
}
button, select { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
kbd { background: #2c4434; border-radius: 4px; padding: 0 5px; font-size: 11px; border-bottom: 2px solid #1a2a20; margin-right: 2px; }

/* ------------------------------------------------ header + ticker */
.topbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.brand { display: flex; align-items: center; gap: 9px; margin-right: auto; min-width: 0; flex: 1 1 auto; }
.brand > div { min-width: 0; }
.brand h1 { font-size: 16px; margin: 0; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand p { margin: 0; color: var(--muted); font-size: 11.5px; display: none; }
.logo {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 10%, #86b6ef 24%, #2a78d6 62%, #0d366b 100%);
  box-shadow: 0 0 12px #3987e580, 0 3px 6px #0008;
}
.me { display: flex; align-items: center; gap: 7px; background: var(--panel2); padding: 4px 10px 4px 5px; border-radius: 999px; min-width: 0; flex: 0 1 auto; max-width: 42vw; }
.me > div { min-width: 0; overflow: hidden; }
.me b { font-size: 12.5px; white-space: nowrap; }
.me small { display: block; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.me-ball { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #888; box-shadow: 0 2px 4px #0008; }
.guide-btn {
  display: flex; align-items: center; gap: 6px; border: 1px solid #3a5a45; background: var(--panel2);
  color: var(--ink); border-radius: 999px; padding: 4px 6px; flex: none;
}
.guide-btn span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #2a1a00; font-weight: 800; }
.guide-btn em { font-style: normal; display: none; padding-right: 6px; }
.guide-btn:hover { background: #2b4735; }

.ticker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 8px 8px; }
@media (min-width: 700px) { .ticker { display: flex; justify-content: center; } }
.ticker::-webkit-scrollbar { display: none; }
.ticker div { min-width: 0; text-align: center; background: #0e1812; border: 1px solid var(--line); border-radius: 10px; padding: 3px 6px; }
.ticker b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.ticker small { color: var(--muted); font-size: 9.5px; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }

/* ------------------------------------------------ layout */
.stage { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 0 8px; }
.board-col { width: 100%; display: flex; justify-content: center; }
.board-wrap { position: relative; padding: 0; }
.board-frame {
  position: relative; width: var(--board); height: var(--board);
  border-radius: 14px; overflow: hidden; touch-action: none;
  box-shadow: 0 0 0 4px #3b2a18, 0 0 0 6px #22170c, 0 18px 36px #000a;
}
#board { display: block; width: 100%; height: 100%; cursor: grab; }
#board.panning { cursor: grabbing; }
#board.placing { cursor: crosshair; }
.pan { display: none; }
.panel { width: 100%; max-width: 720px; }

@media (min-width: 700px) {
  .brand p { display: block; }
  .guide-btn em { display: inline; }
  .board-wrap { padding: 28px; }
  .pan {
    display: block; position: absolute; z-index: 5; border: 0; border-radius: 10px;
    background: #24392b; color: #cfe5d2; width: 44px; height: 22px; opacity: .8;
  }
  .pan:hover { background: #33563f; opacity: 1; }
  .pan-up { top: 2px; left: 50%; margin-left: -22px; }
  .pan-down { bottom: 2px; left: 50%; margin-left: -22px; }
  .pan-left, .pan-right { top: 50%; margin-top: -22px; width: 22px; height: 44px; }
  .pan-left { left: 2px; }
  .pan-right { right: 2px; }
  :root { --board: min(calc(100vw - 72px), calc(100svh - 260px), 720px); }
}
@media (min-width: 1100px) {
  :root { --board: min(calc(100vw - 520px), calc(100svh - 200px), 760px); }
  .stage { flex-direction: row; align-items: flex-start; justify-content: center; gap: 18px; }
  .board-col { width: auto; position: sticky; top: 8px; }
  .panel { width: 420px; max-height: calc(100svh - 150px); overflow-y: auto; border-radius: 14px; }
  .ticker { justify-content: center; }
  .ticker div { flex: 0 0 auto; min-width: 92px; }
}

/* ------------------------------------------------ board overlays */
.coord {
  position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 8px;
  background: #0009; color: #e6f2e6; font-size: 11px; pointer-events: none;
}
.tooltip {
  position: absolute; pointer-events: none; padding: 6px 9px; border-radius: 8px; max-width: 80%;
  background: #0b140fe6; border: 1px solid #365a42; font-size: 12px; z-index: 6;
}
.tooltip b { color: var(--accent); }
.offscreen {
  position: absolute; z-index: 4; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  background: #000a; border: 1px solid #fff3; cursor: pointer; white-space: nowrap;
}
.brain-off { background: #1c5caccc; border-color: #9ec5f4; }
.follow-chip {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 8px; z-index: 6;
  background: #1c5cabee; border: 1px solid #9ec5f4; border-radius: 999px; padding: 4px 6px 4px 12px;
  font-size: 12px; display: flex; gap: 8px; align-items: center; white-space: nowrap;
}
.follow-chip button { border: 0; border-radius: 999px; background: #fff2; color: #fff; padding: 2px 8px; }
.board-btns { position: absolute; top: 8px; right: 8px; z-index: 8; display: flex; gap: 6px; }
.board-btns button {
  display: flex; align-items: center; gap: 6px; border: 1px solid #ffffff40; border-radius: 999px;
  padding: 6px 11px; font-size: 12.5px; font-weight: 600; color: #fff; background: #0b1410cc;
  box-shadow: 0 4px 12px #0007; backdrop-filter: blur(4px); touch-action: manipulation;
}
.board-btns button:active { transform: scale(.95); }
#fabBrain { background: linear-gradient(#2f6fd6, #1d4fa8); border-color: #9cc4ff80; }
.fab-dot { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 12%, #9fc8ff 35%, #2a5bc0 100%); box-shadow: 0 0 8px #9fc8ff; animation: think 1.6s ease-in-out infinite; }
@keyframes think { 50% { box-shadow: 0 0 2px #4d8bff; } }

.radial { position: absolute; width: 0; height: 0; z-index: 7; }
.radial button {
  position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  border: 2px solid #fff; background: #1c2d22ee; color: #fff; font-size: 20px; font-weight: 700;
  box-shadow: 0 4px 10px #0009; animation: pop .22s cubic-bezier(.3,1.6,.5,1) both;
}
.radial button:hover { background: var(--accent); color: #231400; }
.radial .r-up { left: 0; top: -54px; }
.radial .r-down { left: 0; top: 54px; }
.radial .r-left { left: -54px; top: 0; }
.radial .r-right { left: 54px; top: 0; }
@keyframes pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ------------------------------------------------ panel + tabs */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.tabs {
  display: flex; position: sticky; top: 0; z-index: 3; background: var(--panel);
  border-bottom: 1px solid var(--line); border-radius: 14px 14px 0 0; padding: 4px;
}
.tab {
  flex: 1; border: 0; background: transparent; color: var(--muted); padding: 9px 6px; border-radius: 10px;
  font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tab.active { background: var(--panel2); color: var(--ink); }
.badge { font-size: 11px; background: #1c5cab; color: #fff; border-radius: 999px; padding: 0 7px; font-weight: 700; }
.badge:empty { display: none; }
.badge.dot { width: 8px; height: 8px; padding: 0; background: var(--accent); }
.tab-body { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.tab-body[hidden] { display: none; }
.card-lite { background: #0f1a13; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.card-lite h3 { margin: 0; font-size: 13.5px; }
.card-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.card-head small { color: var(--muted); font-size: 11.5px; }
.card-head select { margin-left: auto; background: var(--panel2); color: var(--ink); border: 1px solid #3a5a45; border-radius: 8px; padding: 3px 6px; font-size: 12px; }
.rules { margin: 8px 0 0; padding-left: 18px; color: var(--ink2); font-size: 13px; }
.rules li { margin-bottom: 6px; }
.row-btns { display: flex; gap: 8px; margin-top: 10px; }
.row-btns button {
  flex: 1; border: 1px solid #3a5a45; background: var(--panel2); color: var(--ink);
  padding: 8px 10px; border-radius: 9px;
}
.row-btns button:hover { background: #2b4735; }
.row-btns button.primary { background: var(--accent); color: #2a1a00; border-color: #ffd27a; font-weight: 600; }
.row-btns button.blue { background: #1c5cab; border-color: #5598e7; color: #fff; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.kpi { background: #0f1a13; border: 1px solid var(--line); border-radius: 10px; padding: 7px 6px; text-align: center; min-width: 0; }
.kpi b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.2; }
.kpi small { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi i { font-style: normal; color: var(--ink2); font-size: 11px; }

/* population chart */
.chart-card { margin: 0; background: #0f1a13; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 6px; }
.chart-card figcaption { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.chart-card figcaption small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.chart { position: relative; height: 120px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: #ffffff14; stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 10px; }
.chart .line { fill: none; stroke: var(--brain); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: #3987e51f; }
.chart .cross { stroke: #ffffff55; stroke-width: 1; }
.chart .dot { fill: var(--brain); stroke: #0f1a13; stroke-width: 2; }
.chart-tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -110%); white-space: nowrap;
  background: #0b140ff0; border: 1px solid #365a42; border-radius: 8px; padding: 4px 8px; font-size: 11.5px; color: var(--ink);
}
.chart-empty { color: var(--muted); font-size: 12px; display: grid; place-items: center; height: 100%; }

/* lineages */
.lineages { display: flex; flex-direction: column; gap: 6px; }
.lin { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.lin .sw { width: 12px; height: 12px; border-radius: 50%; }
.lin .bar { height: 8px; border-radius: 4px; background: #ffffff10; overflow: hidden; margin-top: 3px; }
.lin .bar span { display: block; height: 100%; background: #5598e7; border-radius: 4px; }
.lin .meta { color: var(--muted); font-size: 11.5px; text-align: right; white-space: nowrap; }

/* brain list */
.brain-list { display: flex; flex-direction: column; gap: 4px; }
.brain-row {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) 76px 40px; gap: 8px; align-items: center;
  padding: 7px 6px; border-radius: 9px; cursor: pointer; border: 1px solid transparent;
}
.brain-row:hover { background: #ffffff08; }
.brain-row.sel { background: #1c5cab26; border-color: #2a78d6; }
.brain-row .orb { width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 6px #3987e5aa; }
.brain-row .nm { min-width: 0; }
.brain-row .nm b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brain-row .nm small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.ebar { height: 8px; border-radius: 4px; background: #ffffff12; overflow: hidden; }
.ebar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #1c5cab, #5598e7); transition: width .6s; }
.ebar.low span { background: #9a4a2a; }
.etext { font-size: 10.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.acc { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink2); }
.brain-detail { padding: 8px 6px 12px 32px; border-bottom: 1px dashed var(--line); margin-bottom: 4px; }
.brain-detail h4 { margin: 10px 0 6px; font-size: 12px; color: var(--ink2); text-transform: uppercase; letter-spacing: .5px; }
.brain-detail h4:first-child { margin-top: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.stat-grid div { background: #ffffff07; border-radius: 8px; padding: 4px; text-align: center; }
.stat-grid b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.stat-grid small { font-size: 9.5px; color: var(--muted); text-transform: uppercase; }
.pred-grid { display: grid; grid-template-columns: 22px 1fr 42px; gap: 4px 8px; align-items: center; font-size: 12px; }
.pred-grid .dir { text-align: center; font-weight: 700; color: var(--ink2); }
.pred-grid .dir.chosen { color: #fff; background: #2a78d6; border-radius: 6px; }
.pred-grid .bar { display: flex; gap: 2px; height: 12px; }
.pred-grid .bar span { display: block; height: 100%; border-radius: 3px; min-width: 0; }
.pred-grid .val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.o-blocked { background: var(--o-blocked); } .o-move { background: var(--o-move); } .o-collision { background: var(--o-collision); } .o-ride { background: var(--o-ride); } .o-harvest { background: var(--o-harvest); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--ink2); margin: 6px 0 0; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.verdict { margin-top: 6px; font-size: 12.5px; color: var(--ink2); }
.verdict .ok { color: #7fd48a; } .verdict .miss { color: #f0a08a; }
.genes { display: grid; grid-template-columns: 76px 1fr 38px; gap: 3px 8px; align-items: center; font-size: 11.5px; }
.genes .g { color: var(--ink2); }
.genes .gbar { height: 6px; background: #ffffff10; border-radius: 3px; position: relative; }
.genes .gbar span { position: absolute; top: 0; bottom: 0; background: #86b6ef; border-radius: 3px; }
.genes .gv { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* feed */
.feed { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.feed li { padding: 8px 2px; border-bottom: 1px dashed var(--line); animation: feedIn .35s ease both; display: flex; gap: 8px; align-items: baseline; }
.feed li time { color: var(--muted); font-size: 11px; margin-left: auto; white-space: nowrap; }
.feed .dot { flex: none; display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.feed .mem { color: var(--mem); }
.feed li.go { cursor: pointer; }
.feed li.go:hover { background: #ffffff06; }
@keyframes feedIn { from { opacity: 0; transform: translateX(-8px); } }

/* ------------------------------------------------ drawer: ball + arrows */
.drawer {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 15;
  width: min(560px, 100vw);
  animation: drawerOpen .7s cubic-bezier(.2,1.2,.4,1) .2s both;
}
@keyframes drawerOpen { from { transform: translate(-50%, 110%); } }
.drawer-inner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0;
  background: repeating-linear-gradient(92deg, #0000 0 18px, #0000000d 18px 20px), linear-gradient(#8a5a33, #5c3a1f);
  box-shadow: inset 0 3px 0 #b07c4a, inset 0 -6px 12px #0005, 0 -8px 24px #0008;
}
.slot { display: flex; align-items: center; gap: 8px; background: #0000002e; padding: 6px 8px; border-radius: 12px; box-shadow: inset 0 3px 8px #0007; }
.slot-label { font-size: 11.5px; color: #f7e6cf; line-height: 1.25; display: none; }
.slot-label small { color: #d8bf9f; }
.token {
  width: 50px; height: 50px; border-radius: 12px; display: grid; place-items: center; position: relative;
  background: linear-gradient(#fbf3e4, #e2d3b7); box-shadow: 0 4px 0 #b39c77, 0 6px 10px #0006;
  cursor: grab; transition: transform .15s, box-shadow .15s, opacity .2s; touch-action: none;
}
.token:hover { transform: translateY(-3px) rotate(-2deg); }
.token.disabled { opacity: .35; pointer-events: none; filter: grayscale(.6); }
.arrow-token svg { width: 32px; height: 32px; }
.arrow-token path { fill: #e8543f; stroke: #7a1d10; stroke-width: 2; stroke-linejoin: round; }
.sphere { width: 34px; height: 34px; border-radius: 50%; display: block; box-shadow: 0 4px 6px #0007; }
.ball-token.placed { opacity: .7; cursor: pointer; }
.ball-token.placed .sphere { filter: saturate(.5); }
.ball-token.placed::after {
  content: "↺"; position: absolute; right: -6px; top: -6px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; font-weight: 800; color: #2a1a00;
  background: var(--accent); box-shadow: 0 2px 4px #0007;
}
@media (min-width: 520px) { .slot-label { display: block; } }
.drag-ghost {
  position: fixed; z-index: 50; pointer-events: none; width: 60px; height: 60px; margin: -30px 0 0 -30px;
  display: grid; place-items: center; filter: drop-shadow(0 10px 8px #0008); transform: scale(1.15);
}
.drag-ghost svg { width: 44px; height: 44px; }
.drag-ghost path { fill: #e8543f; stroke: #fff; stroke-width: 2.5; }

/* ------------------------------------------------ toast, confirm */
.toast {
  position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 70;
  background: #0d1811f2; border: 1px solid #3e6a4c; padding: 10px 16px; border-radius: 12px;
  box-shadow: 0 10px 24px #000a; animation: toastIn .25s ease both; max-width: 92vw;
}
.toast.bad { border-color: #a4473b; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -10px); } }
.confirm { position: fixed; inset: 0; background: #0008; z-index: 60; display: grid; place-items: center; }
.confirm-box { background: var(--panel); border: 1px solid #3a5a45; border-radius: 16px; padding: 18px 20px; width: min(360px, 90vw); box-shadow: 0 20px 50px #000c; }
.confirm-box p { margin: 0 0 6px; }
[hidden] { display: none !important; }

/* ------------------------------------------------ guide sheet */
.sheet { position: fixed; inset: 0; z-index: 80; background: #000a; display: flex; align-items: flex-end; justify-content: center; }
.sheet-box {
  width: 100%; max-width: 820px; height: 94svh; background: #111c15; border: 1px solid var(--line);
  border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: sheetUp .35s cubic-bezier(.2,1,.3,1);
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 900px) { .sheet { align-items: center; } .sheet-box { height: 88vh; border-radius: 18px; } }
.sheet-head { flex: none; display: flex; align-items: center; padding: 14px 16px 8px; gap: 10px; }
.sheet-head h2 { margin: 0; font-size: 18px; }
.close { margin-left: auto; border: 0; background: var(--panel2); color: var(--ink); width: 34px; height: 34px; border-radius: 50%; font-size: 16px; }
.toc { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 10px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.toc a { flex: none; font-size: 12px; line-height: 1.4; white-space: nowrap; color: var(--ink2); text-decoration: none; background: var(--panel2); border-radius: 999px; padding: 4px 10px; }
.toc a:hover { background: #2b4735; }
.guide { overflow-y: auto; padding: 8px 18px 40px; color: var(--ink2); font-size: 14.5px; line-height: 1.6; }
.guide h3 { color: var(--ink); font-size: 16px; margin: 22px 0 6px; scroll-margin-top: 10px; }
.guide h4 { color: var(--ink); font-size: 14px; margin: 14px 0 4px; }
.guide p { margin: 6px 0; }
.guide ul, .guide ol { padding-left: 20px; margin: 6px 0; }
.guide li { margin: 3px 0; }
.guide b { color: var(--ink); }
.guide code { color: #9fd0ff; font-size: 13px; }
.guide table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.guide th, .guide td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.guide th { color: var(--ink); font-weight: 600; }
.guide td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.guide .callout { background: #1c5cab1f; border: 1px solid #2a78d6; border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.guide .watch { background: #c985001a; border: 1px solid #c98500; border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.guide .watch b { color: #f2c46b; }
.guide .flow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; font-size: 12.5px; }
.guide .flow span { background: var(--panel2); border-radius: 8px; padding: 4px 8px; color: var(--ink); }
.guide .flow em { color: var(--muted); font-style: normal; }

.clock-chip {
  position: absolute; left: 8px; top: 34px; z-index: 6; padding: 3px 9px; border-radius: 999px; font-size: 11.5px;
  pointer-events: none; white-space: nowrap; border: 1px solid #ffffff30;
}
.clock-chip:empty { display: none; }
.clock-chip.day { background: #c98500d9; color: #231400; }
.clock-chip.night { background: #1b2350e6; color: #dfe6ff; border-color: #6f7fd0; }
.chart .nightband { fill: #6f7fd01c; }

/* Chronicles */
.chron-btn span { background: #8a5a33; color: #fff; font-size: 13px; }
.chron-btn { position: relative; }
.chron-new { position: absolute; top: 2px; right: 2px; width: 9px; height: 9px; border-radius: 50%; background: #e0674a; box-shadow: 0 0 0 2px var(--bg); }
.chron-entry { border-bottom: 1px solid var(--line); padding: 14px 0 16px; }
.chron-entry h3 { margin: 0 0 2px; }
.chron-entry time { color: var(--muted); font-size: 12px; }
.chron-stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chron-stats span { background: var(--panel2); border-radius: 8px; padding: 2px 8px; font-size: 12px; color: var(--ink); }

/* Minimap */
.mm-overlay {
  position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: #0a120df2; backdrop-filter: blur(3px);
}
.mm-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mm-head b { margin-right: auto; font-size: 13.5px; }
.mm-head button {
  border: 1px solid #3a5a45; background: var(--panel2); color: var(--ink); border-radius: 8px;
  padding: 4px 9px; font-size: 12px; min-width: 32px; touch-action: manipulation;
}
.mm-head button:hover { background: #2b4735; }
.mm-overlay canvas { flex: 1; min-height: 0; width: 100%; border-radius: 10px; border: 1px solid var(--line); cursor: crosshair; }
.mm-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: var(--ink2); }
.mm-legend i { display: inline-block; width: 9px; height: 9px; margin-right: 3px; vertical-align: -1px; border-radius: 50%; }
.lg-brain { background: #5598e7; } .lg-hut { background: #f0a040; border-radius: 2px !important; }
.lg-road { background: #d6ba82; height: 3px !important; border-radius: 2px !important; vertical-align: 2px !important; }
.lg-human { background: #fff; } .lg-you { border: 2px solid #f2b441; box-sizing: border-box; }
.lg-view { border: 1.5px solid #fff; border-radius: 1px !important; box-sizing: border-box; }
.mm-clusters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; }
.mm-clusters button {
  flex: none; border: 1px solid #2a78d6; background: #1c5cab33; color: var(--ink); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; white-space: nowrap;
}
.mm-clusters button:hover { background: #1c5cab66; }
.mm-card { display: none; padding: 10px 12px; border-bottom: 1px solid var(--line); gap: 6px; flex-direction: column; }
.mm-card canvas { width: 100%; height: 200px; border-radius: 10px; border: 1px solid var(--line); cursor: crosshair; }
@media (min-width: 1100px) { .mm-card { display: flex; } }

/* Chronicles: new behaviour highlight */
.new-behaviour {
  margin: 10px 0; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(135deg, #3a2a05, #2a1d05); border: 2px solid #f2b441;
  box-shadow: 0 0 0 4px #f2b44122, 0 8px 24px #f2b44133; animation: nbGlow 2.4s ease-in-out infinite;
}
@keyframes nbGlow { 50% { box-shadow: 0 0 0 6px #f2b44133, 0 8px 28px #f2b44155; } }
.new-behaviour .nb-tag {
  display: inline-block; font-weight: 800; font-size: 12.5px; letter-spacing: .4px; text-transform: uppercase;
  background: #f2b441; color: #2a1a00; border-radius: 999px; padding: 3px 10px; margin-bottom: 6px;
}
.new-behaviour p { margin: 6px 0; color: #fff3d6; }
.new-behaviour .nb-who { font-size: 12px; color: #f2c46b; background: #f2b4411f; border-radius: 6px; padding: 1px 6px; }
.new-behaviour small { color: #d8bf8f; font-size: 11.5px; }
.chron-entry.has-new h3::after { content: " 🆕"; }
.chron-new.behaviour {
  width: auto; height: auto; padding: 0 5px; border-radius: 999px; top: -4px; right: -6px;
  background: #f2b441; box-shadow: 0 0 0 2px var(--bg);
}
.chron-new.behaviour::after { content: "NEW"; font-style: normal; font-size: 9px; font-weight: 800; color: #2a1a00; }
