:root {
  --ink: #10244b;
  --ink-soft: #304264;
  --cream: #fff7ef;
  --peach: #f6ddd4;
  --sky: #cfe7fa;
  --sky-2: #bcdaf2;
  --mint: #b7ded0;
  --butter: #f8df9d;
  --coral: #f3a49a;
  --lilac: #c9bfe4;
  --night: #0c1c3b;
  --night-2: #152b55;
  --line: rgba(16, 36, 75, 0.16);
  --paper: rgba(255, 255, 255, 0.76);
  --shadow: 0 18px 48px rgba(50, 65, 92, 0.16);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--sky) 0, var(--cream) 21%, var(--sky) 38%, var(--cream) 54%, var(--night) 71%, var(--cream) 92%),
    var(--cream);
  font-family: "DM Sans", system-ui, sans-serif;
  line-height: 1.4;
}

button,
a {
  min-height: 44px;
}

button {
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(16, 36, 75, 0.55);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

#resident-canvas {
  position: fixed;
  inset: 0;
  z-index: 5;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

.town-nav {
  position: fixed;
  top: 16px;
  left: clamp(18px, 4vw, 64px);
  right: clamp(18px, 4vw, 64px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  text-decoration: none;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800;
  line-height: 0.86;
}

.town-nav nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid rgba(16, 36, 75, 0.08);
  border-radius: 999px;
  background: rgba(255, 247, 239, 0.92);
}

.town-nav button {
  border: 0;
  background: transparent;
  padding: 0 10px;
  border-radius: 999px;
  font-weight: 700;
}

#sound-toggle span {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-left: 8px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  vertical-align: -2px;
  background: transparent;
}

#sound-toggle[aria-pressed="true"] span {
  background: var(--mint);
}

.resident-inspector {
  position: fixed;
  right: clamp(14px, 3vw, 34px);
  bottom: 18px;
  z-index: 25;
  width: min(320px, calc(100vw - 28px));
  padding: 12px;
  border: 1px solid rgba(16, 36, 75, 0.12);
  border-radius: 18px;
  background: rgba(255, 247, 239, 0.94);
  box-shadow: var(--shadow);
}

.resident-inspector p {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.inspector-actions {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
}

.inspector-actions button,
.small-controls button,
.filter-stack button,
.relation-controls button,
.destination-controls button,
.hint-button,
.primary-cta,
#close-dialog {
  border: 1px solid rgba(16, 36, 75, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 20px rgba(71, 81, 99, 0.1);
  font-weight: 800;
  letter-spacing: 0.03em;
}

main {
  position: relative;
  z-index: 1;
}

.scene {
  position: relative;
  min-height: 90svh;
  overflow: hidden;
  padding: clamp(82px, 9vw, 130px) clamp(20px, 5vw, 72px) clamp(58px, 7vw, 96px);
  isolation: isolate;
}

.scene + .scene {
  margin-top: -1px;
}

.scene::before,
.scene::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  z-index: -1;
  pointer-events: none;
}

.scene::before {
  top: 0;
  height: 130px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent);
}

.scene-image {
  position: absolute;
  inset: auto 0 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
}

.scene-image--hero {
  object-position: center bottom;
}

.scene-image--soft {
  opacity: 0.34;
  filter: saturate(0.95) brightness(1.05);
}

.scene-image--park {
  opacity: 0.7;
  object-position: right center;
}

.hero {
  min-height: 96svh;
  background: var(--sky);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 620px;
  margin-left: clamp(8px, 5vw, 70px);
  padding-top: 0;
}

h1,
h2 {
  margin: 0;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  letter-spacing: 0;
  line-height: 0.9;
}

h1 {
  font-size: clamp(38px, 4.8vw, 66px);
  max-width: 720px;
}

h2 {
  font-size: clamp(32px, 4vw, 60px);
}

.hero-copy p {
  margin: 8px 0 0 4px;
  font-weight: 700;
  font-size: clamp(14px, 1.3vw, 18px);
}

.hand-note {
  font-family: "Caveat", "DM Sans", sans-serif;
  font-size: clamp(19px, 2vw, 28px);
  line-height: 1.05;
  color: var(--ink-soft);
}

.hero-note {
  position: absolute;
  left: clamp(32px, 7vw, 104px);
  top: 33%;
  max-width: 150px;
}

.sun {
  position: absolute;
  top: 30%;
  left: 50%;
  z-index: 4;
  width: clamp(220px, 26vw, 370px);
  aspect-ratio: 1;
  translate: -50% 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff7c8 0, #ffeaa5 42%, rgba(248, 223, 157, 0.68) 70%, rgba(248, 223, 157, 0.08) 100%);
  box-shadow: 0 20px 80px rgba(248, 202, 105, 0.38);
  display: grid;
  place-items: center;
  gap: 0;
  color: var(--ink);
  touch-action: none;
}

.sun span {
  font-size: clamp(46px, 7vw, 82px);
  line-height: 0.8;
}

.sun strong {
  font-size: clamp(13px, 1.35vw, 18px);
  line-height: 1.05;
  letter-spacing: 0.03em;
}

.primary-cta {
  position: relative;
  z-index: 10;
  padding: 12px 22px;
}

#wake-town {
  position: absolute;
  left: 50%;
  bottom: 7vh;
  translate: -50% 0;
}

.plot {
  position: relative;
  z-index: 3;
}

.plot--hero {
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 13%;
  height: 21%;
}

.section-copy {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  column-gap: 18px;
  max-width: 730px;
}

.section-copy span {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: clamp(26px, 3vw, 42px);
  font-weight: 800;
}

.section-copy p {
  grid-column: 2;
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.wake {
  min-height: 92svh;
  background:
    linear-gradient(90deg, rgba(207, 231, 250, 0.72), transparent 18%, transparent 82%, rgba(246, 221, 212, 0.78)),
    var(--cream);
}

.wake .hand-note {
  position: absolute;
  right: 7%;
  top: 23%;
  max-width: 150px;
}

.chart-plot {
  width: min(840px, 72vw);
  height: 440px;
  margin: 42px auto 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    repeating-linear-gradient(90deg, transparent 0 19.8%, rgba(16, 36, 75, 0.08) 20% calc(20% + 1px), transparent calc(20% + 1px)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.12));
}

.time-axis {
  position: absolute;
  top: -28px;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.time-axis span:nth-child(2) {
  background: rgba(248, 223, 157, 0.7);
  border-radius: 999px;
  padding-inline: 10px;
}

.wake-count {
  position: absolute;
  right: 13%;
  top: 48%;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: clamp(44px, 6vw, 82px);
  line-height: 0.86;
}

.wake-count small,
#awake-count small {
  display: block;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.15;
}

.wheel {
  min-height: 104svh;
  background: var(--sky);
}

.wheel-stage {
  width: min(920px, 88vw);
  height: 620px;
  margin: 24px auto 0;
  display: grid;
  grid-template-columns: minmax(310px, 560px) minmax(220px, 300px);
  align-items: center;
  gap: 28px;
}

.wheel-structure {
  width: min(560px, 82vw);
  filter: drop-shadow(0 20px 30px rgba(41, 63, 96, 0.14));
}

.wheel-structure circle {
  fill: rgba(255, 255, 255, 0.28);
  stroke: rgba(16, 36, 75, 0.36);
  stroke-width: 3;
}

.wheel-structure line {
  stroke: rgba(16, 36, 75, 0.23);
  stroke-width: 2;
}

.wheel-structure text {
  fill: var(--ink);
  font: 800 22px "Bricolage Grotesque", system-ui, sans-serif;
  text-anchor: middle;
}

.wheel-panel,
.story-bubble {
  padding: 18px 20px;
  border: 1px solid rgba(16, 36, 75, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.wheel-panel strong {
  display: block;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 32px;
}

.small-controls {
  display: flex;
  gap: 10px;
}

.small-controls button {
  padding: 0 16px;
}

.commute {
  min-height: 96svh;
  background: linear-gradient(180deg, var(--cream), #f8eadf);
}

.commute .hand-note {
  position: absolute;
  left: 5%;
  top: 42%;
  max-width: 180px;
}

.sankey-wrap {
  width: min(920px, 82vw);
  height: 390px;
  margin: 34px auto 0;
}

#sankey {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.sankey-ribbon {
  fill: none;
  stroke-linecap: round;
  opacity: 0.78;
  transition: opacity 0.24s, stroke-width 0.24s;
}

.sankey-ribbon.is-dimmed {
  opacity: 0.18;
}

.sankey-node {
  fill: rgba(255, 255, 255, 0.7);
  stroke: rgba(16, 36, 75, 0.14);
  stroke-width: 2;
}

.destination-controls {
  position: absolute;
  right: 8%;
  top: 29%;
  z-index: 6;
  display: grid;
  gap: 8px;
}

.destination-controls button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  min-width: 160px;
  padding: 0 14px;
}

#commute-story {
  position: absolute;
  right: 10%;
  bottom: 14%;
  max-width: 280px;
}

.apartments {
  min-height: 94svh;
  background: var(--peach);
}

.building-row {
  height: 560px;
  max-width: 980px;
  margin: 24px auto 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(90px, 1fr));
  align-items: end;
  gap: clamp(10px, 2vw, 24px);
}

.building {
  position: relative;
  min-height: var(--h);
  border: 2px solid rgba(16, 36, 75, 0.13);
  border-radius: 12px 12px 8px 8px;
  background:
    repeating-linear-gradient(180deg, transparent 0 52px, rgba(16, 36, 75, 0.07) 53px 55px),
    linear-gradient(180deg, #f3b7a8, #d89085);
  box-shadow: 0 18px 28px rgba(82, 67, 70, 0.13);
  padding: 30px 12px 72px;
  transition: transform 0.22s;
}

.building::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: -24px;
  height: 42px;
  border-radius: 12px 12px 2px 2px;
  background: #6f8394;
  clip-path: polygon(50% 0, 100% 62%, 100% 100%, 0 100%, 0 62%);
  box-shadow: inset 0 -10px rgba(255, 255, 255, 0.15);
}

.building::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 59px;
  width: 22px;
  height: 35px;
  translate: -50% 0;
  border-radius: 9px 9px 2px 2px;
  background: rgba(16, 36, 75, 0.28);
}

.building:nth-child(2n) {
  background: linear-gradient(180deg, #b7ded0, #75aaa0);
}

.building:nth-child(3n) {
  background: linear-gradient(180deg, #c9bfe4, #9387bd);
}

.building:hover {
  transform: translateY(-8px);
}

.windows {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.windows span,
.night-town i {
  display: block;
  border-radius: 4px;
  background: rgba(255, 247, 239, 0.86);
  box-shadow: inset 0 -5px rgba(248, 223, 157, 0.42);
}

.windows span {
  aspect-ratio: 0.72;
}

.building b,
.building em {
  position: absolute;
  left: 10px;
  right: 10px;
  text-align: center;
  font-style: normal;
}

.building b {
  bottom: 31px;
}

.building em {
  bottom: 8px;
  font-weight: 800;
}

.mood {
  min-height: 96svh;
  background: linear-gradient(180deg, var(--sky), #dff1f6);
}

.mood-plot {
  width: min(840px, 74vw);
  height: 520px;
  margin: 24px auto 0;
  border-left: 2px solid rgba(16, 36, 75, 0.38);
  border-bottom: 2px solid rgba(16, 36, 75, 0.38);
  background:
    radial-gradient(circle at 80% 82%, rgba(183, 222, 208, 0.65), transparent 26%),
    radial-gradient(circle at 22% 20%, rgba(255, 255, 255, 0.4), transparent 32%);
}

.axis-label {
  position: absolute;
  font-weight: 800;
}

.axis-label.top {
  top: -28px;
  left: 47%;
}

.axis-label.bottom {
  bottom: -30px;
  left: 45%;
}

.axis-label.left {
  left: -54px;
  bottom: 8px;
}

.axis-label.right {
  right: -82px;
  bottom: 8px;
}

.filter-stack {
  position: absolute;
  right: 8%;
  top: 30%;
  z-index: 6;
  display: grid;
  gap: 8px;
}

.filter-stack button,
.relation-controls button {
  min-width: 116px;
  padding: 0 14px;
  text-align: left;
}

.filter-stack button.is-active,
.relation-controls button.is-active,
.destination-controls button.is-active {
  background: var(--mint);
}

.network {
  min-height: 93svh;
  color: white;
  background:
    radial-gradient(circle at 72% 50%, rgba(93, 131, 166, 0.4), transparent 32%),
    linear-gradient(180deg, var(--night), var(--night-2));
}

.network .section-copy p,
.network .hand-note {
  color: rgba(255, 255, 255, 0.78);
}

.network-plot {
  width: min(980px, 78vw);
  height: 560px;
  margin: 10px auto 0;
}

.relation-controls {
  position: absolute;
  right: 8%;
  top: 35%;
  display: grid;
  gap: 8px;
  z-index: 7;
}

.lost {
  min-height: 92svh;
  background: var(--cream);
}

.lost-grid {
  display: grid;
  grid-template-columns: minmax(220px, 330px) 1fr;
  gap: 40px;
  align-items: center;
  max-width: 1160px;
  margin: 28px auto 0;
}

.lost-counts {
  list-style: none;
  margin: 0;
  padding: 16px 0;
  display: grid;
  gap: 13px;
  font-size: 18px;
}

.lost-counts li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.lost-items {
  min-height: 500px;
}

.lost-object {
  position: absolute;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  font-size: 24px;
  display: grid;
  place-items: center;
  transition: transform 0.24s, opacity 0.24s;
  transform: rotate(var(--tilt, 0deg));
}

.lost-object svg {
  width: 30px;
  height: 30px;
}

.lost-object.found {
  transform: translateY(-10px) rotate(calc(var(--tilt, 0deg) - 8deg));
  opacity: 0.38;
}

.lost-items.hints .lost-object:not(.found) {
  animation: hint 0.9s ease;
}

.hint-button {
  position: absolute;
  left: 8%;
  bottom: 14%;
  z-index: 6;
  padding: 0 18px;
}

#found-status {
  position: absolute;
  right: 10%;
  top: 22%;
}

.night {
  min-height: 91svh;
  color: white;
  background: var(--night);
}

.night .section-copy p {
  color: rgba(255, 255, 255, 0.8);
}

.night-town {
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 18%;
  height: 24%;
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 8px;
  align-items: end;
}

.night-town i {
  min-height: 18px;
  background: #ffe89c;
  box-shadow: 0 0 18px rgba(255, 226, 125, 0.55);
  transition: opacity 0.4s;
}

#night-lights {
  position: absolute;
  inset: 0;
}

.night-window {
  position: absolute;
  width: 2.4%;
  height: 18px;
  border-radius: 5px 5px 3px 3px;
  background: #ffe89c;
  opacity: 0.1;
  box-shadow: none;
  transition: opacity 0.4s, box-shadow 0.4s;
}

.night-window.lit {
  opacity: 1;
  box-shadow: 0 0 20px rgba(255, 226, 125, 0.58);
}

.night-town i.is-off {
  opacity: 0.08;
}

#awake-count {
  position: absolute;
  top: 34%;
  left: 48%;
  z-index: 7;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: clamp(46px, 7vw, 88px);
  text-align: center;
}

.last-resident {
  position: absolute;
  right: 20%;
  top: 42%;
  z-index: 8;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 14px 20px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.result {
  min-height: 86svh;
  background:
    linear-gradient(180deg, var(--cream), rgba(207, 231, 250, 0.5)),
    var(--cream);
}

.result .section-copy {
  max-width: none;
}

.stats {
  margin: 34px 0 0 clamp(10px, 7vw, 90px);
  display: grid;
  gap: 8px;
  max-width: 320px;
  font-weight: 700;
}

.stats p {
  margin: 0;
  display: grid;
  grid-template-columns: 64px 1fr;
}

.stats b {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 24px;
}

.donut {
  position: absolute;
  left: 38%;
  top: 22%;
  width: min(320px, 36vw);
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 18px 38px rgba(56, 61, 75, 0.14);
}

.donut::after {
  content: "•‿•";
  position: absolute;
  inset: 26%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 247, 239, 0.92);
  color: var(--ink);
  font: 800 38px "Bricolage Grotesque", system-ui, sans-serif;
}

.result .hand-note {
  position: absolute;
  left: 56%;
  top: 35%;
}

.result .primary-cta {
  position: absolute;
  left: 48%;
  bottom: 25%;
  padding-inline: 28px;
}

.result footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 86px;
  padding: 18px clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.result footer a,
.result footer span,
.result footer small {
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

#resident-tooltip {
  position: fixed;
  z-index: 50;
  min-width: 150px;
  pointer-events: none;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 13px;
  transform: translate(12px, 12px);
}

#resident-tooltip[hidden] {
  display: none;
}

.interior-image {
  min-height: 260px;
  margin-bottom: 14px;
  border-radius: 18px;
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 0 0 1px rgba(16, 36, 75, 0.08);
  transform-origin: center;
  transition: transform 0.32s ease, filter 0.32s ease;
}

.interior-image.interior-active {
  transform: scale(1.025);
  filter: saturate(1.08);
}

.pill {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font-weight: 800;
}

.resident-directory {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  max-height: 52vh;
  overflow: auto;
  gap: 8px;
}

.resident-directory button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  text-align: left;
  padding: 8px 10px;
}

dialog {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  border-radius: 24px;
  padding: 28px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 30px 90px rgba(16, 36, 75, 0.28);
}

dialog::backdrop {
  background: rgba(16, 36, 75, 0.28);
}

#dialog-title {
  margin-bottom: 12px;
}

#dialog-body p {
  margin: 0 0 12px;
}

#close-dialog {
  padding: 0 18px;
}

@keyframes hint {
  0%,
  100% {
    box-shadow: var(--shadow);
  }
  45% {
    box-shadow: 0 0 0 16px rgba(248, 223, 157, 0.52), var(--shadow);
  }
}

@media (max-width: 900px) {
  .town-nav {
    top: 10px;
    left: 12px;
    right: 12px;
  }

  .town-nav nav {
    max-width: calc(100vw - 78px);
    overflow-x: auto;
    justify-content: start;
  }

  .resident-inspector {
    left: 12px;
    right: 12px;
    width: auto;
  }

  .scene {
    min-height: auto;
    padding-block: 92px 92px;
  }

  .hero {
    min-height: 95svh;
  }

  .hero-copy {
    margin-left: 0;
    padding-top: 36px;
  }

  .sun {
    top: 36%;
    width: min(66vw, 300px);
  }

  .hero-note,
  .wake .hand-note,
  .commute .hand-note {
    display: none;
  }

  .section-copy {
    grid-template-columns: 54px 1fr;
  }

  .chart-plot,
  .mood-plot,
  .network-plot,
  .sankey-wrap {
    width: 100%;
  }

  .chart-plot {
    height: 520px;
    overflow-x: auto;
  }

  .wake-count {
    position: relative;
    right: auto;
    top: auto;
    display: block;
    margin: 26px 0 0;
  }

  .wheel-stage {
    width: 100%;
    height: auto;
    grid-template-columns: 1fr;
  }

  .wheel-panel {
    max-width: 420px;
    margin-inline: auto;
  }

  .destination-controls,
  .filter-stack,
  .relation-controls {
    position: relative;
    inset: auto;
    display: flex;
    overflow-x: auto;
    margin: 18px 0;
  }

  .destination-controls button,
  .filter-stack button,
  .relation-controls button {
    min-width: max-content;
  }

  #commute-story,
  #found-status,
  .hint-button {
    position: relative;
    inset: auto;
    display: inline-flex;
    margin-top: 18px;
  }

  .building-row {
    height: 520px;
    grid-template-columns: repeat(3, 1fr);
  }

  .lost-grid {
    grid-template-columns: 1fr;
  }

  .night-town {
    left: 6%;
    right: 6%;
    bottom: 16%;
  }

  #awake-count,
  .last-resident {
    position: relative;
    inset: auto;
    display: inline-block;
    margin: 18px 12px 0 0;
  }

  .donut {
    position: relative;
    left: auto;
    top: auto;
    display: block;
    width: min(320px, 86vw);
    margin: 28px auto;
  }

  .stats {
    margin-left: 0;
  }

  .result .hand-note,
  .result .primary-cta {
    position: relative;
    inset: auto;
    display: inline-block;
    margin: 16px 0;
  }
}

@media (max-width: 560px) {
  .town-nav .mark {
    width: 48px;
    height: 48px;
  }

  .town-nav button {
    padding-inline: 8px;
    font-size: 11px;
  }

  h1 {
    font-size: clamp(42px, 14vw, 66px);
  }

  .section-copy {
    grid-template-columns: 46px 1fr;
  }

  .chart-plot {
    height: 560px;
  }

  .building-row {
    grid-template-columns: repeat(3, 1fr);
    height: 560px;
    gap: 12px;
  }

  .building {
    padding-inline: 7px;
  }

  .windows {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .mood-plot {
    height: 420px;
  }

  .axis-label.left,
  .axis-label.right {
    bottom: -52px;
  }

  .axis-label.left {
    left: 0;
  }

  .axis-label.right {
    right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
