/**
 * Interactive Game Lab — Hearthstone Cabin Stylesheet
 * Responsive layout optimized for desktop browsers and iPad landscape/portrait.
 */

:root {
  --bg-deep: #0c0705;
  --bg-panel: rgba(26, 15, 10, 0.88);
  --bg-modal: #1e120c;
  --gold-bright: #fde68a;
  --gold-brass: #d4af37;
  --gold-muted: #92400e;
  --amber-glow: #f59e0b;
  --frost-cyan: #67e8f9;
  --pine-emerald: #34d399;
  --text-cream: #fef3c7;
  --text-soft: #d6d3d1;
  --border-brass: rgba(212, 175, 55, 0.42);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 60%, #1c100b 0%, #090504 100%);
  color: var(--text-cream);
  font-family: 'Georgia', 'Palatino Linotype', 'Book Antiqua', serif;
  display: flex;
  flex-direction: column;
  touch-action: manipulation;
}

body.finale-awakened {
  background: radial-gradient(circle at 50% 45%, #132a3e 0%, #090d16 100%);
}

/* ============================================================================
   INTRO SPLASH OVERLAY
   ============================================================================ */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(circle at 50% 45%, rgba(36, 20, 12, 0.94), rgba(8, 5, 4, 0.98));
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.45s ease;
}

.intro-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.intro-card {
  max-width: 620px;
  width: 100%;
  background: linear-gradient(160deg, #27160e 0%, #150c08 100%);
  border: 2px solid var(--gold-brass);
  border-radius: 18px;
  padding: 38px 34px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 40px rgba(245, 158, 11, 0.18);
}

.intro-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.intro-badge {
  display: inline-block;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--frost-cyan);
  background: rgba(103, 232, 249, 0.1);
  border: 1px solid rgba(103, 232, 249, 0.35);
  padding: 5px 12px;
  border-radius: 999px;
}

.lang-switch-pill {
  display: inline-flex;
  background: rgba(15, 9, 6, 0.78);
  border: 1px solid var(--border-brass);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}

.lang-pill-btn {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
  background: transparent;
  border: none;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.lang-pill-btn:hover {
  color: var(--gold-bright);
}

.lang-pill-btn.active {
  background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  color: #fffbeb;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.lang-hud-btn {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0.04em;
}

.lang-hud-btn .lang-active {
  color: var(--gold-bright);
  font-weight: 800;
}

.lang-hud-btn .lang-inactive {
  color: #94a3b8;
  font-weight: 500;
}

.lang-hud-btn .lang-sep {
  color: rgba(212, 175, 55, 0.45);
  margin: 0 2px;
}

.intro-card h1 {
  font-size: 2.5rem;
  color: var(--gold-bright);
  letter-spacing: 0.03em;
  margin-bottom: 6px;
  text-shadow: 0 2px 14px rgba(245, 158, 11, 0.4);
}

.intro-subtitle {
  font-size: 1.12rem;
  color: #fbbf24;
  font-style: italic;
  margin-bottom: 20px;
}

.intro-lore {
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--text-soft);
  margin-bottom: 28px;
}

.intro-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

/* ============================================================================
   TOP HUD BAR
   ============================================================================ */
.top-hud {
  height: 62px;
  min-height: 62px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-brass);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 40;
}

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

.brand-star {
  color: var(--gold-bright);
  font-size: 1.35rem;
  text-shadow: 0 0 10px var(--amber-glow);
}

.hud-title {
  font-size: 1.05rem;
  font-weight: bold;
  color: var(--gold-bright);
}

.hud-sub {
  font-size: 0.72rem;
  color: #a8a29e;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.progress-pill {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.16);
  border: 1px solid var(--border-brass);
  padding: 4px 10px;
  border-radius: 999px;
}

.narrative-banner {
  flex: 1;
  max-width: 660px;
  text-align: center;
  font-size: 0.94rem;
  color: var(--text-cream);
  background: rgba(45, 25, 15, 0.72);
  border: 1px solid rgba(253, 230, 138, 0.28);
  padding: 7px 16px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.narrative-banner.visible {
  border-color: var(--gold-bright);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.25);
}

.hud-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hud-btn {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-cream);
  background: rgba(62, 36, 23, 0.85);
  border: 1px solid var(--border-brass);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.18s ease, transform 0.12s ease, border-color 0.18s ease;
}

.hud-btn:hover {
  background: rgba(92, 54, 30, 0.95);
  border-color: var(--gold-bright);
}

.hud-btn:active {
  transform: scale(0.96);
}

.hud-btn.muted {
  opacity: 0.7;
}

.badge-num {
  background: var(--amber-glow);
  color: #1c1008;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.audio-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

#volume-slider {
  width: 68px;
  accent-color: var(--amber-glow);
  cursor: pointer;
}

/* ============================================================================
   CLUE NOTEBOOK DRAWER
   ============================================================================ */
.notebook-drawer {
  position: fixed;
  top: 62px;
  right: 0;
  bottom: 92px;
  width: 340px;
  max-width: 90vw;
  background: rgba(26, 15, 10, 0.96);
  border-left: 2px solid var(--gold-brass);
  z-index: 80;
  padding: 18px;
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.7);
}

.notebook-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-brass);
  margin-bottom: 14px;
}

.drawer-header h2 {
  font-size: 1.1rem;
  color: var(--gold-bright);
}

.clue-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clue-entry {
  background: rgba(58, 32, 16, 0.55);
  border: 1px solid var(--border-brass);
  border-radius: 10px;
  padding: 12px;
}

.clue-entry h4 {
  color: var(--gold-bright);
  font-size: 0.94rem;
  margin-bottom: 5px;
}

.clue-entry p {
  font-size: 0.86rem;
  line-height: 1.48;
  color: var(--text-soft);
}

/* ============================================================================
   MAIN ROOM STAGE & HOTSPOTS
   ============================================================================ */
.stage-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px 14px;
}

.room-stage {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: calc((100vh - 170px) * 1.6);
  max-height: calc(100vw / 1.6);
  aspect-ratio: 16 / 10;
  border: 2px solid var(--border-brass);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.85);
  background: #120905;
}

#cabin-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.atmosphere-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.hotspot-group {
  cursor: pointer;
  transition: filter 0.22s ease, transform 0.22s ease;
  outline: none;
}

.hotspot-group:hover,
.hotspot-group:focus-visible {
  filter: drop-shadow(0 0 12px rgba(253, 230, 138, 0.65)) brightness(1.1);
}

.hotspot-label {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  font-weight: 600;
  fill: var(--gold-bright);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  text-shadow: 0 2px 6px #000;
}

.hotspot-group:hover .hotspot-label,
.hotspot-group:focus-visible .hotspot-label {
  opacity: 1;
}

/* Always show subtle hotspot labels on touch devices (iPad) */
@media (hover: none) and (pointer: coarse) {
  .hotspot-label {
    opacity: 0.82;
  }
}

/* ============================================================================
   BOTTOM INVENTORY DOCK
   ============================================================================ */
.bottom-dock {
  height: 92px;
  min-height: 92px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-brass);
  padding: 6px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.inventory-container {
  width: 100%;
  max-width: 1180px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.78rem;
}

.inv-label {
  font-weight: 700;
  color: var(--gold-bright);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.selected-item-hint {
  color: #d6d3d1;
}

.selected-item-hint strong {
  color: var(--frost-cyan);
}

.inventory-slots {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  overflow-x: auto;
}

.inventory-empty {
  font-size: 0.85rem;
  color: #a8a29e;
  font-style: italic;
  padding: 10px 0;
}

.inventory-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(45, 25, 15, 0.88);
  border: 1.5px solid var(--border-brass);
  border-radius: 10px;
  padding: 5px 12px;
  color: var(--text-cream);
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.inventory-slot:hover {
  border-color: var(--gold-bright);
  background: rgba(68, 38, 22, 0.92);
}

.inventory-slot.selected {
  border-color: var(--frost-cyan);
  background: rgba(14, 58, 78, 0.75);
  box-shadow: 0 0 14px rgba(103, 232, 249, 0.35);
}

.slot-icon {
  width: 34px;
  height: 34px;
}

.slot-icon svg {
  width: 100%;
  height: 100%;
}

.slot-name {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ============================================================================
   CLOSE-UP INSPECTION MODAL
   ============================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 4, 3, 0.82);
  backdrop-filter: blur(6px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(165deg, #26160e 0%, #140b07 100%);
  border: 2px solid var(--gold-brass);
  border-radius: 16px;
  padding: 22px 26px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.9);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-brass);
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 1.4rem;
  color: var(--gold-bright);
}

.modal-subtitle {
  font-size: 0.88rem;
  color: #d6d3d1;
  margin-top: 3px;
}

.icon-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-brass);
  color: var(--gold-bright);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}

.icon-close-btn:hover {
  background: rgba(212, 175, 55, 0.25);
}

.closeup-svg {
  width: 100%;
  max-height: 240px;
  display: block;
  margin: 0 auto 14px;
  border-radius: 10px;
}

.closeup-description {
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--text-cream);
  text-align: center;
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

.action-btn {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.action-btn.large {
  font-size: 1rem;
  padding: 13px 24px;
}

.action-btn.primary {
  background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  color: #fffbeb;
  border: 1px solid var(--gold-bright);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.action-btn.primary:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.action-btn.secondary {
  background: rgba(58, 34, 20, 0.85);
  color: var(--gold-bright);
  border: 1px solid var(--border-brass);
}

.action-btn.secondary:hover:not(:disabled) {
  background: rgba(88, 52, 30, 0.95);
}

.action-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

/* ============================================================================
   PARCHMENT LETTER & CLOCKMAKER'S JOURNAL
   ============================================================================ */
.parchment-card {
  background: linear-gradient(145deg, #fef3c7 0%, #fde68a 100%);
  color: #3b1d11;
  border: 2px solid #b45309;
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: inset 0 0 24px rgba(180, 83, 9, 0.25);
  line-height: 1.62;
  font-size: 0.96rem;
}

.parchment-card p {
  margin-bottom: 12px;
}

.parchment-seal {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #991b1b;
  color: #fde68a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin: 0 auto 10px;
}

.parchment-seal.gold {
  background: #b45309;
}

.parchment-greeting {
  font-weight: bold;
  font-size: 1.08rem;
}

.parchment-signature {
  text-align: right;
  font-style: italic;
  font-weight: bold;
  margin-top: 14px;
}

.journal-book {
  background: linear-gradient(145deg, #fef3c7 0%, #f5d087 100%);
  color: #3b1d11;
  border: 2px solid #92400e;
  border-radius: 12px;
  padding: 18px 22px;
}

.journal-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(120, 53, 15, 0.3);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.journal-page-num {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #92400e;
  text-transform: uppercase;
}

.journal-svg {
  width: 100%;
  max-height: 130px;
  display: block;
  margin-bottom: 12px;
}

.journal-text p {
  font-size: 0.94rem;
  line-height: 1.55;
  margin-bottom: 10px;
}

.journal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

.journal-dots {
  display: flex;
  gap: 6px;
}

.journal-dots .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(120, 53, 15, 0.3);
}

.journal-dots .dot.active {
  background: #92400e;
}

/* ============================================================================
   TREE BELLS, GRANDFATHER CLOCK & AUTOMATON DIALS
   ============================================================================ */
.tree-topper-banner {
  text-align: center;
  margin-bottom: 14px;
}

.cipher-badge {
  display: inline-block;
  background: rgba(6, 78, 59, 0.65);
  border: 1.5px solid var(--pine-emerald);
  color: #ecfdf5;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.94rem;
}

.cipher-badge.muted {
  background: rgba(45, 25, 15, 0.65);
  border-color: var(--border-brass);
  color: #d6d3d1;
}

.bells-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.bell-card {
  background: rgba(38, 22, 14, 0.9);
  border: 1.5px solid var(--border-brass);
  border-radius: 12px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-cream);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.18s ease;
}

.bell-card:hover {
  border-color: var(--gold-bright);
  transform: translateY(-2px);
}

.bell-card:active {
  transform: scale(0.95);
}

.bell-svg {
  width: 64px;
  height: 64px;
}

.bell-name {
  font-weight: bold;
  font-size: 0.88rem;
  color: var(--gold-bright);
}

.bell-points {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.76rem;
  color: #cbd5e1;
}

.clock-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.clock-svg {
  width: 210px;
  height: 245px;
  flex-shrink: 0;
}

.clock-controls-panel {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clock-readout {
  font-size: 1.05rem;
  background: rgba(45, 25, 15, 0.8);
  border: 1px solid var(--border-brass);
  padding: 8px 14px;
  border-radius: 8px;
  text-align: center;
}

.clock-status-note {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #fde68a;
}

.hand-adjusters {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.adjuster-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(35, 20, 12, 0.7);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.25);
}

.adjuster-btns {
  display: flex;
  gap: 6px;
}

.dials-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 10px 0 18px;
}

.dial-column {
  background: rgba(36, 20, 12, 0.92);
  border: 2px solid var(--gold-brass);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 115px;
}

.dial-symbol {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
}

.dial-step-btn {
  width: 48px;
  height: 32px;
  background: rgba(78, 44, 24, 0.9);
  border: 1px solid var(--border-brass);
  border-radius: 6px;
  color: var(--gold-bright);
  font-size: 0.95rem;
  cursor: pointer;
}

.dial-step-btn:hover {
  background: rgba(120, 68, 36, 0.95);
}

.dial-wheel {
  font-family: 'Courier New', monospace;
  font-size: 2rem;
  font-weight: bold;
  color: var(--gold-bright);
  background: #0f0906;
  border: 1.5px solid var(--gold-brass);
  border-radius: 8px;
  width: 64px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.finale-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.summary-chip {
  background: rgba(120, 53, 15, 0.14);
  border: 1px solid #b45309;
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-chip strong {
  font-size: 1.1rem;
  color: #78350f;
}

.summary-chip span {
  font-size: 0.75rem;
  color: #92400e;
}

@media (max-width: 820px) {
  .narrative-banner {
    display: none;
  }
  .bells-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================================
   PURPOSEFUL ATMOSPHERIC KEYFRAME ANIMATIONS
   ============================================================================ */
@keyframes flameDance {
  0%, 100% {
    transform: scaleY(1) scaleX(1) skewX(0deg);
  }
  33% {
    transform: scaleY(1.06) scaleX(0.96) skewX(-1.5deg);
  }
  66% {
    transform: scaleY(0.95) scaleX(1.04) skewX(1.5deg);
  }
}

#scene-fire-low,
#scene-fire-stoked,
.fireplace-stage path {
  transform-box: fill-box;
  transform-origin: bottom center;
  animation: flameDance 1.8s ease-in-out infinite;
}

@keyframes pendulumSwing {
  0%, 100% {
    transform: rotate(-8deg);
  }
  50% {
    transform: rotate(8deg);
  }
}

.pendulum-swinging {
  transform-box: fill-box;
  transform-origin: top center;
  animation: pendulumSwing 2s ease-in-out infinite;
}

@keyframes twinkleBulb {
  0%, 100% {
    opacity: 0.95;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.84);
  }
}

#scene-tree-lights circle {
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkleBulb 2.4s ease-in-out infinite;
}

#scene-tree-lights circle:nth-child(2n) {
  animation-delay: 0.8s;
}

#scene-tree-lights circle:nth-child(3n) {
  animation-delay: 1.5s;
}

@keyframes spinCelestial {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.celestial-ring-spin {
  transform-box: fill-box;
  transform-origin: center;
  animation: spinCelestial 18s linear infinite;
}


/* Phone playtest fixes: readable feedback, reachable rooms and generous taps. */
button { min-height: 44px; }
.icon-close-btn { width: 44px; height: 44px; flex-shrink: 0; }
.dial-step-btn { min-height: 44px; }
.play-tips { color: var(--gold-bright); line-height: 1.5; margin: 0 0 22px; }
.room-navigation { display: none; }
.modal-tools { display: flex; gap: 8px; margin-bottom: 12px; }
.modal-feedback { padding: 12px; border: 1px solid var(--gold-brass); border-radius: 8px; color: var(--gold-bright); line-height: 1.5; margin-bottom: 14px; }
.modal-clues { display: grid; gap: 8px; max-height: 220px; overflow-y: auto; margin-bottom: 14px; }
.modal-clues[hidden], .modal-feedback[hidden] { display: none; }
.modal-header { position: sticky; top: -22px; z-index: 2; background: #26160e; padding-top: 8px; }
.intro-overlay { overflow-y: auto; }
.intro-card { max-height: 100%; overflow-y: auto; }
:focus-visible { outline: 3px solid var(--frost-cyan); outline-offset: 3px; }

@media (max-width: 1100px) {
  .top-hud { height: auto; min-height: 0; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .narrative-banner { display: block; order: 3; flex: 1 1 100%; max-width: none; border-radius: 10px; white-space: normal; text-overflow: clip; font-size: 0.88rem; line-height: 1.45; }
  .narrative-banner:not(.visible) { display: none; }
  .hud-controls { flex-wrap: wrap; gap: 6px; }
  .hud-btn { padding: 8px 10px; }
  .notebook-drawer { top: 0; bottom: 0; padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .inventory-header { gap: 6px; align-items: flex-start; }
  .selected-item-hint { min-width: 0; overflow-wrap: anywhere; }
  .bottom-dock { height: auto; min-height: 92px; padding: 8px 12px max(8px, env(safe-area-inset-bottom)); }
}
@media (max-width: 820px), (max-height: 500px) {
  html { display: block; overflow-y: auto; }
  body { height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .top-hud { flex-shrink: 0; }
  .hud-brand { width: 100%; justify-content: space-between; gap: 6px; }
  .hud-title { font-size: 1rem; }
  .hud-controls { width: 100%; }
  .audio-group { gap: 4px; }
  #volume-slider { display: none; }
  .hud-btn { font-size: 0.8rem; }
  .stage-wrapper { flex: 1 0 auto; display: flex; flex-direction: column; gap: 12px; padding: 12px; overflow: visible; }
  .room-stage { flex: none; width: 100%; height: auto; max-width: 760px; max-height: none; aspect-ratio: 16 / 10; }
  .room-navigation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; max-width: 760px; gap: 8px; }
  .room-navigation .hud-btn { justify-content: center; line-height: 1.35; white-space: normal; text-align: center; }
  .inventory-header { flex-direction: column; line-height: 1.4; }
  .inventory-slots { padding: 3px 2px; }
  .bottom-dock { flex-shrink: 0; }
  .intro-overlay { padding: 12px; }
  .intro-card { padding: 22px 18px; }
  .intro-card h1 { font-size: 2rem; }
  .intro-top-row { flex-wrap: wrap; justify-content: center; }
  .intro-lore { margin-bottom: 16px; }
  .intro-buttons { flex-direction: column; }
  .modal-overlay { padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .modal-card { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding: 14px; overscroll-behavior: contain; }
  .modal-header { top: -14px; }
  .modal-header h2 { font-size: 1.18rem; }
  .parchment-card, .journal-book { padding: 14px; }
  .journal-page-header { flex-wrap: wrap; gap: 8px; }
  .journal-nav { gap: 6px; }
  .journal-nav .action-btn { padding: 10px; }
  .modal-actions { align-items: stretch; }
  .modal-actions .action-btn { flex: 1 1 100%; }
  .bells-grid { gap: 8px; }
  .bell-card { min-width: 0; }
  .clock-controls-panel { min-width: 0; flex-basis: 100%; }
  .adjuster-group { gap: 6px; padding: 8px; }
  .adjuster-group .action-btn { padding: 8px 12px; }
  .clock-svg { width: 150px; height: 175px; }
  .dials-row { gap: 6px; }
  .dial-column { min-width: 0; flex: 1 1 0; padding: 10px 4px; }
  .dial-symbol { font-size: 0.8rem; text-align: center; overflow-wrap: anywhere; }
  .dial-wheel { width: 54px; }
  .finale-summary-grid { gap: 5px; }
  .summary-chip { padding: 6px 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
