:root {
  --bg: #111113;
  --panel: #161619;
  --raise: #1c1c20;
  --line: #24242a;
  --line-2: #303037;
  --text: #e9e7e3;
  --muted: #a09fa7;
  --faint: #6c6b74;
  --accent: #d9643f;
  --accent-soft: rgba(217, 100, 63, 0.14);
  --ok: #8fb996;
  --bad: #d78b7a;
  --paper: #efe7d6;
  --ink: #26231e;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
h1, h2, h3, h4 { margin: 0; font-weight: 500; }
h2 { font-size: 13px; letter-spacing: 0.02em; color: var(--muted); }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
b { font-weight: 500; }
.faint { color: var(--faint); }
ol, ul { list-style: none; margin: 0; padding: 0; }
p { margin: 0; }

/* ---------- buttons, fields ---------- */
.btn {
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--raise); cursor: pointer;
  font-size: 13.5px; transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.btn:hover { border-color: #44444d; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0f0a; font-weight: 500; }
.btn.primary:hover { background: #e2724e; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--raise); }
.btn.danger { color: var(--bad); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; min-width: 0;
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: #0d0d0f; color: var(--text); font-size: 15px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error { color: var(--bad); font-size: 13.5px; }
.form-ok { color: var(--ok); font-size: 13.5px; }
.hint-text { color: var(--faint); font-size: 13px; }

/* ---------- brand ---------- */
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px; flex: none; position: relative;
  background: linear-gradient(160deg, #e9845f, var(--accent) 60%, #a8452a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-mark::after {
  content: ""; position: absolute; left: 5px; right: 5px; bottom: 5px; height: 7px;
  background: #1a0f0a; clip-path: polygon(0 100%, 0 45%, 50% 0, 100% 45%, 100% 100%); opacity: 0.8;
}

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 12px 24px;
  background: rgba(17, 17, 19, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-name { font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.clock { display: flex; align-items: center; gap: 12px; }
.clock-text { font-family: var(--mono); font-size: 15px; font-weight: 500; white-space: nowrap; }
.day { color: var(--muted); font-weight: 400; }
.sky { width: 18px; height: 18px; border-radius: 50%; flex: none; transition: background 1s, box-shadow 1s; background: #f2c66d; box-shadow: 0 0 12px rgba(242, 198, 109, 0.6); }
.sky.night { background: transparent; box-shadow: inset -5px -2px 0 0 #dfe4f2; }
.sky.dusk, .sky.dawn { background: #f09a62; box-shadow: 0 0 12px rgba(240, 154, 98, 0.55); }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.status.live .dot { background: var(--ok); }
.status.thinking .dot { background: var(--accent); animation: breathe 1.4s var(--ease) infinite; }
.status.paused .dot { background: var(--bad); }
.top-right { justify-self: end; display: flex; align-items: center; gap: 6px; min-width: 0; }
.who-am-i { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--faint); white-space: nowrap; margin-left: 6px; }
.who-am-i b { color: var(--muted); }
@keyframes breathe { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.8); } }

.banner { margin: 12px 24px 0; padding: 10px 14px; border: 1px solid rgba(215, 139, 122, 0.4); background: rgba(215, 139, 122, 0.08); color: var(--bad); border-radius: 10px; font-size: 14px; }

/* ---------- layout ---------- */
.layout { display: grid; gap: 28px; max-width: 1500px; margin: 0 auto; padding: 22px 24px 60px; }
/* Its own box so the sticky feed lets go before the recap underneath. */
.columns { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(330px, 1fr); gap: 28px; align-items: start; }
.stage { display: grid; gap: 18px; min-width: 0; }
.intro { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.intro p { color: var(--muted); font-size: 14.5px; max-width: 68ch; }
.intro b { color: var(--text); }
.spend { font-family: var(--mono); font-size: 12px; color: var(--faint); white-space: nowrap; }

/* ---------- the town scene ---------- */
.scene {
  position: relative; aspect-ratio: 1000 / 680; border-radius: 20px; overflow: hidden; container-type: inline-size;
  border: 1px solid var(--line); background: #2a3327;
  box-shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.8);
}
.scene-art, .login-art .scene-art { position: absolute; inset: 0; }
.town-svg { display: block; width: 100%; height: 100%; }

.phase-day, .phase-dawn, .phase-dusk, .phase-night {
  --ground: #46563f; --grass: #56704c; --path: #8b8473; --paving: #a39a8a; --paving-line: #8f8777; --stone: #b4ab9b;
  --wall: #ddd3c2; --wall-2: #cbbfa9; --roof: #a35f48; --roof-2: #5f7287; --roof-3: #7d8d5a; --door: #6b4f3c;
  --water: #5e93ad; --tree: #3f6038; --tree-2: #4c7042; --trunk: #6b4f3c; --awning: #b6553e; --awning-2: #3f7a8c;
  --stripe: #efe6d6; --counter: #8a6a4f; --bench: #7a5d45; --board: #e7dcc6; --pediment: #cfc5b2; --column: #ece4d5;
  --clock: #f4efe4; --window: #5d6a73; --shade: #0b1020; --shade-o: 0; --lamps-o: 0; --stars-o: 0;
  --label: #f7f3ec; --label-stroke: rgba(22, 24, 20, 0.78);
}
.phase-dawn { --shade: #e08a5c; --shade-o: 0.16; --lamps-o: 0.25; }
.phase-dusk { --shade: #5b2c4b; --shade-o: 0.34; --window: #f2c46a; --lamps-o: 0.75; }
.phase-night { --shade: #060a1b; --shade-o: 0.6; --window: #f6c768; --lamps-o: 1; --stars-o: 1; }

.town-svg .ground { fill: var(--ground); }
.town-svg .yard { fill: var(--grass); stroke: var(--path); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: 0.9; }
.town-svg .grass { fill: var(--grass); }
.town-svg .paths path { fill: none; stroke: var(--path); stroke-width: 14; stroke-linecap: round; }
.town-svg .square-rim, .town-svg .stone { fill: var(--stone); }
.town-svg .paving { fill: var(--paving); }
.town-svg .paving-line { fill: none; stroke: var(--paving-line); stroke-width: 1; }
.town-svg .water { fill: var(--water); }
.town-svg .post, .town-svg .trunk { fill: var(--trunk); }
.town-svg .board { fill: var(--board); }
.town-svg .board-lines { stroke: #8d806b; stroke-width: 2; }
.town-svg .wall { fill: var(--wall); }
.town-svg .wall-2 { fill: var(--wall-2); }
.town-svg .roof { fill: var(--roof); }
.town-svg .roof-2 { fill: var(--roof-2); }
.town-svg .roof-3 { fill: var(--roof-3); }
.town-svg .door { fill: var(--door); }
.town-svg .pediment { fill: var(--pediment); }
.town-svg .columns rect { fill: var(--column); }
.town-svg .clockface { fill: var(--clock); }
.town-svg .counter, .town-svg .crates rect, .town-svg .tables circle { fill: var(--counter); }
.town-svg .awning { fill: var(--awning); }
.town-svg .awning-2 { fill: var(--awning-2); }
.town-svg .awning-stripe { stroke: var(--stripe); stroke-width: 5; opacity: 0.55; }
.town-svg .tree { fill: var(--tree); }
.town-svg .tree-2 { fill: var(--tree-2); }
.town-svg .pond-rim { fill: none; stroke: var(--stone); stroke-width: 4; }
.town-svg .bench { fill: var(--bench); }
.town-svg .shade { fill: var(--shade); opacity: var(--shade-o); }
.town-svg .windows rect { fill: var(--window); }
.town-svg .lamps { opacity: var(--lamps-o); }
.town-svg .bulb { fill: #ffe2a6; }
.town-svg .stars { opacity: var(--stars-o); }
.town-svg .stars circle { fill: #fff; }
.town-svg .labels text {
  font: 600 15px var(--sans); fill: var(--label); text-anchor: middle; letter-spacing: 0.01em;
  paint-order: stroke; stroke: var(--label-stroke); stroke-width: 4px; stroke-linejoin: round;
}
.town-svg .shade, .town-svg .windows rect, .town-svg .lamps, .town-svg .stars { transition: opacity 2.5s ease, fill 2.5s ease; }

.lots { position: absolute; inset: 0; pointer-events: none; }
.lot-name.vacant { font-style: italic; opacity: 0.6; }
.conditions { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; z-index: 2; }
.condition { font: 500 11.5px var(--sans); padding: 4px 10px; border-radius: 999px; background: rgba(12, 12, 14, 0.78); color: #f3f0ea; box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.5); animation: pop 0.45s var(--ease) both; }
.scene::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 2s ease; }
.scene.weather-rain::after {
  opacity: 1;
  background-image: repeating-linear-gradient(105deg, rgba(200, 215, 235, 0.22) 0 1px, transparent 1px 14px);
  background-size: 140px 140px; animation: rain 0.6s linear infinite;
}
.scene.weather-heat::after { opacity: 1; background: radial-gradient(ellipse at 50% 0%, rgba(255, 170, 80, 0.22), transparent 70%); }
.scene.weather-cold::after { opacity: 1; background: linear-gradient(180deg, rgba(170, 200, 255, 0.16), rgba(170, 200, 255, 0.05)); }
.scene.weather-wind::after { opacity: 1; background-image: repeating-linear-gradient(170deg, rgba(255, 255, 255, 0.06) 0 2px, transparent 2px 60px); background-size: 300px 300px; animation: wind 1.6s linear infinite; }
@keyframes rain { from { background-position: 0 0; } to { background-position: -40px 140px; } }
@keyframes wind { from { background-position: 0 0; } to { background-position: 300px 40px; } }
.lot-name {
  position: absolute; translate: -50% 0; font: 600 clamp(6px, 1.34cqw, 10px) / 1.2 var(--sans); color: var(--label, #f7f3ec); white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); letter-spacing: 0.01em;
}
.build {
  position: absolute; aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto;
  transition: transform 0.25s var(--ease); filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.35));
  animation: rise 0.8s var(--ease) both;
}
.build:hover { transform: translateY(-2px) scale(1.06); }
.build img { display: block; width: 100%; height: 100%; }
.build.pending { border: 2px dashed rgba(247, 243, 236, 0.7); border-radius: 10px; filter: none; animation: breathe 2s ease-in-out infinite; }
.phase-night .build img, .phase-dusk .build img { filter: brightness(0.72) saturate(0.85); }
/* Names grow with the map so neighbors stay clear at any width. Below 6px they stop
   shrinking, and every other one drops a little further to make up for it. */
.lot-name.low { translate: -50% max(0px, calc((6px - 1.34cqw) * 1.5)); }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.85); } to { opacity: 1; transform: none; } }
.tokens { position: absolute; inset: 0; pointer-events: none; }
.token {
  position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer;
  display: grid; justify-items: center; gap: 3px; background: none; border: 0; padding: 0;
  transition: transform 1.6s var(--ease);
  will-change: transform;
}
.token .face {
  position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c); color: #16130f; font-weight: 600; font-size: 16px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 14px -4px rgba(0, 0, 0, 0.55);
  transition: transform 0.2s var(--ease);
}
.token:hover .face { transform: translateY(-2px) scale(1.06); }
.token .tag {
  font-size: 11px; font-weight: 500; line-height: 1; padding: 3px 6px 4px; border-radius: 6px;
  background: rgba(12, 12, 14, 0.74); color: #f3f0ea; white-space: nowrap;
}
.token.claude .face { border-color: #f6c4ad; }
.token.thinking .face::after {
  content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 2px solid var(--accent);
  animation: ring 1.6s var(--ease) infinite;
}
.token.asleep .face { filter: saturate(0.5) brightness(0.8); }
.token .zz { position: absolute; top: -10px; right: -12px; font: 600 12px var(--mono); color: #dfe4f2; animation: float 2.4s ease-in-out infinite; }
@keyframes ring { 0% { transform: scale(0.85); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); opacity: 0.9; } 50% { transform: translateY(-5px); opacity: 0.5; } }

.bubble {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform-origin: 50% 100%;
  width: max-content; max-width: 230px; padding: 7px 10px; border-radius: 12px;
  background: #f7f3ec; color: #1f1d19; font-size: 12.5px; line-height: 1.35; text-align: left;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.6);
  animation: pop 0.45s var(--ease) both;
  pointer-events: none;
  translate: -50% 0;
}
.bubble::after { content: ""; position: absolute; top: 100%; left: 50%; translate: -50% 0; border: 6px solid transparent; border-top-color: #f7f3ec; }
.bubble.dots { padding: 6px 10px; font: 600 14px var(--mono); letter-spacing: 2px; }
.bubble.dots span { animation: blink 1.2s infinite; }
.bubble.dots span:nth-child(2) { animation-delay: 0.2s; }
.bubble.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pop { from { opacity: 0; transform: scale(0.85) translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.scene.small .token .face { width: 28px; height: 28px; font-size: 13px; border-width: 1.5px; }
.scene.small .token .tag { font-size: 10px; padding: 2px 4px 3px; }
.scene.small .bubble { max-width: 150px; font-size: 11px; padding: 5px 8px; }
.scene.tiny .token .face { width: 20px; height: 20px; font-size: 10px; border-width: 1.5px; }
.scene.tiny .token .tag { font-size: 8.5px; padding: 1px 3px 2px; border-radius: 4px; }
.scene.tiny .bubble { max-width: 118px; font-size: 10px; padding: 4px 7px; border-radius: 9px; bottom: calc(100% + 7px); }
.scene.tiny .token.thinking .face::after { inset: -4px; }

/* ---------- cast cards ---------- */
.cast { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-top: 12px; }
.citizens { display: grid; }
.citizens .cast-wrap { grid-template-rows: 0fr; opacity: 0; }
.citizens.open .cast-wrap { grid-template-rows: 1fr; opacity: 1; }
.cast-toggle {
  display: block; width: 100%; padding: 14px 16px; text-align: left; cursor: pointer; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
}
.cast-toggle:hover { border-color: var(--line-2); background: #18181c; }
.cast-toggle:active { transform: scale(0.995); }
.cast-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cast-summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px 18px; }
.cast-title { display: grid; gap: 1px; }
.cast-title b { font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; }
.cast-title span { font: 11.5px var(--mono); color: var(--faint); }
.faces { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.face {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--c); color: #16130f; font-weight: 600; font-size: 12px;
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ring, var(--line-2));
}
.face.good { --ring: var(--ok); }
.face.mid { --ring: #e2b04a; }
.face.low { --ring: var(--bad); }
.face.thinking { animation: breathe 1.4s var(--ease) infinite; }
.cast-alerts { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.alert { font: 11px var(--mono); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); white-space: nowrap; }
.alert.low { color: var(--bad); border-color: rgba(215, 139, 122, 0.45); }
.alert.mid { color: #e2b04a; border-color: rgba(226, 176, 74, 0.4); }
.alert.good { color: var(--ok); border-color: rgba(143, 185, 150, 0.4); }
.cast-more { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.cast-more svg { width: 16px; height: 16px; transition: rotate 0.3s var(--ease); }
.citizens.open .cast-more svg { rotate: 180deg; }
.card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start;
  text-align: left; padding: 14px; border-radius: 16px; cursor: pointer; min-height: 132px;
  background: var(--panel); border: 1px solid var(--line);
  transition: border-color 0.2s, transform 0.2s var(--ease), background 0.2s;
}
.card:hover { border-color: var(--line-2); background: #18181c; transform: translateY(-1px); }
.card:active { transform: scale(0.99); }
.card.thinking { border-color: rgba(217, 100, 63, 0.55); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.ring { position: relative; width: 52px; height: 52px; flex: none; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--line-2); stroke-width: 3; }
.ring .fill { fill: none; stroke: var(--c); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.ring.low .fill { stroke: var(--bad); }
.ring .av { position: absolute; inset: 7px; width: auto; height: auto; font-size: 15px; }
.card-main { display: grid; gap: 6px; min-width: 0; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-name { font-weight: 600; font-size: 15.5px; letter-spacing: -0.01em; }
.coins { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.coins::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #d8b45a; margin-right: 6px; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.3); }
.model { font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model.claude { color: var(--accent); }
.card-doing { font-size: 13.5px; color: var(--text); line-height: 1.35; }
.card-doing .where, .mood { color: var(--faint); }
.needs { display: flex; flex-wrap: wrap; gap: 4px; }
.need { font: 11px var(--mono); padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.need.warn { color: #e2b04a; border-color: rgba(226, 176, 74, 0.4); }
.need.bad { color: var(--bad); border-color: rgba(215, 139, 122, 0.45); }
.card-diary { font-size: 12.5px; color: var(--muted); font-style: italic; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.av {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: var(--c); color: #16130f; font-weight: 600; font-size: 11px;
}
.av.lg { width: 52px; height: 52px; font-size: 21px; }
.av.pulse { animation: breathe 1.4s var(--ease) infinite; }

/* ---------- panels ---------- */
.panels { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { flex: none; height: 32px; padding: 0 12px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13.5px; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--raise); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.tab-panel { padding: 18px; }
.empty { color: var(--faint); font-size: 14px; }

.ties { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.ties-graph { width: 100%; height: auto; display: block; }
.ties-graph line { stroke: #e9e7e3; stroke-linecap: round; transition: opacity 0.3s, stroke 0.3s; }
.ties-graph .node { cursor: pointer; }
.ties-graph .node circle { stroke: rgba(255, 255, 255, 0.85); stroke-width: 2; }
.ties-graph .node text { font: 600 15px var(--sans); fill: #16130f; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.ties-graph .node .name { fill: var(--muted); font-size: 12px; font-weight: 500; }
.ties-graph.focus line { opacity: 0.08 !important; }
.ties-graph.focus line.on { opacity: 0.9 !important; stroke: var(--accent); }
.ties-list { display: grid; gap: 2px; }
.ties-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.ties-list .pair { display: inline-flex; }
.ties-list .pair .av + .av { margin-left: -6px; box-shadow: 0 0 0 2px var(--panel); }
.ties-list .count { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.ties-caption { grid-column: 1 / -1; color: var(--faint); font-size: 12.5px; }

.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.note {
  position: relative; background: var(--paper); color: var(--ink); border-radius: 4px; padding: 16px 14px 12px;
  font-size: 13.5px; line-height: 1.45; box-shadow: 0 10px 20px -12px rgba(0, 0, 0, 0.7); rotate: -0.8deg;
}
.note:nth-child(even) { rotate: 0.9deg; }
.note:nth-child(3n) { rotate: -0.3deg; }
.note::before { content: ""; position: absolute; top: 6px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--accent); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25); }
.note .meta { margin-top: 8px; font-size: 11.5px; color: #6f665a; font-family: var(--mono); }

.rules { display: grid; gap: 22px; }
.rules-intro { color: var(--muted); font-size: 14px; max-width: 70ch; }
.rules-part { display: grid; gap: 12px; }
.rules-part h3 { font-size: 13px; color: var(--muted); letter-spacing: 0.02em; }
.rule-no { display: block; margin-bottom: 4px; font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: #8a5a3f; }
.rule-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rule-group { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--raise); }
.rule-group h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.rule-group ul { display: grid; gap: 7px; }
.rule-group li { position: relative; padding-left: 14px; color: #cfcdc8; font-size: 13.5px; line-height: 1.5; }
.rule-group li::before { content: ""; position: absolute; left: 1px; top: 0.6em; width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); }
.rule-group b { font-family: var(--mono); font-weight: 500; color: var(--text); }
.land { display: grid; gap: 18px; }
.fund { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--raise); font-size: 14px; }
.fund b { font: 500 18px var(--mono); }
.fund span { color: var(--faint); font-size: 12.5px; }
.land h3 { font-size: 13px; color: var(--muted); letter-spacing: 0.02em; }
.builds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.built { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--raise); font-size: 13px; }
.built .pic { aspect-ratio: 1; border-radius: 10px; background: var(--ground-ui, #2a3327); display: grid; place-items: center; }
.built .pic img { width: 82%; height: 82%; }
.built .pic.pending { border: 2px dashed var(--line-2); background: transparent; color: var(--faint); font-size: 12px; text-align: center; padding: 8px; }
.built .what { font-weight: 500; }
.built .meta { font: 11px var(--mono); color: var(--faint); }
.shop-card .offer { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.shop-card .price { font-size: 13px; color: var(--muted); }
.shop-card .price b { font: 500 15px var(--mono); color: var(--text); }
.shop-card.closed { opacity: 0.55; }
.warn-text { color: #e2b04a; }
.need.shop { color: var(--accent); border-color: rgba(217, 100, 63, 0.4); }
.tag.building { color: #e2b04a; border-color: rgba(226, 176, 74, 0.4); }
.hall { display: grid; gap: 12px; }
.prop { border: 1px solid var(--line); border-radius: 14px; background: var(--raise); transition: border-color 0.2s; }
.prop:hover { border-color: var(--line-2); }
.prop details { border: 0; background: none; border-radius: 0; }
.prop summary { display: grid; gap: 8px; padding: 14px; color: inherit; font-size: inherit; border-radius: 14px; }
.prop summary::before { display: none; }
.prop summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.see-votes { justify-self: start; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.see-votes svg { width: 15px; height: 15px; transition: rotate 0.25s var(--ease); }
.prop details[open] .see-votes svg { rotate: 180deg; }
.votes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 0 14px 14px; animation: fade 0.25s ease; }
.vote-col { display: grid; gap: 8px; align-content: start; padding: 10px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.vote-col h5 { display: flex; justify-content: space-between; margin: 0; font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }
.vote-col h5 b { font-weight: 600; }
.vote-col.yes h5 b { color: var(--ok); }
.vote-col.no h5 b { color: var(--bad); }
.voters { display: grid; gap: 4px; }
.voter { all: unset; display: flex; align-items: center; gap: 8px; padding: 3px 4px; margin: 0 -4px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.voter:hover { background: var(--raise); }
.voter:focus-visible { outline: 2px solid var(--accent); }
.voter em { font-style: normal; font-size: 11.5px; color: var(--faint); margin-left: 4px; }
.nobody { font-size: 13px; color: var(--faint); font-style: italic; }
.prop-text { font-size: 14.5px; }
.prop-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--faint); font-family: var(--mono); flex-wrap: wrap; }
.tag { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); margin-right: 6px; }
.tag.open { color: var(--accent); border-color: rgba(217, 100, 63, 0.4); }
.tag.passed { color: var(--ok); border-color: rgba(143, 185, 150, 0.4); }
.tag.failed { color: var(--bad); border-color: rgba(215, 139, 122, 0.4); }
.votebar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line); }
.votebar .yes { background: var(--ok); }
.votebar .no { background: var(--bad); }

/* ---------- feed ---------- */
.feed {
  position: sticky; top: 74px; max-height: calc(100dvh - 96px); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
}
.feed-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.filters, .kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.filter {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 6px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; cursor: pointer; font-size: 12.5px; color: var(--muted);
}
.filter.plain { padding: 0 10px; }
.filter .av { width: 18px; height: 18px; font-size: 9.5px; }
.filter[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.kinds .filter { height: 24px; font-size: 11.5px; padding: 0 9px; }
.feed-list { overflow-y: auto; padding: 4px 16px 16px; flex: 1; }
.hour-sep { position: sticky; top: 0; z-index: 1; padding: 10px 0 6px; font: 500 11.5px var(--mono); color: var(--faint); background: var(--panel); letter-spacing: 0.03em; }
.ev { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ev.new { animation: slidein 0.6s var(--ease); }
.ev-body { min-width: 0; overflow-wrap: anywhere; }
.ev .quote { display: block; margin-top: 4px; padding-left: 10px; border-left: 2px solid var(--line-2); color: var(--text); }
.ev.private .quote { border-left-color: #8f9ed6; }
.ev.civic .quote { border-left-color: var(--accent); }
.ev.quiet { color: var(--faint); font-size: 13px; }
.ev.news { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.ev-body > b, .ev-body .who { font-weight: 500; }
.ev .kind { display: inline-flex; align-items: center; gap: 4px; font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); margin-right: 6px; }
.ev .kind svg { width: 12px; height: 12px; }
.ev-time { margin-top: 3px; font: 11px var(--mono); color: var(--faint); }
.sys-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.sys-icon svg { width: 14px; height: 14px; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- status at a glance ---------- */
.segs { display: inline-grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 2px; }
.segs i { display: block; border-radius: 2px; background: var(--line-2); transition: background 0.5s var(--ease); }
.segs.good i.on { background: var(--ok); }
.segs.mid i.on { background: #e2b04a; }
.segs.low i.on { background: var(--bad); }
.vital { display: flex; align-items: center; gap: 6px; min-width: 0; }
.vital svg { width: 14px; height: 14px; flex: none; }
.vital.good svg { color: var(--ok); }
.vital.mid svg { color: #e2b04a; }
.vital.low svg { color: var(--bad); }
.vital .segs { flex: 1; height: 7px; }

.card-foot { grid-column: 1 / -1; display: grid; gap: 8px; min-width: 0; }
.card-stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 14px; align-items: center; padding: 9px 10px; border-radius: 10px; background: var(--raise); }
.card-stats .vital .segs { height: 8px; }
.card-stocks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 16px; min-width: 0; }
.chip-stat { display: inline-flex; align-items: center; gap: 5px; font: 11.5px var(--mono); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-stat svg { width: 14px; height: 14px; flex: none; }
.chip-stat b { color: var(--text); font-weight: 600; }
.chip-stat.ok svg { color: var(--ok); }
.chip-stat.warn, .chip-stat.warn b, .chip-stat.warn svg { color: #e2b04a; }
.chip-stat.bad, .chip-stat.bad b, .chip-stat.bad svg { color: var(--bad); }

.hud { display: grid; gap: 8px; margin-top: 14px; }
.hud-bars { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.hud-bar { display: grid; gap: 9px; padding: 11px 13px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.hud-bar-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.hud-label { display: inline-flex; align-items: center; gap: 6px; font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }
.hud-label svg { width: 16px; height: 16px; }
.hud-word { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-bar .segs { height: 11px; gap: 3px; }
.hud-bar.good .hud-word, .hud-bar.good .hud-label svg { color: var(--ok); }
.hud-bar.mid .hud-word, .hud-bar.mid .hud-label svg { color: #e2b04a; }
.hud-bar.low .hud-word, .hud-bar.low .hud-label svg { color: var(--bad); }
.hud-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.hud-tile {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 9px; align-items: center;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
}
.hud-tile svg { grid-row: span 2; width: 19px; height: 19px; color: var(--faint); }
.hud-val { font: 600 16px/1.2 var(--mono); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-sub { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-tile.money svg { color: #e2b04a; }
.hud-tile.ok svg { color: var(--ok); }
.hud-tile.warn svg, .hud-tile.warn .hud-val { color: #e2b04a; }
.hud-tile.bad svg, .hud-tile.bad .hud-val { color: var(--bad); }
.hud-tile.where .hud-val { font: 600 13.5px/1.25 var(--sans); }

/* ---------- recap ---------- */
.recap {
  display: grid; gap: 12px; padding: 26px 28px 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
}
.recap-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; }
.recap-kicker { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.recap-range { font: 12px var(--mono); color: var(--faint); }
.recap-title { font-size: clamp(20px, 2.2vw, 26px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; color: var(--text); max-width: 44ch; text-wrap: balance; }
.recap-body { display: grid; gap: 10px; max-width: 72ch; }
.recap-body p { color: #cfcdc8; font-size: 15.5px; line-height: 1.65; }
.recap-meta { font: 11.5px var(--mono); color: var(--faint); }
.recap-empty { color: var(--muted); font-size: 14.5px; max-width: 62ch; }
.name-link {
  all: unset; cursor: pointer; color: var(--text); font-weight: 500;
  background: linear-gradient(var(--c), var(--c)) no-repeat 0 100% / 100% 2px; padding-bottom: 1px; transition: color 0.2s;
}
.name-link:hover { color: var(--c); }
.name-link:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; border-radius: 3px; }

/* ---------- drawers ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(8, 8, 10, 0.55); backdrop-filter: blur(2px); animation: fade 0.25s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(640px, 100vw);
  display: flex; flex-direction: column; background: #131316; border-left: 1px solid var(--line);
  box-shadow: -30px 0 60px -30px rgba(0, 0, 0, 0.7); animation: drawer-in 0.35s var(--ease);
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.drawer-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.drawer-who { display: flex; gap: 14px; min-width: 0; }
.drawer-who h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.persona { color: var(--muted); font-size: 13.5px; margin-top: 12px; max-width: 62ch; }
#drawer .drawer-head { flex-wrap: wrap; row-gap: 0; }
.drawer-more { flex-basis: 100%; }
.hud-meta { margin-top: 8px; font: 11.5px var(--mono); color: var(--faint); }
.wish { color: #e2b04a; font-size: 13px; margin-top: 4px; max-width: 52ch; }
.wish::before { content: "Secret wish: "; color: var(--faint); }
.gone-note { color: var(--bad); font-size: 13px; margin-top: 4px; }
.departed { display: flex; flex-wrap: wrap; gap: 8px; }
.departed span { font-size: 13px; color: var(--faint); padding: 4px 10px; border: 1px dashed var(--line-2); border-radius: 999px; }
.drawer-body { overflow-y: auto; overflow-x: hidden; padding: 16px 22px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; }
/* Reading down a diary folds the header to the name and one line; scrolling back up opens it. */
.who-text { min-width: 0; }
.fold { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.32s var(--ease), opacity 0.22s ease; }
.fold-inner { min-height: 0; overflow: hidden; }
.mini-fold { grid-template-rows: 0fr; opacity: 0; }
.mini { margin-top: 4px; display: flex; align-items: center; gap: 12px; font: 12px var(--mono); color: var(--faint); white-space: nowrap; }
.mini .vital { flex: none; }
.mini .vital .segs { width: 62px; height: 6px; flex: none; }
.mini-coins { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.mini-coins svg { width: 14px; height: 14px; color: #e2b04a; }
.drawer-head { transition: padding 0.32s var(--ease); }
.drawer-who .av.lg { transition: width 0.32s var(--ease), height 0.32s var(--ease), font-size 0.32s var(--ease); }
.drawer.compact .drawer-head { padding-top: 12px; padding-bottom: 10px; align-items: center; }
.drawer.compact .drawer-who { align-items: center; cursor: pointer; }
.drawer.compact .drawer-who .av.lg { width: 34px; height: 34px; font-size: 15px; }
.drawer.compact .more-fold { grid-template-rows: 0fr; opacity: 0; }
.drawer.compact .mini-fold { grid-template-rows: 1fr; opacity: 1; }
@keyframes drawer-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chart { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.chart-label { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); font-family: var(--mono); }
.chart-label b { color: var(--text); }
.chart svg { display: block; width: 100%; height: 40px; margin-top: 6px; overflow: visible; }
.chart polyline { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .area { fill: var(--c); opacity: 0.12; }
.talks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--faint); }
.talks .pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); }
.talks .pill .av { width: 18px; height: 18px; font-size: 9.5px; }

.notes { padding: 12px 14px; border-radius: 12px; background: var(--paper); color: var(--ink); font-size: 13.5px; white-space: pre-wrap; line-height: 1.5; }
.notes-label { display: block; font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: #7a7064; margin-bottom: 4px; }
.turn { padding: 14px 0 16px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.turn-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font: 12px var(--mono); color: var(--faint); }
.turn-head .when { color: var(--text); font-weight: 500; }
.turn-diary { white-space: pre-wrap; font-size: 15px; line-height: 1.6; }
.turn-diary.none { color: var(--faint); font-style: italic; }
.turn-error { padding: 9px 12px; border-radius: 10px; background: rgba(215, 139, 122, 0.08); border: 1px solid rgba(215, 139, 122, 0.3); color: var(--bad); font-size: 13.5px; }
.turn-note { font: 12px var(--mono); color: var(--faint); }
.acts { display: grid; gap: 2px; }
.acts li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; font-size: 13.5px; padding: 3px 0; }
.acts .mark { font-family: var(--mono); font-weight: 600; text-align: center; }
.acts .ok .mark { color: var(--ok); }
.acts .bad .mark { color: var(--bad); }
.act-what { color: var(--text); }
.act-result { color: var(--faint); }
details { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
details summary { cursor: pointer; padding: 8px 12px; font-size: 13px; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 8px; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; rotate: -45deg; transition: rotate 0.2s; }
details[open] summary::before { rotate: 45deg; }
details pre { margin: 0; padding: 10px 12px 12px; border-top: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font: 12.5px/1.55 var(--mono); color: #c9c7c2; max-height: 420px; overflow-y: auto; }
.more { justify-self: center; }

.about p { color: #cfcdc8; font-size: 14.5px; line-height: 1.65; }

.new-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 2px; align-self: flex-start; margin-top: 8px; }
.changelog { gap: 22px; }
.changelog .intro-text { color: var(--faint); font-size: 13.5px; }
.change { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.change:first-of-type { border-top: 0; padding-top: 0; }
.change-date { font: 500 11.5px var(--mono); color: var(--faint); letter-spacing: 0.03em; }
.change h4 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.change ul { display: grid; gap: 6px; }
.change li { position: relative; padding-left: 16px; color: #cfcdc8; font-size: 14px; line-height: 1.55; }
.change li::before { content: ""; position: absolute; left: 2px; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.change.latest .change-date { color: var(--accent); }
.about h4 { margin-top: 8px; font-size: 13px; color: var(--muted); letter-spacing: 0.02em; }

/* ---------- admin ---------- */
.admin-section { display: grid; gap: 12px; padding: 4px 0 18px; border-bottom: 1px solid var(--line); }
.admin-section:last-child { border-bottom: 0; }
.admin-section h4 { font-size: 14px; font-weight: 600; }
.admin-section .sub { color: var(--faint); font-size: 13px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.switch-row .label { display: grid; gap: 2px; font-size: 14px; }
.switch-row .label span { color: var(--faint); font-size: 12.5px; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; border: 0; background: var(--line-2); cursor: pointer; flex: none; transition: background 0.25s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #f1eee8; transition: transform 0.25s var(--ease); }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.users { display: grid; }
.user-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.user-row .name { font-weight: 500; }
.user-row .meta { font: 11.5px var(--mono); color: var(--faint); }
.user-row .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.user-row .inline { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.user-row .inline input { height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: #0d0d0f; color: var(--text); min-width: 0; flex: 1; }
.role { font: 10.5px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin-left: 6px; }
.add-user { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 150px); gap: 10px; align-items: end; }
.add-user .btn, .add-user .form-error { grid-column: 1 / -1; justify-self: start; }
.town-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.news-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px); gap: 10px; align-items: end; }
.news-form .field:first-child { grid-column: 1 / -1; }

/* ---------- sign in ---------- */
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); }
.login-art { position: relative; overflow: hidden; background: #2a3327; }
.login-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 60%, var(--bg)); }
.login-art .town-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-panel { display: grid; align-content: center; gap: 16px; padding: 48px clamp(24px, 6vw, 80px); max-width: 520px; }
.login-panel h1 { font-size: clamp(34px, 4vw, 48px); font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.login-lede { color: var(--muted); font-size: 15.5px; max-width: 40ch; }
.login-panel .form { margin-top: 10px; }
.login-panel .btn.primary { height: 42px; }
.login-panel .hint-text a { color: var(--muted); text-underline-offset: 3px; }
.login-panel .hint-text a:hover { color: var(--text); }

/* ---------- loading ---------- */
.skel { position: relative; overflow: hidden; background: var(--panel); border-color: var(--line); }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.035), transparent);
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- smaller screens ---------- */
@media (max-width: 1400px) {
  .who-label { display: none; }
}
@media (max-width: 1240px) {
  .top { grid-template-columns: 1fr auto; row-gap: 8px; }
  .clock { grid-column: 1 / -1; grid-row: 2; }
  .top-right { grid-column: 2; grid-row: 1; }
}
@media (max-width: 1100px) {
  .cast { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cast-summary { grid-template-columns: auto minmax(0, 1fr) auto; }
  .cast-alerts { grid-column: 1 / -1; justify-content: flex-start; grid-row: 2; }
}
@media (max-width: 980px) {
  .layout { padding: 16px 16px 40px; gap: 18px; }
  .columns { grid-template-columns: 1fr; gap: 18px; }
  .feed { position: static; max-height: 640px; }
  .top { grid-template-columns: 1fr auto; padding: 10px 16px; }
  .clock { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .top-right { grid-column: 2; grid-row: 1; }
  .login { grid-template-columns: 1fr; grid-template-rows: 34dvh auto; }
  .login-art::after { background: linear-gradient(180deg, transparent 55%, var(--bg)); }
  .ties { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .brand-name { font-size: 15px; }
  .clock { flex-wrap: wrap; row-gap: 2px; gap: 8px; }
  .clock-text { font-size: 13.5px; }
  .status { font-size: 11.5px; }
  #about-btn, #changes-btn { display: none; }
  .who-am-i .who-name { display: none; }
  .intro { flex-direction: column; gap: 6px; }
  .scene { border-radius: 14px; }
  .cast { grid-template-columns: 1fr; }
  .cast-summary { grid-template-columns: minmax(0, 1fr) auto; }
  .faces { grid-column: 1 / -1; grid-row: 2; }
  .cast-alerts { grid-row: 3; }
  .card { min-height: 0; }
  .charts { grid-template-columns: 1fr; }
  .add-user, .news-form { grid-template-columns: 1fr; }
  .drawer-head, .drawer-body { padding-left: 16px; padding-right: 16px; }
  .recap { padding: 20px 16px; border-radius: 14px; }
  .hud-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recap-body p { font-size: 15px; }
}

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