:root {
  color-scheme: light;
  --bg: #f7f5ee;
  --surface: #fffdf7;
  --surface-2: #f0eee5;
  --ink: #16211d;
  --muted: #637067;
  --green: #237a57;
  --green-dark: #14543b;
  --lime: #c8e870;
  --orange: #e76f51;
  --blue: #4e7fa8;
  --line: rgba(22, 33, 29, 0.14);
  --shadow: 0 18px 60px rgba(25, 38, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(200, 232, 112, 0.28), transparent 28rem),
    linear-gradient(135deg, #f8f4e8 0%, #eef3ed 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.game-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
}

.start-screen,
.play-screen {
  width: 100%;
}

.brand-row,
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--ink);
  color: var(--green-dark);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: lowercase;
}

.prototype-chip,
.eyebrow {
  color: var(--green-dark);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prototype-chip {
  padding: 8px 10px;
  border: 1px solid rgba(35, 122, 87, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
}

.start-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(380px, 1.05fr);
  gap: 24px;
  align-items: stretch;
  min-height: calc(100vh - 86px);
}

.start-copy,
.title-card,
.room-panel,
.action-panel,
.hud-card,
.story-card {
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.9);
  box-shadow: var(--shadow);
}

.start-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 6vw, 72px);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 18px;
  font-size: clamp(3.2rem, 9vw, 8.4rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-wrap: balance;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.42rem, 2.4vw, 2.15rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.04rem;
  line-height: 1.2;
}

.lede {
  max-width: 620px;
  color: #2a372f;
  font-size: clamp(1.08rem, 2vw, 1.48rem);
}

.mission,
.helper-text,
.audio-note {
  color: var(--muted);
}

.mission {
  max-width: 560px;
  font-size: 1.05rem;
}

.start-actions,
.sound-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.primary-button,
.ghost-button,
.icon-button,
.choice-button,
.clue-button,
.action-button,
.stage-tab {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--surface);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.primary-button {
  border-color: var(--green-dark);
  background: var(--green);
  color: white;
  font-weight: 900;
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.choice-button:hover,
.clue-button:hover,
.action-button:hover,
.stage-tab:not(:disabled):hover {
  transform: translateY(-1px);
}

.ghost-button {
  background: transparent;
  font-weight: 800;
}

.wide {
  width: 100%;
  margin-top: 12px;
}

.title-card {
  position: relative;
  overflow: hidden;
  min-height: 540px;
  background:
    linear-gradient(180deg, rgba(15, 30, 26, 0.08), transparent 44%),
    #e7e1d4;
}

.pixel-window {
  position: absolute;
  top: 8%;
  right: 8%;
  width: 34%;
  aspect-ratio: 1.3;
  border: 8px solid #24352e;
  background:
    linear-gradient(90deg, transparent 48%, rgba(36, 53, 46, 0.7) 49%, rgba(36, 53, 46, 0.7) 52%, transparent 53%),
    linear-gradient(180deg, #1d3548 0%, #2a5b70 45%, #f2a660 100%);
}

.title-room {
  position: absolute;
  inset: 0;
}

.title-bed {
  position: absolute;
  left: 8%;
  bottom: 13%;
  width: 46%;
  height: 28%;
  border: 5px solid #273831;
  background: #f4f0df;
  box-shadow: inset 0 -44px 0 #9fc9b6;
}

.title-desk {
  position: absolute;
  right: 7%;
  bottom: 16%;
  width: 34%;
  height: 22%;
  border: 5px solid #273831;
  background: #b98765;
}

.title-lamp {
  position: absolute;
  right: 22%;
  bottom: 38%;
  width: 12%;
  height: 20%;
  background: #f6d772;
  clip-path: polygon(25% 0, 75% 0, 100% 40%, 0 40%);
}

.title-smell {
  position: absolute;
  left: 48%;
  top: 42%;
  width: 26%;
  height: 26%;
  border: 4px solid rgba(231, 111, 81, 0.7);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(-25deg);
  animation: drift 2.7s ease-in-out infinite;
}

.title-phone {
  position: absolute;
  left: 19%;
  bottom: 43%;
  display: grid;
  place-items: center;
  width: 58px;
  height: 82px;
  border: 5px solid #273831;
  border-radius: 12px;
  background: #131f1a;
  color: var(--orange);
  font-size: 2.4rem;
  font-weight: 900;
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0) rotate(-25deg);
    opacity: 0.48;
  }
  50% {
    transform: translateY(-12px) rotate(-10deg);
    opacity: 1;
  }
}

.game-header h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 5.6rem);
}

.sound-controls {
  justify-content: flex-end;
}

.icon-button {
  background: #17241e;
  color: white;
  font-weight: 850;
}

.volume-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

#volume-slider {
  width: 120px;
  accent-color: var(--green);
}

.hud {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.hud-card {
  min-width: 0;
  padding: 12px;
}

.hud-card span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.hud-card strong {
  display: block;
  margin-top: 2px;
  font-size: 1.22rem;
}

.meter {
  overflow: hidden;
  height: 7px;
  margin-top: 7px;
  border-radius: 999px;
  background: #dde4da;
}

.meter i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.meter.panic i {
  background: var(--orange);
}

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

.stage-tab {
  font-size: 0.88rem;
  font-weight: 900;
}

.stage-tab.active {
  border-color: var(--green);
  background: #dff0df;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.96fr) minmax(0, 1.04fr);
  gap: 14px;
  align-items: start;
}

.room-panel,
.action-panel {
  padding: 14px;
}

.room-map {
  position: relative;
  overflow: hidden;
  min-height: 460px;
  border: 1px solid var(--line);
  background: #e9e2d4;
}

.room-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wall {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(22, 33, 29, 0.08) 1px, transparent 1px) 0 0 / 54px 54px,
    linear-gradient(180deg, #efe6d8 0%, #e8ddcd 55%, #d0bd9e 56%, #d0bd9e 100%);
}

.window-shape,
.bed-shape,
.desk-shape,
.microwave-shape,
.rug-shape,
.smell-wave {
  position: absolute;
  border: 4px solid #24352e;
}

.window-shape {
  top: 8%;
  right: 10%;
  width: 30%;
  height: 22%;
  background: #7fb1c4;
}

.bed-shape {
  left: 8%;
  bottom: 12%;
  width: 46%;
  height: 30%;
  background: #f7f1df;
  box-shadow: inset 0 -44px 0 #a3c7b7;
}

.desk-shape {
  right: 7%;
  bottom: 15%;
  width: 34%;
  height: 24%;
  background: #b88763;
}

.microwave-shape {
  left: 41%;
  bottom: 47%;
  width: 22%;
  height: 17%;
  background: #dcd9cf;
}

.rug-shape {
  left: 28%;
  bottom: 4%;
  width: 42%;
  height: 13%;
  border-radius: 50%;
  background: rgba(35, 122, 87, 0.22);
}

.smell-wave {
  left: 49%;
  top: 31%;
  width: 16%;
  height: 20%;
  border-color: rgba(231, 111, 81, 0.65);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(-20deg);
  animation: drift 2.9s ease-in-out infinite;
}

.wave-two {
  left: 57%;
  top: 26%;
  width: 12%;
  height: 16%;
  animation-delay: 400ms;
}

.room-zone {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 2px solid rgba(20, 84, 59, 0.6);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.74);
  color: var(--green-dark);
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(22, 33, 29, 0.12);
}

.room-zone.found {
  background: rgba(200, 232, 112, 0.76);
}

.bed-zone {
  left: 6%;
  bottom: 9%;
  width: 48%;
  height: 34%;
}

.desk-zone {
  right: 5%;
  bottom: 12%;
  width: 36%;
  height: 28%;
}

.microwave-zone {
  left: 39%;
  top: 34%;
  width: 26%;
  height: 21%;
}

.window-zone {
  right: 7%;
  top: 6%;
  width: 34%;
  height: 25%;
}

.inventory-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.panel-heading {
  margin-bottom: 12px;
}

.panel-heading h2,
.panel-heading .eyebrow {
  margin-bottom: 5px;
}

.inventory-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  padding-right: 4px;
}

.inventory-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.inventory-item strong {
  display: block;
  margin-bottom: 3px;
}

.inventory-item span {
  color: var(--muted);
  font-size: 0.84rem;
}

.story-card {
  padding: 16px;
  margin-bottom: 12px;
}

.stage-panel {
  display: none;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.76);
}

.stage-panel.active {
  display: block;
}

.card-stack,
.budget-actions,
.choice-grid {
  display: grid;
  gap: 10px;
}

.clue-button,
.action-button {
  width: 100%;
  padding: 12px;
  text-align: left;
  background: var(--surface);
}

.clue-button.found,
.action-button.selected {
  border-color: rgba(35, 122, 87, 0.52);
  background: #e6f3de;
}

.clue-meta,
.action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(35, 122, 87, 0.1);
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 900;
}

.pill.orange {
  background: rgba(231, 111, 81, 0.12);
  color: #99402c;
}

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

.claim-card {
  display: grid;
  gap: 12px;
}

.claim-box {
  padding: 16px;
  border: 1px solid rgba(231, 111, 81, 0.28);
  border-radius: 8px;
  background: rgba(231, 111, 81, 0.08);
}

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

.choice-button {
  width: 100%;
  text-align: left;
  font-weight: 850;
}

.feedback-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.feedback-card.correct {
  border-color: rgba(35, 122, 87, 0.4);
}

.feedback-card.wrong {
  border-color: rgba(231, 111, 81, 0.4);
}

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

.action-button.blocked {
  border-color: rgba(231, 111, 81, 0.34);
  background: rgba(231, 111, 81, 0.08);
}

.final-report {
  display: grid;
  gap: 12px;
}

.report-hero,
.report-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.report-hero {
  border-color: rgba(35, 122, 87, 0.34);
  background: #e8f4e5;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-actions a,
.report-actions button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 850;
  text-decoration: none;
}

@media (max-width: 980px) {
  .start-grid,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .start-grid {
    min-height: auto;
  }

  .title-card {
    min-height: 420px;
  }

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

@media (max-width: 720px) {
  .game-shell {
    padding: 12px;
  }

  .brand-row,
  .game-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .sound-controls {
    justify-content: flex-start;
    width: 100%;
  }

  #volume-slider {
    flex: 1;
    min-width: 120px;
  }

  .start-copy {
    padding: 22px;
  }

  h1 {
    font-size: clamp(3rem, 18vw, 4.8rem);
  }

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

  .stage-tabs {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .stage-tab {
    flex: 0 0 auto;
  }

  .room-map {
    min-height: 380px;
  }

  .budget-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .hud-card {
    padding: 10px;
  }

  .hud-card strong {
    font-size: 1.05rem;
  }

  .room-zone {
    min-height: 58px;
    padding: 6px;
    font-size: 0.82rem;
  }

  .stage-panel,
  .story-card,
  .room-panel,
  .action-panel {
    padding: 12px;
  }
}
