/* THE MAYOR: a municipal storybook in chunky pixel frames.
   Palette tokens first; everything else uses them. */

:root {
  /* The notch, the rounded corners and the gesture bar. In the Android app
     Capacitor sets --safe-area-inset-* (edge to edge is forced from Android
     15); a browser gives env(). */
  --safe-t: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-r: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  --safe-b: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-l: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --ink: #2b2233;
  --ink-soft: #4a3d55;
  --night: #2f2a4a;
  --night-2: #3d3660;
  --paper: #f4ead5;
  --paper-2: #ebdfc4;
  --card: #fffaf0;
  --teal: #4f9d9a;
  --teal-dark: #357370;
  --gold: #e2b64c;
  --gold-dark: #b58b2c;
  --red: #d94f4f;
  --red-dark: #a83737;
  --green: #6aa84f;
  --blue: #3e7cb1;
  --pink: #e07aa8;
  --muted: #7a6f80;

  --c-approval: #6aa84f;
  --c-unrest: #d94f4f;
  --c-trust: #3e7cb1;
  --c-economy: #e2b64c;

  --f-pixel: "Silkscreen", "Press Start 2P", monospace;
  --f-body: "Pixelify Sans", "VT323", ui-monospace, monospace;
  --f-news: "Old Standard TT", "Georgia", "Times New Roman", serif;

  --frame: 3px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --tap: 44px;
  --radius: 4px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font: 17px/1.35 var(--f-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* Like an app: the game's night behind the page (no white flash when it is
   pulled past its edge), no grey flash on a tap, and buttons and the street
   aren't text to select. Letters, laws and the paper stay selectable. */
html { background: var(--night); }
button, .game-canvas, .stage, .places { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; user-select: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  min-height: var(--tap);
  padding: 8px 16px;
  border: var(--frame);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--f-pixel);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: transform 0.06s, box-shadow 0.06s;
}
.btn:hover { background: #fff; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--gold); }
.btn-primary:hover { background: #ecc35b; }
.btn-go { background: var(--teal); color: #fff; }
.btn-go:hover { background: #5daeab; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #e26161; }
.btn-small { min-height: 36px; padding: 4px 10px; font-size: 11px; }
.btn-link { background: none; border: 0; box-shadow: none; padding: 6px; text-decoration: underline; font-family: var(--f-body); text-transform: none; font-size: 15px; color: var(--ink-soft); min-height: var(--tap); }
.icon-btn {
  width: var(--tap); height: var(--tap);
  border: 2px solid rgba(255,255,255,0.25); border-radius: var(--radius);
  background: var(--night-2); color: var(--paper); font-size: 20px; line-height: 1;
}
.icon-btn:hover { background: #4a4275; }

/* ---------------------------------------------------------------- layout */
/* Named areas, so an empty warnings bar can vanish without shifting rows. */
#game {
  display: grid;
  grid-template-areas: "top" "warn" "stage" "desk";
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(180px, 44vh) 1fr;
  height: 100dvh;
  max-width: 2400px;
  margin: 0 auto;
  padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
}

.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  padding-top: max(8px, var(--safe-t));
  background: var(--night);
  color: var(--paper);
  border-bottom: 3px solid var(--ink);
}
.tb-city { display: flex; align-items: center; gap: 10px; min-width: 0; }
.city-name { font-family: var(--f-pixel); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22ch; }
.day-line { font-size: 14px; opacity: 0.9; display: flex; gap: 8px; align-items: center; }
.phase-pill { font-family: var(--f-pixel); font-size: 10px; padding: 2px 8px; border-radius: 99px; background: var(--gold); color: var(--ink); }
.phase-pill[data-phase="afternoon"] { background: #9fd3ec; }
.phase-pill[data-phase="evening"] { background: #c0567a; color: #fff; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.mode-chip { font-family: var(--f-pixel); font-size: 10px; padding: 4px 8px; border: 2px solid rgba(255,255,255,0.3); border-radius: 3px; cursor: help; white-space: nowrap; }
.mode-chip[data-mode="ai"] { background: var(--teal); border-color: var(--teal); }

.stats { display: flex; gap: 10px; flex: 1; justify-content: center; flex-wrap: wrap; }
.stat { min-width: 108px; display: grid; gap: 3px; cursor: help; }
.stat-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 13px; }
.stat-label { font-family: var(--f-pixel); font-size: 10px; letter-spacing: 0.03em; opacity: 0.9; }
.stat-val { font-family: var(--f-pixel); font-size: 13px; }
.stat-delta { font-size: 12px; margin-left: 3px; }
.stat-delta.up { color: #9ee07f; } .stat-delta.down { color: #ff9a8a; }
.stat[data-k="unrest"] .stat-delta.up { color: #ff9a8a; } .stat[data-k="unrest"] .stat-delta.down { color: #9ee07f; }
.meter { height: 9px; border: 2px solid var(--ink); background: #1f1b33; border-radius: 2px; overflow: hidden; }
.meter > i { display: block; height: 100%; transition: width 0.6s ease; }
.stat-treasury .stat-val.neg { color: #ff9a8a; }

.warnings { grid-area: warn; display: flex; gap: 8px; flex-wrap: wrap; padding: 0 12px; background: var(--night); }
.warnings:empty { display: none; }
.warn { font-size: 14px; padding: 4px 10px; margin-bottom: 6px; border-radius: 3px; background: var(--paper-2); border: 2px solid var(--ink); }
.warn.bad { background: #f6c9c0; } .warn.alarm { background: var(--red); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { filter: brightness(1.2); } }

/* ---------------------------------------------------------------- stage */
.stage { grid-area: stage; position: relative; background: #1f1b33; border-bottom: 3px solid var(--ink); overflow: hidden; touch-action: pan-y; }
/* Absolutely positioned so the canvas's own pixel size can never feed back
   into the layout (which would make it grow every resize). */
#city { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; cursor: grab; }
#city:active { cursor: grabbing; }
.places { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 16px); }
.places button {
  font-family: var(--f-pixel); font-size: 10px; min-height: 32px; padding: 4px 8px;
  border: 2px solid var(--ink); border-radius: 3px; background: rgba(255,250,240,0.9); box-shadow: 2px 2px 0 var(--ink);
}
.places button.hot { background: var(--red); color: #fff; }
.toasts { position: absolute; top: 8px; left: 8px; display: grid; gap: 6px; max-width: min(360px, 70%); pointer-events: none; }
.toast { background: var(--card); border: var(--frame); box-shadow: var(--shadow); padding: 8px 10px; font-size: 15px; animation: toast-in 0.25s ease-out; }
.toast.bad { background: #f6c9c0; } .toast.good { background: #d6efc6; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }

.phase-banner {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(20,16,36,0.55) 25%, rgba(20,16,36,0.55) 75%, transparent);
  color: var(--paper); animation: banner 2.2s ease forwards;
}
.pb-title { font-family: var(--f-pixel); font-size: clamp(26px, 5vw, 48px); color: var(--gold); text-shadow: 3px 3px 0 var(--ink); }
.pb-sub { font-size: clamp(14px, 2vw, 18px); text-shadow: 2px 2px 0 var(--ink); }
@keyframes banner { 0% { opacity: 0; transform: scale(1.05); } 15%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---------------------------------------------------------------- desk */
.desk {
  grid-area: desk;
  display: grid; grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.1fr);
  gap: 12px; padding: 12px; min-height: 0;
  background: var(--paper) repeating-linear-gradient(0deg, transparent 0 23px, rgba(43,34,51,0.04) 23px 24px);
}
.desk-main, .panel { background: var(--card); border: var(--frame); box-shadow: var(--shadow); border-radius: var(--radius); min-height: 0; overflow: auto; }
.desk-main { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.panel { display: flex; flex-direction: column; }

h2.desk-title { margin: 0; font-family: var(--f-pixel); font-size: 15px; display: flex; align-items: center; gap: 8px; }
.desk-sub { margin: 0; color: var(--ink-soft); font-size: 15px; }

.law-form { display: grid; gap: 10px; }
.law-input {
  width: 100%; min-height: 76px; resize: vertical; padding: 12px 14px;
  border: var(--frame); border-radius: var(--radius); background: #fff;
  font: 20px/1.3 var(--f-body);
  box-shadow: inset 3px 3px 0 rgba(43,34,51,0.08);
}
.law-input::placeholder { color: #a99fae; }
.law-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 14px; padding: 4px 10px; min-height: 32px; border: 2px dashed var(--ink-soft); border-radius: 99px; background: transparent; }
.chip:hover { background: var(--paper-2); border-style: solid; }
.hint { font-size: 14px; color: var(--muted); }

.thinking { display: flex; align-items: center; gap: 10px; font-family: var(--f-pixel); font-size: 12px; }
.thinking i { width: 10px; height: 10px; background: var(--ink); animation: blink 0.6s infinite alternate; }
.thinking i:nth-child(2) { animation-delay: 0.2s; } .thinking i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { to { opacity: 0.15; } }

/* The bill: drafted law awaiting signature. */
.bill { border: 3px double var(--ink); background: #fffdf6; padding: 14px 16px; display: grid; gap: 10px; position: relative; }
.bill::before { content: "BILL"; position: absolute; top: -11px; left: 12px; background: var(--gold); border: 2px solid var(--ink); font-family: var(--f-pixel); font-size: 10px; padding: 1px 6px; }
.bill h3 { margin: 0; font-family: var(--f-news); font-size: 24px; line-height: 1.1; }
.bill .quote { font-style: italic; color: var(--ink-soft); }
.bill ul { margin: 0; padding-left: 18px; }
.bill li { margin: 2px 0; }
.bill-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-family: var(--f-pixel); font-size: 9px; padding: 2px 6px; border: 2px solid var(--ink); border-radius: 3px; background: var(--paper-2); }
.tag.ai { background: var(--teal); color: #fff; } .tag.guess { background: var(--pink); }
.groups { display: flex; flex-wrap: wrap; gap: 6px; }
.grp { font-size: 13px; padding: 2px 8px; border-radius: 99px; border: 2px solid var(--ink); }
.grp.pos { background: #d6efc6; } .grp.neg { background: #f6c9c0; }
.notice { padding: 10px 12px; border: 2px solid var(--ink); background: #fff3c9; border-radius: 3px; }
.notice.bad { background: #f6c9c0; }

.afternoon-summary { display: grid; gap: 8px; }
.deltas { display: flex; gap: 8px; flex-wrap: wrap; }
.delta { font-family: var(--f-pixel); font-size: 11px; padding: 4px 8px; border: 2px solid var(--ink); background: var(--paper); }
.delta.good { background: #d6efc6; } .delta.bad { background: #f6c9c0; }

/* ---------------------------------------------------------------- panel tabs */
.tabs { flex: 0 0 auto; display: flex; border-bottom: 3px solid var(--ink); background: var(--paper-2); position: sticky; top: 0; z-index: 2; overflow-x: auto; }
.tabs button {
  flex: 1 1 auto; min-height: var(--tap); padding: 6px 7px; border: 0; border-right: 2px solid var(--ink);
  background: transparent; font-family: var(--f-pixel); font-size: 10px; white-space: nowrap; position: relative;
}
.tabs button[aria-selected="true"] { background: var(--card); }
.tabs .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--red); border: 1px solid var(--ink); }
.tab-body { padding: 12px 14px; display: grid; gap: 10px; align-content: start; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { font-size: 13px; padding: 2px 10px; min-height: 32px; border: 2px solid var(--ink); border-radius: 99px; background: var(--paper); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.feed { display: grid; gap: 8px; }
.feed-item { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px; border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); }
.feed-item.important { background: #fff3c9; }
.feed-item.protest { background: #f6c9c0; }
.feed-item .who { font-size: 13px; color: var(--ink-soft); }
.feed-item .who b { color: var(--ink); }
.feed-item .text { font-size: 16px; }
.feed-item .where { font-size: 12px; color: var(--teal-dark); text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer; }
.portrait { width: 40px; height: 40px; image-rendering: pixelated; background: #cfe6ef; border: 2px solid var(--ink); border-radius: 3px; }
.icon-sq { width: 40px; height: 40px; display: grid; place-items: center; font-size: 20px; border: 2px solid var(--ink); border-radius: 3px; background: var(--card); }
.mood-happy .portrait { background: #d6efc6; } .mood-angry .portrait, .mood-furious .portrait { background: #f6c9c0; } .mood-confused .portrait { background: #e8dcf5; }
.ai-mark { font-family: var(--f-pixel); font-size: 8px; padding: 1px 4px; background: var(--teal); color: #fff; margin-left: 4px; vertical-align: middle; }

.law-card { border: 2px solid var(--ink); border-radius: 3px; padding: 10px 12px; background: var(--paper); display: grid; gap: 6px; }
.law-card h4 { margin: 0; font-family: var(--f-news); font-size: 19px; }
.law-card .meta { font-size: 13px; color: var(--muted); }
.law-card.ended { opacity: 0.65; background: transparent; border-style: dashed; }
.law-actions { display: flex; gap: 8px; }

.section-h { margin: 6px 0 0; font-family: var(--f-pixel); font-size: 11px; color: var(--ink-soft); }

/* ---------------------------------------------------------------- newspaper */
.paper {
  background: #f7f2e6; color: #1e1a22; border: 2px solid var(--ink);
  padding: 14px 16px; font-family: var(--f-news);
  box-shadow: inset 0 0 40px rgba(120,100,60,0.12);
}
.masthead { text-align: center; border-bottom: 3px double #1e1a22; padding-bottom: 6px; }
.masthead .name { font-size: clamp(22px, 3.2vw, 32px); font-weight: 700; letter-spacing: 0.02em; }
.masthead .ed { font-size: 12px; display: flex; justify-content: space-between; border-top: 1px solid #1e1a22; margin-top: 4px; padding-top: 3px; font-style: italic; }
.headline { font-size: clamp(24px, 3.4vw, 36px); line-height: 1.02; font-weight: 700; margin: 10px 0 6px; text-transform: uppercase; }
.paper[data-style="tabloid"] .headline { font-family: Impact, "Arial Black", var(--f-news); letter-spacing: 0.01em; }
.paper[data-style="tabloid"] .masthead .name { color: var(--red-dark); }
.subhead { font-style: italic; font-size: 17px; margin: 0 0 8px; }
.cols { columns: 2 220px; column-gap: 18px; column-rule: 1px solid #c8bca4; font-size: 15px; line-height: 1.4; }
.cols p { margin: 0 0 8px; text-align: justify; hyphens: auto; }
.cols p:first-child::first-letter { font-size: 2.4em; float: left; line-height: 0.9; margin-right: 4px; font-weight: 700; }
.pull { border-top: 1px solid #1e1a22; border-bottom: 1px solid #1e1a22; padding: 6px 0; margin: 8px 0; font-style: italic; font-size: 16px; }
/* Front page layout: story + photo on the left, opinion/figures/vox on the right
   once the paper is wide enough; everything stacks on a phone. */
.paper { container-type: inline-size; }
.paper .motto { justify-content: center; border-top: 0; margin-top: 0; padding-top: 0; }
.paper h5 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid #1e1a22; padding-bottom: 2px; }
.front { display: grid; gap: 14px; }
@container (min-width: 560px) { .front { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); } }
.front-main { display: grid; gap: 8px; align-content: start; }
.front-side { display: grid; gap: 12px; align-content: start; font-size: 14px; }
@container (min-width: 560px) { .front-side { border-left: 1px solid #c8bca4; padding-left: 12px; } }
.paper-photo { margin: 0; position: relative; }
.paper-photo img { width: 100%; display: block; image-rendering: pixelated; border: 2px solid #1e1a22; filter: grayscale(1) sepia(0.35) contrast(1.2) brightness(1.05); }
/* Newsprint dots over the photo. */
.paper-photo::after { content: ""; position: absolute; left: 2px; right: 2px; top: 2px; bottom: 26px; pointer-events: none; background: radial-gradient(rgba(30,26,34,0.22) 0.8px, transparent 1.2px) 0 0 / 3px 3px; mix-blend-mode: multiply; }
.paper-photo figcaption { font-size: 13px; font-style: italic; padding: 4px 2px 0; }
.opinion .op-title { font-weight: 700; font-size: 17px; line-height: 1.15; margin-bottom: 4px; }
.opinion p { margin: 0 0 4px; }
.opinion .byline { font-style: italic; font-size: 13px; }
.figures table { width: 100%; border-collapse: collapse; }
.figures td { padding: 2px 0; border-bottom: 1px dotted #c8bca4; }
.figures td:nth-child(2) { text-align: right; font-weight: 700; padding-right: 6px; }
.figures .up { color: #3e7d2a; } .figures .down { color: #a83737; }
.vox { margin: 0 0 6px; font-style: italic; }
.vox span { font-style: normal; font-size: 12px; font-weight: 700; }
.paper-bottom { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 12px; border-top: 3px double #1e1a22; padding-top: 10px; font-size: 14px; }
.paper-bottom p { margin: 0 0 6px; }
.paper-bottom ul { margin: 0; padding-left: 14px; }
.letter { grid-column: span 2; }
@container (max-width: 380px) { .letter { grid-column: auto; } }
.letter .signoff { font-style: italic; }
.obits p { font-size: 13px; }
.classifieds p { font-size: 13px; border-bottom: 1px dotted #c8bca4; padding-bottom: 3px; }
.archive { display: grid; gap: 6px; }
.archive button { text-align: left; padding: 6px 10px; border: 2px solid var(--ink); background: var(--paper); border-radius: 3px; font-family: var(--f-news); }
.archive button span { font-family: var(--f-pixel); font-size: 10px; margin-right: 8px; }

/* ---------------------------------------------------------------- ledger */
table.ledger { width: 100%; border-collapse: collapse; font-size: 15px; }
.ledger td { padding: 4px 6px; border-bottom: 1px dashed #c8bca4; }
.ledger td:last-child { text-align: right; font-family: var(--f-pixel); font-size: 12px; }
.ledger tr.total td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 600; }
.pos { color: #3e7d2a; } .neg { color: var(--red-dark); }
.charts { display: grid; gap: 4px; }
.chart { width: 100%; height: 150px; display: block; border: 2px solid var(--ink); border-radius: 3px; background: var(--card); }
.chart-short { height: 100px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; margin-top: 6px; }
.chart-legend i { display: inline-block; width: 12px; height: 4px; margin-right: 5px; vertical-align: middle; border-radius: 2px; }

/* ---------------------------------------------------------------- modals */
.modal-back { position: fixed; inset: 0; background: rgba(20,16,36,0.6); display: grid; place-items: center; z-index: 50; padding: 12px; animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(680px, 100%); max-height: calc(100dvh - 24px); overflow: auto;
  background: var(--card); border: var(--frame); box-shadow: 6px 6px 0 var(--ink); border-radius: var(--radius);
  padding: 18px 20px; display: grid; gap: 12px; animation: pop 0.22s ease-out;
}
@keyframes pop { from { transform: scale(0.96); opacity: 0; } }
.modal h2 { margin: 0; font-family: var(--f-pixel); font-size: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.report-stat { border: 2px solid var(--ink); padding: 8px; background: var(--paper); }
.report-stat .k { font-family: var(--f-pixel); font-size: 10px; }
.report-stat .v { font-family: var(--f-pixel); font-size: 18px; }
.report-stat .d { font-size: 15px; }
.explain { margin: 0; padding-left: 18px; }
.main-event { padding: 10px 12px; border-left: 6px solid var(--gold); background: var(--paper); }

/* ---------------------------------------------------------------- menu */
#menu {
  min-height: 100dvh; display: grid; place-items: center;
  padding: max(20px, var(--safe-t)) max(20px, var(--safe-r)) max(20px, var(--safe-b)) max(20px, var(--safe-l));
  background: linear-gradient(#2f2a4a, #4b2a5c 60%, #c0567a);
  color: var(--paper);
}
.title-wrap { width: min(720px, 100%); display: grid; gap: 18px; text-align: center; }
.logo { font-family: var(--f-pixel); font-size: clamp(42px, 10vw, 84px); line-height: 0.9; letter-spacing: 0.02em; text-shadow: 4px 4px 0 var(--ink), 0 0 30px rgba(226,182,76,0.35); color: var(--gold); margin: 0; }
.logo small { display: block; font-size: 0.24em; color: var(--paper); letter-spacing: 0.25em; margin-top: 10px; text-shadow: 2px 2px 0 var(--ink); }
.tagline { font-size: 19px; opacity: 0.95; margin: 0; }
.menu-canvas { width: 100%; height: 160px; border: var(--frame); box-shadow: var(--shadow); image-rendering: pixelated; background: #1f1b33; }
.slots { display: grid; gap: 10px; text-align: left; color: var(--ink); }
.slot { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: var(--frame); box-shadow: var(--shadow); border-radius: var(--radius); }
.slot .info { flex: 1; min-width: 0; }
.slot .nm { font-family: var(--f-pixel); font-size: 14px; }
.slot .sub { font-size: 14px; color: var(--muted); }
.slot.locked { background: #e9e1e6; }
.found { font-size: 14px; opacity: 0.85; }
.title-wrap .version { margin-top: 10px; font-size: 11px; opacity: 0.5; letter-spacing: 0.05em; }
.home-link { color: var(--paper); opacity: 0.8; font-size: 15px; justify-self: center; padding: 10px; }
.home-link:hover { opacity: 1; }
.found b { color: var(--gold); }
.field { display: grid; gap: 4px; text-align: left; }
.field label { font-family: var(--f-pixel); font-size: 11px; }
.field input { min-height: var(--tap); padding: 8px 10px; border: var(--frame); border-radius: var(--radius); background: #fff; font-size: 18px; }

/* ---------------------------------------------------------------- endings & cutscenes */
#cutscene { position: fixed; inset: 0; z-index: 80; background: #000; }
#cut-canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.cut-overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; padding: 16px; }
.cut-overlay > * { pointer-events: auto; }
.cut-caption { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); background: rgba(10,8,20,0.75); color: #fff; padding: 10px 16px; border: 2px solid #fff; font-family: var(--f-pixel); font-size: clamp(12px, 2vw, 16px); text-align: center; max-width: 90%; animation: fade 0.6s; }
.cut-skip { position: absolute; top: 12px; right: 12px; }
.spinning-paper { width: min(560px, 92vw); transform-origin: center; animation: spin-in 1.4s cubic-bezier(.2,.9,.3,1.1) both; }
@keyframes spin-in { from { transform: rotate(-720deg) scale(0.05); opacity: 0; } to { transform: rotate(-2deg) scale(1); opacity: 1; } }

.ending { width: min(760px, 100%); display: grid; gap: 14px; }
.ending-card { background: var(--card); border: var(--frame); box-shadow: 6px 6px 0 var(--ink); padding: 18px 20px; display: grid; gap: 10px; }
.ending-title { font-family: var(--f-pixel); font-size: clamp(22px, 4vw, 34px); margin: 0; }
.ending[data-tone="victory"] .ending-title { color: var(--teal-dark); }
.ending[data-tone="secret"] .ending-title { color: #8e5bb5; }
.ending[data-tone="disaster"] .ending-title, .ending[data-tone="defeat"] .ending-title { color: var(--red-dark); }
.ending[data-tone="enforcement"] .ending-title { color: var(--ink); }
.record { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.record div { border: 2px solid var(--ink); padding: 6px 8px; background: var(--paper); font-size: 14px; }
.record b { display: block; font-family: var(--f-pixel); font-size: 16px; }
.secret-badge { font-family: var(--f-pixel); font-size: 11px; background: #8e5bb5; color: #fff; padding: 3px 8px; justify-self: start; }
.lock-box { border: 3px solid var(--ink); background: #ece6ee; padding: 12px 14px; }

.mood-panel { display: grid; gap: 4px; margin-top: auto; padding-top: 6px; border-top: 2px dashed var(--paper-2); }
.mood-row { display: grid; grid-template-columns: minmax(130px, 40%) 1fr; gap: 8px; align-items: center; font-size: 14px; }
.mood-bar { position: relative; height: 10px; border: 2px solid var(--ink); background: var(--paper); border-radius: 2px; }
.mood-bar::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: var(--ink); }
.mood-bar i { position: absolute; top: 0; bottom: 0; transition: width 0.5s; }
.mood-bar i.pos { background: var(--c-approval); } .mood-bar i.neg { background: var(--c-unrest); }
/* Law Book */
.book-search { min-height: var(--tap); padding: 8px 12px; border: var(--frame); border-radius: var(--radius); font-size: 17px; background: #fff; }
.book-chapters { display: flex; flex-wrap: wrap; gap: 6px; }
.book-chapters button { font-size: 14px; padding: 4px 10px; min-height: 34px; border: 2px solid var(--ink); border-radius: 99px; background: var(--paper); }
.book-chapters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.book-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); grid-auto-rows: max-content; gap: 8px; max-height: 46vh; overflow: auto; padding: 2px; }
.book-act { text-align: left; display: grid; gap: 3px; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 3px; background: var(--card); box-shadow: 2px 2px 0 var(--ink); min-height: var(--tap); }
.book-act b { font-family: var(--f-news); font-size: 17px; line-height: 1.15; }
.book-act span { font-size: 13px; color: var(--muted); }
.book-act:hover:not(:disabled) { background: #fff3c9; transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.book-act.done { opacity: 0.55; box-shadow: none; }
.modal:has(.book-list) { width: min(900px, 100%); }

.interview { border: 3px solid var(--ink); border-radius: var(--radius); background: #eef6f6; padding: 12px; display: grid; gap: 8px; box-shadow: 3px 3px 0 var(--ink); }
.iv-head { display: flex; gap: 10px; align-items: center; }
.interview .meta { font-size: 13px; color: var(--muted); }
.iv-q { margin: 0; font-family: var(--f-news); font-size: 19px; line-height: 1.2; }
.iv-options { display: grid; gap: 6px; }
.iv-opt { text-align: left; padding: 8px 10px; min-height: var(--tap); border: 2px solid var(--ink); border-radius: 3px; background: var(--card); font-size: 15px; display: grid; gap: 2px; }
.iv-opt:hover { background: #fff; transform: translateX(2px); }
.iv-opt.tone-promise { border-color: var(--teal-dark); background: #e2f2f1; }
.iv-promise { font-family: var(--f-pixel); font-size: 9px; color: var(--teal-dark); }
.interview .btn-link { justify-self: end; min-height: 32px; }

.mini-profile {
  position: absolute; right: 8px; top: 8px; z-index: 5; width: min(340px, calc(100% - 16px));
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; padding: 10px 28px 10px 10px;
  background: var(--card); border: var(--frame); box-shadow: var(--shadow); border-radius: var(--radius);
  font-size: 14px; animation: toast-in 0.2s ease-out;
}
.mini-profile .mp-body { display: grid; gap: 5px; justify-items: start; }
.mini-profile .meta { font-size: 13px; color: var(--muted); }
.mp-close { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; background: none; font-size: 20px; line-height: 1; }
.person.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 60% { background: #fff3c9; box-shadow: 0 0 0 3px var(--gold); } }

/* People tab */
.person { border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); padding: 10px 12px; display: grid; gap: 8px; }
.person.gone { opacity: 0.6; border-style: dashed; background: transparent; }
.person-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.person-id { display: grid; gap: 3px; }
.person .meta { font-size: 13px; color: var(--muted); }
.chips-row { display: flex; flex-wrap: wrap; gap: 4px; }
.life-chip { font-size: 12px; padding: 1px 7px; border: 2px solid var(--ink); border-radius: 99px; background: var(--card); }
.life-chip.good { background: #d6efc6; } .life-chip.bad { background: #f6c9c0; }
.mood-spark { display: flex; align-items: center; gap: 2px; height: 34px; border-left: 2px solid var(--ink); padding-left: 4px; position: relative; }
.mood-spark::before { content: ""; position: absolute; left: 4px; right: 0; top: 50%; height: 1px; background: var(--ink-soft); opacity: 0.5; }
.mood-spark i { flex: 1; max-width: 10px; border-radius: 1px; }
.mood-spark i.pos { background: var(--c-approval); align-self: flex-end; margin-bottom: 17px; max-height: 17px; }
.mood-spark i.neg { background: var(--c-unrest); align-self: flex-start; margin-top: 17px; max-height: 17px; }
.life-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; }
.life-list li { padding: 3px 8px; border-left: 4px solid var(--muted); background: var(--card); }
.life-list li.good { border-color: var(--c-approval); } .life-list li.bad { border-color: var(--c-unrest); }
.life-list .day { font-family: var(--f-pixel); font-size: 10px; margin-right: 8px; color: var(--muted); }

.key-hint { margin: 0; font-size: 13px; color: var(--muted); }
body.is-touch .desktop-only { display: none; }

/* ---------------------------------------------------------------- responsive */
/* Big monitors: use the room. Larger type, a taller street, wider panels. */
@media (min-width: 1500px) {
  body { font-size: 19px; }
  #game { grid-template-rows: auto auto minmax(260px, 50vh) 1fr; }
  .desk { gap: 16px; padding: 16px 20px; grid-template-columns: minmax(420px, 1fr) minmax(520px, 1.3fr); }
  .stat { min-width: 150px; }
  .stat-label { font-size: 12px; }
  .stat-val { font-size: 15px; }
  .meter { height: 11px; }
  .city-name { font-size: 18px; }
  .btn { font-size: 14px; }
  .tabs button { font-size: 12px; }
  .feed-item .text { font-size: 17px; }
  .places button { font-size: 12px; min-height: 36px; padding: 6px 10px; }
  .mood-row { font-size: 15px; }
}
@media (min-width: 2200px) {
  body { font-size: 21px; }
  .stat-label { font-size: 13px; }
}
body.is-desktop .places button:hover { background: #fff; }
body.is-desktop .feed-item:hover { border-color: var(--teal-dark); }
@media (max-width: 980px) {
  #game { grid-template-rows: auto auto minmax(170px, 36vh) auto; height: auto; min-height: 100dvh; align-content: start; }
  .desk { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .desk-main, .panel { overflow: visible; }
  .panel { max-height: none; }
  .stats { order: 3; flex-basis: 100%; justify-content: space-between; gap: 6px; }
  .topbar { flex-wrap: wrap; }
  .stat { min-width: 0; flex: 1 1 18%; }
}
@media (max-width: 560px) {
  /* Portrait phones: size the street by width so it shows a decent stretch
     of city instead of a tall slice of sky. */
  #game { grid-template-rows: auto auto max(210px, 68vw) auto; }
  .places button { min-height: 26px !important; font-size: 8px !important; padding: 2px 5px !important; }
  .places { flex-wrap: nowrap; overflow-x: auto; left: 6px; right: 6px; bottom: 6px; max-width: none; scrollbar-width: none; }
  .places::-webkit-scrollbar { display: none; }
  .places button { flex: 0 0 auto; opacity: 0.92; }
  body { font-size: 16px; }
  .stat-label { font-size: 8px; }
  .stat-val { font-size: 11px; }
  .stat { flex: 1 1 30%; min-width: 0; }
  .stats { gap: 6px 8px; }
  .stat-top { flex-wrap: wrap; }
  .city-name { max-width: 14ch; font-size: 13px; }
  .desk { padding: 8px; gap: 8px; }
  .desk-main { padding: 12px; }
  .law-input { font-size: 18px; }
  .places button { font-size: 9px; min-height: 30px; padding: 3px 6px; }
  .mode-chip { display: none; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #game { grid-template-rows: auto auto 62vh auto; }
}
@media (prefers-reduced-motion: reduce) {
  /* Run once, never loop: a looping animation squeezed to 0.01ms flickers. */
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  /* The cutscene hints only fade, which isn't motion: keep the one-off fade, and hold the waiting hint steady. */
  .cut-hint.once { animation-duration: 4s !important; }
  .cut-hint.pulse { animation: none !important; opacity: 0.85; }
}

/* Music toggle: struck through when off. */
.icon-btn.off { opacity: 0.45; text-decoration: line-through; }

/* The paper's back page: the blotter's hints and the funny last story. */
.paper .blotter p { margin: 0 0 6px; }
.paper .blotter .hint-line { display: block; font-size: 0.86em; opacity: 0.75; }
.paper .and-finally {
  margin-top: 14px; padding: 12px 14px 10px; border-top: 3px double var(--ink, #2b2233);
  text-align: center;
}
.paper .af-kicker { font-style: italic; font-size: 0.9em; opacity: 0.7; letter-spacing: 0.05em; }
.paper .af-head { font-family: Georgia, 'Times New Roman', serif; font-weight: 900; font-size: 1.25em; line-height: 1.15; margin: 4px 0 6px; }
.paper .and-finally p { margin: 0 auto; max-width: 52ch; }

/* Live interviews and occasions. */
.modal.modal-live, .modal.modal-occasion { max-width: 620px; }
.live-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; margin-bottom: 10px; }
.on-air { background: #d1262f; color: #fff; padding: 2px 8px; border-radius: 4px; font-weight: 700; letter-spacing: 0.08em; animation: on-air 1.2s steps(2) infinite; }
.on-air.off { background: var(--ink-soft); animation: none; }
@keyframes on-air { 50% { opacity: 0.55; } }
.live-dots { display: inline-flex; gap: 4px; margin-left: auto; }
.live-dots i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); background: transparent; }
.live-dots i.done { background: var(--ink); }
.live-dots i.now { background: #d1262f; }
.live-q { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.live-q .portrait, .live-q .icon-sq { width: 56px; height: 56px; flex: none; }
.iv-q.typed { animation: typed 0.5s ease-out; }
@keyframes typed { from { opacity: 0; transform: translateY(4px); } }
.live-headline { font-family: Georgia, 'Times New Roman', serif; font-weight: 900; font-size: 22px; line-height: 1.15; padding: 10px 0; border-top: 3px double var(--ink); border-bottom: 3px double var(--ink); margin: 6px 0 12px; }
.invite { border: 2px dashed var(--ink); border-radius: var(--radius); padding: 10px 12px; margin: 10px 0; background: rgba(226, 182, 76, 0.12); }
.invite p { margin: 6px 0; }
details.host { margin: 10px 0; border: 2px solid var(--ink); border-radius: var(--radius); padding: 6px 10px; background: var(--paper); }
details.host summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.host-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0 4px; }
.host-opt { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 8px; border: 2px solid var(--ink); border-radius: var(--radius); background: #fff8e6; font: inherit; font-size: 13px; cursor: pointer; min-height: var(--tap); }
.host-opt:hover:not([disabled]) { background: #ffe9b0; }
.host-opt[disabled] { opacity: 0.5; cursor: not-allowed; }
.host-ico { font-size: 22px; }
.host-cost { font-size: 12px; opacity: 0.75; }
.occ-title { display: flex; flex-direction: column; margin-bottom: 8px; }
.occ-title b { font-size: 18px; }
.occ-title span { font-size: 13px; opacity: 0.75; }
.stage-canvas { width: 100%; aspect-ratio: 2 / 1; image-rendering: pixelated; border: 3px solid var(--ink); border-radius: var(--radius); background: #2a1d3d; display: block; }
.occ-moment { font-size: 16px; margin: 6px 0 10px; }
.occ-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .occ-options { grid-template-columns: 1fr; } }
.occ-opt { text-align: left; padding: 10px; border: 2px solid var(--ink); border-radius: var(--radius); background: #fff; font: inherit; font-size: 14px; cursor: pointer; min-height: var(--tap); }
.occ-opt.wild { background: #fdf0ff; }
.occ-opt:hover { transform: translateY(-1px); box-shadow: 0 2px 0 var(--ink); }
.occ-result { font-size: 16px; padding: 10px; border-radius: var(--radius); margin: 8px 0; }
.occ-result.good { background: rgba(106, 168, 79, 0.18); }
.occ-result.bad { background: rgba(217, 79, 79, 0.15); }

/* Resident dossier. */
.modal.modal-dossier { max-width: 640px; }
.person-btns { display: flex; flex-direction: column; gap: 6px; margin-left: auto; }
.dossier section { margin-top: 14px; }
.dz-head { display: flex; gap: 14px; align-items: center; }
.dz-head h2 { margin: 0 0 2px; }
.dz-portrait { width: 84px; height: 84px; flex: none; }
.dz-feel { border: 2px solid var(--ink); border-radius: var(--radius); padding: 10px 12px; background: #fff8e6; }
.dz-feel-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dz-meter { position: relative; height: 12px; margin: 8px 0 2px; border: 2px solid var(--ink); border-radius: 8px; background: linear-gradient(90deg, #d94f4f, #e2b64c 50%, #6aa84f); }
.dz-meter i { position: absolute; top: -6px; width: 6px; height: 20px; margin-left: -3px; background: var(--ink); border-radius: 3px; }
.dz-meter-labels { display: flex; justify-content: space-between; font-size: 11px; opacity: 0.7; margin-bottom: 6px; }
.dz-spark { height: 46px; margin-top: 8px; }
.dz-family { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 14px; }
.dz-family li { display: flex; gap: 8px; align-items: baseline; }
.dz-laws { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; }
.dz-laws li { border-left: 4px solid var(--ink-soft); padding: 4px 0 4px 10px; }
.dz-laws li.up { border-left-color: #6aa84f; }
.dz-laws li.down { border-left-color: #d94f4f; }
.dz-law-top { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.dz-law-top .day { font-size: 12px; opacity: 0.7; }
.dz-kind { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.6; }
.dz-delta { margin-left: auto; font-weight: 700; font-size: 13px; }
.dz-laws li.up .dz-delta { color: #3f7a2b; }
.dz-laws li.down .dz-delta { color: #b03a3a; }
.dz-bar { position: relative; height: 6px; background: rgba(0,0,0,0.08); border-radius: 3px; margin: 4px 0; }
.dz-bar::after { content: ''; position: absolute; left: 50%; top: -2px; width: 1px; height: 10px; background: var(--ink-soft); }
.dz-bar i { position: absolute; top: 0; height: 6px; border-radius: 3px; background: #6aa84f; }
.dz-laws li.down .dz-bar i { background: #d94f4f; }
.dz-why { font-size: 13px; }

/* Talking to residents. */
.mp-ask { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.mp-answer { background: #fff8e6; border: 2px solid var(--ink); border-radius: var(--radius); padding: 6px 8px; margin-bottom: 6px; }
.mp-answer p { margin: 0 0 6px; font-size: 14px; }

/* The advisors' odds on a bill. */
.odds-box { margin-top: 8px; }
.odds-box ul { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 8px; }
.odds-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.odds-bar { height: 6px; border: 1px solid var(--ink); border-radius: 3px; margin: 3px 0; background: rgba(0,0,0,0.06); }
.odds-bar i { display: block; height: 100%; background: var(--ink-soft); }
.odds.bad .odds-bar i { background: #d94f4f; }
.odds.good .odds-bar i { background: #6aa84f; }

/* The paper reads at a comfortable size: everything about 15% larger. */
.paper .cols { font-size: 17px; line-height: 1.45; }
.paper .subhead { font-size: 19px; }
.paper .headline { font-size: clamp(28px, 3.8vw, 42px); }
.paper .masthead .name { font-size: clamp(26px, 3.6vw, 38px); }
.paper .masthead .ed { font-size: 13px; }
.paper h5 { font-size: 13px; }
.paper .paper-bottom, .paper .front-side { font-size: 16px; }
.paper .paper-photo figcaption { font-size: 15px; }
.paper .af-head { font-size: 1.4em; }
.paper .and-finally p { font-size: 17px; }
.paper.compact .cols { font-size: 15px; }

/* The park close-up. */
.park-canvas { aspect-ratio: 32 / 15; cursor: pointer; }
.park-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.park-list li.done { opacity: 0.75; font-style: italic; }
.places .look-closer { background: #2b2350; color: #f3ecd2; }

/* The mayor's own money. */
.stat-pocket .stat-val { color: #b58b2c; }
.pocket-box { border: 2px solid var(--ink); border-radius: var(--radius); background: #fff3c4; padding: 8px 10px; margin-bottom: 10px; }
.pocket-box .hint { margin: 4px 0; }

/* The mayor's post. */
details.post { margin: 10px 0; border: 2px solid var(--ink); border-radius: var(--radius); padding: 6px 10px; background: #fdf6e3; }
details.post summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.letters { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.letter-card { border-left: 4px solid var(--ink-soft); padding: 4px 0 4px 10px; }
.letter-card.answered { opacity: 0.7; }
.letter-card p { margin: 4px 0 6px; font-size: 15px; }
.letter-head { display: flex; gap: 8px; align-items: center; }
.letter-head .portrait { width: 34px; height: 34px; }
.letter-options { display: flex; flex-wrap: wrap; gap: 6px; }

/* Nonsense answers look like what they are. */
.iv-opt.tone-absurd { font-style: italic; background: #f6ecff; }

/* The rivalry. */
details.rival { background: #f3eefc; }
.paper .rivalry table { width: 100%; border-collapse: collapse; margin: 4px 0; }
.paper .rivalry td { padding: 1px 4px; }
.paper .rivalry td.up { font-weight: 700; color: #3f7a2b; }
.paper .rivalry td.down { font-weight: 700; color: #b03a3a; }
.modal.modal-unlock { max-width: 560px; }
.unlock-kicker { display: inline-block; background: var(--ink); color: #ffd66e; padding: 3px 10px; border-radius: 99px; font-size: 13px; letter-spacing: 0.05em; }

/* City pulse. */
.pulse-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.pulse-tabs button { border: 2px solid var(--ink); border-radius: 99px; background: var(--paper); padding: 4px 12px; font: inherit; font-size: 14px; min-height: 36px; cursor: pointer; }
.pulse-tabs button.on { background: var(--ink); color: var(--paper); }
.pulse-big { font-size: 18px; margin: 4px 0; }
.pulse-big b { font-size: 34px; }
.pulse-body h4 { margin: 12px 0 4px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; }
.pulse-bars { display: flex; align-items: flex-end; gap: 2px; height: 60px; border-bottom: 1px solid var(--ink-soft); margin: 4px 0; }
.pulse-bars i { flex: 1; background: #6aa84f; border-radius: 2px 2px 0 0; }
.pulse-bars i.neg { background: #d94f4f; }
.pulse-groups { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.pulse-groups li { display: grid; grid-template-columns: 120px 1fr 44px; gap: 8px; align-items: center; font-size: 14px; }
.pulse-meter { height: 10px; border: 2px solid var(--ink); border-radius: 6px; background: rgba(0,0,0,0.06); overflow: hidden; }
.pulse-meter i { display: block; height: 100%; }
.pulse-people { display: flex; flex-wrap: wrap; gap: 8px; }
.pulse-person { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 2px solid var(--ink); border-radius: var(--radius); background: #fff; padding: 4px 6px; font: inherit; font-size: 13px; cursor: pointer; }
.pulse-person .portrait { width: 40px; height: 40px; }

/* Season announcements. */
.modal.season-winter { background: linear-gradient(180deg, #eef5fb, #fff); }
.modal.season-summer { background: linear-gradient(180deg, #fff6d6, #fff); }
.modal.season-spring { background: linear-gradient(180deg, #fbeef4, #fff); }
.modal.season-autumn { background: linear-gradient(180deg, #fbefe0, #fff); }

.rival-score { font-size: 20px; margin: 4px 0; }
.game-canvas { aspect-ratio: 2 / 1; cursor: pointer; touch-action: manipulation; }

.modal.modal-flood { background: linear-gradient(180deg, #e3eef7, #fff); }
.flood-card { background: rgba(78,128,170,0.15); }

details.bid { background: #fff6dc; }
.bid-bars { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.bid-bars > div { display: grid; grid-template-columns: 150px 1fr 40px; gap: 8px; align-items: center; font-size: 14px; }

.lab-btn { position: fixed; right: 12px; bottom: 12px; z-index: 40; background: #fff6dc; box-shadow: 0 2px 0 #2b2233; }
.modal.modal-lab { max-width: 720px; }
.modal-lab .section-h { margin-top: 12px; }
.lab-endings { display: flex; flex-direction: column; gap: 6px; }
.lab-ending { display: grid; grid-template-columns: 190px 1fr; gap: 10px; align-items: center; }
.lab-ending .btn { width: 100%; }
@media (max-width: 560px) { .lab-ending { grid-template-columns: 1fr; gap: 2px; } }
.book-chapters button.locked { opacity: 0.6; }
.modal.modal-strange { background: linear-gradient(180deg, #efe4ff, #fff); }
.modal.modal-aliens { background: linear-gradient(180deg, #e2fbe4, #fff); }
.alien-card { background: rgba(126,224,138,0.18); }
.rewind-box { margin: 12px 0; padding: 10px 12px; border: 2px dashed rgba(43,34,51,0.35); border-radius: 8px; }
.rewind-box .law-row { flex-wrap: wrap; gap: 6px; }
.alien-profile { border-color: #4caf6d; }
.island-frame { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) rotate(-2deg); width: min(600px, 88vw); padding: 14px 14px 10px; background: #8a5a3b; border: 4px solid #5e3b25; border-radius: 4px; box-shadow: inset 0 0 0 3px #b58b2c, 0 10px 0 rgba(0,0,0,0.4); animation: frame-in 1s cubic-bezier(.2,.9,.3,1.15) both; }
.island-frame canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; border: 3px solid #2b2233; }
.island-plaque { margin: 8px auto 0; width: fit-content; padding: 2px 12px; background: #e2b64c; border: 2px solid #5e3b25; font-family: var(--f-pixel); font-size: 13px; color: #2b2233; }
.island-frame.leaving { animation: frame-out 0.7s ease-in both; }
@keyframes frame-in { from { opacity: 0; transform: translate(-50%, -30%) rotate(-12deg) scale(0.6); } to { opacity: 1; transform: translate(-50%, -50%) rotate(-2deg) scale(1); } }
@keyframes frame-out { to { opacity: 0; transform: translate(-50%, -70%) rotate(6deg) scale(0.8); } }
.cut-hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); color: #fff; font-family: var(--f-pixel); font-size: 12px; background: rgba(10,8,20,0.55); padding: 4px 10px; border-radius: 4px; pointer-events: none; }
.cut-hint.once { animation: hint-once 4s ease-in-out both; }
.cut-hint.pulse { top: auto; bottom: 3%; animation: hint-pulse 2.4s ease-in-out infinite; }
@keyframes hint-once { 0% { opacity: 0; } 20%, 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes hint-pulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 1; } }
#cutscene { cursor: pointer; }
.paper-photo.second { margin-top: 6px; }
.paper-photo.second img { filter: grayscale(1) sepia(0.5) contrast(1.15) brightness(1.08); }
/* Phones: a save slot's name and details sit above its buttons, not squashed beside them. */
@media (max-width: 520px) {
  .slot { flex-wrap: wrap; }
  .slot .info { flex: 1 1 100%; }
  .slot > .btn, .slot > button { flex: 1 1 auto; }
}
@container (min-width: 560px) { .paper-photo.second { width: 66%; margin-left: auto; margin-right: auto; } }
/* touch-action: quick taps on the title count as taps, not a double-tap zoom. */
.logo { user-select: none; -webkit-tap-highlight-color: transparent; cursor: default; touch-action: manipulation; }

/* The mayor's appearance editor */
.modal.modal-found { max-width: 640px; }
.look-editor { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: start; }
.look-stage { display: grid; gap: 8px; justify-items: center; position: sticky; top: 0; }
.mayor-preview { width: 150px; height: 204px; image-rendering: pixelated; background: radial-gradient(circle at 50% 40%, #fff6dc, #efe3c4); border: 3px solid var(--ink); border-radius: 8px; }
.look-rows { display: grid; gap: 8px; }
.look-row { display: grid; grid-template-columns: 86px 1fr; gap: 8px; align-items: center; }
.look-label { font-family: var(--f-pixel); font-size: 12px; }
.look-opts { display: flex; flex-wrap: wrap; gap: 5px; }
.look-swatch { width: 30px; height: 30px; border: 2px solid var(--ink); border-radius: 6px; cursor: pointer; padding: 0; }
.look-swatch.on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--ink); }
.look-chip { min-height: 30px; padding: 3px 9px; border: 2px solid var(--ink); border-radius: 6px; background: #fffaf0; font-size: 13px; cursor: pointer; }
.look-chip.on { background: var(--gold); }
@media (max-width: 560px) {
  .look-editor { grid-template-columns: 1fr; }
  .look-stage { position: static; }
  .mayor-preview { width: 120px; height: 164px; }
  .look-row { grid-template-columns: 1fr; gap: 3px; }
}
.paper-photo.second.sketch img { filter: sepia(0.12) contrast(1.02); }
.paper-photo.second.sketch::after { display: none; }

/* A stat that just changed: a quick bump and a number floating off it. */
.stat { position: relative; }
.stat.bump-good .stat-val, .stat.bump-bad .stat-val { display: inline-block; animation: stat-bump 0.7s ease-out; }
.stat.bump-good .stat-val { color: #6fdc8c; }
.stat.bump-bad .stat-val { color: #ff8a80; }
.stat-pop { position: absolute; right: 4px; top: -2px; font-family: var(--f-pixel); font-size: 12px; pointer-events: none; animation: stat-pop 1.6s ease-out forwards; }
.stat-pop.bump-good { color: #6fdc8c; }
.stat-pop.bump-bad { color: #ff8a80; }
@keyframes stat-bump { 0% { transform: scale(1); } 30% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes stat-pop { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; transform: translateY(0); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
@media (prefers-reduced-motion: reduce) { .stat-val, .stat-pop { animation: none !important; } }

/* Phones: the person card is a sheet along the bottom of the screen, never
   cut off by the street picture, and it scrolls if the answer is long. */
@media (max-width: 700px) {
  .mini-profile {
    position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(8px + var(--safe-b)); width: auto;
    max-height: 52vh; overflow-y: auto; z-index: 60; grid-template-columns: 36px minmax(0, 1fr); padding: 10px 34px 10px 10px;
    box-shadow: 0 -2px 0 var(--ink), 0 8px 24px rgba(0,0,0,0.35);
  }
  .mini-profile .mp-ask { display: flex; flex-wrap: wrap; gap: 5px; }
  .mini-profile .mp-ask .btn { flex: 1 1 auto; min-height: 36px; padding: 4px 8px; font-size: 11px; }
  .mini-profile .mp-answer p { margin: 4px 0; font-size: 15px; line-height: 1.35; }
  .mp-close { width: 36px; height: 36px; font-size: 24px; }
}

/* The cutscene hint: a slow, soft fade everywhere, never a blink. */
.cut-hint { will-change: opacity; }
.cut-hint.pulse { animation: hint-pulse 3.6s ease-in-out infinite; }
@keyframes hint-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.9; } }

/* How to play: a topic list, then a few steps per topic. */
.modal-guide { max-width: 520px; }
.guide-topics { display: grid; gap: 8px; margin: 10px 0 4px; }
.guide-topic { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; min-height: 52px; padding: 8px 12px;
  background: var(--card); color: var(--ink); border: 2px solid var(--ink); border-radius: 6px; font: inherit; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.guide-topic:hover, .guide-topic:focus-visible { background: var(--paper); }
.guide-topic.first { border-color: var(--gold-dark); box-shadow: 2px 2px 0 var(--gold-dark); }
.guide-topic .gt-icon { font-size: 24px; width: 30px; text-align: center; flex: none; }
.guide-topic b { display: block; }
.guide-topic small { display: block; color: var(--muted); font-size: 13px; }
.guide-kicker { font-size: 13px; color: var(--muted); letter-spacing: 0.04em; }
.guide-text { font-size: 17px; line-height: 1.45; min-height: 5.5em; }
.guide-dots { display: flex; gap: 6px; justify-content: center; margin: 6px 0 2px; }
.guide-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft); opacity: 0.35; }
.guide-dots span.on { opacity: 1; background: var(--gold-dark); }

/* History: the law record, one card per law ever signed. */
.law-record { display: grid; gap: 10px; margin-top: 10px; }
.law-rec { border: 2px solid var(--ink); border-radius: 6px; padding: 10px 12px; background: var(--card); }
.law-rec.ended { opacity: 0.8; }
.law-rec p { margin: 6px 0; }
.lr-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.lr-status { font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--ink-soft); white-space: nowrap; }
.lr-status.on { background: var(--green); color: var(--ink); border-color: var(--ink); }
.lr-said { font-style: italic; color: var(--muted); margin-top: 4px; }
.lr-line { margin-top: 6px; font-size: 14px; }
.lr-line ul { margin: 4px 0 0; padding-left: 18px; }

/* Links to the site's pages, under the main menu. */
.title-wrap .menu-links { margin-top: 14px; display: flex; gap: 4px 18px; justify-content: center; flex-wrap: wrap; font-size: 14px; }
.title-wrap .menu-links a { color: var(--paper); opacity: 0.75; min-height: 44px; display: inline-flex; align-items: center; }
.title-wrap .menu-links a:hover { opacity: 1; }

/* Share button above the newspaper. */
.paper-actions { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.paper-actions .btn { min-height: 44px; }
