:root {
  --bg: #0a0a14;
  --bg-elev: #14142a;
  --fg: #f5f5fa;
  --fg-muted: #8b8ba8;
  --accent-1: #ff4e88;
  --accent-2: #48dbfb;
  --accent-3: #9b59ff;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --gradient: linear-gradient(135deg, #ff4e88 0%, #ff9f43 25%, #feca57 50%, #48dbfb 75%, #9b59ff 100%);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255, 78, 136, 0.12), transparent 40%),
    radial-gradient(circle at 80% 30%, rgba(72, 219, 251, 0.1), transparent 40%),
    radial-gradient(circle at 50% 90%, rgba(155, 89, 255, 0.12), transparent 40%);
  background-attachment: fixed;
}

.container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding-top: 24px;
  padding-right: max(20px, env(safe-area-inset-right));
  padding-bottom: max(80px, calc(40px + env(safe-area-inset-bottom)));
  padding-left: max(20px, env(safe-area-inset-left));
}

header.hero {
  text-align: center;
  padding: 16px 0 28px;
}

header.hero .cover {
  width: 100%;
  border-radius: var(--radius);
  display: block;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  background: var(--bg-elev);
  aspect-ratio: 8 / 5;
  object-fit: cover;
}

header.hero h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 2px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
}

header.hero p {
  color: var(--fg-muted);
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.section {
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.section h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section h2 .tag {
  font-size: 0.7rem;
  color: var(--accent-2);
  border: 1px solid var(--accent-2);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 1px;
}

.section p.desc {
  color: var(--fg-muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

video {
  width: 100%;
  border-radius: 12px;
  display: block;
  background: #000;
  aspect-ratio: 16 / 9;
}

.video-fallback {
  display: none;
  padding: 40px 20px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
}

.video-fallback .hint {
  font-size: 0.75rem;
  color: var(--fg-muted);
  opacity: 0.7;
}

.nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.nav-card {
  display: block;
  background: linear-gradient(135deg, rgba(255, 78, 136, 0.15), rgba(155, 89, 255, 0.15));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 18px 14px;
  color: var(--fg);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease;
  min-height: 90px;
  position: relative;
  overflow: hidden;
}

.nav-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--gradient);
}

.nav-card:active {
  transform: scale(0.97);
  border-color: var(--accent-2);
}

.nav-card .label {
  font-size: 0.7rem;
  color: var(--fg-muted);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.nav-card .title {
  font-size: 1rem;
  font-weight: 700;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(72, 219, 251, 0.12);
  color: var(--accent-2);
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.status .dot {
  width: 6px;
  height: 6px;
  background: var(--accent-2);
  border-radius: 50%;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.6); }
}

footer {
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.75rem;
  padding: 24px 0 8px;
  letter-spacing: 2px;
}

footer .heart {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 16px;
  padding: 6px 0;
}

.back-link:active { color: var(--accent-2); }

.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.gallery img {
  width: 100%;
  border-radius: 12px;
  display: block;
  background: rgba(255, 255, 255, 0.03);
}

@media (min-width: 480px) {
  .gallery {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================
   App Loader  Arknights-inspired overlay
   ============================================================ */

#app-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0a0a14;
  color: #f5f5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow: hidden;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "PingFang SC", "Microsoft YaHei", monospace;
  animation: loader-fade-in 0.25s ease both;
}

#app-loader::before,
#app-loader::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(243, 200, 106, 0.55), transparent);
  pointer-events: none;
  will-change: transform;
}

#app-loader::before {
  top: 18%;
  animation: loader-scan 2.4s linear infinite;
}

#app-loader::after {
  bottom: 18%;
  animation: loader-scan 3.2s linear infinite reverse;
  opacity: 0.45;
}

#app-loader .loader-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  pointer-events: none;
}

.loader-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 1;
  padding: 6px 2px;
}

.loader-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 0 solid #f3c86a;
  pointer-events: none;
}
.loader-corner.tl { top: -6px; left: -6px; border-top-width: 2px; border-left-width: 2px; }
.loader-corner.tr { top: -6px; right: -6px; border-top-width: 2px; border-right-width: 2px; }
.loader-corner.bl { bottom: -6px; left: -6px; border-bottom-width: 2px; border-left-width: 2px; }
.loader-corner.br { bottom: -6px; right: -6px; border-bottom-width: 2px; border-right-width: 2px; }

.loader-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  letter-spacing: 2px;
}

.loader-top .tag-sys {
  color: #f3c86a;
  border: 1px solid rgba(243, 200, 106, 0.8);
  padding: 2px 8px;
  background: rgba(243, 200, 106, 0.08);
  font-weight: 700;
}

.loader-top .loader-node {
  color: #6b6b85;
  font-variant-numeric: tabular-nums;
}

.loader-title {
  text-align: center;
  padding: 2px 0;
}

.loader-title .zh {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 8px;
  padding-left: 8px;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #f3c86a 0%, #48dbfb 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.loader-title .en {
  font-size: 0.6rem;
  color: #6b6b85;
  letter-spacing: 4px;
  margin-top: 4px;
}

.loader-alert {
  border-left: 2px solid #f3c86a;
  background: rgba(243, 200, 106, 0.06);
  padding: 10px 12px;
  color: #f3c86a;
  line-height: 1.55;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
}

.loader-alert .row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.loader-alert .icon {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid #f3c86a;
  transform: rotate(45deg);
  flex-shrink: 0;
}

.loader-alert .icon::after {
  content: "!";
  position: absolute;
  inset: 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #f3c86a;
}

.loader-alert .primary {
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 1px;
}

.loader-alert .secondary {
  color: #a88a4a;
  font-size: 0.72rem;
  margin-top: 2px;
  padding-left: 22px;
  letter-spacing: 0.5px;
}

.loader-bar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.loader-bar-wrap {
  flex: 1;
  position: relative;
  height: 14px;
  background: rgba(255, 255, 255, 0.04);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  overflow: hidden;
}

.loader-bar-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 8px,
    rgba(255, 255, 255, 0.035) 8px 9px
  );
  pointer-events: none;
  z-index: 2;
}

.loader-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #48dbfb 0%, #f3c86a 100%);
  box-shadow: 0 0 12px rgba(72, 219, 251, 0.6);
  transition: width 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.loader-bar-fill::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 8px #f3c86a;
}

.loader-percent-wrap {
  display: flex;
  align-items: baseline;
  gap: 2px;
  color: #f3c86a;
  font-weight: 700;
  min-width: 68px;
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
}

.loader-percent {
  font-size: 1.7rem;
  letter-spacing: 1px;
  line-height: 1;
}

.loader-percent-unit {
  font-size: 0.82rem;
  opacity: 0.6;
}

.loader-bottom {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: #6b6b85;
}

.loader-bottom .loader-count {
  color: #48dbfb;
  font-variant-numeric: tabular-nums;
}

.loader-slow-hint {
  text-align: center;
  font-size: 0.72rem;
  color: #ff7a7a;
  letter-spacing: 1px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.4s ease, max-height 0.4s ease;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
}

.loader-slow-hint.visible {
  opacity: 1;
  max-height: 40px;
  padding-top: 4px;
}

/* ---------- Loader failure panel ---------- */

.loader-fail {
  margin-top: 14px;
  border: 1px solid rgba(255, 122, 122, 0.5);
  background: rgba(255, 60, 60, 0.08);
  padding: 12px 14px 14px;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #ffb0b0;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.3s ease;
}

.loader-fail.visible {
  opacity: 1;
  max-height: 400px;
}

.loader-fail-title {
  color: #ff7a7a;
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.loader-fail-sub {
  color: #c88a8a;
  font-size: 0.72rem;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.loader-fail-list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  max-height: 140px;
  overflow-y: auto;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.7rem;
  color: #e0b6b6;
  line-height: 1.5;
}

.loader-fail-list li {
  padding: 3px 0;
  border-bottom: 1px dashed rgba(255, 122, 122, 0.18);
  word-break: break-all;
}

.loader-fail-list li:last-child { border-bottom: 0; }

.loader-fail-list code {
  color: #ffcccc;
  font-family: inherit;
}

.loader-fail-list .reason {
  color: #a66f6f;
  margin-left: 6px;
  font-size: 0.66rem;
}

.loader-fail-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.loader-fail-actions button {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f5f5fa;
  font-size: 0.74rem;
  letter-spacing: 2px;
  cursor: pointer;
  font-family: inherit;
  border-radius: 0;
  transition: background 0.2s, border-color 0.2s;
}

.loader-fail-actions button:active { transform: scale(0.96); }

.loader-fail-actions .loader-retry-btn {
  border-color: #48dbfb;
  color: #48dbfb;
  background: rgba(72, 219, 251, 0.08);
}

.loader-fail-actions .loader-retry-btn:hover {
  background: rgba(72, 219, 251, 0.2);
}

.loader-fail-actions .loader-force-btn {
  color: #c88a8a;
}

.loader-fail-actions .loader-force-btn:hover {
  color: #ffb0b0;
  border-color: rgba(255, 160, 160, 0.4);
}

#app-loader.loader-done {
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

@keyframes loader-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes loader-scan {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  #app-loader::before,
  #app-loader::after {
    animation: none;
    opacity: 0.3;
  }
}

/* ============================================================
   Responsive  tablet / foldable (wider screens)
   ============================================================ */

@media (min-width: 720px) {
  .container {
    max-width: 760px;
  }
  header.hero h1 {
    font-size: 1.9rem;
  }
  header.hero p {
    font-size: 0.95rem;
  }
  .section {
    padding: 22px 22px 24px;
  }
  .section h2 {
    font-size: 1.1rem;
  }
  .nav-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .gallery {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .loader-panel {
    max-width: 520px;
  }
  .loader-title .zh {
    font-size: 1.9rem;
    letter-spacing: 10px;
  }
  .loader-title .en {
    font-size: 0.7rem;
  }
}

/* ============================================================
   Responsive  landscape phones (short viewport)
   ============================================================ */

@media (orientation: landscape) and (max-height: 600px) {
  .container {
    padding-top: 14px;
    padding-bottom: max(32px, calc(16px + env(safe-area-inset-bottom)));
    max-width: 820px;
  }
  header.hero {
    padding: 6px 0 16px;
  }
  header.hero .cover {
    aspect-ratio: auto;
    max-height: 52vh;
    width: auto;
    max-width: 100%;
    margin: 0 auto 14px;
  }
  header.hero h1 {
    font-size: 1.35rem;
  }
  header.hero p {
    font-size: 0.82rem;
  }
  .section {
    padding: 14px 14px 16px;
    margin-bottom: 14px;
  }
  .section h2 {
    font-size: 0.95rem;
    margin-bottom: 8px;
  }
  .section p.desc {
    font-size: 0.8rem;
    margin-bottom: 10px;
  }
  video {
    aspect-ratio: auto;
    max-height: 70vh;
  }
  .video-fallback {
    aspect-ratio: auto;
    min-height: 140px;
    padding: 20px;
  }
  .nav-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .nav-card {
    padding: 14px 12px;
    min-height: 72px;
  }
  .gallery {
    grid-template-columns: 1fr 1fr 1fr;
  }

  #app-loader {
    padding: max(14px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  }
  .loader-panel {
    max-width: 640px;
    gap: 10px;
  }
  .loader-title {
    padding: 0;
  }
  .loader-title .zh {
    font-size: 1.2rem;
    letter-spacing: 5px;
    padding-left: 5px;
  }
  .loader-title .en {
    font-size: 0.55rem;
    letter-spacing: 3px;
    margin-top: 2px;
  }
  .loader-alert {
    padding: 7px 10px;
    line-height: 1.45;
  }
  .loader-alert .primary {
    font-size: 0.76rem;
  }
  .loader-alert .secondary {
    font-size: 0.66rem;
    padding-left: 22px;
  }
  .loader-bar-row {
    gap: 10px;
  }
  .loader-bar-wrap {
    height: 11px;
  }
  .loader-percent {
    font-size: 1.3rem;
  }
  .loader-percent-unit {
    font-size: 0.72rem;
  }
  .loader-bottom {
    font-size: 0.6rem;
  }
  #app-loader::before { top: 12%; }
  #app-loader::after { bottom: 12%; }
}

/* ============================================================
   Responsive  very small phones (legacy iPhone SE etc.)
   ============================================================ */

@media (max-width: 340px) {
  header.hero h1 {
    font-size: 1.4rem;
  }
  .section {
    padding: 14px;
  }
  .loader-title .zh {
    font-size: 1.3rem;
    letter-spacing: 5px;
    padding-left: 5px;
  }
  .loader-panel {
    gap: 14px;
  }
  .loader-alert .primary {
    font-size: 0.78rem;
  }
}

/* ============================================================
   Deck  PPT-style single-screen paging
   ============================================================ */

.deck {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 1;
}

.deck-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.55s cubic-bezier(0.77, 0, 0.175, 1);
  will-change: transform;
}

.slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-right: max(20px, env(safe-area-inset-right));
  padding-bottom: max(96px, calc(72px + env(safe-area-inset-bottom)));
  padding-left: max(20px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.slide-inner {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}

.slide-card {
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 22px 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.slide-card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.slide-card h2 .tag {
  font-size: 0.7rem;
  color: var(--accent-2);
  border: 1px solid var(--accent-2);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 1px;
}
.slide-card p.desc {
  color: var(--fg-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* Hero slide */
.slide-hero .slide-inner {
  align-items: center;
  text-align: center;
  gap: 14px;
}
.slide-hero .cover {
  width: 100%;
  max-width: 360px;
  border-radius: var(--radius);
  display: block;
  box-shadow: var(--shadow);
  background: var(--bg-elev);
  aspect-ratio: 8 / 5;
  object-fit: cover;
}
.slide-hero h1 {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 6px;
  padding-left: 6px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-top: 4px;
}
.slide-hero .subtitle {
  color: var(--fg-muted);
  font-size: 0.78rem;
  letter-spacing: 4px;
  margin-top: -4px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* Video slide: fills the entire stage */
.slide-video {
  padding: 0 !important;
  background: #000;
}
.slide-video video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
.slide-video .video-missing {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--fg-muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 30px;
}
.slide-video .video-missing .hint {
  font-size: 0.75rem;
  opacity: 0.7;
}
.slide-video .mute-toggle {
  position: absolute;
  top: max(20px, calc(20px + env(safe-area-inset-top)));
  right: max(20px, calc(20px + env(safe-area-inset-right)));
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.76rem;
  letter-spacing: 1px;
  font-family: inherit;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}
.slide-video .mute-toggle:active { transform: scale(0.95); }

/* End slide (thank-you card for sub-pages) */
.slide-end .slide-inner {
  align-items: center;
  text-align: center;
  gap: 8px;
}
.slide-end .end-title {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 10px;
  padding-left: 10px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
}
.slide-end .end-sub {
  color: var(--fg-muted);
  font-size: 0.88rem;
  letter-spacing: 2px;
  margin-bottom: 22px;
  line-height: 1.7;
}
.slide-end .end-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.end-btn {
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 1.5px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.end-btn:active { transform: scale(0.97); }
.end-btn.primary {
  border-color: var(--accent-2);
  color: var(--accent-2);
  background: rgba(72, 219, 251, 0.08);
}

/* Gallery inside slide */
.slide .gallery {
  max-height: 58vh;
  overflow: hidden;
}
.slide .gallery img {
  width: 100%;
  border-radius: 12px;
  display: block;
  background: rgba(255, 255, 255, 0.03);
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

/* Deck bottom navigation */
.deck-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px max(20px, env(safe-area-inset-right)) max(14px, calc(10px + env(safe-area-inset-bottom))) max(20px, env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  pointer-events: none;
  z-index: 10;
}
.deck-nav > * { pointer-events: auto; }

.deck-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(20, 20, 42, 0.75);
  color: var(--fg);
  font-size: 1.1rem;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s, border-color 0.18s, opacity 0.2s;
  font-family: inherit;
  padding: 0;
  line-height: 1;
}
.deck-btn:active { transform: scale(0.9); border-color: var(--accent-2); }
.deck-btn:disabled { opacity: 0.28; pointer-events: none; }
.deck-btn.deck-next { border-color: rgba(72, 219, 251, 0.45); color: var(--accent-2); }

.deck-counter {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--fg-muted);
  letter-spacing: 3px;
  background: rgba(20, 20, 42, 0.7);
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-variant-numeric: tabular-nums;
}
.deck-counter .deck-cur { color: var(--accent-2); font-weight: 700; }

/* Tap hint on first slide */
.deck[data-index="0"] .tap-hint {
  opacity: 0;
  animation: tap-hint-pulse 2.4s ease-in-out 1.8s infinite;
}
.tap-hint {
  position: absolute;
  bottom: calc(92px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--fg-muted);
  letter-spacing: 4px;
  pointer-events: none;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  opacity: 0;
  white-space: nowrap;
}
@keyframes tap-hint-pulse {
  0%, 100% { opacity: 0; transform: translate(-50%, 6px); }
  40%, 70% { opacity: 0.8; transform: translate(-50%, 0); }
}

/* Back-to-index corner link for sub pages */
.corner-back {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 2px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(20, 20, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 11;
  pointer-events: auto;
}
.corner-back:active { color: var(--accent-2); }

/* Landscape phones: slightly tighter slides */
@media (orientation: landscape) and (max-height: 600px) {
  .slide {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(80px, calc(60px + env(safe-area-inset-bottom)));
  }
  .slide-hero .cover { max-width: 40vh; }
  .slide-hero h1 { font-size: 1.6rem; letter-spacing: 5px; }
  .slide-card { padding: 16px 18px 18px; }
  .slide-end .end-title { font-size: 1.5rem; letter-spacing: 6px; padding-left: 6px; }
  .slide .gallery { max-height: 72vh; }
  .deck-nav { padding-top: 10px; padding-bottom: max(10px, calc(6px + env(safe-area-inset-bottom))); }
  .deck-btn { width: 40px; height: 40px; font-size: 1rem; }
  .tap-hint { bottom: calc(70px + env(safe-area-inset-bottom)); }
}

/* Tablet / foldable: expand inner width */
@media (min-width: 720px) {
  .slide-inner { max-width: 560px; }
  .slide-hero .cover { max-width: 440px; }
  .slide-hero h1 { font-size: 2.6rem; letter-spacing: 10px; padding-left: 10px; }
  .slide-end .end-title { font-size: 2.6rem; letter-spacing: 14px; padding-left: 14px; }
}

/* ============================================================
   Story  scene slides (image + typewriter caption)
   ============================================================ */

.slide-scene {
  padding: 0 !important;
  background: #000;
}

.slide-scene .scene-blur {
  position: absolute;
  top: -6%;
  left: -6%;
  width: 112%;
  height: 112%;
  object-fit: cover;
  filter: blur(28px) brightness(0.55) saturate(1.1);
  z-index: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.slide-scene .scene-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.slide-scene .scene-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(0, 0, 0, 0) 25%,
    rgba(0, 0, 0, 0) 55%,
    rgba(0, 0, 0, 0.75) 88%,
    rgba(0, 0, 0, 0.95) 100%
  );
  z-index: 2;
  pointer-events: none;
}

.slide-scene .scene-text,
.slide-text .scene-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 24px max(28px, env(safe-area-inset-right)) calc(100px + env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
  z-index: 3;
  text-align: center;
}

/* ---------- Text-only slides (white / black / intro) ---------- */

.slide-text {
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a14;
}

.slide-text .scene-text {
  position: relative;
  inset: auto;
  padding: 40px max(32px, env(safe-area-inset-right)) 40px max(32px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 760px;
}

.slide-text-white {
  background: #f4f1ea;
  color: #181820;
}

.slide-text-welcome {
  background:
    radial-gradient(circle at 20% 20%, rgba(243, 200, 106, 0.1), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(72, 219, 251, 0.08), transparent 45%),
    #0a0a14;
}

.slide-text-welcome .welcome-badge {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.7rem;
  letter-spacing: 3px;
  color: #f3c86a;
  border: 1px solid rgba(243, 200, 106, 0.5);
  padding: 4px 12px;
  margin-bottom: 24px;
  display: inline-block;
}

.slide-text-welcome .welcome-lines {
  font-family: "Noto Serif SC", "Source Han Serif CN", "Songti SC", "STSong", "SimSun", serif;
  font-size: 1.1rem;
  line-height: 2.2;
  letter-spacing: 2px;
  color: #f5f5fa;
  max-width: 560px;
}

.slide-text-welcome .welcome-lines .em {
  color: #f3c86a;
  font-weight: 700;
}

.slide-text-welcome .welcome-hint {
  margin-top: 28px;
  font-size: 0.78rem;
  color: #8b8ba8;
  letter-spacing: 2px;
  line-height: 1.8;
}

.slide-text-welcome .welcome-hint .arrow {
  color: #f3c86a;
}

/* ---------- Typewriter ---------- */

.typewriter {
  font-family: "Noto Serif SC", "Source Han Serif CN", "Songti SC", "STSong", "SimSun", serif;
  font-size: 1.18rem;
  line-height: 2;
  letter-spacing: 3px;
  color: #f5f5fa;
  white-space: pre-wrap;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.8);
  min-height: 1em;
  display: inline-block;
  text-align: center;
  max-width: 100%;
}

.typewriter.typing::after,
.typewriter.done::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  background: currentColor;
  margin-left: 4px;
  vertical-align: middle;
  animation: tw-caret 0.85s steps(1) infinite;
  opacity: 0.85;
}

.typewriter.done::after {
  opacity: 0.45;
}

@keyframes tw-caret {
  50% { opacity: 0; }
}

.typewriter-calligraphy {
  color: #181820;
  text-shadow: none;
  font-size: 1.4rem;
  line-height: 2.4;
  letter-spacing: 4px;
  font-style: italic;
  font-weight: 500;
  text-align: left;
  white-space: pre;
}

.typewriter-large {
  font-size: 1.4rem;
  letter-spacing: 4px;
}

/* Tap-to-continue hint (shown after typewriter done) */
.tap-next-hint {
  margin-top: 22px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.65rem;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.55);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.slide-text-white .tap-next-hint { color: rgba(24, 24, 32, 0.4); }

.slide.tw-done .tap-next-hint { opacity: 1; }

.tap-next-hint::before {
  content: "? ";
  margin-right: 4px;
  animation: tap-next-bounce 1.8s ease-in-out infinite;
  display: inline-block;
}

@keyframes tap-next-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.9; }
  50% { transform: translateY(2px); opacity: 0.4; }
}

/* ---------- Choice slide (??????????) ---------- */

.slide-choice {
  padding: 0 !important;
  background: #000;
  color: #e8e8ef;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-choice .choice-box {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "PingFang SC", "Microsoft YaHei", monospace;
  text-align: center;
  width: 100%;
  max-width: 480px;
  padding: 40px 24px;
  position: relative;
  z-index: 2;
}

.slide-choice .choice-prefix {
  font-size: 0.7rem;
  color: #f3c86a;
  letter-spacing: 4px;
  margin-bottom: 22px;
  border-top: 1px solid rgba(243, 200, 106, 0.3);
  border-bottom: 1px solid rgba(243, 200, 106, 0.3);
  padding: 6px 0;
  animation: choice-prefix-blink 1.6s steps(1) infinite;
}

@keyframes choice-prefix-blink {
  0%, 70% { opacity: 1; }
  75%, 85% { opacity: 0.25; }
  90%, 100% { opacity: 1; }
}

.slide-choice .choice-question {
  font-size: 1.2rem;
  letter-spacing: 3px;
  margin-bottom: 40px;
  color: #f5f5fa;
  line-height: 1.7;
  font-weight: 500;
}

.slide-choice .choice-options {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.slide-choice .choice-btn {
  padding: 14px 44px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f5f5fa;
  font-size: 1.1rem;
  letter-spacing: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
  position: relative;
}

.slide-choice .choice-btn.choice-yes {
  border-color: #ff4e4e;
  color: #ff8a8a;
  box-shadow: 0 0 0 0 rgba(255, 78, 78, 0.45);
  animation: choice-yes-pulse 1.6s ease-in-out infinite;
}

.slide-choice .choice-btn.choice-yes:active {
  background: rgba(255, 78, 78, 0.2);
  transform: scale(0.96);
}

@keyframes choice-yes-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 78, 78, 0.45); }
  50% { box-shadow: 0 0 0 14px rgba(255, 78, 78, 0); }
}

.slide-choice .choice-btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
  text-decoration: line-through;
  animation: none;
  color: #888;
}

.slide-choice .choice-hint {
  margin-top: 28px;
  color: #6b6b85;
  font-size: 0.68rem;
  letter-spacing: 4px;
  line-height: 1.6;
}

/* Scanline overlay for choice (atmosphere) */
.slide-choice::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0 2px,
    rgba(255, 255, 255, 0.03) 2px 3px
  );
  pointer-events: none;
  z-index: 1;
}

/* ---------- Blood splash transition ---------- */

.slide-bloody {
  padding: 0 !important;
  background: #000;
  overflow: hidden;
}

.slide-bloody .blood-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.slide-bloody .blood {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle at 48% 45%, #d60000 0%, #8a0000 55%, #3a0000 100%);
  border-radius: 50% 38% 62% 32% / 42% 58% 40% 55%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  filter: blur(0.5px);
  mix-blend-mode: screen;
}

.slide.is-active.slide-bloody .blood {
  animation: blood-splash 1.5s cubic-bezier(0.2, 0.75, 0.3, 1) forwards;
}

.slide-bloody .blood.b1 { --tx: -170px; --ty: -120px; --r: -18deg; animation-delay: 0s; }
.slide-bloody .blood.b2 { --tx:  150px; --ty: -130px; --r:  42deg; width: 110px; height: 110px; animation-delay: 0.05s; }
.slide-bloody .blood.b3 { --tx: -130px; --ty:  140px; --r: -30deg; width: 160px; height: 160px; animation-delay: 0.12s; }
.slide-bloody .blood.b4 { --tx:  180px; --ty:   80px; --r:  58deg; width: 120px; height: 120px; animation-delay: 0.18s; }
.slide-bloody .blood.b5 { --tx:    0px; --ty:    0px; --r:   0deg; width: 260px; height: 260px; animation-delay: 0.02s; }
.slide-bloody .blood.b6 { --tx:  -40px; --ty:  170px; --r: -50deg; width:  90px; height:  90px; animation-delay: 0.28s; }

@keyframes blood-splash {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(0);
    opacity: 0;
    filter: blur(6px);
  }
  12% {
    transform: translate(
      calc(-50% + var(--tx, 0px) * 0.35),
      calc(-50% + var(--ty, 0px) * 0.35)
    ) scale(0.95) rotate(calc(var(--r, 0deg) * 0.5));
    opacity: 1;
    filter: blur(0.5px);
  }
  100% {
    transform: translate(
      calc(-50% + var(--tx, 0px)),
      calc(-50% + var(--ty, 0px))
    ) scale(1.25) rotate(var(--r, 0deg));
    opacity: 0.85;
    filter: blur(0.5px);
  }
}

.slide-bloody .blood-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 60, 60, 0.55), transparent 50%);
  opacity: 0;
  pointer-events: none;
}

.slide.is-active.slide-bloody .blood-flash {
  animation: blood-flash 0.4s ease-out forwards;
}

@keyframes blood-flash {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* ---------- BGM toggle (top-right global) ---------- */

.bgm-toggle {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(20, 20, 42, 0.72);
  color: #f3c86a;
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  z-index: 20;
  padding: 0;
  transition: color 0.25s, border-color 0.25s, transform 0.15s;
  font-family: inherit;
}

.bgm-toggle:active { transform: scale(0.92); }

.bgm-toggle.playing {
  color: #48dbfb;
  border-color: rgba(72, 219, 251, 0.5);
}

.bgm-toggle.playing::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(72, 219, 251, 0.35);
  animation: bgm-ring 1.6s ease-out infinite;
  pointer-events: none;
}

@keyframes bgm-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* keep video-slide mute button away from bgm button */
.slide-video .mute-toggle {
  right: calc(max(14px, env(safe-area-inset-right)) + 52px);
}

/* ---------- Lightweight toast (used for BGM not-ready) ---------- */

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: rgba(14, 14, 28, 0.92);
  color: #f5f5fa;
  padding: 12px 22px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 200;
  font-size: 0.85rem;
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  max-width: calc(100% - 48px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ---------- Landscape adjustments for story slides ---------- */

@media (orientation: landscape) and (max-height: 600px) {
  .slide-scene .scene-text,
  .slide-text .scene-text {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
    padding-top: 16px;
  }
  .typewriter {
    font-size: 1rem;
    line-height: 1.8;
    letter-spacing: 2px;
  }
  .typewriter-calligraphy {
    font-size: 1.15rem;
    line-height: 2;
  }
  .slide-text-welcome .welcome-lines {
    font-size: 0.95rem;
    line-height: 1.9;
  }
  .slide-text-welcome .welcome-badge { margin-bottom: 14px; }
  .slide-choice .choice-question { font-size: 1.05rem; margin-bottom: 24px; }
  .slide-choice .choice-btn { padding: 10px 32px; font-size: 1rem; letter-spacing: 6px; }
  .slide-bloody .blood.b5 { width: 200px; height: 200px; }
}

@media (max-width: 340px) {
  .typewriter { font-size: 1rem; letter-spacing: 2px; }
  .typewriter-calligraphy { font-size: 1.2rem; }
  .slide-text-welcome .welcome-lines { font-size: 1rem; letter-spacing: 1px; }
  .slide-choice .choice-btn { padding: 12px 30px; letter-spacing: 5px; font-size: 1rem; }
}
