:root {
  --bg: #050505;
  --fg: #ffffff;
  --red: #ff2b2b;
  --red-dark: #d51d1d;
  --button-size: 68px;
  --desktop-overlay: rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  touch-action: none;
}

#app,
#desktopFallback {
  position: fixed;
  inset: 0;
}

/* Desktop-only fallback */
#desktopFallback {
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

body.is-desktop #desktopFallback {
  display: flex;
}

body.is-desktop #app {
  display: none;
}

.desktop-bg {
  position: absolute;
  inset: 0;
  background-image: var(
    --desktop-bg-image,
    linear-gradient(135deg, #101010 0%, #1b1b1b 40%, #0b0b0b 100%)
  );
  background-size: cover;
  background-position: center;
  filter: saturate(0.8) contrast(1.05);
}

.desktop-text {
  position: relative;
  z-index: 1;
  background: var(--desktop-overlay);
  padding: 18px 22px;
  border-radius: 12px;
  font-size: 18px;
  letter-spacing: 0.4px;
}

/* Player */
#player {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
}

.video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 240ms ease;
  pointer-events: none;
}

.video.is-active {
  opacity: 1;
}

#transitionCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

#transitionCanvas.is-active {
  opacity: 1;
}

.loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  color: #f0f0f0;
  font-size: 14px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.loading.is-visible {
  opacity: 1;
}

/* Intro screen */
.intro {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  transition: opacity 500ms ease;
  z-index: 5;
}

.intro.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.intro-content {
  text-align: center;
  max-width: 280px;
  padding: 20px;
}

.intro-text {
  margin: 0 0 18px 0;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: 0.2px;
}

.start-btn {
  border: none;
  background: #ffffff;
  color: #000;
  font-size: 16px;
  padding: 12px 24px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 0.4px;
  transition: transform 120ms ease, background 120ms ease;
}

.start-btn:active {
  transform: scale(0.98);
  background: #f2f2f2;
}

/* Advance button */
.next-btn {
  position: absolute;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  width: var(--button-size);
  height: var(--button-size);
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 30% 30%, #ff5a5a, var(--red));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 120ms ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body.started .next-btn {
  opacity: 1;
  pointer-events: auto;
}

.next-btn:active {
  transform: translateX(-50%) scale(0.94);
}

.next-btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.2);
}

@media (max-width: 360px) {
  :root {
    --button-size: 60px;
  }

  .intro-text {
    font-size: 16px;
  }
}
