:root {
  --bg-deep: #07111f;
  --ink: rgba(252, 249, 240, 0.92);
  --ink-strong: #fffaf0;
  --muted: rgba(252, 249, 240, 0.58);
  --faint: rgba(252, 249, 240, 0.34);
  --line: rgba(255, 255, 255, 0.28);
  --line-strong: rgba(255, 255, 255, 0.42);
  --glass: rgba(8, 16, 26, 0.16);
  --glass-strong: rgba(8, 16, 26, 0.38);
  --violet: #a88cff;
  --violet-soft: rgba(168, 140, 255, 0.62);
  --gold: #ead591;
  --shadow: 0 22px 72px rgba(0, 0, 0, 0.28);
  --display: "Cormorant Garamond", "Times New Roman", serif;
  --ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--ui);
}

body[data-lang="zh"] {
  --display: "Noto Serif SC", "Songti SC", "STSong", serif;
  --ui: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button,
summary {
  cursor: pointer;
}

#app,
#scene {
  width: 100%;
  height: 100%;
  display: block;
}

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

.scene-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 54% 43%, transparent 0 42%, rgba(2, 7, 13, 0.16) 78%, rgba(2, 7, 13, 0.36) 100%),
    linear-gradient(to bottom, rgba(5, 10, 18, 0.24), transparent 30%, rgba(5, 10, 18, 0.24));
}

.shell {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.shell button,
.shell input,
.shell summary,
.shell details,
.proof-drawer {
  pointer-events: auto;
}

.eyebrow,
.kicker,
.meta-label,
.metric-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

.eyebrow {
  text-transform: none;
  letter-spacing: 0.14em;
}

p,
h1,
h2,
h3 {
  margin: 0;
}

.title-lockup {
  position: absolute;
  top: clamp(24px, 5vw, 62px);
  left: clamp(22px, 5vw, 64px);
  width: min(340px, calc(100vw - 44px));
  opacity: 0;
  animation: hudIn 900ms ease forwards 350ms;
}

.title-lockup h1 {
  margin-top: 7px;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(35px, 5vw, 62px);
  line-height: 0.92;
  letter-spacing: 0.16em;
  color: var(--ink-strong);
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.subtitle {
  margin-top: 11px;
  max-width: 290px;
  color: rgba(252, 249, 240, 0.68);
  font-size: 13px;
  line-height: 1.45;
  text-wrap: pretty;
}

.title-rule {
  margin-top: 24px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  color: var(--faint);
}

.title-rule::before {
  content: "";
  display: block;
  width: 38px;
  height: 1px;
  margin-top: 3px;
  background: var(--line-strong);
}

.title-rule span {
  width: 1px;
  height: 62px;
  display: block;
  background: linear-gradient(to bottom, var(--ink) 0 6px, transparent 6px 18px, var(--violet-soft) 18px 100%);
}

.title-rule i {
  width: 5px;
  height: 5px;
  margin-left: -16px;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.55);
}

.hud-actions {
  position: absolute;
  top: clamp(24px, 5vw, 62px);
  right: clamp(22px, 4vw, 58px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  opacity: 0;
  animation: hudIn 900ms ease forwards 650ms;
}

.field-note-button,
.ghost,
.pill {
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.13);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.field-note-button:hover,
.ghost:hover,
.pill:hover,
.controls-dock:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(8, 16, 26, 0.25);
}

.field-note-button:focus-visible,
.ghost:focus-visible,
.pill:focus-visible,
.controls-dock summary:focus-visible {
  outline: 2px solid rgba(168, 140, 255, 0.65);
  outline-offset: 3px;
}

.field-note-button {
  position: static;
  min-height: 45px;
  border-radius: 999px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
}

.language-button {
  min-height: 45px;
  padding: 0 14px;
  text-transform: none;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--violet);
  box-shadow: 0 0 18px rgba(168, 140, 255, 0.72);
  animation: pulseDot 2.8s ease-in-out infinite;
}

.small-dot {
  width: 8px;
  height: 8px;
}

.button-glyphs {
  color: var(--muted);
  letter-spacing: 0.12em;
}

.field-note-card {
  position: absolute;
  left: clamp(22px, 5vw, 64px);
  bottom: clamp(112px, 17vh, 190px);
  width: min(330px, calc(100vw - 44px));
  padding-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.34);
  opacity: 0;
  transform: translateY(8px);
  animation: fieldNoteIn 900ms ease forwards 5s;
}

.one-liner {
  margin-top: 10px;
  color: rgba(252, 249, 240, 0.82);
  font-family: var(--display);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.16;
  letter-spacing: 0.015em;
  text-wrap: pretty;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.26);
}

.controls-dock {
  position: absolute;
  right: clamp(22px, 4vw, 58px);
  bottom: clamp(36px, 5vw, 54px);
  width: min(360px, calc(100vw - 44px));
  border-radius: 25px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  animation: hudIn 900ms ease forwards 1s;
  overflow: clip;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.controls-dock summary {
  list-style: none;
  min-height: 48px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 11px;
}

.controls-dock summary::-webkit-details-marker {
  display: none;
}

.controls-dock summary::after {
  content: "+";
  margin-left: 4px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0;
}

.controls-dock[open] summary::after {
  content: "−";
}

.controls-dock strong {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink-strong);
}

.controls-panel {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.controls-panel label {
  color: var(--muted);
  font-size: 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--violet);
}

.control-row,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.control-row {
  font-size: 11px;
  color: var(--muted);
}

.toggle-row {
  flex-wrap: wrap;
}

.pill,
.ghost {
  min-height: 40px;
  border-radius: 999px;
  padding: 0 13px;
  font-size: 12px;
}

.ghost.small {
  min-height: 36px;
}

.metrics-rail {
  position: absolute;
  right: clamp(22px, 4vw, 58px);
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 12px;
  width: 148px;
  opacity: 0;
  animation: metricsIn 800ms ease forwards 6.2s;
  transition: top 260ms ease;
}

.controls-dock[open] ~ .metrics-rail {
  top: 42%;
}

@media (max-height: 620px) {
  .controls-dock[open] ~ .metrics-rail {
    top: min(42%, calc(100% - 400px));
  }
}

.metric {
  padding: 11px 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(90deg, rgba(8, 16, 26, 0.22), transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.metric strong {
  display: block;
  margin-top: 5px;
  color: var(--ink-strong);
  font-size: 15px;
  line-height: 1.18;
  font-weight: 600;
}

.metric.wide strong {
  font-size: 12px;
  color: rgba(252, 249, 240, 0.75);
}

.drag-hint {
  position: absolute;
  left: 50%;
  bottom: clamp(44px, 7vw, 74px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(252, 249, 240, 0.74);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  animation: hintLife 6.2s ease forwards 1.2s;
}

.mouse-icon {
  width: 13px;
  height: 22px;
  border: 1px solid rgba(252, 249, 240, 0.72);
  border-radius: 999px;
  position: relative;
}

.mouse-icon::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  width: 2px;
  height: 5px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: rgba(252, 249, 240, 0.78);
  animation: wheel 1.5s ease-in-out infinite;
}

.scene-progress {
  position: absolute;
  left: 50%;
  bottom: clamp(18px, 3vw, 30px);
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
  opacity: 0;
  animation: hudIn 900ms ease forwards 1.35s;
}

.scene-progress span {
  width: 16px;
  height: 2px;
  border-radius: 99px;
  background: rgba(252, 249, 240, 0.48);
}

.scene-progress .active {
  background: var(--violet);
  box-shadow: 0 0 14px rgba(168, 140, 255, 0.75);
}

.proof-drawer {
  position: absolute;
  top: clamp(92px, 9vw, 112px);
  right: clamp(20px, 3vw, 42px);
  width: min(368px, calc(100vw - 40px));
  max-height: calc(100vh - 152px);
  padding: 18px;
  display: grid;
  gap: 14px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 25px;
  background: rgba(46, 59, 72, 0.52);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
  transform: translateX(0);
  opacity: 1;
  transition: transform 280ms ease, opacity 220ms ease;
}

.proof-drawer.closed {
  transform: translateX(calc(100% + 76px));
  opacity: 0;
  pointer-events: none;
}

.proof-header,
.proof-meta {
  display: grid;
  gap: 12px;
}

.proof-header {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.proof-header h2 {
  margin-top: 5px;
  font-family: var(--display);
  font-size: 28px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.proof-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.proof-meta > div,
.proof-card {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  padding: 13px;
}

.proof-meta strong {
  display: block;
  margin-top: 6px;
  color: rgba(252, 249, 240, 0.76);
  font-size: 12px;
  line-height: 1.35;
}

.proof-list {
  display: grid;
  gap: 10px;
}

.proof-card h3 {
  margin-top: 5px;
  font-size: 15px;
  color: var(--ink-strong);
}

.proof-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.proof-card .effect {
  margin-top: 8px;
  color: rgba(252, 249, 240, 0.8);
}

@keyframes hudIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes metricsIn {
  from {
    opacity: 0;
    transform: translateY(calc(-50% + 8px));
  }
  to {
    opacity: 0.86;
    transform: translateY(-50%);
  }
}

@keyframes fieldNoteIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseDot {
  0%, 100% {
    box-shadow: 0 0 10px rgba(168, 140, 255, 0.32);
  }
  50% {
    box-shadow: 0 0 24px rgba(168, 140, 255, 0.85);
  }
}

@keyframes wheel {
  0% {
    opacity: 0;
    transform: translate(-50%, 0);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 7px);
  }
}

@keyframes hintLife {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  18%, 72% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
}

@media (max-width: 1040px) {
  .metrics-rail {
    display: none;
  }

  .field-note-card {
    width: min(300px, calc(100vw - 44px));
  }
}

@media (max-width: 760px) {
  .title-lockup {
    top: 20px;
    left: 20px;
  }

  .title-lockup h1 {
    font-size: 34px;
  }

  .subtitle,
  .title-rule,
  .button-glyphs,
  .field-note-card {
    display: none;
  }

  .hud-actions {
    top: auto;
    right: auto;
    left: 20px;
    bottom: 92px;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .field-note-button,
  .language-button {
    min-height: 42px;
    padding-inline: 15px;
  }

  .controls-dock {
    left: 20px;
    right: 20px;
    bottom: 22px;
    width: auto;
  }

  .drag-hint,
  .scene-progress {
    display: none;
  }

  .proof-drawer {
    top: 84px;
    left: 14px;
    right: 14px;
    width: auto;
    max-height: calc(100vh - 108px);
  }

  .proof-meta {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
