* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #16130e; --panel: #1f1a12; --line: #3a2f1e; --ink: #ece4d2;
  --dim: #9a8f78; --gold: #ffd76e; --red: #ff6b5e; --green: #7ec97e;
}
body {
  background: radial-gradient(1200px 700px at 50% -10%, #241d12 0%, var(--bg) 60%) fixed;
  color: var(--ink); font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}

header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 18px; background: rgba(31,26,18,.85); border-bottom: 2px solid var(--line); flex-wrap: wrap; backdrop-filter: blur(4px); }
.brand h1 { font-size: 20px; display: inline; letter-spacing: 2px; color: var(--gold); text-shadow: 2px 2px 0 #000, 0 0 18px rgba(255,215,110,.25); }
.brand h1::before { content: '🏘️'; margin-right: 8px; font-size: 18px; }
.brand .sub { font-size: 11px; color: var(--dim); margin-left: 10px; letter-spacing: 1px; }
.clockbox { display: flex; gap: 12px; align-items: baseline; font-size: 15px; font-variant-numeric: tabular-nums; }
.clockbox #clock { font-size: 20px; font-weight: 700; color: #fff; }
.stats { display: flex; gap: 14px; font-size: 12px; color: var(--dim); align-items: center; }
#pausedBadge { color: var(--gold); }

main { flex: 1; display: flex; gap: 14px; padding: 14px; max-width: 1440px; margin: 0 auto; width: 100%; }
#stage { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cvwrap {
  position: relative; margin: 0 auto; width: fit-content;
  box-shadow: 0 0 0 3px #463524, 0 0 0 8px #191309, 0 22px 50px rgba(0,0,0,.6);
  border-radius: 3px; background: #111;
}
canvas#cv {
  display: block; width: 100%; height: auto;
  image-rendering: pixelated; image-rendering: crisp-edges;
  border-radius: 2px; touch-action: pan-y;
}
canvas#ov { position: absolute; left: 0; top: 0; pointer-events: none; }
#tip { position: absolute; transform: translate(14px, -50%); background: rgba(20,15,8,.94); padding: 4px 9px; border-radius: 4px; font-size: 12px; pointer-events: none; white-space: nowrap; border: 1px solid var(--line); z-index: 5; color: var(--ink); }
.controls { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 10px; align-items: center; z-index: 6; }
.controls button {
  background: rgba(30,24,14,.9); color: var(--ink); border: 2px solid #4a3a22; border-radius: 3px;
  padding: 3px 11px; cursor: pointer; font-size: 12px;
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.4), inset 2px 2px 0 rgba(255,255,255,.06);
}
.controls button:active { transform: translateY(1px); box-shadow: inset 2px 2px 0 rgba(0,0,0,.4); }
.controls button.on { color: var(--gold); border-color: var(--gold); }
.hint { font-size: 11px; color: rgba(255,255,255,.6); text-shadow: 0 1px 2px #000; }

aside { width: 288px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 140px); }
.panel {
  background: linear-gradient(180deg, #221c12 0%, #1c1710 100%);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-y: auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 8px 20px rgba(0,0,0,.35);
}
.panel h2 { font-size: 14px; margin-bottom: 8px; letter-spacing: 1px; }
.panel:first-child { flex: 1; }
.panel::-webkit-scrollbar, .mem::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-thumb, .mem::-webkit-scrollbar-thumb { background: #3a2f1e; border-radius: 4px; }
.panel::-webkit-scrollbar-track, .mem::-webkit-scrollbar-track { background: transparent; }

#feed { list-style: none; display: flex; flex-direction: column; gap: 6px; }
#feed li { font-size: 12.5px; line-height: 1.5; padding: 6px 8px; background: rgba(255,255,255,.03); border-left: 2px solid var(--line); border-radius: 0 5px 5px 0; cursor: default; transition: background .15s; }
#feed li:hover { background: rgba(255,255,255,.07); }
#feed li i { font-style: normal; color: var(--dim); font-size: 10.5px; margin-right: 4px; }
#feed li.rumor { border-color: var(--gold); background: rgba(255,215,110,.08); }
#feed li.event { border-color: #5b8dd6; }
#feed li.group { border-color: #16a085; background: rgba(22,160,133,.08); }
#feed li.crisis { border-color: var(--red); background: rgba(255,107,94,.1); color: #ffb0a8; }

#godcard h2 { display: flex; justify-content: space-between; align-items: center; }
#closeGod { background: none; border: none; color: var(--dim); font-size: 18px; cursor: pointer; }
#closeGod:hover { color: var(--ink); }
.godhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.swatch { width: 26px; height: 26px; border-radius: 4px; border: 2px solid #000; box-shadow: inset -4px -4px 0 rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; font-size: 13px; }
.secret-badge { font-size: 11px; background: rgba(255,107,94,.15); color: var(--red); border: 1px solid var(--red); padding: 1px 7px; border-radius: 10px; }
#godbody p { font-size: 12.5px; margin: 6px 0; line-height: 1.55; }
#godbody .persona { color: var(--dim); }
#godbody h3 { font-size: 12px; margin: 10px 0 4px; color: var(--gold); }
.mem { font-family: inherit; font-size: 12px; line-height: 1.6; white-space: pre-wrap; background: linear-gradient(180deg, #f4ecd8, #ede2c6); color: #4a3a22; padding: 8px 10px; border-radius: 6px; max-height: 180px; overflow-y: auto; box-shadow: inset 0 0 14px rgba(120,90,40,.3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); }
.chip.good { color: var(--green); }
.chip.bad { color: var(--red); }
.quotes { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.quotes li { font-size: 12px; background: rgba(255,255,255,.04); padding: 4px 8px; border-radius: 4px; }
.dim { color: var(--dim); }
.hidden { display: none !important; }
.arc { font-size: 12.5px; color: var(--gold); background: rgba(255,215,110,.07); border-left: 2px solid var(--gold); padding: 5px 8px; border-radius: 0 4px 4px 0; }

/* 密码门 */
#gate { position: fixed; inset: 0; background: radial-gradient(800px 500px at 50% 30%, #2a2214 0%, #16130e 70%); display: flex; align-items: center; justify-content: center; z-index: 99; }
#gate.hidden { display: none; }
.gatecard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 34px 38px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.6); max-width: 320px; }
.gatecard h1 { font-size: 26px; color: var(--gold); letter-spacing: 3px; margin-bottom: 8px; }
.gatecard p { font-size: 12.5px; color: var(--dim); margin-bottom: 18px; }
.gatecard input { width: 100%; padding: 10px 12px; font-size: 15px; text-align: center; letter-spacing: 2px; background: #14100a; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; outline: none; }
.gatecard input:focus { border-color: var(--gold); }
.gatecard button { margin-top: 12px; width: 100%; padding: 10px; font-size: 15px; letter-spacing: 6px; background: var(--gold); color: #241a08; border: none; border-radius: 6px; cursor: pointer; font-weight: 700; }
.gatecard button:active { transform: translateY(1px); }
.gateerr { color: var(--red) !important; margin-top: 10px !important; margin-bottom: 0 !important; }

footer { text-align: center; font-size: 11px; color: var(--dim); padding: 8px; border-top: 1px solid var(--line); letter-spacing: 1px; }

@media (max-width: 900px) {
  main { flex-direction: column; }
  aside { width: 100%; max-height: none; }
  header { padding: 8px 10px; }
  .controls { position: static; margin-top: 8px; }
}
