:root {
  --page-bg: #121316;
  --panel-bg: rgba(255, 255, 255, 0.08);
  --panel-border: rgba(255, 255, 255, 0.16);
  --text: #f4f0ea;
  --muted: #c9c2b8;
  --accent: #f2c36b;
  --accent-strong: #ffcf6b;
  --button-bg: rgba(255, 255, 255, 0.12);
  --button-bg-hover: rgba(255, 255, 255, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(242, 195, 107, 0.18), transparent 34rem),
    linear-gradient(135deg, #111215, #202126 55%, #151515);
}

button {
  font: inherit;
}

.app {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.top-panel {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.65rem);
  line-height: 1.05;
}

.instruction {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.08rem);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.control-button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 10px 15px;
  color: var(--text);
  background: var(--button-bg);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.control-button:hover:not(:disabled),
.control-button:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  background: var(--button-bg-hover);
}

.control-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.control-button.primary {
  color: #201609;
  border-color: transparent;
  background: var(--accent-strong);
  font-weight: 700;
}

.stage-card {
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 2732 / 2048;
  overflow: hidden;
  border-radius: 18px;
  background: #050505;
  isolation: isolate;
}

.scene-image,
.object-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.scene-image {
  z-index: 1;
  transition: opacity 220ms ease, transform 260ms ease;
}

.scene-image.changing {
  opacity: 0;
  transform: scale(1.018);
}

.object-overlay {
  z-index: 3;
  opacity: 0;
  transform: scale(1);
  transition: opacity 180ms ease, filter 180ms ease;
}

.object-overlay.visible {
  opacity: 1;
}

#lampOverlay.visible {
  filter: drop-shadow(0 0 20px rgba(255, 214, 91, 0.65));
}

#candleOverlay.visible {
  filter: drop-shadow(0 0 18px rgba(255, 183, 59, 0.75));
}

.hotspot {
  position: absolute;
  z-index: 8;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 207, 107, 0);
  cursor: pointer;
}

.hotspot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transform: scale(0.84);
  background: radial-gradient(ellipse at center,
    rgba(255, 207, 107, 0.34) 0%,
    rgba(255, 207, 107, 0.18) 34%,
    rgba(255, 207, 107, 0.08) 54%,
    rgba(255, 207, 107, 0) 76%);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.hotspot:hover::after,
.hotspot:focus-visible::after {
  opacity: 1;
  transform: scale(1);
}

/* Scene 0: full room table hotspot */
.object-hotspot {
  border-radius: 50%;
}

.room-desk-hotspot {
  left: 31%;
  top: 58%;
  width: 40%;
  height: 28%;
  border-radius: 50%;
}

/* Scene 1: closer table hotspot */
.closeup-desk-hotspot {
  left: 11%;
  top: 41%;
  width: 78%;
  height: 46%;
  border-radius: 50%;
}

/* Scene 2: final interactive object hotspots */
.lamp-hotspot {
  left: 24.5%;
  top: 10.4%;
  width: 24.7%;
  height: 34.6%;
}

.laptop-hotspot {
  left: 38.3%;
  top: 18.3%;
  width: 27.5%;
  height: 29.4%;
}

.drink-hotspot {
  left: 33.2%;
  top: 28.6%;
  width: 7.2%;
  height: 12.6%;
}

.book-hotspot {
  left: 66.9%;
  top: 31.1%;
  width: 19.1%;
  height: 22.9%;
}

.candle-hotspot {
  left: 15.3%;
  top: 29.4%;
  width: 9.2%;
  height: 13.2%;
  border-radius: 50%;
}

/* Only show the correct hotspots for the current scene. */
.stage[data-scene="0"] .closeup-desk-hotspot,
.stage[data-scene="0"] .object-hotspot,
.stage[data-scene="1"] .room-desk-hotspot,
.stage[data-scene="1"] .object-hotspot,
.stage[data-scene="2"] .navigation-hotspot {
  display: none;
}

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

.state-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
}

.state-item span {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.state-item.done {
  color: var(--text);
  border-color: rgba(255, 207, 107, 0.42);
  background: rgba(255, 207, 107, 0.12);
}

.state-item.done span {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  box-shadow: 0 0 14px rgba(255, 207, 107, 0.55);
}

@media (max-width: 780px) {
  .app {
    width: min(100vw - 18px, 1280px);
    padding-top: 10px;
  }

  .top-panel {
    align-items: stretch;
    flex-direction: column;
    padding: 15px;
  }

  .controls {
    justify-content: flex-start;
  }

  .control-button {
    padding: 9px 12px;
  }

  .stage-card {
    padding: 7px;
    border-radius: 18px;
  }

  .stage {
    border-radius: 13px;
  }

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

.state-item.done {
  color: var(--text);
  border-color: rgba(242, 195, 107, 0.45);
  background: rgba(242, 195, 107, 0.12);
}

.state-item span {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.28);
}

.state-item.done span {
  background: var(--accent-strong);
  box-shadow: 0 0 12px rgba(255, 207, 107, 0.6);
}

@media (max-width: 900px) {
  .state-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .top-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .controls {
    justify-content: flex-start;
  }

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

.hotspot:focus-visible {
  outline: none;
}
