:root {
  --paper: #eef0e8;
  --panel: #fbfbf2;
  --ink: #151711;
  --muted: #64685e;
  --line: #24291f;
  --soft-line: rgba(21, 23, 17, 0.16);
  --ai: #2457ff;
  --public: #2f7d62;
  --warm: #d7a429;
  --warning: #b8463d;
  --control: #2b3144;
  --good: #207354;
  --bad: #b43d35;
  --shadow: 0 18px 45px rgba(21, 23, 17, 0.14);
  --display: "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: Inter, "Avenir Next", ui-sans-serif, system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(36, 87, 255, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(21, 23, 17, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 44px 44px;
  color: var(--ink);
  font-family: var(--body);
}

body {
  min-height: 100vh;
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.intro-screen {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 0.9fr);
  min-height: 100vh;
  overflow: hidden;
}

.intro-city {
  position: relative;
  min-height: 520px;
  border-right: 2px solid var(--line);
  background:
    repeating-linear-gradient(90deg, transparent 0 52px, rgba(21, 23, 17, 0.08) 53px 54px),
    linear-gradient(180deg, #dce5dc 0%, #b7c7bd 54%, #6f7f78 100%);
}

.intro-city::before {
  position: absolute;
  inset: 12% 9%;
  content: "";
  border: 1px solid rgba(21, 23, 17, 0.3);
  box-shadow: inset 0 0 0 12px rgba(251, 251, 242, 0.22);
}

.intro-grid {
  position: absolute;
  inset: 13% 10%;
}

.intro-tower {
  position: absolute;
  bottom: 18%;
  left: 16%;
  width: 18%;
  height: 56%;
  border: 2px solid var(--line);
  background:
    repeating-linear-gradient(0deg, rgba(251, 251, 242, 0.88) 0 11px, rgba(21, 23, 17, 0.22) 12px 13px),
    #dfe3da;
  box-shadow: 8px 8px 0 rgba(21, 23, 17, 0.12);
}

.intro-tower.short {
  left: 42%;
  width: 14%;
  height: 42%;
  background:
    repeating-linear-gradient(0deg, rgba(215, 164, 41, 0.46) 0 12px, rgba(21, 23, 17, 0.2) 13px 14px),
    #e9e6d7;
}

.intro-tower.wide {
  left: 62%;
  width: 22%;
  height: 48%;
  background:
    repeating-linear-gradient(0deg, rgba(36, 87, 255, 0.16) 0 10px, rgba(21, 23, 17, 0.2) 11px 12px),
    #d5ddd8;
}

.intro-road {
  position: absolute;
  right: -4%;
  bottom: 13%;
  left: -4%;
  height: 18%;
  transform: skewY(-5deg);
  border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  background:
    repeating-linear-gradient(90deg, transparent 0 48px, rgba(251, 251, 242, 0.75) 49px 56px),
    #2b3144;
}

.intro-signal {
  position: absolute;
  width: 26%;
  height: 7%;
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--ai);
  font-family: var(--mono);
  font-size: clamp(0.64rem, 1.2vw, 0.9rem);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.intro-signal::after {
  position: absolute;
  inset: 12% 10%;
  overflow: hidden;
  content: "92% HAPPY";
  white-space: nowrap;
}

.intro-signal.one {
  top: 19%;
  right: 18%;
}

.intro-signal.two {
  top: 32%;
  left: 12%;
  color: var(--warning);
}

.intro-signal.two::after {
  content: "31% RESPONSE";
}

.intro-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(28px, 5vw, 72px);
  background: var(--panel);
}

.kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 680px;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(4.2rem, 11vw, 10rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.82;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.2rem, 4vw, 4rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.9;
  text-transform: uppercase;
}

h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.thesis {
  max-width: 520px;
  margin: 22px 0 0;
  font-size: clamp(1.1rem, 2.1vw, 1.55rem);
  line-height: 1.25;
}

.mandate {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 620px);
  margin-top: 36px;
}

.goal,
.metric-tile,
.resource-tile {
  border: 2px solid var(--line);
  background: var(--paper);
}

.goal {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
}

.goal span,
.metric-tile span,
.resource-tile span,
.log-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.goal strong {
  font-family: var(--display);
  font-size: 2.5rem;
  line-height: 0.9;
}

.goal em {
  color: var(--muted);
  font-size: 0.8rem;
  font-style: normal;
}

.intro-actions,
.tutorial-actions,
.ending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.tutorial-screen {
  display: grid;
  min-height: 100vh;
  padding: clamp(14px, 3vw, 36px);
  background:
    linear-gradient(90deg, rgba(36, 87, 255, 0.07), transparent 42%),
    var(--paper);
}

.tutorial-sheet {
  display: grid;
  align-self: center;
  gap: 18px;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px);
  border: 2px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tutorial-sheet h1 {
  max-width: 920px;
  font-size: clamp(3.8rem, 9vw, 8rem);
}

.tutorial-lede {
  max-width: 820px;
  margin: 0;
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  line-height: 1.35;
}

.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.tutorial-block {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 2px solid var(--line);
  background: var(--paper);
}

.tutorial-block span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--line);
  background: var(--ai);
  color: white;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 900;
}

.tutorial-block strong,
.tutorial-rules strong {
  font-size: 1rem;
}

.tutorial-block p,
.tutorial-rules p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.tutorial-rules {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border-top: 2px solid var(--line);
  padding-top: 14px;
}

.tutorial-rules article {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 4px 4px 0 var(--line);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 6px 6px 0 var(--line);
}

.btn:focus-visible,
.district:focus-visible,
.policy-card:focus-visible,
.implementation-card:focus-visible,
.final-card:focus-visible {
  outline: 3px solid var(--ai);
  outline-offset: 3px;
}

.btn.primary {
  background: var(--ai);
  color: white;
}

.btn.ghost {
  background: transparent;
}

.btn.icon {
  width: auto;
  min-width: 42px;
  padding-inline: 12px;
}

.btn.danger {
  color: var(--bad);
}

.btn.wide {
  width: 100%;
}

.btn.disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: 4px 4px 0 rgba(21, 23, 17, 0.35);
}

.game-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100vh;
}

.top-bar {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr auto;
  gap: 14px;
  align-items: stretch;
  padding: 12px;
  border-bottom: 2px solid var(--line);
  background: rgba(251, 251, 242, 0.94);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  background: var(--ink);
  color: var(--panel);
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 0.9;
  text-transform: uppercase;
}

.brand span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(88px, 1fr));
  gap: 8px;
}

.metric-tile,
.resource-tile {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 8px;
  min-width: 0;
  padding: 9px;
}

.metric-tile strong,
.resource-tile strong {
  font-family: var(--display);
  font-size: 2rem;
  line-height: 0.85;
}

.metric-tile.ok strong {
  color: var(--good);
}

.meter {
  grid-column: 1 / -1;
  display: block;
  height: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(21, 23, 17, 0.08);
}

.meter b {
  display: block;
  height: 100%;
  background: var(--ai);
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.game-board {
  display: grid;
  grid-template-columns: minmax(420px, 1.1fr) minmax(390px, 0.9fr);
  gap: 12px;
  min-height: 0;
  padding: 12px;
}

.map-panel,
.side-panel {
  min-width: 0;
  border: 2px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.map-panel {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto auto;
  min-height: 0;
}

.panel-heading,
.section-title {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.panel-heading {
  padding: 14px;
  border-bottom: 2px solid var(--line);
}

.signal-quality {
  display: grid;
  justify-items: end;
  padding: 8px 10px;
  border: 2px solid var(--line);
  background: var(--paper);
}

.signal-quality span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
}

.signal-quality strong {
  font-family: var(--display);
  font-size: 2rem;
  line-height: 0.85;
}

.city-map {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 0.96fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  min-height: 0;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(21, 23, 17, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(21, 23, 17, 0.08) 1px, transparent 1px),
    #cfd9d0;
  background-size: 32px 32px;
}

.city-map::after {
  position: absolute;
  right: 20px;
  bottom: 16px;
  width: min(44%, 360px);
  height: 18px;
  content: "";
  border: 2px solid var(--line);
  background:
    repeating-linear-gradient(90deg, var(--panel) 0 24px, transparent 25px 38px),
    var(--control);
  transform: skewX(-18deg);
  opacity: 0.78;
  pointer-events: none;
}

.district {
  position: relative;
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 170px;
  padding: 12px;
  overflow: hidden;
  border: 2px solid rgba(21, 23, 17, 0.92);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(251, 251, 242, 0.64), rgba(251, 251, 242, 0.2)),
    #aebeb3;
  cursor: pointer;
  text-align: left;
}

.district:nth-child(1) {
  grid-row: 1 / 3;
}

.district.related {
  box-shadow: inset 0 0 0 5px rgba(36, 87, 255, 0.16);
}

.district.active {
  background:
    linear-gradient(135deg, rgba(215, 164, 41, 0.22), rgba(251, 251, 242, 0.22)),
    #bdc9b7;
}

.district-label {
  position: relative;
  z-index: 3;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 0.95;
  text-transform: uppercase;
}

.district-role {
  position: relative;
  z-index: 3;
  max-width: 24ch;
  margin-top: 3px;
  color: rgba(21, 23, 17, 0.72);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.district-road {
  position: absolute;
  right: -22px;
  bottom: 28%;
  left: -22px;
  height: 22px;
  border-top: 2px solid rgba(21, 23, 17, 0.55);
  border-bottom: 2px solid rgba(21, 23, 17, 0.55);
  background: rgba(43, 49, 68, 0.72);
  transform: rotate(-9deg);
}

.district-people {
  position: absolute;
  right: 10px;
  bottom: 14px;
  left: 14px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap-reverse;
  gap: 8px;
  align-items: end;
}

.person {
  display: inline-block;
  width: 8px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 2px 2px;
  background: var(--ink);
  opacity: 0.78;
}

.drift-mid .person {
  opacity: 0.52;
}

.drift-high .person {
  opacity: 0.35;
}

.district-marks {
  position: absolute;
  top: 62px;
  right: 10px;
  left: 10px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: start;
}

.city-mark {
  display: inline-block;
  max-width: 100%;
  padding: 4px 5px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.city-mark.data {
  border-color: var(--ai);
  color: var(--ai);
}

.city-mark.control {
  background: var(--control);
  color: var(--panel);
}

.city-mark.public {
  border-color: var(--public);
  color: var(--public);
}

.city-mark.warm {
  background: var(--warm);
}

.city-mark.warning {
  background: var(--warning);
  color: white;
}

.observation,
.echo-stack {
  padding: 12px 14px;
  border-top: 2px solid var(--line);
}

.observation {
  background: #e8ebe2;
}

.observation-label {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
}

.observation p,
.echo-card p,
.result-note p,
.forecast p {
  margin: 6px 0 0;
  line-height: 1.35;
}

.echo-stack {
  display: grid;
  gap: 8px;
  background: rgba(215, 164, 41, 0.17);
}

.echo-card {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 2px solid var(--line);
  background: var(--panel);
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
  overflow: auto;
}

.ai-header {
  display: flex;
  gap: 12px;
  align-items: start;
}

.ai-light {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 3px;
  border: 2px solid var(--line);
  background: var(--ai);
  box-shadow: 0 0 0 6px rgba(36, 87, 255, 0.12);
}

.ai-light.final {
  background: var(--warning);
  box-shadow: 0 0 0 6px rgba(184, 70, 61, 0.14);
}

.ai-brief {
  margin: 0;
  padding: 12px;
  border-left: 5px solid var(--ai);
  background: #eef2ff;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.4;
}

.event-body,
.ending-sentence {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
}

.ending-sentence {
  font-size: 1.25rem;
  font-weight: 800;
}

.investigation,
.policy-composer,
.final-choices,
.replay,
.character-endings {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.section-title {
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}

.section-title span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 900;
  text-align: right;
  text-transform: uppercase;
}

.investigation-grid,
.implementation-grid,
.card-grid {
  display: grid;
  gap: 8px;
}

.card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.implementation-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.investigate-btn,
.policy-card,
.implementation-card,
.final-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  cursor: pointer;
  text-align: left;
}

.investigate-btn {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.policy-card,
.implementation-card,
.final-card {
  min-height: 148px;
}

.implementation-card {
  min-height: 126px;
}

.policy-card:hover,
.implementation-card:hover,
.final-card:hover,
.investigate-btn:hover {
  background: #fffef6;
}

.policy-card.selected,
.implementation-card.selected,
.final-card.selected {
  background: #e6ecff;
  box-shadow: inset 0 0 0 4px rgba(36, 87, 255, 0.18);
}

.policy-card.disabled,
.final-card.locked {
  cursor: not-allowed;
  opacity: 0.48;
}

.policy-card strong,
.implementation-card strong,
.final-card strong,
.echo-card strong,
.result-note strong,
.forecast strong,
.share-card strong,
.character-line strong {
  font-size: 0.98rem;
  line-height: 1.12;
}

.policy-card span:not(.cost),
.implementation-card span:not(.cost),
.final-card span:not(.cost) {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.final-card em {
  color: var(--bad);
  font-size: 0.74rem;
  font-style: normal;
  line-height: 1.25;
}

.cost {
  justify-self: start;
  padding: 3px 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--line);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.card-group-label {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-block,
.forecast,
.share-card,
.character-line {
  padding: 12px;
  border: 2px solid var(--line);
  background: #f3f4ec;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.delta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.delta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.delta-chip.good {
  color: var(--good);
}

.delta-chip.bad {
  color: var(--bad);
}

.delta-chip.neutral {
  color: var(--muted);
}

.forecast-mini {
  margin-top: auto;
}

.result-panel {
  gap: 16px;
}

.delta-comparison {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.comparison-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 2px solid var(--line);
  background: var(--paper);
}

.comparison-item span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.comparison-item strong {
  font-family: var(--display);
  font-size: 1.45rem;
  line-height: 0.9;
}

.comparison-item em {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
}

.comparison-item.good em {
  color: var(--good);
}

.comparison-item.bad em {
  color: var(--bad);
}

.result-note {
  padding: 12px;
  border: 2px solid var(--line);
}

.result-note.ai {
  background: #eef2ff;
}

.result-note.citizen {
  background: #edf5ec;
}

.result-note.echo {
  background: rgba(215, 164, 41, 0.2);
}

.note-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.final-choices {
  grid-template-columns: 1fr 1fr;
}

.ending-panel {
  align-content: start;
}

.share-card {
  display: grid;
  gap: 8px;
  background:
    linear-gradient(90deg, rgba(36, 87, 255, 0.11), transparent),
    var(--paper);
}

.share-title {
  font-family: var(--display);
  font-size: 2.1rem;
  font-weight: 900;
  line-height: 0.9;
  text-transform: uppercase;
}

.replay ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.replay li {
  padding: 8px 10px;
  border: 2px solid var(--line);
  background: var(--paper);
}

.character-endings {
  grid-template-columns: 1fr;
}

.character-line p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.bottom-log {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-top: 2px solid var(--line);
  background: var(--ink);
  color: var(--panel);
}

.bottom-log div {
  min-width: 0;
}

.bottom-log strong,
.bottom-log span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-log strong {
  font-size: 0.86rem;
}

.log-label {
  color: rgba(251, 251, 242, 0.58);
}

.tour-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.tour-scrim {
  position: absolute;
  inset: 0;
  background: rgba(21, 23, 17, 0.28);
}

.tour-spotlight {
  position: fixed;
  border: 3px solid var(--ai);
  border-radius: 10px;
  background: rgba(251, 251, 242, 0.08);
  box-shadow:
    0 0 0 9999px rgba(21, 23, 17, 0.24),
    0 0 0 8px rgba(36, 87, 255, 0.16);
}

.tour-cursor {
  position: fixed;
  width: 28px;
  height: 36px;
  transform: rotate(-18deg);
  filter: drop-shadow(3px 3px 0 rgba(21, 23, 17, 0.26));
}

.tour-cursor::before {
  position: absolute;
  inset: 0;
  content: "";
  clip-path: polygon(0 0, 0 31px, 9px 23px, 14px 36px, 22px 33px, 17px 20px, 28px 20px);
  background: var(--panel);
  border: 2px solid var(--line);
}

.tour-callout {
  position: fixed;
  display: grid;
  gap: 10px;
  width: min(340px, calc(100vw - 24px));
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 8px 8px 0 var(--line);
  pointer-events: auto;
}

.tour-callout p:not(.kicker) {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.tour-actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.hover-tooltip {
  position: fixed;
  z-index: 120;
  max-width: min(280px, calc(100vw - 20px));
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--ink);
  color: var(--panel);
  box-shadow: 4px 4px 0 rgba(21, 23, 17, 0.26);
  font-size: 0.78rem;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.hover-tooltip.visible {
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .ai-light {
    animation: pulse 2.4s ease-in-out infinite;
  }

  .city-map.drift-high .city-mark.warning {
    animation: flicker 1.3s steps(2, end) infinite;
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 5px rgba(36, 87, 255, 0.12);
  }

  50% {
    box-shadow: 0 0 0 9px rgba(36, 87, 255, 0.08);
  }
}

@keyframes flicker {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.62;
  }
}

@media (max-width: 1120px) {
  .top-bar {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: start;
  }

  .game-board {
    grid-template-columns: 1fr;
  }

  .side-panel {
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .intro-screen {
    grid-template-columns: 1fr;
  }

  .intro-city {
    min-height: 42vh;
    border-right: 0;
    border-bottom: 2px solid var(--line);
  }

  .intro-copy {
    padding: 26px 18px 34px;
  }

  .mandate,
  .metrics,
  .tutorial-grid,
  .tutorial-rules,
  .card-grid,
  .implementation-grid,
  .final-choices,
  .delta-comparison,
  .bottom-log {
    grid-template-columns: 1fr;
  }

  .top-bar,
  .game-board {
    padding: 8px;
  }

  .city-map {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, minmax(180px, auto));
  }

  .district:nth-child(1) {
    grid-row: auto;
  }

  .map-panel {
    grid-template-rows: auto auto auto auto;
  }

  h1 {
    font-size: clamp(3.7rem, 24vw, 6.3rem);
  }

  h2 {
    font-size: 2.3rem;
  }

  .share-title {
    font-size: 1.7rem;
  }
}
