:root {
  --bg: #0a0b0d; --panel: #111215; --line: #1f2126; --line2: #2a2d33;
  --fg: #e9e7e3; --mute: #7a7e86; --dim: #4a4e56;
  --tally: #ff3b30; --pvw: #2fd26b; --cue: #ffb340;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--fg);
  font: 14px/1.5 -apple-system, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", sans-serif;
  display: grid; grid-template-rows: 52px minmax(0, 1fr) 64px; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 1px solid var(--line2); border-radius: 6px; padding: 4px 12px; cursor: pointer; }
button:hover { border-color: var(--mute); }

/* ---------- header ---------- */
header { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--line); }
.brand b { font-weight: 600; letter-spacing: 3px; }
.brand span { color: var(--mute); margin-left: 12px; font-size: 12px; letter-spacing: 1px; }
.tc { justify-self: center; font-family: var(--mono); font-size: 18px; letter-spacing: 1px; display: flex; gap: 14px; }
.tc #tc-day { color: var(--mute); }
.tc #tc-beat { color: var(--dim); }
.right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.rec { font-family: var(--mono); font-size: 11px; color: var(--tally); letter-spacing: 2px; display: flex; align-items: center; gap: 6px; }
.rec i { width: 8px; height: 8px; border-radius: 50%; background: var(--tally); animation: blink 1.6s infinite; }
.meta { font-family: var(--mono); font-size: 11px; color: var(--mute); margin-right: 8px; white-space: nowrap; }
.right button { white-space: nowrap; font-size: 13px; font-weight: 500; color: var(--fg); background: #1a1c21; border-color: #3a3e46; padding: 6px 16px; letter-spacing: 1px; transition: background .15s, border-color .15s; }
.right button:hover { background: #262930; border-color: #6a6e76; }
#run { font: 11px var(--mono); letter-spacing: 1px; color: var(--fg); background: var(--panel); border: 1px solid var(--line2); border-radius: 6px; padding: 4px 6px; }
.right button.on { color: var(--bg); background: var(--fg); border-color: var(--fg); }

/* ---------- main ---------- */
main { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; padding: 16px 20px; min-height: 0; }
#left { display: grid; grid-template-rows: minmax(0, 1fr) 92px; gap: 10px; min-height: 0; }

#pgm { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #000; min-height: 0; }
#stage { position: relative; container-type: size; overflow: hidden; min-height: 0; }
#pgm.cue { box-shadow: 0 0 0 1px var(--cue) inset; }
.label { position: absolute; top: 12px; left: 14px; z-index: 6; font-family: var(--mono); font-size: 11px; letter-spacing: 2px;
  background: var(--tally); color: #fff; padding: 2px 8px; border-radius: 3px; }
.label span { margin-left: 10px; opacity: .85; }
#map { position: absolute; left: 50%; top: 50%; width: max(100cqw, 150cqh); aspect-ratio: 3 / 2; transform: translate(-50%, -50%); }
#map .bg { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; filter: saturate(.85); transition: filter 1.2s; }
#dark { position: absolute; inset: 0; background: #050818; opacity: 0; transition: opacity 1.2s; pointer-events: none; }
#glow { position: absolute; left: 46.5%; top: 55%; width: 34%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(255,150,40,.35), rgba(255,150,40,0) 65%); opacity: 0; transition: opacity 1s; pointer-events: none; mix-blend-mode: screen; }
#pgm.night #dark { opacity: .74; }
#pgm.night.lit #dark { background: radial-gradient(circle at 46.5% 55%, rgba(5,8,24,.1) 0 7%, #050818 26%); opacity: .8; }
#pgm.night.lit #glow { opacity: 1; }

#pins { position: absolute; inset: 0; }
.pin { position: absolute; width: 52px; transform: translate(-50%, -50%); transition: left .7s ease, top .7s ease, opacity .4s; text-align: center; }
.pin img { width: 52px; height: 52px; border-radius: 8px; image-rendering: pixelated; border: 2px solid rgba(0,0,0,.6); display: block; background: #141414; }
.pin span { font-size: 10px; background: rgba(0,0,0,.7); padding: 0 5px; border-radius: 3px; white-space: nowrap; }
.pin.sleep img { filter: grayscale(1) brightness(.55); }
.pin.sleep::after { content: "z"; position: absolute; top: -8px; right: -2px; font-family: var(--mono); font-size: 12px; color: #9fb4ff; }
.pin.on { z-index: 3; }
.pin.on img { border-color: var(--tally); box-shadow: 0 0 0 3px rgba(255,59,48,.35); }

#gauges { position: absolute; top: 12px; right: 14px; z-index: 6; display: flex; gap: 1px; background: rgba(10,11,13,.72); border: 1px solid var(--line2);
  border-radius: 6px; backdrop-filter: blur(6px); overflow: hidden; }
#gauges > div { padding: 5px 12px; text-align: center; }
#gauges small { display: block; font-size: 10px; color: var(--mute); letter-spacing: 1px; }
#gauges b { font-family: var(--mono); font-weight: 500; font-size: 15px; transition: color .4s; }
#gauges b.chg { color: var(--cue); }
#gauges em { font-style: normal; font-size: 10px; color: var(--mute); margin-left: 2px; }
#gauges .wx { font-size: 12px; color: var(--mute); align-self: center; }

#event { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); z-index: 6; font-size: 15px; letter-spacing: 3px; padding: 6px 18px;
  background: rgba(10,11,13,.78); border: 1px solid var(--line2); border-radius: 20px; opacity: 0; pointer-events: none; white-space: nowrap; }
#event.show { animation: caption 3.2s ease forwards; }
@keyframes caption { 0% { opacity: 0; transform: translate(-50%, -6px); } 12%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

#lower { height: 168px; overflow: hidden; padding: 12px 28px 14px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; background: #060709; border-top: 1px solid var(--line); }
#lower .line { display: flex; flex-direction: column; gap: 2px; max-width: 920px; opacity: .45; transition: opacity .4s; }
#lower .line.now { opacity: 1; }
#lower .n { font-weight: 600; font-size: 13px; letter-spacing: 1px; padding-left: 10px; border-left: 3px solid var(--dim); }
#lower .now .n { border-left-color: var(--tally); }
#lower .n em { font-style: normal; font-weight: 400; color: var(--mute); margin-left: 8px; }
#lower .say { font-size: 15px; line-height: 1.45; text-wrap: pretty; }
#lower .line:not(.now) { flex-direction: row; gap: 10px; align-items: baseline; }
#lower .line:not(.now) .say { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lower .line:not(.now) .act { display: none; }
#lower .line:not(.now) .n { flex-shrink: 0; }
#lower .now .say { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font-size: 21px; font-weight: 500; }
#lower .act { font-size: 13px; color: #a8adb5; font-style: italic; }
#lower .act::before { content: "（"; } #lower .act::after { content: "）"; }

#slate { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 7; width: min(560px, 80%); padding: 18px 22px;
  background: rgba(10,11,13,.9); border: 1px solid var(--cue); border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .35s; }
#slate.show { opacity: 1; }
#slate span { font-family: var(--mono); font-size: 11px; letter-spacing: 3px; color: var(--cue); }
#slate p { margin: 8px 0 0; font-size: 16px; }

/* ---------- camera wall ---------- */
#cams { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; min-height: 0; }
.cam { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); cursor: pointer; transition: border-color .25s, opacity .4s; }
.cam img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; image-rendering: pixelated; transition: filter .4s; }
.cam .bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 7px 4px;
  background: linear-gradient(transparent, rgba(0,0,0,.92) 70%); font-size: 12px; }
.cam .bar b { font-weight: 600; }
.cam .bar i { font-style: normal; color: #b7bac0; font-size: 11px; }
.cam .bar b, .cam .bar i { text-shadow: 0 1px 3px #000, 0 0 6px #000; }
.cam .no { position: absolute; top: 6px; left: 8px; font-family: var(--mono); font-size: 10px; color: var(--mute); letter-spacing: 1px; }
.cam .tally { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.cam .mem { display: none; position: absolute; top: 22px; left: 8px; font-size: 10px; color: #8fc9a8; text-shadow: 0 1px 3px #000; }
.cam.on { border-color: var(--tally); }
.cam.on .tally { background: var(--tally); box-shadow: 0 0 8px var(--tally); }
.cam.on .no { color: var(--tally); }
.cam.sleep img { filter: grayscale(1) brightness(.35); }
.cam.sleep .bar i::after { content: " · 睡"; }
.cam.same { border-color: var(--line2); }

/* ---------- backstage column ---------- */
#bts { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.bh { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; gap: 10px; }
.bh b { letter-spacing: 2px; font-weight: 600; }
.bh small { color: var(--mute); font-size: 11px; }
.bb { position: relative; overflow-y: auto; padding: 4px 16px 24px; font-size: 13px; }
.bb .future { display: none; }
.btick { font-family: var(--mono); font-size: 11px; color: var(--mute); letter-spacing: 1px; margin: 16px 0 4px; }
.bi { padding: 9px 10px; margin: 0 -10px; border-radius: 6px; cursor: pointer; opacity: .62; transition: opacity .3s, background .3s; }
.bi:hover { background: #16181c; }
.bi.cur { opacity: 1; background: #1a1c21; box-shadow: inset 2px 0 0 var(--tally); }
.bn { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 12px; margin-bottom: 4px; min-width: 0; }
.bn > b { flex-shrink: 0; font-weight: 600; }
.bn img { width: 20px; height: 20px; border-radius: 4px; image-rendering: pixelated; }
.bctx { font-weight: 400; color: var(--mute); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bos { color: #c9c3d9; line-height: 1.55; }
.bos::before { content: "心里想"; font-size: 10px; color: var(--bg); background: #b9b3c9; padding: 0 5px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.bmemo { color: #8fc9a8; margin-top: 4px; font-size: 12.5px; }
.bmemo::before { content: "记下"; font-size: 10px; color: var(--bg); background: #8fc9a8; padding: 0 5px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.bi.ref .bctx { font-style: italic; white-space: normal; }
.bi.cue .blog { color: var(--fg); margin-top: 4px; padding-left: 8px; border-left: 2px solid var(--cue); }
.bi.cue .bwhy { color: var(--mute); font-size: 12px; margin-top: 2px; padding-left: 10px; }

/* ---------- footer ---------- */
footer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 0 20px; border-top: 1px solid var(--line); }
.transport { display: flex; gap: 6px; }
.transport button { width: 38px; height: 32px; padding: 0; font-size: 16px; }
#play { width: 46px; background: var(--fg); color: var(--bg); border-color: var(--fg); }
#speed { font-family: var(--mono); font-size: 12px; width: 44px; }
#timeline { position: relative; height: 40px; }
#scrub { position: absolute; left: 0; right: 0; top: 8px; width: 100%; margin: 0; -webkit-appearance: none; appearance: none; height: 16px; background: transparent; }
#scrub::-webkit-slider-runnable-track { height: 3px; background: var(--line2); border-radius: 2px; }
#scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 3px; height: 18px; margin-top: -7.5px; background: var(--tally); border-radius: 1px; }
#marks, #labels { position: absolute; left: 0; right: 0; pointer-events: none; }
#marks { top: 12px; height: 8px; }
#marks i { position: absolute; width: 1px; height: 8px; background: var(--dim); }
#marks i.cue { background: var(--cue); width: 3px; height: 10px; top: -1px; }
#marks i.ref { background: #6b5a8a; height: 4px; top: 2px; }
#labels { top: 26px; font-family: var(--mono); font-size: 10px; color: var(--dim); }
#labels span { position: absolute; transform: translateX(-2px); pointer-events: auto; cursor: pointer; white-space: nowrap; }
#labels span:hover, #labels span.cur { color: var(--fg); }
.disc { font-size: 11px; color: var(--dim); }

/* ---------- drawer ---------- */
#drawer { position: fixed; top: 52px; right: 0; bottom: 64px; width: 520px; background: #0e0f12; border-left: 1px solid var(--line2); z-index: 20;
  transform: translateX(100%); transition: transform .3s ease; display: flex; flex-direction: column; }
#drawer.open { transform: none; }
.dh { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.dh b { font-weight: 600; letter-spacing: 1px; }
.dh button { border: none; font-size: 20px; color: var(--mute); padding: 0 4px; }
.db { overflow-y: auto; padding: 16px 20px 40px; font-size: 13px; color: #c9c7c3; }
.db h5 { margin: 22px 0 8px; font-size: 11px; font-weight: 500; letter-spacing: 2px; color: var(--mute); text-transform: uppercase; }
.db h5:first-child { margin-top: 0; }
.db .note { padding: 10px 0; border-bottom: 1px solid var(--line); }
.db .note .t { font-family: var(--mono); font-size: 11px; color: var(--mute); }
.db .note.cur .t { color: var(--tally); }
.cue-tag { font-family: var(--mono); font-size: 10px; color: var(--bg); background: var(--cue); padding: 0 5px; border-radius: 2px; margin-left: 6px; }
.db .iv { margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--cue); color: var(--fg); }
.db .muted { color: var(--mute); }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.check .ok { color: var(--pvw); } .check .warn { color: var(--cue); } .check .info { color: var(--mute); }
.check small { grid-column: 2; color: var(--mute); font-family: var(--mono); font-size: 11px; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 4px 12px; font-size: 12px; }
.kv > :nth-child(odd) { color: var(--mute); }
.kv > :nth-child(even) { font-family: var(--mono); word-break: break-all; }
pre { white-space: pre-wrap; word-break: break-all; background: #08090b; border: 1px solid var(--line); padding: 10px 12px; border-radius: 6px;
  font: 11.5px/1.55 var(--mono); color: #a9a7a3; max-height: 320px; overflow-y: auto; }
details summary { cursor: pointer; color: var(--mute); font-size: 12px; margin-top: 18px; }
details table { border-collapse: collapse; font-size: 11.5px; margin: 8px 0; }
details td { border-bottom: 1px solid var(--line); padding: 4px 6px; vertical-align: top; }
.who-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.who-tabs button { display: flex; align-items: center; gap: 6px; padding: 4px 6px; font-size: 12px; color: var(--mute); }
.who-tabs button img { width: 24px; height: 24px; border-radius: 4px; image-rendering: pixelated; }
.who-tabs button.on { color: var(--fg); border-color: #8fc9a8; }
.mstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin: 14px 0 4px; }
.mstats div { background: #0e0f12; padding: 10px 0; text-align: center; }
.mstats b { display: block; font-family: var(--mono); font-size: 20px; font-weight: 500; color: #8fc9a8; }
.mstats small { color: var(--mute); font-size: 11px; }
.heard { padding: 5px 0 5px 10px; border-left: 2px solid var(--line2); margin: 4px 0; color: var(--fg); }
.logline { display: grid; grid-template-columns: 56px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.logline:hover { background: #14161a; }
.logline.cur { background: #1a1215; }
.logline .n { color: var(--mute); font-size: 12px; }
.logline .s { color: var(--fg); }
.logline .p { color: var(--mute); font-size: 12px; }
.logtick { font-family: var(--mono); font-size: 11px; color: var(--mute); margin: 16px 0 4px; letter-spacing: 1px; }

@keyframes blink { 50% { opacity: .25; } }

/* memory v1: recall, 触景生情, promises, bedtime journals */
.brecall { color: #9cc3e6; margin-top: 4px; font-size: 12.5px; }
.brecall::before { content: "翻记忆"; font-size: 10px; color: var(--bg); background: #9cc3e6; padding: 0 5px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.brecall small { color: #7d8aa0; margin-left: 6px; }
.bnudge { color: #c8b7e8; margin-top: 4px; font-size: 12.5px; font-style: italic; }
.bpromise { color: #e6c38f; margin-top: 4px; font-size: 12.5px; }
.bpromise::before { content: "答应了"; font-size: 10px; color: var(--bg); background: #e6c38f; padding: 0 5px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.bjournal { color: #d9d3c4; line-height: 1.6; white-space: pre-wrap; }
.bdream { color: #b9c4dc; line-height: 1.6; font-style: italic; margin-top: 6px; }
.bdream::before { content: "梦"; font-style: normal; font-size: 10px; color: var(--bg); background: #b9c4dc; padding: 0 5px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.bfrag { color: #b9c4dc; font-size: 12px; margin-top: 4px; }
.bfade { color: var(--mute); font-size: 11px; margin-top: 4px; }
.bfade small { display: block; color: #9a9588; font-size: 11px; line-height: 1.5; }
.bjournal::before { content: "睡前回想"; font-size: 10px; color: var(--bg); background: #d9d3c4; padding: 0 5px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.bpeople { color: #a9a39a; font-size: 12px; margin-top: 3px; }

/* 复盘 drawer */
.evsum { border-left: 2px solid var(--tally); padding: 8px 12px; margin: 12px 0; line-height: 1.7; }
.db a.at { color: var(--cue); cursor: pointer; font-family: var(--mono); font-size: 0.92em; text-decoration: none; border-bottom: 1px dotted; }
.grade { font-size: 10px; padding: 1px 6px; border-radius: 2px; color: var(--bg); margin-right: 4px; font-family: inherit; }
.grade.g1 { background: var(--pvw); } .grade.g2 { background: var(--cue); } .grade.g3 { background: var(--mute); }
.mom > div { margin-top: 4px; }
.checks6 { display: flex; flex-wrap: wrap; gap: 4px; }
.checks6 span { font-size: 11px; padding: 1px 6px; border: 1px solid var(--line2); border-radius: 2px; }
.checks6 .ok { color: var(--pvw); } .checks6 .no { color: var(--cue); border-color: var(--cue); }
.belief { display: inline-block; margin: 4px 10px 0 0; font-size: 12px; color: var(--mute); }
.belief b { color: inherit; font-family: var(--mono); color: #e8e4da; }
