:root {
  --ink: #202124;
  --paper: #fffdf5;
  --paper-2: #f4fbff;
  --line: #202124;
  --yellow: #ffd447;
  --pink: #ff6b8a;
  --cyan: #43d9ff;
  --mint: #65e6a8;
  --violet: #8b6dff;
  --red: #ff5a3d;
  --green: #14b87a;
  --shadow: 5px 5px 0 var(--line);
  --small-shadow: 3px 3px 0 var(--line);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(32, 33, 36, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(32, 33, 36, 0.05) 1px, transparent 1px),
    #eafcff;
  background-size: 34px 34px;
}

button {
  font: inherit;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: clamp(14px, 2vw, 24px);
}

.screen--active {
  display: block;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tiny-note {
  margin: 0;
  color: #555;
  font-size: 0.86rem;
}

.button,
.icon-button,
.text-button {
  border: 3px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

.button {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: var(--small-shadow);
  font-weight: 900;
}

.button:hover,
.icon-button:hover,
.text-button:hover,
.hotspot:hover {
  transform: translate(-1px, -1px);
}

.button:active,
.icon-button:active,
.text-button:active,
.hotspot:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--line);
}

.button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.button--primary {
  background: var(--yellow);
}

.button--ghost {
  background: var(--mint);
}

.button--small {
  min-height: 38px;
  padding: 7px 11px;
  font-size: 0.88rem;
}

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

.sound-toggle[aria-pressed="false"] {
  background: var(--paper);
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--yellow);
  box-shadow: var(--small-shadow);
  font-size: 1.35rem;
  font-weight: 900;
}

.text-button {
  min-height: 34px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--cyan);
  box-shadow: 2px 2px 0 var(--line);
  font-weight: 900;
}

.start-screen {
  display: none;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4vw, 48px);
}

.start-screen.screen--active {
  display: flex;
}

.comic-splash {
  position: relative;
  width: min(42vw, 420px);
  min-width: 260px;
  aspect-ratio: 1;
  border: 4px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at center, transparent 0 36%, rgba(32, 33, 36, 0.08) 37% 38%, transparent 39%),
    conic-gradient(from 8deg, var(--yellow), var(--cyan), var(--mint), var(--pink), var(--yellow));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.splash-burst {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border: 4px solid var(--line);
  border-radius: 50%;
  background: var(--red);
  color: white;
  font-weight: 900;
  transform: rotate(10deg);
}

.vacuum-hero {
  position: absolute;
  left: 12%;
  right: 8%;
  bottom: 15%;
  height: 45%;
}

.vacuum-body {
  position: absolute;
  left: 18%;
  right: 8%;
  bottom: 22%;
  height: 56%;
  border: 4px solid var(--line);
  border-radius: 50% 18px 18px 50%;
  background: var(--paper);
  box-shadow: var(--small-shadow);
}

.vacuum-eye {
  position: absolute;
  top: 35%;
  left: 34%;
  z-index: 2;
  width: 18px;
  height: 18px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--cyan);
}

.vacuum-hose {
  position: absolute;
  right: 2%;
  bottom: 64%;
  width: 42%;
  height: 26%;
  border-top: 10px solid var(--line);
  border-radius: 999px 999px 0 0;
  transform: rotate(-18deg);
}

.vacuum-wheel {
  position: absolute;
  bottom: 8%;
  width: 42px;
  height: 42px;
  border: 4px solid var(--line);
  border-radius: 50%;
  background: var(--violet);
}

.vacuum-wheel--one {
  left: 28%;
}

.vacuum-wheel--two {
  right: 22%;
}

.start-copy {
  width: min(92vw, 540px);
  border: 4px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 3vw, 34px);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.start-copy h1 {
  margin: 0 0 10px;
  font-size: clamp(3rem, 8vw, 5.8rem);
  line-height: 0.95;
}

.start-copy p:not(.eyebrow):not(.tiny-note) {
  max-width: 44rem;
  font-size: 1.08rem;
  line-height: 1.5;
}

.start-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 22px 0 12px;
}

.game-screen {
  background:
    linear-gradient(135deg, rgba(255, 212, 71, 0.55), rgba(67, 217, 255, 0.3)),
    transparent;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  width: min(1480px, 100%);
  margin: 0 auto 14px;
}

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

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--pink);
  color: white;
  box-shadow: var(--small-shadow);
  font-size: 0.9rem;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  color: #555;
}

.stats,
.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.chip,
.count-pill {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  padding: 4px 10px;
  box-shadow: 2px 2px 0 var(--line);
  font-weight: 900;
  white-space: nowrap;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 390px);
  gap: 16px;
  width: min(1480px, 100%);
  margin: 0 auto;
}

.play-area,
.side-panel,
.missions-screen {
  min-width: 0;
}

.place-header,
.dialog-panel,
.inventory-panel,
.mission-panel,
.missions-header,
.mission-card {
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--small-shadow);
}

.place-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.place-header h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.45rem);
}

.scene-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 320px;
  border: 4px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.scene-art {
  display: block;
  width: 100%;
  height: 100%;
}

.hotspot-layer {
  position: absolute;
  inset: 0;
}

.hotspot {
  position: absolute;
  display: block;
  min-width: 52px;
  min-height: 52px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  --hotspot-color: var(--yellow);
}

.hotspot::before,
.hotspot::after {
  position: absolute;
  left: 50%;
  pointer-events: none;
}

.hotspot::before {
  content: "";
  top: 50%;
  width: clamp(24px, 3.2vw, 34px);
  height: clamp(24px, 3.2vw, 34px);
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--hotspot-color);
  box-shadow: 2px 2px 0 var(--line);
  transform: translate(-50%, -50%);
}

.hotspot::after {
  content: attr(data-label);
  top: calc(50% + clamp(18px, 2.7vw, 25px));
  max-width: min(150px, 24vw);
  border: 2px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 245, 0.95);
  box-shadow: 2px 2px 0 var(--line);
  color: var(--ink);
  font-size: clamp(0.64rem, 1.15vw, 0.78rem);
  font-weight: 900;
  line-height: 1.1;
  overflow: hidden;
  padding: 4px 8px;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  white-space: nowrap;
}

.hotspot--person {
  --hotspot-color: var(--yellow);
}

.hotspot--item {
  --hotspot-color: var(--mint);
}

.hotspot--travel {
  --hotspot-color: var(--cyan);
}

.hotspot--travel::before {
  border-radius: 8px;
}

.hotspot--clue {
  --hotspot-color: var(--pink);
}

.hotspot:focus-visible {
  outline: 4px solid white;
  outline-offset: 4px;
}

.hotspot:hover::before,
.hotspot:focus-visible::before {
  transform: translate(-50%, -50%) scale(1.12);
}

.hotspot:hover::after,
.hotspot:focus-visible::after {
  background: var(--paper);
}

.location-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.location-nav .button {
  min-width: 0;
  padding-inline: 8px;
  white-space: normal;
}

.location-nav .button[aria-current="page"] {
  background: var(--yellow);
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialog-panel {
  padding: 14px;
}

.dialog-speaker {
  display: inline-block;
  margin: 0 0 8px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--yellow);
  padding: 4px 10px;
  font-weight: 900;
}

.dialog-text {
  min-height: 88px;
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
}

.dialog-choices {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.dialog-choices .button {
  width: 100%;
  text-align: left;
}

.inventory-panel,
.mission-panel {
  padding: 12px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.05rem;
}

.inventory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inventory-item {
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
  padding: 8px 10px;
  box-shadow: 2px 2px 0 var(--line);
  cursor: pointer;
  font-weight: 900;
}

.mission-mini-list {
  display: grid;
  gap: 8px;
}

.mini-mission {
  display: grid;
  gap: 4px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
  padding: 8px;
}

.mini-mission strong {
  font-size: 0.92rem;
}

.progress-track {
  height: 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: white;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: var(--progress);
  background: var(--green);
}

.missions-screen {
  width: min(980px, 100%);
  margin: 0 auto;
}

.missions-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  margin-bottom: 14px;
}

.missions-header h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
}

.missions-list {
  display: grid;
  gap: 12px;
}

.mission-card {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.mission-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.mission-card p {
  margin: 0;
  line-height: 1.45;
}

.mission-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 900;
}

.status-pill--done {
  background: var(--mint);
}

.status-pill--active {
  background: var(--yellow);
}

.status-pill--open {
  background: white;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  max-width: min(92vw, 520px);
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: var(--small-shadow);
  padding: 10px 14px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast--show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: auto minmax(150px, 1fr) auto;
  }

  .stats {
    grid-column: 1 / -1;
    justify-content: start;
  }

  .top-actions {
    grid-column: 3;
  }

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

  .side-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dialog-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .screen {
    padding: 10px;
  }

  .start-screen.screen--active {
    flex-direction: column;
    justify-content: flex-start;
  }

  .comic-splash {
    width: min(92vw, 360px);
    min-width: 0;
  }

  .start-copy h1 {
    font-size: clamp(2.6rem, 15vw, 4.6rem);
  }

  .topbar {
    grid-template-columns: auto 1fr;
  }

  .top-actions,
  .stats {
    grid-column: 1 / -1;
    justify-content: start;
  }

  .game-layout,
  .side-panel {
    grid-template-columns: 1fr;
  }

  .place-header {
    align-items: start;
    flex-direction: column;
  }

  .scene-stage {
    min-height: 220px;
    aspect-ratio: 16 / 9;
  }

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

  .dialog-text {
    min-height: 72px;
  }

  .hotspot {
    min-width: 48px;
    min-height: 48px;
  }

  .hotspot::after {
    max-width: 92px;
    font-size: 0.63rem;
  }
}

@media (max-width: 420px) {
  .start-actions,
  .top-actions,
  .stats {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .button {
    width: 100%;
  }

  .location-nav {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
