:root {
  --ink: #fff8eb;
  --paper: #f5e7c9;
  --night: #111827;
  --deep: #0b1020;
  --panel: rgba(15, 23, 42, 0.84);
  --line: rgba(255, 255, 255, 0.2);
  --gold: #f6c85f;
  --mint: #7ddfbd;
  --red: #ff6961;
  --blue: #62b6ff;
  --black: #05070d;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(125, 223, 189, 0.18), transparent 30%),
    linear-gradient(225deg, rgba(246, 200, 95, 0.16), transparent 36%),
    var(--deep);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.escape-app {
  min-height: 100vh;
}

.start-screen,
.end-screen {
  min-height: 100vh;
  padding: 20px;
}

.top-links {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  width: min(1180px, 100%);
  margin: 0 auto 16px;
}

.top-links a,
.nav-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 7, 13, 0.6);
  color: var(--ink);
  font-weight: 850;
}

.start-scene,
.end-scene {
  position: relative;
  display: grid;
  align-items: end;
  width: min(1180px, 100%);
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  overflow: hidden;
  border: 3px solid var(--black);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(5, 7, 13, 0.86), rgba(5, 7, 13, 0.32) 64%, rgba(5, 7, 13, 0.54)),
    url("assets/room-classroom.png") center / cover no-repeat;
  box-shadow: var(--shadow), 8px 8px 0 var(--black);
}

.end-scene {
  background:
    linear-gradient(90deg, rgba(5, 7, 13, 0.82), rgba(5, 7, 13, 0.28) 68%, rgba(5, 7, 13, 0.48)),
    url("assets/room-entrance.png") center / cover no-repeat;
}

.start-copy,
.end-copy {
  width: min(680px, 100%);
  padding: clamp(22px, 5vw, 52px);
}

.kicker {
  display: inline-flex;
  margin: 0 0 14px;
  padding: 7px 10px;
  border: 2px solid var(--black);
  border-radius: 8px;
  background: var(--mint);
  color: #062015;
  font-weight: 950;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 var(--black);
}

h1,
.end-copy h2 {
  max-width: 10ch;
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(3.2rem, 8vw, 7.6rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 5px 5px 0 var(--black);
}

.start-copy p,
.end-copy p {
  max-width: 36rem;
  margin: 18px 0 24px;
  color: #fff5df;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  font-weight: 800;
  line-height: 1.45;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 3px solid var(--black);
  border-radius: 8px;
  background: var(--gold);
  color: #1f1300;
  font-weight: 950;
  box-shadow: 5px 5px 0 var(--black);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.nav-button:hover {
  transform: translate(2px, 2px);
}

.primary-button:hover {
  box-shadow: 3px 3px 0 var(--black);
}

.game-screen {
  min-height: 100vh;
  padding: 14px;
}

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

.room-status {
  min-width: 0;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 7, 13, 0.62);
}

.room-status span {
  display: block;
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 800;
}

.room-status strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(1.1rem, 3vw, 1.65rem);
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
  width: min(1440px, 100%);
  margin: 0 auto;
}

.viewer-shell,
.side-panel > section {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26);
}

.viewer-toolbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 8px;
  border-bottom: 2px solid var(--line);
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 2px solid var(--black);
  border-radius: 8px;
  background: var(--blue);
  color: #07111d;
  font-size: 2rem;
  font-weight: 950;
  cursor: pointer;
}

.viewer-title {
  min-width: 0;
}

.viewer-title span {
  display: block;
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
}

.viewer-title strong {
  display: block;
  line-height: 1.2;
}

.viewer {
  position: relative;
  height: min(72vh, 720px);
  min-height: 480px;
  overflow: hidden;
  background: #000;
  touch-action: pan-y;
  cursor: grab;
}

.viewer:active {
  cursor: grabbing;
}

.panorama {
  position: absolute;
  inset: 0 auto 0 0;
  width: 220%;
  min-width: 1600px;
  background-image: var(--room-image);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transform: translateX(var(--pan-x, 0));
  transition: transform 260ms ease;
}

.panorama::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.38), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.38)),
    radial-gradient(circle at 50% 50%, transparent 45%, rgba(0, 0, 0, 0.18));
}

.hotspot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;
  width: 78px;
  height: 78px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: transparent;
  font-size: 0;
  transform: translate(-50%, -50%);
  cursor: pointer;
  opacity: 0;
  touch-action: manipulation;
  transition: opacity 140ms ease;
}

.hotspot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid #fff8eb;
  border-radius: 50%;
  background: rgba(246, 200, 95, 0.34);
  color: transparent;
  box-shadow:
    0 0 0 10px rgba(246, 200, 95, 0.12),
    0 0 26px rgba(246, 200, 95, 0.95),
    inset 0 0 14px rgba(255, 248, 235, 0.8);
  transform: translate(-50%, -50%);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.hotspot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 248, 235, 0.62);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: hotspot-pulse 1.9s ease-in-out infinite;
}

.hotspot:hover,
.hotspot:focus-visible,
.hotspot.is-revealed {
  opacity: 1;
}

.hotspot:hover::before,
.hotspot:focus-visible::before {
  background: rgba(255, 248, 235, 0.78);
  transform: translate(-50%, -50%) scale(1.16);
}

.hotspot:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.hotspot.is-solved::before {
  width: 20px;
  height: 20px;
  border-color: #d7ffe8;
  background: rgba(18, 183, 106, 0.72);
  box-shadow:
    0 0 0 8px rgba(18, 183, 106, 0.18),
    0 0 18px rgba(18, 183, 106, 0.82);
}

.hotspot.is-revealed::before {
  background: rgba(125, 223, 189, 0.74);
  border-color: #eafff7;
  box-shadow:
    0 0 0 10px rgba(125, 223, 189, 0.18),
    0 0 28px rgba(125, 223, 189, 0.95),
    inset 0 0 14px rgba(255, 248, 235, 0.78);
}

.hotspot.is-revealed::after {
  border-color: rgba(125, 223, 189, 0.62);
}

.hotspot.is-solved::after {
  border-color: rgba(215, 255, 232, 0.5);
  animation: none;
}

@keyframes hotspot-pulse {
  0%,
  100% {
    opacity: 0.28;
    transform: translate(-50%, -50%) scale(0.86);
  }

  50% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.18);
  }
}

.side-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.side-panel > section {
  padding: 14px;
}

.note-panel span,
.inventory-panel h2,
.progress-panel h2 {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 950;
  text-transform: uppercase;
}

.note-panel p {
  min-height: 96px;
  margin: 0;
  color: #fff8eb;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.45;
}

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

.item-pill,
.empty-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font-size: 0.86rem;
  font-weight: 850;
}

.item-pill {
  background: rgba(125, 223, 189, 0.22);
}

.progress-panel ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: #dbeafe;
  font-weight: 760;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 7, 13, 0.72);
}

.modal-card {
  width: min(440px, 100%);
  padding: 22px;
  border: 3px solid var(--black);
  border-radius: 8px;
  background: #172033;
  box-shadow: var(--shadow), 8px 8px 0 var(--black);
}

.modal-card h2 {
  margin: 0 0 8px;
  font-size: 1.75rem;
}

.modal-card p {
  line-height: 1.4;
}

.modal-card input {
  width: 100%;
  height: 54px;
  margin: 6px 0 14px;
  border: 3px solid var(--black);
  border-radius: 8px;
  background: var(--paper);
  color: #111827;
  font-size: 1.6rem;
  font-weight: 950;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feedback {
  min-height: 22px;
  margin: 12px 0 0;
  color: #fecaca;
  font-weight: 850;
}

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

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

  .viewer {
    height: 58vh;
  }
}

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

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

  .viewer {
    min-height: 430px;
  }

  .panorama {
    width: 260%;
  }

  .hotspot {
    width: 72px;
    height: 72px;
  }

  h1,
  .end-copy h2 {
    font-size: clamp(3rem, 17vw, 5.2rem);
  }
}
