@font-face {
  font-family: 'FuturaStd';
  src: url('../assets/font/FuturaStd-Bold.woff2') format('woff2'),
       url('../assets/font/FuturaStd-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'FuturaStd', 'Futura', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* --- Loader screen --- */

#loader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  transition: opacity 0.8s ease;
}

#loader.done {
  opacity: 0;
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.loader-logo {
  width: clamp(200px, 35vw, 420px);
  height: auto;
  margin-bottom: 1.5rem;
}

.loader-bar-track {
  width: clamp(200px, 40vw, 400px);
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

.loader-bar-fill {
  width: 0%;
  height: 100%;
  background: #fff;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.loader-status {
  color: rgba(255, 255, 255, 0.4);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 300;
  font-size: clamp(0.6rem, 1vw, 0.75rem);
  margin-top: 0.5rem;
  letter-spacing: 0.1em;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#scene {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  overflow: hidden;
  background: #000;
}

#room {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#room.hidden {
  visibility: hidden;
}

/* --- Collection bar --- */

#collection-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.5vw, 20px);
  padding: clamp(6px, 1vh, 14px) 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#collection-bar.bar-hidden {
  opacity: 0;
}

.collection-slot {
  position: relative;
  width: clamp(52px, 7.2vw, 92px);
  height: clamp(52px, 7.2vw, 92px);
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.4);
  transition: border-color 0.3s, transform 0.3s;
}

.collection-slot img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  margin: 15%;
  filter: brightness(0) opacity(0.3);
  transition: filter 0.5s;
}

.collection-slot.collected {
  border-color: rgba(80, 200, 120, 0.6);
}

.collection-slot.collected img {
  filter: none;
}

.collection-slot.slot-pop {
  animation: slot-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slot-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* --- Particle burst --- */

.particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 101;
  animation: particle-burst 0.6s ease-out forwards;
}

@keyframes particle-burst {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--px), var(--py)) scale(0); opacity: 0; }
}

.collection-check {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #50c878;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* --- Mute button --- */

#btn-mute {
  position: absolute;
  top: clamp(6px, 1vh, 14px);
  right: clamp(24px, 4vw, 44px);
  z-index: 30;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

#btn-mute:hover {
  color: #fff;
}

#btn-mute svg {
  width: clamp(26px, 3.2vw, 36px);
  height: clamp(26px, 3.2vw, 36px);
}

/* --- Onboarding --- */

#onboarding {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.5);
  transition: opacity 0.6s ease;
}

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

.onb-step {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: clamp(1rem, 2.5vh, 2rem);
  text-align: center;
  padding: 0 2rem;
  animation: onb-fade-in 0.5s ease forwards;
}

.onb-step.active {
  display: flex;
}

@keyframes onb-fade-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.onb-logo {
  width: clamp(180px, 30vw, 360px);
  height: auto;
  margin-bottom: clamp(0.5rem, 1vh, 1rem);
}

.onb-title {
  color: #fff;
  font-size: clamp(1rem, 2.5vw, 1.6rem);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.02em;
  max-width: clamp(280px, 50vw, 500px);
}

.onb-title em {
  font-style: italic;
  opacity: 0.9;
}

.onb-subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: clamp(0.9rem, 2vw, 1.3rem);
  font-weight: 400;
  letter-spacing: 0.03em;
}

.onb-input {
  width: clamp(220px, 30vw, 360px);
  padding: 0.7rem 1.2rem;
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
  font-family: inherit;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.3s;
}

.onb-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.onb-input:focus {
  border-color: rgba(255, 255, 255, 0.6);
}

.onb-btn {
  padding: 0.7rem 2.5rem;
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  font-family: inherit;
  font-weight: 700;
  color: #000;
  background: #e1ddd3;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: transform 0.2s, opacity 0.2s;
}

.onb-btn:hover {
  transform: scale(1.04);
}

.onb-btn:active {
  transform: scale(0.97);
}

/* --- Slot entrance animation --- */

.collection-slot.slot-enter {
  opacity: 0;
  transform: translateY(-40px);
  animation: slot-slide-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slot-slide-in {
  from { opacity: 0; transform: translateY(-40px); }
  to { opacity: 1; transform: translateY(0); }
}

.collection-slot.slot-exit {
  animation: slot-slide-out 0.4s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes slot-slide-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-60px); }
}

/* --- Hotspots --- */

#hotspots {
  position: absolute;
  inset: 0;
}

#hotspots-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hotspot {
  fill: transparent;
  stroke: transparent;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  pointer-events: all;
  filter: none;
  transition: filter 0s, stroke 0s, fill 0s, stroke-width 0s;
}

.hotspot:hover,
.hotspot:active {
  transition: filter 0.3s, stroke 0.3s, fill 0.3s, stroke-width 0s;
  stroke: rgba(255, 255, 255, 0.6);
  fill: rgba(255, 255, 255, 0.15);
  stroke-width: 1;
  filter:
    drop-shadow(0 0 2px rgba(255, 255, 255, 1))
    drop-shadow(0 0 6px rgba(255, 255, 255, 1))
    drop-shadow(0 0 15px rgba(255, 255, 255, 0.8))
    drop-shadow(0 0 30px rgba(255, 255, 255, 0.6))
    drop-shadow(0 0 50px rgba(255, 255, 255, 0.4))
    drop-shadow(0 0 80px rgba(255, 255, 255, 0.2));
}

.hotspot.visited {
  fill: hsl(0, 0%, 50%);
  mix-blend-mode: saturation;
  cursor: default;
  pointer-events: none;
  transition: fill 0.5s;
}

#hotspots.fading .hotspot,
#hotspots.fading .hotspot:hover,
#hotspots.fading .hotspot:active {
  filter: none !important;
  stroke: transparent !important;
  fill: transparent !important;
  transition: none !important;
}

/* --- Reward screen --- */

#reward-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.5s ease;
}

#reward-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

#reward-sticker {
  width: clamp(230px, 52vw, 768px);
  height: auto;
  animation: sticker-enter 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             sticker-float 3s ease-in-out 0.8s infinite;
  filter: drop-shadow(0 0 24px rgba(255, 255, 255, 0.25));
}

@keyframes sticker-enter {
  0% { transform: scale(0) rotateY(180deg); opacity: 0; }
  100% { transform: scale(1) rotateY(0deg); opacity: 1; }
}

@keyframes sticker-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-12px) rotate(2deg); }
}

#btn-next {
  padding: 0.8rem 2.5rem;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  font-family: inherit;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.3s, border-color 0.3s;
}

#btn-next:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.6);
}

#player.blurred {
  filter: blur(12px) brightness(0.6);
  transition: filter 2s ease;
}

/* --- Final background --- */

#final-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 14;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2s ease;
  transform: scale(1.8);
  transform-origin: center center;
}

#final-bg.active {
  opacity: 1;
  animation: final-zoom-out 15s ease-out forwards;
}

@keyframes final-zoom-out {
  0% { transform: scale(1.8); }
  100% { transform: scale(1); }
}

/* --- Success screen --- */

#success-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.8rem, 2vh, 1.5rem);
  background: rgba(0, 0, 0, 0);
  opacity: 0;
  pointer-events: none;
  transition: background-color 2s ease;
}

#success-overlay.visible {
  opacity: 1;
}

#success-overlay.backdrop {
  background: rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}

#success-stickers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.2vw, 16px);
  min-height: clamp(50px, 8vw, 90px);
}

#success-stickers img {
  width: clamp(40px, 6vw, 80px);
  height: clamp(40px, 6vw, 80px);
  object-fit: contain;
  opacity: 0;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.3));
}

.success-title {
  color: #fff;
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.8s ease;
}

.success-title.visible {
  opacity: 1;
}

.success-subtitle {
  color: rgba(255, 255, 255, 0.6);
  font-size: clamp(0.9rem, 2vw, 1.3rem);
  font-weight: 400;
  letter-spacing: 0.03em;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.success-subtitle.visible {
  opacity: 1;
  transform: translateY(0);
}

.success-logo {
  width: clamp(140px, 25vw, 300px);
  height: auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s ease, transform 1s ease;
}

.success-logo.visible {
  opacity: 1;
  transform: translateY(0);
}

.success-presave {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.8rem;
  background: #1DB954;
  color: #fff;
  font-family: inherit;
  font-size: clamp(0.8rem, 1.5vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  border: none;
  border-radius: 30px;
  text-decoration: none;
  cursor: pointer;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease, background 0.3s;
}

.success-presave svg {
  width: clamp(18px, 2vw, 22px);
  height: clamp(18px, 2vw, 22px);
  flex-shrink: 0;
}

.success-presave.visible {
  opacity: 1;
  transform: translateY(0);
}

.success-presave:hover {
  background: #1ed760;
}

.success-repeat {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.6);
  font-family: inherit;
  font-size: clamp(0.7rem, 1.2vw, 0.85rem);
  padding: 0.4rem 1.5rem;
  border-radius: 20px;
  cursor: pointer;
  margin-top: 0.5rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease, color 0.3s, border-color 0.3s;
}

.success-repeat.visible {
  opacity: 1;
  transform: translateY(0);
}

.success-repeat:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
}

/* --- Share picker --- */

/* --- Fade overlay --- */

#fade-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity 0.3s ease;
}

#fade-overlay.active {
  opacity: 1;
}

/* --- Video --- */

#player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  z-index: 10;
}

#player.active {
  display: block;
}

/* --- Rotate notice (mobile portrait) --- */

#rotate-notice {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  transition: opacity 0.8s ease;
}

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

#rotate-notice .rotate-icon {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0.8;
}

#rotate-notice .arrow {
  animation: nudge 1.5s ease-in-out infinite;
}

#rotate-notice p {
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

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

@media (orientation: portrait) and (max-width: 900px) {
  #rotate-notice:not(.hidden) {
    display: flex;
  }
  #app {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100vh;
    height: 100vw;
    transform: translate(-50%, -50%) rotate(90deg);
  }
  #scene {
    width: min(100vh, calc(100vw * 16 / 9));
    height: min(100vw, calc(100vh * 9 / 16));
  }
}
