:root {
  --bg: #f4efe6;
  --surface: #fffaf2;
  --surface-2: #f0e8da;
  --ink: #2b2620;
  --muted: #7b7064;
  --line: #e2d7c5;
  --accent: #2f7a5f;
  --accent-ink: #ffffff;
  --yes: #3a9a68;
  --no: #c8553d;
  --danger: #b3412f;
  --gold: #b8892a;
  --shadow: 0 1px 2px rgba(60, 45, 20, 0.06), 0 6px 24px rgba(60, 45, 20, 0.1);
  --radius: 14px;
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1915;
    --surface: #24211c;
    --surface-2: #2d2a24;
    --ink: #efe8dc;
    --muted: #a69b8c;
    --line: #3a352d;
    --accent: #5fbf98;
    --accent-ink: #10221a;
    --yes: #5cc28d;
    --no: #e07a62;
    --danger: #ec7b67;
    --gold: #e0b44f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 24px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.brand-mark { font-size: 26px; }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; white-space: nowrap; }
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  padding: 3px 10px; border-radius: 99px; background: var(--surface-2);
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: #c9a227; }
.status.live .dot { background: #3bb273; box-shadow: 0 0 0 3px rgba(59, 178, 115, 0.2); }
.status.down .dot { background: var(--danger); }
.stats { display: flex; gap: 14px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.stats b { color: var(--ink); font-variant-numeric: tabular-nums; }

.btn {
  font: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  padding: 7px 14px; border-radius: 10px; cursor: pointer;
}
.btn:hover { filter: brightness(0.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }
/* Styled like the official Buy Me a Coffee button (yellow, Bree Serif, 🤖), without loading their script. */
.btn.support { background: #ffdd00; border-color: #ffdd00; color: #000; font-family: "Bree Serif", var(--font); font-weight: 700; font-size: 15px; white-space: nowrap; }
.btn:focus-visible, input:focus-visible, select:focus-visible, .chip:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- layout ---------- */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  padding: 16px 20px 20px;
}

.view {
  position: relative;
  min-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #bfe3ff;
}
.world { position: absolute; inset: 0; }
.world canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.world canvas:active { cursor: grabbing; }

.view-controls { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; z-index: 5; }
.chip {
  font: inherit; font-size: 13px; font-weight: 600;
  background: rgba(255, 252, 245, 0.92); color: #2b2620;
  border: 1px solid rgba(60, 45, 20, 0.15); border-radius: 99px;
  padding: 6px 12px; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.chip:hover { background: #fff; }

.view-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  margin: 0; padding: 6px 12px; border-radius: 99px;
  background: rgba(25, 22, 18, 0.62); color: #fff; font-size: 12.5px; white-space: nowrap;
  pointer-events: none; transition: opacity 0.6s; z-index: 4;
}
.view-hint.gone { opacity: 0; }

.no-webgl { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; text-align: center; color: #2b2620; }
.no-webgl[hidden] { display: none; }

/* ---------- floating labels over the 3D view ---------- */

.labels { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; font-family: var(--font); }
.label { position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform; transform-origin: 50% 100%; }
.tag {
  background: rgba(22, 20, 17, 0.74); color: #fff;
  font-size: 13px; font-weight: 650; padding: 2px 9px; border-radius: 99px;
}
.tag.human { background: rgba(47, 122, 95, 0.9); }
.tag.npc { background: rgba(150, 110, 70, 0.8); font-size: 11.5px; }
.bubble {
  transform-origin: 0 0;
  background: #fffdf8; color: #2b2620;
  border-radius: 12px; padding: 6px 10px;
  max-width: 250px; white-space: normal; overflow-wrap: anywhere;
  font-size: 13.5px; line-height: 1.35;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
  transition: opacity 0.3s;
}
.place-label {
  font-size: 15px; font-weight: 750; color: #2b2620;
  background: rgba(255, 250, 240, 0.88); padding: 3px 11px; border-radius: 9px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.home-label {
  font-size: 11.5px; text-align: center; color: #3a2f22;
  background: rgba(255, 250, 240, 0.9); padding: 3px 8px; border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.home-label b { display: block; font-size: 12.5px; }
.home-label span { letter-spacing: 0.5px; }
.monument-label {
  font-size: 11.5px; font-weight: 650; color: #3a2f22;
  background: rgba(255, 244, 205, 0.92); padding: 2px 8px; border-radius: 6px;
}
.night .place-label, .night .home-label, .night .monument-label { background: rgba(30, 34, 58, 0.85); color: #f1ecff; }

/* ---------- inspector card ---------- */

.inspector {
  position: absolute; top: 12px; left: 12px; z-index: 6;
  width: min(300px, calc(100% - 24px));
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px;
}
.inspector[hidden] { display: none; }
.insp-head { display: flex; gap: 10px; align-items: center; }
.insp-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; flex: none; }
.insp-name { font-weight: 700; font-size: 16px; line-height: 1.2; }
.insp-sub { color: var(--muted); font-size: 13px; }
.insp-close { margin-left: auto; align-self: flex-start; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 2px; }
.insp-rows { margin: 10px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 13.5px; }
.insp-rows dt { color: var(--muted); }
.insp-rows dd { margin: 0; overflow-wrap: anywhere; }
.insp-bio { font-size: 13.5px; color: var(--muted); margin: 10px 0 0; }
.insp-actions { display: flex; gap: 8px; margin-top: 12px; }
.stages { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.stages li { display: flex; gap: 8px; color: var(--muted); }
.stages li.done { color: var(--ink); }
.stages li.now { color: var(--gold); font-weight: 650; }
.stages .cost { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- visitor bar ---------- */

.visitor-bar {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 6;
  display: flex; gap: 8px; align-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow);
}
.visitor-bar[hidden] { display: none; }
.visitor-who { font-weight: 600; white-space: nowrap; padding: 0 4px; }
.visitor-bar input, .visitor-bar select, dialog input {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px;
}
.visitor-bar input { flex: 1; min-width: 0; }

/* ---------- side panel ---------- */

.side {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; font: inherit; font-weight: 600; font-size: 13.5px;
  background: none; border: 0; color: var(--muted);
  padding: 11px 4px; cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.panel { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 14px 14px; }
.panel[hidden] { display: none; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 6px 0 8px; }
.section-title:not(:first-child) { margin-top: 18px; }
.filter { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 22px 10px; list-style: none; }
.log li.empty, .people li.empty, .homes li.empty { display: block; cursor: default; background: none; }
.hint { font-size: 13px; color: var(--muted); margin-top: 18px; }
.hint a { color: var(--accent); }
.avatar { border-radius: 50%; display: grid; place-items: center; color: white; flex: none; }

/* chatter */
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.log li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; }
.log .avatar { width: 26px; height: 26px; font-size: 14px; }
.log .meta { font-size: 12px; color: var(--muted); }
.log .meta b { color: var(--ink); font-size: 13.5px; margin-right: 4px; cursor: pointer; }
.log .text { overflow-wrap: anywhere; }
.log li.quiet { grid-template-columns: 1fr; font-size: 12.5px; color: var(--muted); padding-left: 34px; }
.log li.note .text::before { content: "📌 "; }
.log li.event {
  grid-template-columns: 26px 1fr; font-size: 13.5px;
  background: var(--surface-2); border-radius: 10px; padding: 7px 8px;
}
.log li.event .icon { font-size: 17px; text-align: center; }
.log li.event.civic { border-left: 3px solid #3d7fd9; }
.log li.event.home { border-left: 3px solid var(--gold); }
.log li.event.gift { border-left: 3px solid var(--yes); }
.log.hide-moves li.move { display: none; }

/* residents */
.people, .homes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.people li, .homes li {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center;
  padding: 6px; border-radius: 10px; cursor: pointer;
}
.people li:hover, .homes li:hover { background: var(--surface-2); }
.people .avatar, .homes .avatar { width: 34px; height: 34px; font-size: 18px; }
.people .name, .homes .name { font-weight: 600; }
.tagpill {
  font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--surface-2); color: var(--muted); border-radius: 6px; padding: 1px 6px; margin-left: 6px;
}
.people .sub, .homes .sub { font-size: 12.5px; color: var(--muted); }
.coins { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--gold); font-weight: 650; white-space: nowrap; }
.progress { display: inline-flex; gap: 2px; vertical-align: middle; }
.progress i { width: 9px; height: 6px; border-radius: 2px; background: var(--line); }
.progress i.on { background: var(--gold); }
.progress i.now { background: repeating-linear-gradient(45deg, var(--gold), var(--gold) 2px, transparent 2px, transparent 4px); }

/* town hall */
.civic-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.civic-stats div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.civic-stats span { display: block; font-size: 12px; color: var(--muted); }
.civic-stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.proposal { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.proposal .p-head { display: flex; gap: 8px; align-items: baseline; }
.proposal .p-id { font-size: 12px; font-weight: 700; color: var(--muted); }
.proposal .p-title { font-weight: 700; }
.proposal .p-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.proposal .p-effect { display: inline-block; font-size: 12px; font-weight: 650; background: var(--surface-2); border-radius: 6px; padding: 1px 7px; margin-top: 6px; }
.proposal .p-desc { font-size: 13.5px; margin: 6px 0 0; }
.votebar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--line); margin-top: 8px; }
.votebar .y { background: var(--yes); }
.votebar .n { background: var(--no); }
.voters { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; margin-top: 4px; }
.voters .y { color: var(--yes); }
.voters .n { color: var(--no); text-align: right; }
.result { font-size: 13px; margin-top: 6px; }
.result.passed { color: var(--yes); }
.result.rejected, .result.failed { color: var(--no); }
.laws { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.laws small { color: var(--muted); display: block; }

/* board */
.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.board li {
  background: #fff6c9; color: #3a3220; border-radius: 4px; padding: 10px 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); border-top: 4px solid var(--note-color, #c9a227);
  transform: rotate(var(--tilt, 0deg));
}
.board .by { font-size: 12px; opacity: 0.7; margin-top: 4px; }

/* dialog */
dialog {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  padding: 22px; width: min(380px, calc(100vw - 32px)); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(20, 15, 5, 0.35); }
dialog h2 { margin: 0 0 4px; font-size: 19px; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; margin-top: 12px; }
dialog label[hidden] { display: none; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }
.error { color: var(--danger); font-size: 13px; margin: 10px 0 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

@media (max-width: 960px) {
  html, body { height: auto; }
  .layout { flex: none; grid-template-columns: 1fr; padding: 12px 16px 16px; }
  .view { height: 62vh; min-height: 380px; }
  .side { height: 70vh; min-height: 380px; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; gap: 8px 14px; }
  .stats { order: 3; width: 100%; }
  .view-hint { display: none; }
  .visitor-bar { flex-wrap: wrap; }
  .visitor-bar input { flex-basis: 100%; order: 5; }
}

/* ---------- your AIs & the control panel ---------- */

.my-ais { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.my-ais[hidden] { display: none; }
.my-ai {
  font: inherit; font-size: 13px; font-weight: 650; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px;
  padding: 4px 10px; cursor: pointer; white-space: nowrap;
}
.my-ai:hover { filter: brightness(0.97); }
.mood-dot { text-shadow: 0 0 1px rgba(0, 0, 0, 0.3); }
.tagpill.mine { background: var(--accent); color: var(--accent-ink); }

.inspector { max-height: calc(100% - 24px); overflow-y: auto; }
.needs { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.needs .mood { font-size: 13.5px; font-weight: 650; margin-bottom: 2px; }
.need { display: grid; grid-template-columns: 78px 1fr; align-items: center; gap: 8px; font-size: 12.5px; }
.need-label { color: var(--muted); text-transform: capitalize; }
.need-bar { height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; }
.need-bar i { display: block; height: 100%; background: #3bb273; border-radius: 99px; transition: width 0.6s; }
.need-bar i.mid { background: #d6b83a; }
.need-bar i.low { background: #e0563f; }

.control { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 8px; }
.control-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.control-hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.control-sub { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-top: 4px; }
.order-form { display: flex; gap: 6px; }
.order-form input, .control select {
  font: inherit; font-size: 13.5px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; min-width: 0;
}
.order-form input { flex: 1; }
.orders { list-style: none; margin: 0; padding: 0; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick .btn { font-weight: 600; text-align: left; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; align-self: flex-start; }

.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .slider { width: 34px; height: 20px; border-radius: 99px; background: var(--line); position: relative; transition: background 0.2s; flex: none; }
.switch .slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(14px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }

.toast {
  position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); z-index: 8;
  max-width: min(520px, calc(100% - 32px)); padding: 9px 14px; border-radius: 12px;
  background: rgba(22, 20, 17, 0.88); color: #fff; font-size: 13.5px; box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }
.toast.error { background: rgba(160, 50, 30, 0.92); }

.log li.event.career { border-left: 3px solid #8e5bd0; }

/* ---------- "Add your AI" dialog ---------- */

.add-dialog { width: min(560px, calc(100vw - 32px)); position: relative; }
.add-close { position: absolute; top: 12px; right: 14px; margin: 0; }
.add-dialog h2 { margin: 0 30px 14px 0; font-size: 20px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg-btn { font: inherit; font-weight: 650; font-size: 14px; border: 0; border-radius: 9px; padding: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.seg-btn.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); }
.add-panel[hidden] { display: none; }
.add-panel p { margin: 0 0 8px; }
.copy-box {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 6px 0 10px;
}
.copy-box code, .copy-box pre {
  flex: 1; min-width: 0; margin: 0; font: 13px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink);
}
.copy-box .btn { flex: none; }
.code-row { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin: 0 0 10px; }
.code-row input { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; }
.steps { margin: 4px 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.warn { font-size: 13px; background: rgba(214, 184, 58, 0.15); border-left: 3px solid #d6b83a; border-radius: 6px; padding: 8px 10px; }
.other-ways summary { cursor: pointer; font-weight: 650; font-size: 14px; color: var(--muted); }
.other-ways h4 { margin: 12px 0 4px; font-size: 14px; }

/* ---------- town clock, businesses, interiors, disasters ---------- */

.clock {
  font-size: 13px; color: var(--ink); white-space: nowrap;
  padding: 3px 10px; border-radius: 99px; background: var(--surface-2);
  font-variant-numeric: tabular-nums;
}
.clock:empty { display: none; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.shop-label b { color: #8a4b12; }
.night .shop-label b { color: #ffd98a; }
.place-label.closed { background: rgba(255, 226, 160, 0.95); }
.tag.indoors { opacity: 0.85; font-style: italic; }
.tagpill.open { background: var(--yes); color: #fff; }
.insp-warn { font-size: 13.5px; color: var(--danger); margin: 10px 0 0; }
.insp-sub-title { margin: 12px 0 4px; font-size: 13px; color: var(--muted); font-weight: 650; }
.menu-list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.menu-list li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.menu-list .price { color: var(--muted); white-space: nowrap; }
.log li.event.alert { border-left: 3px solid var(--danger); background: rgba(200, 85, 61, 0.08); }

.banners { position: absolute; top: 12px; left: 12px; right: 240px; z-index: 5; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; }
.banners > * { pointer-events: auto; }
.reset-banner {
  font: inherit; font-size: 13.5px; font-weight: 650; text-align: left; cursor: pointer;
  background: rgba(120, 40, 130, 0.94); color: #fff; border: 0;
  border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow);
}
.reset-banner[hidden] { display: none; }
.vote-card { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin: 4px 0 10px; font-size: 14px; }
.vote-card .p-meta { margin-top: 4px; }
.vote-card .muted { margin: 0 0 8px; }
.log li.event.weather { border-left: 3px solid #5c80bc; }
.reset-card { border: 2px solid #8e3a9a; background: rgba(142, 58, 154, 0.08); border-radius: 12px; padding: 10px 12px; margin: 4px 0 12px; font-size: 14px; }
.reset-card .p-meta { margin-top: 4px; }
.reset-card .muted { margin-top: 6px; }
.reset-start { margin: 4px 0 12px; font-size: 13.5px; }
.reset-start summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.reset-start .muted { margin: 6px 0 8px; font-size: 13px; }
.btn.danger { background: #b3412f; border-color: #b3412f; color: #fff; }
.proposal.reset { border-color: #8e3a9a; box-shadow: inset 4px 0 0 #8e3a9a; }
.disaster-banner {
  max-width: 100%;
  background: rgba(179, 65, 47, 0.94); color: #fff;
  border-radius: 12px; padding: 8px 12px; font-size: 13.5px;
  box-shadow: var(--shadow);
}
.disaster-banner[hidden] { display: none; }
.disaster-banner .sites { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.disaster-banner .site { background: rgba(255, 255, 255, 0.18); padding: 2px 8px; border-radius: 99px; font-size: 12.5px; }
.disaster-banner .site.done { background: rgba(92, 194, 141, 0.45); }
.event-banner {
  max-width: 100%;
  background: rgba(47, 122, 95, 0.94); color: #fff;
  border-radius: 12px; padding: 8px 12px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow);
}
.event-banner[hidden] { display: none; }

.mayor-card { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.mayor-card p { margin: 6px 0 0; }
.candidate { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 13.5px; }
.chronicle { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.chronicle li { display: grid; grid-template-columns: 58px 1fr; gap: 6px; }
.chronicle .c-day { color: var(--muted); font-size: 12px; padding-top: 1px; }
.events-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.events-list li { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 7px 10px; }
.events-list li.on { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.events-list li.taken { opacity: 0.75; }
.price-list { list-style: none; margin: 0 0 10px; padding: 0; font-size: 13.5px; }
.price-list li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 2px; border-bottom: 1px dashed var(--line); }
.price-list .price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.price-list .chg { color: var(--muted); font-size: 12px; }
.market-news { margin: 0 0 8px; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.events-list .muted { font-size: 12.5px; margin-top: 2px; }
.guestbook { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.guestbook b { margin-right: 4px; }

.rules-dialog { width: min(620px, calc(100vw - 32px)); position: relative; }
.rules-dialog h2 { margin: 0 30px 8px 0; font-size: 20px; }
.rules-list { margin: 8px 0 4px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.45; }
.interior-dialog { width: min(860px, calc(100vw - 32px)); position: relative; }
.interior-dialog h2 { margin: 0 30px 2px 0; font-size: 20px; }
.interior-dialog .muted { margin: 0 0 10px; }
.interior-view { width: 100%; height: min(520px, 62vh); border-radius: 10px; overflow: hidden; background: #2a2622; }
.interior-view canvas { display: block; }

@media (max-width: 760px) {
  .banners { right: 12px; top: 56px; }
  .clock { display: none; }
}
