/* Fonts moved to <link> in index.html for non-blocking load */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box
}

body {
  overflow: hidden;
  background: #050508;
  font-family: 'DM Sans', sans-serif;
  user-select: none
}

/* ── Splash Screen ── */
#blocker {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: linear-gradient(180deg, rgba(5,5,8,.82) 0%, rgba(8,8,14,.78) 50%, rgba(5,5,8,.82) 100%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 1s
}

#blocker.hidden {
  opacity: 0;
  pointer-events: none
}

#blocker h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(2rem, 6vw, 4rem);
  color: #f2ece0;
  letter-spacing: .15em;
  margin-bottom: .2em;
  animation: fu 1.2s ease both, breathe 4.5s ease-in-out 1.5s infinite
}

#blocker .sub {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-style: italic;
  font-size: clamp(.75rem, 1.8vw, 1.1rem);
  color: #5a7a94;
  letter-spacing: .3em;
  text-transform: uppercase;
  margin-bottom: 2.5rem;
  animation: fu 1.2s ease .3s both, breathe 4.5s ease-in-out 2s infinite
}

#blocker .btn {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: .8rem;
  color: #c8d8e8;
  letter-spacing: .4em;
  text-transform: uppercase;
  border: 1px solid rgba(100, 140, 180, .2);
  padding: .9em 2.8em;
  background: none;
  cursor: pointer;
  transition: all .4s;
  animation: fu 1.2s ease .6s both, glowPulse 3.2s ease-in-out 2s infinite
}

#blocker .btn:hover {
  background: rgba(100, 140, 180, .06);
  border-color: rgba(100, 140, 180, .5)
}

#blocker .hint {
  position: absolute;
  bottom: 2rem;
  color: #3a4a58;
  font-size: .65rem;
  letter-spacing: .12em;
  text-align: center;
  line-height: 2;
  animation: fu 1.2s ease .9s both
}

#blocker .hint span {
  color: #5a7a90
}

#blocker .hint .gp-start {
  display: inline-block;
  color: #7a9ab4;
  border: 1px solid rgba(100, 140, 180, .25);
  padding: .15em .7em;
  border-radius: 2px;
  margin-left: .3em;
  animation: glowPulse 3.2s ease-in-out 2.5s infinite
}

#blocker .btn.gp-focus {
  background: rgba(100, 140, 180, .08);
  border-color: rgba(100, 140, 180, .45)
}

#blocker .rooms {
  color: #4a6070;
  font-size: .7rem;
  letter-spacing: .1em;
  margin-top: 1.5rem;
  text-align: center;
  line-height: 1.8;
  animation: fu 1.2s ease .7s both;
  position: relative;
  padding-top: 1.2rem
}

#blocker .rooms::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(100, 140, 180, .25), transparent);
  animation: accentLine 1.4s cubic-bezier(.22, 1, .36, 1) 1s forwards
}

@keyframes fu {
  from {
    opacity: 0;
    transform: translateY(15px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.015); }
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 0 rgba(100, 140, 180, 0);
    border-color: rgba(100, 140, 180, .2)
  }
  50% {
    box-shadow: 0 0 18px rgba(100, 140, 180, .12), inset 0 0 8px rgba(100, 140, 180, .04);
    border-color: rgba(100, 140, 180, .4)
  }
}

@keyframes accentLine {
  from { width: 0; opacity: 0 }
  to { width: clamp(80px, 20vw, 180px); opacity: 1 }
}

/* ── Pause ── */
#pause {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(4, 4, 8, .92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer
}

#pause.show {
  display: flex
}

#pause .m1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: 1.5rem;
  color: #f0ece4;
  letter-spacing: .1em;
  margin-bottom: .8rem
}

#pause .m2 {
  color: #5a5650;
  font-size: .7rem;
  letter-spacing: .2em
}

/* ── HUD ── */
#room-label {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: .9rem;
  color: rgba(120, 160, 200, .3);
  letter-spacing: .25em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity .8s
}

#room-label.show {
  opacity: 1
}

/* ── Artwork Info ── */
#info-panel {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: rgba(6, 8, 14, .94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(80, 120, 160, .1);
  padding: 1.2rem 2.2rem;
  text-align: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: all .5s cubic-bezier(.22, 1, .36, 1);
  max-width: 480px;
  border-radius: 2px;
  will-change: opacity, transform
}

#info-panel.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0)
}

#sit-prompt {
  position: fixed;
  bottom: 6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;
  font-family: 'DM Sans', sans-serif;
  font-size: .75rem;
  color: rgba(160, 190, 220, .8);
  letter-spacing: .15em;
  text-transform: uppercase;
  background: rgba(6, 8, 14, .85);
  border: 1px solid rgba(80, 120, 160, .15);
  padding: .6em 1.6em;
  border-radius: 2px;
  opacity: 0;
  transition: opacity .4s
}

#sit-prompt.visible {
  opacity: 1
}

#info-panel .t {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 1.3rem;
  color: #d0dde8;
  margin-bottom: .2em
}

#info-panel .a {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-style: italic;
  font-size: .95rem;
  color: #7a9ab4;
  margin-bottom: .4em
}

#info-panel .d {
  font-size: .73rem;
  color: #5a7080;
  line-height: 1.6
}

/* ── Crosshair & Vignette ── */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s
}

#crosshair.show {
  opacity: 1
}

#crosshair::before,
#crosshair::after {
  content: '';
  position: absolute;
  background: rgba(140, 170, 200, .18)
}

#crosshair::before {
  width: 14px;
  height: 1px;
  top: 0;
  left: -7px
}

#crosshair::after {
  width: 1px;
  height: 14px;
  left: 0;
  top: -7px
}

#vignette {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(3, 3, 6, .6) 100%)
}

#vignette.show {
  opacity: 1
}

canvas {
  display: block
}

/* ── Tux Letter Overlay ── */
#tux-letter-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(4, 4, 8, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease, background 0.8s ease;
}

#tux-letter-overlay.visible {
  opacity: 1;
  pointer-events: auto;
  background: rgba(4, 4, 8, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#tux-letter {
  width: 580px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: linear-gradient(170deg, #f5f0e4 0%, #ede7d8 40%, #e8e0d0 100%);
  border-radius: 3px;
  padding: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 1px rgba(0, 0, 0, 0.2);
  transform: scale(0.92) translateY(20px);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
  opacity: 0;
}

#tux-letter::-webkit-scrollbar {
  display: none;
}

#tux-letter-overlay.visible #tux-letter {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.tux-letter-header {
  padding: 1.4rem 2rem 0.8rem;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: 0.75rem;
  color: #8a7a6a;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(120, 100, 80, 0.15);
}

.tux-letter-body {
  padding: 1.6rem 2.2rem 1.2rem;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.85;
  color: #2a2420;
}

.tux-letter-body p {
  margin-bottom: 1.1em;
  text-align: justify;
  text-indent: 1.5em;
}

.tux-letter-body p:first-child {
  text-indent: 0;
}

.tux-letter-body p:last-child {
  margin-bottom: 0;
}

.tux-letter-footer {
  padding: 0.8rem 2rem 1.2rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.65rem;
  color: #9a8a7a;
  letter-spacing: 0.12em;
  text-align: center;
  border-top: 1px solid rgba(120, 100, 80, 0.12);
  animation: blink-prompt 1.5s ease-in-out infinite;
}

.tux-letter-footer span {
  color: #6a5a4a;
  font-weight: 500;
}

/* ── Room Title Overlay (cinematic entrance) ── */
#room-title-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 55;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  opacity: 0;
  transition: opacity 0.8s ease;
}

#room-title-overlay.visible {
  opacity: 1;
}

#room-title-overlay.fade-out {
  opacity: 0;
  transition: opacity 1.2s ease;
}

#room-title-overlay .rtl-name {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  color: #e8e0d4;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 0 40px rgba(80, 120, 180, 0.3), 0 2px 8px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  animation: rtlReveal 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#room-title-overlay .rtl-sub {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-style: italic;
  font-size: clamp(0.65rem, 1.5vw, 0.9rem);
  color: rgba(120, 160, 200, 0.6);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  text-align: center;
  animation: rtlReveal 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
  opacity: 0;
}

#room-title-overlay .rtl-line {
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(120, 160, 200, 0.3), transparent);
  animation: rtlLine 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.05s forwards;
}

@keyframes rtlReveal {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(6px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes rtlLine {
  from {
    width: 0;
    opacity: 0;
  }

  to {
    width: clamp(120px, 30vw, 280px);
    opacity: 1;
  }
}

@keyframes blink-prompt {
  0%, 100% { opacity: .6 }
  50% { opacity: 1 }
}

/* ═══ Virtual Touch Joystick ═══ */
#touch-joy-base {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 60px;
  background: rgba(80, 120, 160, .08);
  border: 1px solid rgba(100, 140, 180, .2);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}

#touch-joy-base.active {
  opacity: 1;
}

#touch-joy-stick {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 54px;
  border-radius: 27px;
  background: rgba(100, 140, 180, .25);
  border: 1px solid rgba(140, 180, 220, .35);
  transform: translate(-50%, -50%);
  margin-left: -27px;
  margin-top: -27px;
  transition: none;
  pointer-events: none;
}

/* ═══ Touch Action Buttons ═══ */
.touch-btn {
  position: fixed;
  width: 50px;
  height: 50px;
  border-radius: 25px;
  background: rgba(6, 8, 14, .7);
  border: 1px solid rgba(80, 120, 160, .2);
  color: rgba(160, 190, 220, .7);
  font-size: .75rem;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: background .15s, border-color .15s;
}

.touch-btn:active, .touch-btn.pressed {
  background: rgba(80, 120, 160, .2);
  border-color: rgba(100, 140, 180, .5);
}

#touch-btn-action {
  bottom: 100px;
  right: 24px;
}

#touch-btn-sprint {
  bottom: 40px;
  right: 24px;
}

/* ═══ Settings Gear ═══ */
#settings-gear {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 60;
  width: 36px;
  height: 36px;
  font-size: 20px;
  line-height: 36px;
  text-align: center;
  color: rgba(140, 170, 200, .4);
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  transition: color .3s;
}

#settings-gear:hover, #settings-gear:active {
  color: rgba(160, 190, 220, .8);
}

/* ═══ Settings Panel ═══ */
#settings-panel {
  position: fixed;
  top: 56px;
  right: 12px;
  z-index: 95;
  width: 260px;
  background: rgba(6, 8, 14, .94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(80, 120, 160, .12);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: all .3s cubic-bezier(.22, 1, .36, 1);
}

#settings-panel.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.sp-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: .9rem;
  color: #c8d8e8;
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-bottom: .8rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid rgba(80, 120, 160, .1);
}

.sp-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .7rem;
}

.sp-row label {
  font-size: .7rem;
  color: #7a9ab4;
  letter-spacing: .08em;
  min-width: 70px;
  flex-shrink: 0;
}

.sp-row input[type="range"] {
  flex: 1;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(80, 120, 160, .2);
  border-radius: 2px;
  outline: none;
}

.sp-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 7px;
  background: #7a9ab4;
  cursor: pointer;
}

.sp-row span {
  font-size: .65rem;
  color: #5a7a90;
  min-width: 32px;
  text-align: right;
}

/* Toggle switch */
.sp-toggle {
  width: 38px;
  height: 20px;
  border-radius: 10px;
  background: rgba(60, 80, 100, .3);
  border: 1px solid rgba(80, 120, 160, .15);
  cursor: pointer;
  position: relative;
  transition: background .25s;
}

.sp-toggle.on {
  background: rgba(80, 140, 200, .35);
  border-color: rgba(100, 160, 220, .4);
}

.sp-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 7px;
  background: #7a9ab4;
  transition: left .2s;
}

.sp-toggle.on .sp-toggle-knob {
  left: 20px;
}

.sp-close {
  text-align: center;
  font-size: .65rem;
  color: #5a7080;
  letter-spacing: .15em;
  text-transform: uppercase;
  cursor: pointer;
  padding-top: .5rem;
  border-top: 1px solid rgba(80, 120, 160, .08);
  margin-top: .3rem;
  transition: color .2s;
}

.sp-close:hover, .sp-close:active {
  color: #8aaac0;
}