:root {
  --bg: #0e131d;
  --panel: #161d2b;
  --panel2: #1c2536;
  --line: #2a3448;
  --text: #e7eaf0;
  --muted: #8d97ab;
  --red: #e8553d;
  --gold: #f2c14e;
  --sea: #3aa0c8;
  --green: #5cc46a;
  --amber: #f0a43a;
  --S: #f2c14e;
  --N: #7fb3ff;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif; }
button, select { font: inherit; color: inherit; }
small { color: var(--muted); font-weight: normal; }
.muted { color: var(--muted); }
main { max-width: 1400px; margin: 0 auto; padding: 12px 16px 48px; }

/* header */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 8px 16px; background: rgba(14, 19, 29, .94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { font-size: 26px; }
.brand b { display: block; font-size: 17px; letter-spacing: 1px; }
.brand small { display: block; font-size: 12px; line-height: 1.2; }
.runinfo { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; flex-wrap: wrap; }
select { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; max-width: 100%; }
.status { font-size: 13px; color: var(--muted); }
.status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.status .dot.running { background: var(--green); box-shadow: 0 0 0 0 rgba(92, 196, 106, .7); animation: pulse 1.8s infinite; }
.status .dot.paused { background: var(--amber); }
.status .dot.done, .status .dot.stopped { background: var(--muted); }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(92, 196, 106, 0); } 100% { box-shadow: 0 0 0 0 rgba(92, 196, 106, 0); } }
.toggle { font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }

/* stage */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; }
.mapwrap { min-width: 0; }
.mapbox { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #1b2a1c; }
#map { display: block; width: 100%; cursor: pointer; }
.banner { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); padding: 6px 14px; border-radius: 8px;
  background: rgba(10, 14, 22, .85); border: 1px solid var(--gold); color: var(--gold); font-weight: 600; font-size: 14px;
  opacity: 0; transition: opacity .4s; pointer-events: none; max-width: 90%; text-align: center; }
.banner.show { opacity: 1; }
.controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.controls button { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.controls button:hover { border-color: #46546f; }
.controls button.primary { background: #23314a; }
.controls .speeds { display: inline-flex; }
.controls .speeds button { border-radius: 0; margin-left: -1px; padding: 4px 8px; }
.controls .speeds button:first-child { border-radius: 8px 0 0 8px; }
.controls .speeds button:last-child { border-radius: 0 8px 8px 0; }
.controls .speeds button.on { background: #2f4266; }
.controls .live.on { color: var(--red); border-color: var(--red); }
.daylabel { min-width: 72px; text-align: center; font-weight: 600; }
.phaselabel { color: var(--muted); font-size: 13px; margin-left: auto; }

/* side panel */
.side { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column;
  min-height: 0; max-height: calc((100vw - 32px - 392px) * 0.62 + 48px); }
@media (min-width: 1432px) { .side { max-height: calc((1400px - 32px - 392px) * 0.62 + 48px); } }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; padding: 8px 4px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--red); }
.tabbody { overflow-y: auto; padding: 8px 10px; flex: 1; min-height: 240px; }
.ev { padding: 5px 2px; border-bottom: 1px dashed #243049; font-size: 13px; word-break: break-word; }
.ev .ph { color: var(--muted); font-size: 11px; margin-right: 6px; }
.ev.new { animation: flash 1.2s; }
@keyframes flash { from { background: rgba(242, 193, 78, .18); } to { background: transparent; } }
.ev .who { font-weight: 600; cursor: pointer; }
.ev .who:hover { text-decoration: underline; }
.ev.k-dm { color: #c9d3e6; }
.ev.k-dm .tx { color: #b6c2d8; }
.ev.k-default, .ev.k-leave, .ev.k-hungry { color: #ff9b87; }
.ev.k-council_result, .ev.k-proposal { color: var(--gold); }
.ev.k-arrive { color: #9be3a5; }
.ev.k-note { color: #c8bfff; }
.phase-h { margin: 10px 0 2px; font-weight: 700; font-size: 13px; color: var(--gold); }
.board h4 { margin: 10px 0 4px; font-size: 13px; color: var(--gold); }
.board table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.board td, .board th { padding: 3px 4px; border-bottom: 1px solid #243049; text-align: left; }
.board th { color: var(--muted); font-weight: normal; }

/* kpis */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.kpi .l { color: var(--muted); font-size: 12px; }
.kpi .v { font-size: 22px; font-weight: 700; line-height: 1.3; }
.kpi .s { color: var(--muted); font-size: 12px; }
.kpi .v.good { color: var(--green); }
.kpi .v.warn { color: var(--amber); }
.kpi .v.bad { color: var(--red); }

/* charts */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.card h3 { margin: 0 0 6px; font-size: 14px; }
.card h3 small { font-size: 12px; margin-left: 6px; }
.chart { position: relative; height: 220px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .legend { position: absolute; top: 0; right: 0; font-size: 11px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: 75%; }
.chart .legend i { display: inline-block; width: 10px; height: 3px; margin-right: 3px; vertical-align: 3px; }
.chart .empty { color: var(--muted); font-size: 13px; padding-top: 80px; text-align: center; }
.tip { position: fixed; z-index: 60; pointer-events: none; background: rgba(10, 14, 22, .95); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 9px; font-size: 12px; max-width: 280px; }
.tip .r { display: flex; justify-content: space-between; gap: 12px; }

/* residents */
h2.sec { font-size: 17px; margin: 22px 0 10px; }
h2.sec small { font-size: 13px; margin-left: 8px; }
.residents { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.rc { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: var(--radius);
  padding: 10px 12px; cursor: pointer; transition: transform .12s, border-color .12s; }
.rc:hover { transform: translateY(-2px); border-color: #46546f; border-left-color: var(--c); }
.rc .nm { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 0 6px; line-height: 18px; border: 1px solid; }
.chip.S { color: var(--S); border-color: var(--S); }
.chip.N { color: var(--N); border-color: var(--N); }
.chip.f { color: var(--muted); border-color: var(--line); font-weight: normal; }
.chip.gone { color: #ff9b87; border-color: #ff9b87; }
body.nobadge .chip.S, body.nobadge .chip.N, body.nobadge .chip.f { display: none; }
.rc .stats { display: flex; gap: 12px; font-size: 13px; margin: 4px 0; flex-wrap: wrap; }
.rc .stats b { font-size: 15px; }
.rc .plan { font-size: 12.5px; color: #c9d3e6; }
.rc .note { font-size: 12px; color: var(--muted); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.departed { margin-top: 10px; font-size: 13px; color: var(--muted); }
.departed span.who { color: var(--text); cursor: pointer; margin-right: 4px; }
.departed span.who:hover { text-decoration: underline; }

.about { margin-top: 22px; }
.about h2 { font-size: 16px; margin: 0 0 6px; }
.about p { margin: 6px 0; color: #c9d3e6; }

/* drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); z-index: 50; background: var(--panel);
  border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0, 0, 0, .4); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.drawer-head button { background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--muted); }
#drTitle .nm { font-size: 18px; font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#drTitle .sub { font-size: 12.5px; color: var(--muted); }
.drawer-body { overflow-y: auto; padding: 10px 14px 40px; flex: 1; }
.dday { margin: 12px 0 4px; font-weight: 700; color: var(--gold); font-size: 13px; }
.notebox { white-space: pre-wrap; background: var(--panel2); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.call { background: var(--panel2); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.call .h { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.call .h b { color: var(--text); }
.call details { margin-top: 6px; }
.call summary { cursor: pointer; color: #c8bfff; font-size: 12.5px; }
.call pre { white-space: pre-wrap; word-break: break-word; font: 12.5px/1.55 ui-monospace, Consolas, monospace; margin: 6px 0 0; color: #d5dbe8; max-height: 420px; overflow: auto; }
.call .err { color: #ff9b87; font-size: 12px; }
.daypick { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.daypick button { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 9px; cursor: pointer; }
.more { display: block; margin: 12px auto; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 14px; cursor: pointer; }
.ledger td, .ledger th { padding: 3px 6px; border-bottom: 1px solid #243049; font-size: 12.5px; text-align: right; }
.ledger th:first-child, .ledger td:first-child { text-align: left; }
.ledger { border-collapse: collapse; width: 100%; }

@media (max-width: 980px) {
  .stage { grid-template-columns: 1fr; }
  .side { max-height: 420px; }
  .charts { grid-template-columns: 1fr; }
  .phaselabel { margin-left: 0; width: 100%; }
}
[hidden] { display: none !important; }
.controls #camBtn.on { color: var(--gold); border-color: var(--gold); }
.banner { top: 16px; font-size: 15px; background: rgba(20, 24, 34, .78); border-color: rgba(242, 193, 78, .8); border-radius: 999px; padding: 6px 18px; }
.av { width: 34px; height: 34px; border-radius: 50%; background: #f3ead6; border: 2px solid var(--c, #46546f); object-fit: cover; }
.av.big { width: 46px; height: 46px; border-color: currentColor; }

/* observer: news and reports */
.news { background: linear-gradient(180deg, #1b2335, var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }
.news-head { display: flex; align-items: center; gap: 10px; }
.news-head b { font-size: 15px; }
.news-head button { margin-left: auto; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 2px 10px; cursor: pointer; color: var(--muted); }
.news-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-top: 8px; }
.news-body.collapsed { display: none; }
.news h4 { margin: 2px 0 4px; font-size: 16px; color: var(--gold); }
.news .period p { margin: 4px 0; color: #d5dbe8; white-space: pre-wrap; }
.news .watch { margin: 6px 0 0; padding-left: 18px; color: #c8bfff; font-size: 13px; }
.news .dailies a { display: block; padding: 4px 0; border-bottom: 1px dashed #243049; color: #e7eaf0; text-decoration: none; cursor: pointer; font-size: 13.5px; }
.news .dailies a:hover { color: var(--gold); }
.news .dailies a small { margin-right: 6px; }
.news .more-p { font-size: 12.5px; color: var(--muted); cursor: pointer; }
.report h3 { margin: 6px 0; font-size: 16px; color: var(--gold); }
.report p { white-space: pre-wrap; color: #d5dbe8; font-size: 13.5px; line-height: 1.75; }
.report .people { color: var(--muted); font-size: 12.5px; }
.report .period { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.bio .tag { display: inline-block; background: #2b2550; color: #c8bfff; border-radius: 6px; padding: 1px 8px; font-size: 12.5px; margin-bottom: 6px; }
.bio p { white-space: pre-wrap; line-height: 1.8; color: #d5dbe8; }
@media (max-width: 980px) { .news-body { grid-template-columns: 1fr; } }

/* 每天开场卡 */
.daycard { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;
  background: rgba(10, 14, 22, .86); border: 1px solid rgba(242, 193, 78, .7); border-radius: 16px;
  padding: 18px 30px; text-align: center; cursor: pointer; min-width: 220px; max-width: 86%;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .55); }
.daycard .dc-day { font-size: 34px; font-weight: 700; letter-spacing: 3px; }
.daycard .dc-y { color: var(--gold); margin-top: 6px; font-size: 15px; font-weight: 600; }
.daycard .dc-b { color: #c9d3e6; margin-top: 6px; font-size: 13px; }

/* 时间轴 */
.followBtn { margin-top: 6px; padding: 3px 10px; border-radius: 12px; border: 1px solid #f2c14e; background: transparent; color: #f2c14e; cursor: pointer; }
.controls button.follow { border-color: #f2c14e; color: #f2c14e; }
.timeline { display: flex; gap: 2px; overflow-x: auto; margin-top: 6px; padding: 6px 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.tday { flex: 0 0 auto; width: 13px; height: 40px; border-radius: 4px; background: #1e2740;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; }
.tday:hover { background: #2b3a56; }
.tday.on { background: #3a4a2a; box-shadow: 0 0 0 1px var(--gold); }
.tday .d { width: 5px; height: 5px; border-radius: 50%; display: block; flex: 0 0 auto; }
.tday .d.leave { background: var(--red); }
.tday .d.arrive { background: var(--green); }
.tday .d.storm { background: var(--N); }
.tday .d.council { background: var(--gold); }
.tday .d.build { background: #a0724a; }
.tday .d.theft { background: #a06cd5; }
@media (max-width: 980px) { .daycard .dc-day { font-size: 26px; } }

/* 浏览人数：很淡，只给站长自己看 */
.pv-foot { text-align: right; padding: 18px 16px 10px; font-size: 11px; color: var(--muted); opacity: .35; }
