:root {
  --bg: #050816;
  --bg-soft: #0b1020;
  --accent: #ff9a76;
  --accent-soft: rgba(255, 154, 118, 0.2);
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --border-subtle: rgba(148, 163, 184, 0.3);
  --radius-lg: 18px;
  --radius-full: 999px;
  --shadow-soft: 0 24px 80px rgba(15, 23, 42, 0.85);
  --shadow-soft-up: 0 -20px 60px rgba(15, 23, 42, 0.8);
  --transition-fast: 180ms ease-out;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  padding: 0;
  margin: 0;
  height: 100%;
}

body {
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #111827, #020617 55%);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}

.background-gradient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 0%, rgba(248, 113, 113, 0.2), transparent 55%),
    radial-gradient(circle at 90% 10%, rgba(96, 165, 250, 0.16), transparent 60%),
    radial-gradient(circle at 50% 100%, rgba(56, 189, 248, 0.2), transparent 50%);
  filter: blur(10px);
  opacity: 0.9;
  z-index: -1;
}

/* Load screen */
.load-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top, #111827, #020617 55%);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.load-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.load-content {
  width: min(320px, 100%);
  text-align: center;
}

.load-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 20px;
  border: 3px solid rgba(148, 163, 184, 0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: load-spin 0.9s linear infinite;
}

@keyframes load-spin {
  to { transform: rotate(360deg); }
}

.load-status {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.load-bar {
  height: 6px;
  background: rgba(15, 23, 42, 0.95);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.load-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #fecaca, #fb7185);
  border-radius: var(--radius-full);
  transition: width 0.25s ease;
}

/* Gate screen (password + audio toggle) */
.gate-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top, #111827, #020617 55%);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gate-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body.gate-unlocked .gate-screen {
  display: none;
}

.gate-card {
  width: min(420px, 100%);
  padding: 32px 28px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.85);
  text-align: center;
}

.gate-title {
  font-size: 1.5rem;
  margin: 0 0 6px;
  letter-spacing: 0.02em;
}

.gate-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.gate-navigate-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 28px;
  opacity: 0.85;
}

.gate-step {
  margin-bottom: 20px;
}

.gate-step-hear {
  margin-top: 8px;
}

.gate-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 8px 0 0 62px;
  text-align: left;
}

.gate-step-password {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
}

.gate-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: left;
}

.gate-input {
  width: 100%;
  padding: 12px 16px;
  font: inherit;
  font-size: 1rem;
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 12px;
  margin-bottom: 8px;
  transition: border-color var(--transition-fast), opacity var(--transition-fast);
}

.gate-input:focus {
  outline: none;
  border-color: var(--accent);
}

.gate-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gate-error {
  font-size: 0.85rem;
  color: #f87171;
  margin: 0 0 12px;
  min-height: 1.4em;
}

.gate-btn {
  width: 100%;
  padding: 12px 20px;
}

.gate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Toggle switch */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  user-select: none;
}

.toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.toggle-slider {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: var(--radius-full);
  transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.toggle-input:checked + .toggle-slider {
  background: linear-gradient(135deg, #fecaca, #fb7185);
  border-color: rgba(248, 113, 113, 0.6);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9);
}

.toggle-input:checked + .toggle-slider::after {
  transform: translateX(22px);
  background: #0b1120;
}

.toggle-input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.toggle-text {
  font-size: 0.95rem;
  color: var(--text-main);
}

.deck {
  position: relative;
  width: min(100%);
  /* Use small viewport height on mobile so header stays visible with browser UI */
  height: min(900px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  padding: 12px 16px 10px;
}

.deck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
  flex-shrink: 0;
}

.deck-title h1 {
  font-size: 1.5rem;
  margin: 2px 0 0;
  letter-spacing: 0.03em;
}

.deck-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.17em;
  color: var(--text-muted);
}

.deck-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #f97373, #fb7185);
  box-shadow: 0 0 0 6px rgba(248, 113, 113, 0.18);
}

.deck-progress {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  /* background: linear-gradient(120deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.9)); */
  /* border: 1px solid rgba(148, 163, 184, 0.5); */
}

.deck-progress #current-slide {
  font-weight: 600;
  color: var(--text-main);
}

.deck-progress .divider {
  opacity: 0.6;
}

.slides {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 14px 0 10px;
  overflow: hidden;
  border-radius: 24px;
  padding: 16px 20px 14px;
}

.slides:focus{
  outline: none;
}

.slide {
  position: absolute;
  inset: 0;
  padding: 12px 4px 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  transform: translateX(16px) scale(0.985);
  filter: blur(4px);
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast),
    filter var(--transition-fast);
}

.slide.is-active {
  opacity: 1;
  transform: translateX(0) scale(1);
  filter: blur(0);
}

.slide.exit-left {
  opacity: 0;
  transform: translateX(-24px) scale(0.98);
}

.slide.exit-right {
  opacity: 0;
  transform: translateX(24px) scale(0.98);
}

.slide h2 {
  font-size: 1.9rem;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.slide p {
  max-width: 52rem;
  width: 100%;
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 0.98rem;
  text-align: center;
  flex-shrink: 0;
}

.slide p + p {
  margin-top: 8px;
}

.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.21em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.accent {
  color: #fbbf77;
  font-weight: 500;
}

.hint {
  font-size: 0.8rem;
  margin-top: 22px;
  /* color: rgba(148, 163, 184, 0.9); */
}

.deck-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 4px 2px;
  flex-shrink: 0;
}


/* Volume slider */
.volume-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 140px;
}

.volume-icon {
  font-size: 1rem;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  outline: none;
  min-width: 60px;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fecaca, #fb7185);
  border: 1px solid rgba(15, 23, 42, 0.9);
  box-shadow: 0 2px 8px rgba(248, 113, 113, 0.4);
  cursor: pointer;
  margin-top: 0;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fecaca, #fb7185);
  border: 1px solid rgba(15, 23, 42, 0.9);
  box-shadow: 0 2px 8px rgba(248, 113, 113, 0.4);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.volume-slider::-webkit-slider-thumb:hover,
.volume-slider::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 12px rgba(248, 113, 113, 0.5);
}

.volume-slider:focus-visible {
  outline: none;
}

.volume-slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.volume-slider:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Touch-friendly: larger hit area on small screens */
@media (max-width: 768px) {
  .volume-wrap {
    flex: 1 1 100%;
    max-width: 180px;
    min-height: 44px;
    justify-content: center;
  }

  .volume-slider {
    flex: 1;
    min-width: 80px;
    height: 8px;
  }

  .volume-slider::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }

  .volume-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
  }
}

button {
  font: inherit;
}

.primary-btn,
.ghost-btn {
  border-radius: var(--radius-full);
  padding: 7px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast);
}

.primary-btn {
  background: radial-gradient(circle at 30% 20%, #fecaca, #fb7185);
  color: #0b1120;
  font-weight: 600;
  box-shadow:
    0 12px 30px rgba(248, 113, 113, 0.55),
    0 0 0 1px rgba(15, 23, 42, 0.9);
}

.primary-btn:hover {
  transform: translateY(-0.5px);
  box-shadow:
    0 16px 40px rgba(248, 113, 113, 0.7),
    0 0 0 1px rgba(15, 23, 42, 0.9);
}

.primary-btn:active {
  transform: translateY(0.5px) scale(0.99);
  box-shadow:
    0 8px 20px rgba(248, 113, 113, 0.5),
    0 0 0 1px rgba(15, 23, 42, 0.9);
}

.ghost-btn {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.6);
}

.ghost-btn:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(248, 113, 113, 0.8);
  color: var(--text-main);
}

.ghost-btn:active {
  transform: translateY(0.5px) scale(0.99);
}

.tip {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tip::before {
  content: "⌨";
  margin-right: 6px;
  opacity: 0.7;
}

dialog {
  border: none;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.95));
  backdrop-filter: blur(10px);
}

.dialog-content {
  width: min(560px, 100vw - 40px);
  margin: auto;
  background: linear-gradient(150deg, #020617, #020617);
  border-radius: 24px;
  /* border: 1px solid rgba(148, 163, 184, 0.45); */
  padding: 22px 24px 20px;
  color: var(--text-main);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.95);
}

.dialog-content h2 {
  margin-top: 0;
  margin-bottom: 10px;
}

.dialog-content p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.dialog-content p + p {
  margin-top: 8px;
}

.dialog-note {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px dashed rgba(148, 163, 184, 0.6);
  font-size: 0.82rem;
}

.dialog-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  body {
    padding: 12px;
    align-items: flex-start;
  }

  .deck {
    /* 100svh = visible viewport when browser UI is shown (header stays visible) */
    height: min(900px, calc(100svh - 24px));
    max-height: calc(100svh - 24px);
    padding: 14px 14px 12px;
    border-radius: 24px;
  }

  @supports not (height: 100svh) {
    .deck {
      height: min(900px, calc(100vh - 24px));
      max-height: calc(100vh - 24px);
    }
  }

  .deck-header {
    padding-inline: 2px;
  }

  .deck-title h1 {
    font-size: 1.3rem;
  }

  .slides {
    padding: 12px 14px 14px;
    margin: 8px 0 6px;
  }

  .slide h2 {
    font-size: 1.45rem;
  }
}

@media (max-width: 480px) {
  .deck {
    height: min(900px, calc(100svh - 16px));
    max-height: calc(100svh - 16px);
    padding: 10px 12px 8px;
  }

  @supports not (height: 100svh) {
    .deck {
      height: min(900px, calc(100vh - 16px));
      max-height: calc(100vh - 16px);
    }
  }

  .deck-footer {
    flex-direction: row;
    justify-content: center;
    gap: 8px;
  }

  .tip {
    font-size: 0.7rem;
  }

  .slide {
    padding: 8px 4px 20px;
  }

  .image-item img,
  .image-item video {
    max-height: min(280px, 35vh);
  }
}

.image-container {
  max-height: min(400px, 45vh);
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 16px;
  padding: 12px 0;
  box-sizing: border-box;
  flex-shrink: 0;
}

.image-item {
  text-align: center;
  flex-shrink: 0;
}

/* Images: contain within viewport so full image is visible */
.image-item img {
  max-height: min(320px, 38vh);
  width: auto;
  max-width: min(100%, 320px);
  height: auto;
  display: block;
  border-radius: 8px;
  object-fit: contain;
}

.image-item video {
  max-height: min(320px, 38vh);
  width: auto;
  max-width: min(100%, 320px);
  height: auto;
  display: block;
  border-radius: 8px;
  object-fit: contain;
}


/* Caption */
.caption {
  font-size: 0.85rem;
  color: #555;
  margin-top: 6px;
}

.highlight{
  color: rgba(248, 113, 113, 0.6);
}