/* ============================================================
   XTer · 无限可能 — Shell 样式
   负责：舞台、Loader、过渡层、导航件、颗粒
   场景自身样式在各 scenes/<name>/scene.css 中，作用域隔离
   ============================================================ */

:root {
  --ink: #0b0b10;
  --ui-fg: rgba(255, 255, 255, 0.92);
  --ui-dim: rgba(255, 255, 255, 0.45);
  --font-sans: 'Noto Sans SC', 'Space Grotesk', system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--ink);
}

body {
  font-family: var(--font-sans);
  color: var(--ui-fg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ---------- 舞台与场景 ---------- */

#stage { position: fixed; inset: 0; }

.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
}

.scene.is-active { visibility: visible; }

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

#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--ink);
}

.lx-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.06em;
  font-family: 'Archivo Black', sans-serif;
  font-size: clamp(3rem, 10vw, 7rem);
  letter-spacing: 0.02em;
  line-height: 1;
}

.lx { display: inline-block; }

.lx-inf {
  margin-left: 0.18em;
  background: linear-gradient(120deg, #7df9ff, #ff71ce);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.loader-sub {
  font-size: clamp(0.65rem, 1.6vw, 0.85rem);
  letter-spacing: 0.42em;
  color: var(--ui-dim);
}

/* ---------- 过渡层 ---------- */

#transition-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

.tr-wipe {
  position: absolute;
  top: -15%;
  left: -20%;
  width: 140%;
  height: 130%;
}

.tr-slat {
  position: absolute;
  top: -2%;
  width: 12.75%;
  height: 104%;
}

.tr-iris {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 170vmax;
  height: 170vmax;
  margin: -85vmax 0 0 -85vmax;
  border-radius: 50%;
}

.tr-bloom-circle {
  position: absolute;
  width: 90vmax;
  height: 90vmax;
  margin: -45vmax 0 0 -45vmax;
  border-radius: 50%;
}

.tr-glitch-base { position: absolute; inset: 0; opacity: 0; }

.tr-glitch-bar {
  position: absolute;
  left: 0;
  width: 100%;
  opacity: 0;
}

/* ---------- 颗粒 ---------- */

#grain {
  position: fixed;
  inset: -60%;
  width: 220%;
  height: 220%;
  pointer-events: none;
  z-index: 60;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 7s steps(10) infinite;
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -8%); }
  20% { transform: translate(-13%, 3%); }
  30% { transform: translate(6%, -10%); }
  40% { transform: translate(-4%, 12%); }
  50% { transform: translate(-11%, 6%); }
  60% { transform: translate(12%, 0); }
  70% { transform: translate(0, 10%); }
  80% { transform: translate(3%, 13%); }
  90% { transform: translate(-8%, 8%); }
}

/* ---------- 导航点 ---------- */

#dots {
  position: fixed;
  right: clamp(12px, 2.4vw, 26px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 15px;
  mix-blend-mode: difference;
}

.dot {
  position: relative;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--ui-dim);
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.dot:hover { transform: scale(1.5); border-color: #fff; }

.dot.is-active {
  background: #fff;
  border-color: #fff;
  transform: scale(1.35);
}

.dot-label {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  white-space: nowrap;
  color: #fff;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.dot:hover .dot-label,
.dot.is-active .dot-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ---------- 计数器与提示 ---------- */

#counter {
  position: fixed;
  left: clamp(14px, 2.6vw, 30px);
  bottom: clamp(14px, 3vw, 28px);
  z-index: 70;
  font-family: 'Space Grotesk', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  color: var(--ui-dim);
  mix-blend-mode: difference;
}

/* ---------- 首页滑动提示（显式，平台感知） ---------- */

#hint {
  position: fixed;
  left: 50%;
  bottom: clamp(20px, 3.6vw, 36px);
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  mix-blend-mode: difference;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
  pointer-events: none;
}

#hint.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease;
  animation: hint-float 2.6s ease-in-out infinite;
}

@keyframes hint-float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-6px); }
}

.hint-text {
  font-size: 0.92rem;
  letter-spacing: 0.32em;
  padding-left: 0.32em;
  color: #fff;
  white-space: nowrap;
}

.hint-text--touch { display: none; }

/* 桌面端：鼠标滚轮图标 */
.hint-mouse {
  position: relative;
  width: 22px;
  height: 35px;
  border: 2px solid #fff;
  border-radius: 12px;
}

.hint-mouse i {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 4px;
  height: 7px;
  margin-left: -2px;
  border-radius: 2px;
  background: #fff;
  animation: hint-wheel 1.7s ease-in-out infinite;
}

@keyframes hint-wheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(13px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* 触屏端：上滑手势箭头 */
.hint-swipe {
  display: none;
  flex-direction: column;
  align-items: center;
}

.hint-swipe i {
  width: 13px;
  height: 13px;
  margin-top: -4px;
  border-top: 2.5px solid #fff;
  border-left: 2.5px solid #fff;
  transform: rotate(45deg);
  animation: hint-swipe-up 1.5s ease-in-out infinite;
}

.hint-swipe i:first-child { margin-top: 0; }
.hint-swipe i:nth-child(2) { animation-delay: 0.15s; }
.hint-swipe i:nth-child(3) { animation-delay: 0.3s; }

@keyframes hint-swipe-up {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

@media (pointer: coarse) {
  #hint .hint-mouse, #hint .hint-text--fine { display: none; }
  #hint .hint-swipe { display: flex; }
  #hint .hint-text--touch { display: inline; }
}

/* ---------- 响应式 ---------- */

@media (max-width: 768px) {
  #dots { gap: 12px; }
  .dot { width: 9px; height: 9px; }
  .dot-label { display: none; }
  #counter { font-size: 0.66rem; }
  .hint-text { font-size: 0.78rem; letter-spacing: 0.26em; }
}

/* ---------- 降低动态偏好 ---------- */

@media (prefers-reduced-motion: reduce) {
  #grain { animation: none; }
  #hint, .hint-mouse i, .hint-swipe i { animation: none !important; }
}
