:root {
  /* 100% Unified Deep Console Obsidian Canvas — ZERO black/white section whiplash.
     Live dynamic --accent / --accent-rgb smoothly morphs to match the active game! */
  --bg: #07080d;
  --surface: rgba(18, 21, 31, 0.72);
  --surface-solid: #12151f;
  --surface-elev: rgba(27, 31, 46, 0.84);
  --ink: #f4f3ef;
  --muted: #989fb2;
  --line: rgba(244, 243, 239, 0.1);
  --line-bright: rgba(244, 243, 239, 0.22);

  /* Live morphing game theme tokens (updated dynamically per active game) */
  --accent: #e5b35c;
  --accent-rgb: 229, 179, 92;
  --accent-ink: #120d05;

  --font-serif: "Noto Serif SC", "Songti SC", Georgia, serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;

  --text-heading: clamp(1.6rem, 2.6vw, 2.2rem);
  --text-body: 1rem;
  --text-sm: 0.875rem;

  --maxw: 1240px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  background-color: var(--bg);
  color: var(--ink);
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.64;
  background-color: var(--bg);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Full-Viewport Live Adaptive Ambient Canvas */
.ambient-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Native Scroll-Driven Progress Hairline (modern-web-guidance) */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2.5px;
  z-index: 90;
  background-color: var(--accent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.7);
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
  transition-property: background-color;
  transition-duration: 500ms;
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    @keyframes grow-scroll-progress {
      from { transform: scaleX(0); }
      to { transform: scaleX(1); }
    }
    :root {
      scroll-timeline: --page-scroll block;
    }
    .scroll-progress {
      animation: grow-scroll-progress auto linear;
      animation-timeline: --page-scroll;
    }
  }
}

.console-main,
.console-footer {
  position: relative;
  z-index: 2;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
}

/* =========================================================================
   CONSOLE TOP HUD BAR
   ========================================================================= */
.console-hud {
  position: fixed;
  top: 12px;
  left: 16px;
  right: 16px;
  z-index: 60;
  border-radius: 16px;
  background-color: rgba(10, 12, 19, 0.72);
  backdrop-filter: saturate(160%) blur(20px);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  transition-property: border-color;
  transition-duration: 500ms;
}

.hud-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hud-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.hud-orb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.9);
  transition-property: background-color, box-shadow;
  transition-duration: 500ms;
}

.hud-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.hud-nav a {
  position: relative;
  padding: 4px 0;
  white-space: nowrap;
  transition-property: color;
  transition-duration: 180ms;
}

.hud-nav a:hover {
  color: var(--ink);
}

.hud-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background-color: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition-property: transform, background-color;
  transition-duration: 240ms;
  transition-timing-function: var(--ease);
}

.hud-nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.hud-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-keys {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.hud-sound,
.hud-replay {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: var(--text-sm);
  cursor: pointer;
  white-space: nowrap;
  transition-property: border-color, color, background-color, transform;
  transition-duration: 180ms;
}

.hud-sound:hover,
.hud-sound.active,
.hud-replay:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
}

.hud-replay:active {
  transform: scale(0.95);
}

.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 12px;
}

.eq i {
  display: block;
  width: 2.5px;
  height: 5px;
  border-radius: 2px;
  background-color: currentColor;
}

.hud-sound.active .eq i {
  animation: eqPulse 0.6s ease-in-out var(--d, 0s) infinite alternate;
}

@keyframes eqPulse {
  from { height: 4px; }
  to { height: 12px; }
}

/* =========================================================================
   STAGE 1: 3D CONSOLE COVERFLOW DECK (100dvh LIVING STAGE)
   ========================================================================= */
.deck-stage {
  position: relative;
  min-height: 100dvh;
  padding: 96px 0 42px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.deck-backdrop {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  object-fit: cover;
  filter: blur(52px) brightness(0.24) saturate(1.3);
  z-index: 0;
  pointer-events: none;
  transition-property: opacity;
  transition-duration: 500ms;
}

.deck-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(900px 460px at 50% 42%, rgba(var(--accent-rgb), 0.16), transparent 68%),
    linear-gradient(180deg, rgba(7, 8, 13, 0.55) 0%, rgba(7, 8, 13, 0.25) 48%, #07080d 100%);
  pointer-events: none;
  transition-property: background;
  transition-duration: 600ms;
}

.deck-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
}

.spotlight-grid {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.spotlight-info {
  max-width: 720px;
}

.spotlight-status {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  transition-property: color;
  transition-duration: 450ms;
}

.spotlight-title {
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 3.8vw, 3.1rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.spotlight-tagline {
  font-size: var(--text-body);
  color: var(--muted);
  max-width: 56ch;
  margin-bottom: 22px;
}

.spotlight-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  border-radius: 999px;
  border: none;
  background-color: var(--accent);
  color: var(--accent-ink);
  font-size: var(--text-sm);
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 28px rgba(var(--accent-rgb), 0.36);
  transition-property: background-color, transform, box-shadow;
  transition-duration: 240ms;
  transition-timing-function: var(--ease);
}

.btn-launch:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(var(--accent-rgb), 0.55);
}

.btn-glass,
.btn-applaud-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--line-bright);
  background-color: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition-property: border-color, background-color, color;
  transition-duration: 180ms;
}

.btn-glass:hover,
.btn-applaud-hero:hover,
.btn-applaud-hero.applauded {
  border-color: var(--accent);
  color: var(--accent);
  background-color: rgba(var(--accent-rgb), 0.12);
}

/* Telemetry Score Ring */
.spotlight-telemetry {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-radius: 18px;
  background-color: rgba(15, 18, 28, 0.72);
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  backdrop-filter: blur(14px);
}

.score-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct, 83) * 1%), rgba(255, 255, 255, 0.1) 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.score-ring-inner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: #0e111a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
}

.score-ring-inner b {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--accent);
}

.score-ring-inner small {
  font-size: 0.65rem;
  color: var(--muted);
}

.telemetry-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.telemetry-meta span {
  font-size: 0.8rem;
  color: var(--muted);
}

.telemetry-meta strong {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* 3D PERSPECTIVE COVERFLOW STAGE */
.coverflow-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(240px, 42vw, 440px);
  perspective: 1400px;
  margin-bottom: 22px;
  touch-action: pan-y;
}

.coverflow-stage {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.cf-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(720px, 78vw);
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background-color: #0e1018;
  cursor: pointer;
  transform-origin: center center;
  transition-property: transform, opacity, filter, border-color, box-shadow;
  transition-duration: 520ms;
  transition-timing-function: var(--ease);
  will-change: transform, opacity;
  user-select: none;
}

.cf-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.cf-card.is-center {
  border-color: rgba(var(--accent-rgb), 0.85);
  box-shadow:
    0 32px 95px rgba(0, 0, 0, 0.78),
    0 0 64px rgba(var(--accent-rgb), 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  z-index: 10;
}

/* Collector's Holographic Foil Sheen on Active 3D Game Cartridge */
.cf-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(460px circle at var(--foil-x, 50%) var(--foil-y, 50%), rgba(255, 255, 255, 0.22), rgba(var(--accent-rgb), 0.12) 28%, transparent 62%),
    linear-gradient(125deg, transparent 30%, rgba(255, 255, 255, 0.08) 48%, rgba(var(--accent-rgb), 0.14) 52%, transparent 70%);
  mix-blend-mode: screen;
  transition-property: opacity;
  transition-duration: 280ms;
}

.cf-card.is-center:hover::before {
  opacity: 1;
}

/* Tactical Corner Lock Brackets on Active 3D Cartridge */
.cf-brackets {
  position: absolute;
  inset: 10px;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transform: scale(1.06);
  transition-property: opacity, transform;
  transition-duration: 320ms;
  transition-timing-function: var(--ease);
}

.cf-card.is-center .cf-brackets {
  opacity: 1;
  transform: scale(1);
}

.cf-brackets i {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--accent);
  border-style: solid;
  filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), 0.9));
}

.cf-brackets i:nth-child(1) { top: 0; left: 0; border-width: 2px 0 0 2px; border-top-left-radius: 4px; }
.cf-brackets i:nth-child(2) { top: 0; right: 0; border-width: 2px 2px 0 0; border-top-right-radius: 4px; }
.cf-brackets i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 2px 2px; border-bottom-left-radius: 4px; }
.cf-brackets i:nth-child(4) { bottom: 0; right: 0; border-width: 0 2px 2px 0; border-bottom-right-radius: 4px; }

/* Stage Floor Neon Reflection under 3D Deck */
.coverflow-floor-glow {
  position: absolute;
  left: 50%;
  bottom: -24px;
  width: min(680px, 84vw);
  height: 90px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(var(--accent-rgb), 0.32) 0%, rgba(var(--accent-rgb), 0.08) 48%, transparent 74%);
  filter: blur(18px);
  pointer-events: none;
  z-index: 0;
  transition-property: background;
  transition-duration: 500ms;
}

.deck-scanlines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.22;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 4px
  );
}

.cf-card:not(.is-center) {
  filter: brightness(0.56) saturate(0.8);
}

.cf-card:not(.is-center):hover {
  filter: brightness(0.82) saturate(1);
}

.cf-label {
  position: absolute;
  inset: auto 0 0 0;
  padding: 28px 18px 14px;
  background: linear-gradient(180deg, transparent, rgba(7, 8, 13, 0.88));
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  opacity: 0;
  transition-property: opacity;
  transition-duration: 280ms;
}

.cf-card.is-center .cf-label {
  opacity: 1;
}

.cf-label strong {
  font-size: var(--text-body);
  font-weight: 800;
}

.cf-label span {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 700;
}

/* Cartridge Dots */
.deck-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.deck-dot {
  height: 6px;
  width: 20px;
  border-radius: 999px;
  border: none;
  background-color: rgba(244, 243, 239, 0.2);
  cursor: pointer;
  transition-property: width, background-color;
  transition-duration: 280ms;
  transition-timing-function: var(--ease);
}

.deck-dot[aria-selected="true"] {
  width: 48px;
  background-color: var(--accent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.7);
}

/* =========================================================================
   UNIFIED CONSOLE SECTIONS (SEAMLESS CONTINUOUS DARK GLASS)
   ========================================================================= */
.console-section {
  padding: 76px 0;
  border-top: 1px solid var(--line);
}

.sec-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.sec-bar h2,
.terminal-left h2 {
  font-family: var(--font-serif);
  font-size: var(--text-heading);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 6px;
}

.sec-sub {
  font-size: var(--text-sm);
  color: var(--muted);
}

.lib-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.seg-tabs {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background-color: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.seg-tabs button {
  background: transparent;
  border: none;
  padding: 7px 15px;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition-property: background-color, color;
  transition-duration: 200ms;
}

.seg-tabs button[aria-selected="true"] {
  background-color: var(--accent);
  color: var(--accent-ink);
}

.lib-search {
  height: 38px;
  width: 210px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background-color: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
  transition-property: border-color;
  transition-duration: 180ms;
}

.lib-search:focus {
  outline: none;
  border-color: var(--accent);
}

/* 9-Game Shelf Grid (Strict 16:9 Posters, Live Theme Sync on Hover) */
.shelf-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.shelf-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background-color: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition-property: transform, border-color, box-shadow;
  transition-duration: 220ms;
  transition-timing-function: var(--ease);
  will-change: transform;
}

.shelf-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--card-rgb, 229, 179, 92), 0.16), transparent 62%);
  opacity: 0;
  pointer-events: none;
  transition-property: opacity;
  transition-duration: 240ms;
}

.shelf-card:hover {
  border-color: rgba(var(--card-rgb, 229, 179, 92), 0.58);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.52), 0 0 36px rgba(var(--card-rgb, 229, 179, 92), 0.14);
}

.shelf-card:hover::after {
  opacity: 1;
}

.shelf-poster {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: #0c0e16;
}

.shelf-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition-property: transform;
  transition-duration: 460ms;
  transition-timing-function: var(--ease);
}

.shelf-card:hover .shelf-poster img {
  transform: scale(1.04);
}

.shelf-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  flex: 1;
}

.shelf-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.shelf-meta .score-accent {
  color: rgb(var(--card-rgb, 229, 179, 92));
  font-weight: 800;
}

.shelf-card h3 {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
}

.shelf-desc {
  font-size: var(--text-sm);
  color: var(--muted);
}

.shelf-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.shelf-links {
  display: flex;
  align-items: center;
  gap: 14px;
}

.link-btn {
  background: transparent;
  border: none;
  padding: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition-property: color;
  transition-duration: 180ms;
}

.link-btn:hover {
  color: var(--accent);
}

.link-btn-accent {
  color: rgb(var(--card-rgb, 229, 179, 92));
}

.applaud-chip {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background-color: rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition-property: border-color, color, background-color;
  transition-duration: 180ms;
}

.applaud-chip:hover,
.applaud-chip.applauded {
  border-color: var(--accent);
  color: var(--accent);
  background-color: rgba(var(--accent-rgb), 0.14);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 40px 0;
  color: var(--muted);
}

/* =========================================================================
   STAGE 3: FATE TERMINAL (LIVE SERVER POLL)
   ========================================================================= */
.terminal-frame {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 32px;
  padding: 34px;
  border-radius: 22px;
  background-color: var(--surface);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.fate-choices {
  border: none;
  margin-top: 22px;
  display: grid;
  gap: 12px;
}

.fate-option {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  border-radius: 14px;
  background-color: rgba(7, 8, 13, 0.56);
  border: 1px solid var(--line);
  cursor: pointer;
  transition-property: border-color, background-color;
  transition-duration: 180ms;
}

.fate-option:hover {
  border-color: var(--accent);
  background-color: rgba(var(--accent-rgb), 0.08);
}

.fate-option input[type="radio"] {
  margin-top: 4px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.fate-copy strong {
  display: block;
  font-size: var(--text-body);
  font-weight: 700;
  margin-bottom: 3px;
}

.fate-copy span {
  display: block;
  font-size: var(--text-sm);
  color: var(--muted);
}

.fate-pct {
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--accent);
  min-width: 40px;
  text-align: right;
}

.terminal-readout {
  padding: 26px;
  border-radius: 16px;
  background-color: rgba(7, 8, 13, 0.62);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.terminal-readout h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.readout-desc {
  color: var(--muted);
}

.poll-bars {
  display: grid;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.bar-row {
  display: grid;
  grid-template-columns: 74px 1fr 44px;
  gap: 12px;
  align-items: center;
  font-size: var(--text-sm);
  color: var(--muted);
}

.bar-track {
  height: 6px;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background-color: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.65);
  transition-property: width, background-color;
  transition-duration: 360ms;
  transition-timing-function: var(--ease);
}

.bar-num {
  text-align: right;
  font-weight: 700;
  color: var(--ink);
}

/* =========================================================================
   STAGE 4: VERSION LOG & FOOTER
   ========================================================================= */
.log-list {
  list-style: none;
  border-top: 1px solid var(--line);
}

.log-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.log-row time {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  padding-top: 3px;
}

.log-row h3 {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.log-row p {
  font-size: var(--text-body);
  color: var(--muted);
  max-width: 66ch;
}

.console-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 44px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-row a:hover {
  color: var(--accent);
}

/* =========================================================================
   NATIVE MODAL DIALOG (modern-web-guidance + Lenis-safe Scroll)
   ========================================================================= */
.detail-dialog {
  width: min(860px, calc(100vw - 24px));
  max-height: calc(100dvh - 36px);
  margin: auto;
  padding: 0;
  border: 1px solid rgba(var(--accent-rgb), 0.34);
  border-radius: 20px;
  background-color: var(--surface-solid);
  color: var(--ink);
  overflow: hidden;
  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 240ms;
  transition-timing-function: var(--ease);
  transition-behavior: allow-discrete;
}

@media (prefers-reduced-motion: no-preference) {
  .detail-dialog {
    transform: translateY(14px) scale(0.98);
  }
}

.detail-dialog[open] {
  display: flex;
  flex-direction: column;
  opacity: 1;
}

@starting-style {
  .detail-dialog[open] {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .detail-dialog[open] {
    transform: translateY(0) scale(1);
  }
  @starting-style {
    .detail-dialog[open] {
      transform: translateY(14px) scale(0.98);
    }
  }
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background-color: rgba(4, 5, 10, 0);
  backdrop-filter: blur(10px);
  overflow: hidden;
  overscroll-behavior: contain;
  transition-property: background-color, display, overlay;
  transition-duration: 240ms;
  transition-timing-function: var(--ease);
  transition-behavior: allow-discrete;
}

dialog[open]::backdrop {
  background-color: rgba(4, 5, 10, 0.8);
}

@starting-style {
  dialog[open]::backdrop {
    background-color: rgba(4, 5, 10, 0);
  }
}

.dialog-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 26px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  font-weight: 700;
  line-height: 1.25;
}

.dialog-meta {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: 4px;
}

.close-btn {
  background: transparent;
  border: 1px solid var(--line-bright);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition-property: border-color, color;
  transition-duration: 180ms;
}

.close-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-rgb), 0.5) rgba(255, 255, 255, 0.05);
  padding: 22px 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dialog-media-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: min(46vh, 400px);
  border-radius: 12px;
  overflow: hidden;
  background-color: #090b12;
}

.dialog-media-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dialog-stage figcaption {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: 10px;
}

.dialog-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}

.dialog-thumb {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  cursor: pointer;
  opacity: 0.6;
  transition-property: opacity, border-color;
  transition-duration: 180ms;
}

.dialog-thumb:hover,
.dialog-thumb[aria-selected="true"] {
  opacity: 1;
}

.dialog-thumb[aria-selected="true"] {
  border-color: var(--accent);
}

.dialog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dialog-summary {
  color: var(--muted);
}

.dialog-highlights {
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--ink);
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.dialog-secondary {
  display: flex;
  align-items: center;
  gap: 18px;
}

.dialog-link-btn {
  background: transparent;
  border: none;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .detail-dialog,
  dialog::backdrop {
    transition-duration: 100ms;
  }
  .eq i {
    animation: none !important;
  }
}

/* =========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================= */
@media (max-width: 1024px) {
  .shelf-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .terminal-frame {
    grid-template-columns: 1fr;
    padding: 24px;
  }
  .hud-keys { display: none; }
}

@media (max-width: 720px) {
  .console-hud { left: 10px; right: 10px; top: 10px; }
  .hud-inner { height: 50px; padding: 0 12px; }
  .hud-nav { gap: 12px; font-size: 0.8rem; }
  .hud-brand span:last-child { font-size: 0.88rem; }
  .hud-sound span:last-child { display: none; }

  .deck-stage { min-height: auto; padding: 78px 0 36px; }
  .deck-container,
  .wrap { padding-left: 16px; padding-right: 16px; }
  .spotlight-telemetry { width: 100%; justify-content: space-between; }
  .coverflow-wrap { height: clamp(200px, 52vw, 290px); }
  .cf-card { width: 84vw; border-radius: 14px; }
  .deck-arrow { width: 38px; height: 38px; font-size: 1.35rem; }

  .console-section { padding: 54px 0; }
  .shelf-grid { grid-template-columns: 1fr; }
  .seg-tabs { width: 100%; justify-content: space-between; }
  .seg-tabs button { flex: 1; padding: 7px 6px; font-size: 0.8rem; }
  .lib-search { width: 100%; }
  .terminal-frame { padding: 18px; }
  .log-row { grid-template-columns: 1fr; gap: 6px; }
  .dialog-head, .dialog-body { padding-left: 16px; padding-right: 16px; }
  .hud-replay span:last-child { display: none; }
  .intro-hud-outer { width: 260px; height: 260px; }
  .intro-hud-inner { width: 204px; height: 204px; }
  .intro-corners { width: 290px; height: 210px; }
  .intro-title,
  .intro-title-ghost { font-size: clamp(2rem, 11vw, 3rem); letter-spacing: 0.14em; }
  .intro-meter { width: min(280px, 82vw); }
}

/* =========================================================================
   FLOATING RPG COMBO / APPLAUSE VFX LAYER
   ========================================================================= */
.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  overflow: hidden;
}

.fx-combo-pop {
  position: fixed;
  left: 0;
  top: 0;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(var(--accent-rgb), 0.9), 0 2px 6px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  animation: comboFloatUp 950ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes comboFloatUp {
  0% {
    opacity: 0;
    transform: translate(-50%, -20%) scale(0.65);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -80%) scale(1.18);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -240%) scale(0.95);
  }
}

/* =========================================================================
   GAME ENGINE BOOT CUTSCENE — SPARKKIT OS // IGNITION
   ========================================================================= */
body.is-intro-active {
  overflow: hidden;
}

.intro-stage {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  overflow: hidden;
  user-select: none;
  cursor: pointer;
  background: transparent;
}

.intro-stage.is-done {
  display: none;
  pointer-events: none;
}

.intro-stage.is-shaking {
  animation: introShake 320ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes introShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  15% { transform: translate3d(-6px, 4px, 0); }
  32% { transform: translate3d(6px, -5px, 0); }
  50% { transform: translate3d(-4px, -3px, 0); }
  70% { transform: translate3d(4px, 3px, 0); }
  85% { transform: translate3d(-2px, 1px, 0); }
}

/* Upper & Lower Mecha Blast-Door Shutters */
.intro-shutter {
  position: absolute;
  left: 0;
  right: 0;
  height: 50.5%;
  z-index: 1;
  background:
    radial-gradient(900px 420px at 50% 100%, rgba(var(--accent-rgb), 0.12), transparent 70%),
    linear-gradient(180deg, #04050a 0%, #090c16 100%);
  will-change: transform;
}

.intro-shutter-top {
  top: 0;
}

.intro-shutter-bottom {
  bottom: 0;
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(var(--accent-rgb), 0.12), transparent 70%),
    linear-gradient(0deg, #04050a 0%, #090c16 100%);
}

.shutter-edge {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 5%, rgba(var(--accent-rgb), 0.35) 28%, var(--accent) 50%, rgba(var(--accent-rgb), 0.35) 72%, transparent 95%);
  box-shadow: 0 0 24px rgba(var(--accent-rgb), 0.85);
  opacity: 0;
  transition: opacity 280ms ease;
}

.intro-shutter-top .shutter-edge { bottom: 0; }
.intro-shutter-bottom .shutter-edge { top: 0; }

.intro-stage.is-splitting .shutter-edge {
  opacity: 1;
}

.intro-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.intro-scanlines {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.34;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Central Tactical HUD Core */
.intro-core {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  will-change: transform, opacity;
}

.intro-hud-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.intro-hud-outer {
  width: 400px;
  height: 400px;
  border: 1px dashed rgba(var(--accent-rgb), 0.34);
  box-shadow: 0 0 60px rgba(var(--accent-rgb), 0.08);
  animation: hudSpinCW 14s linear infinite;
}

.intro-hud-inner {
  width: 310px;
  height: 310px;
  border: 1.5px solid transparent;
  border-top-color: rgba(var(--accent-rgb), 0.78);
  border-bottom-color: rgba(56, 210, 222, 0.55);
  animation: hudSpinCCW 5.2s linear infinite;
}

@keyframes hudSpinCW {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes hudSpinCCW {
  from { transform: translate(-50%, -50%) rotate(360deg); }
  to { transform: translate(-50%, -50%) rotate(0deg); }
}

.intro-corners {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(560px, 88vw);
  height: 250px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.intro-corners i {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: rgba(var(--accent-rgb), 0.65);
  border-style: solid;
}

.intro-corners i:nth-child(1) { top: 0; left: 0; border-width: 2px 0 0 2px; }
.intro-corners i:nth-child(2) { top: 0; right: 0; border-width: 2px 2px 0 0; }
.intro-corners i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
.intro-corners i:nth-child(4) { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

.intro-emblem {
  color: var(--accent);
  margin-bottom: 14px;
  filter: drop-shadow(0 0 26px rgba(var(--accent-rgb), 0.75));
  will-change: transform, opacity;
}

.emblem-hex {
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: drawHex 900ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes drawHex {
  to { stroke-dashoffset: 0; }
}

.intro-sysline {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.76rem;
  letter-spacing: 0.28em;
  color: rgba(var(--accent-rgb), 0.88);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.intro-title-wrap {
  position: relative;
  display: inline-block;
  overflow: hidden;
  padding: 6px 14px;
  margin-bottom: 10px;
}

.intro-title,
.intro-title-ghost {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 6.2vw, 4.4rem);
  font-weight: 900;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  line-height: 1.1;
  white-space: nowrap;
}

.intro-title {
  position: relative;
  z-index: 2;
  color: #fffaf0;
  text-shadow:
    0 0 32px rgba(var(--accent-rgb), 0.55),
    0 0 80px rgba(var(--accent-rgb), 0.25);
}

.intro-title-ghost {
  position: absolute;
  inset: 6px 14px;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
}

.intro-title-r {
  color: #ff4d7d;
  mix-blend-mode: screen;
}

.intro-title-c {
  color: #38d2de;
  mix-blend-mode: screen;
}

.intro-stage.is-impact .intro-title-r {
  animation: glitchSplitR 420ms steps(2, end) forwards;
}

.intro-stage.is-impact .intro-title-c {
  animation: glitchSplitC 420ms steps(2, end) forwards;
}

@keyframes glitchSplitR {
  0% { opacity: 0.9; transform: translate(-8px, -2px); }
  45% { opacity: 0.7; transform: translate(5px, 1px); }
  100% { opacity: 0; transform: translate(0, 0); }
}

@keyframes glitchSplitC {
  0% { opacity: 0.9; transform: translate(8px, 2px); }
  45% { opacity: 0.7; transform: translate(-5px, -1px); }
  100% { opacity: 0; transform: translate(0, 0); }
}

/* Diagonal Laser Sheen Sweep Across Title */
.intro-sheen {
  position: absolute;
  top: -20%;
  left: -40%;
  width: 34%;
  height: 140%;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), rgba(var(--accent-rgb), 0.6), transparent);
  transform: skewX(-24deg);
  opacity: 0;
}

.intro-stage.is-impact .intro-sheen {
  animation: sheenSweep 680ms cubic-bezier(0.22, 1, 0.36, 1) 80ms forwards;
}

@keyframes sheenSweep {
  0% { left: -40%; opacity: 0.95; }
  100% { left: 135%; opacity: 0; }
}

.intro-sub {
  font-size: 0.92rem;
  letter-spacing: 0.24em;
  color: var(--muted);
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(8px);
}

.intro-meter {
  width: min(360px, 78vw);
}

.intro-meter-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.25);
}

.intro-meter-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38d2de 0%, var(--accent) 60%, #fff4d2 100%);
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.9);
}

.intro-meter-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.intro-meter-meta strong {
  color: var(--accent);
  font-weight: 800;
}

.intro-skip {
  position: absolute;
  bottom: max(26px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(var(--accent-rgb), 0.34);
  border-radius: 999px;
  padding: 8px 20px;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  color: rgba(244, 243, 239, 0.82);
  cursor: pointer;
  backdrop-filter: blur(10px);
  animation: skipPulse 1.6s ease-in-out infinite;
  transition: border-color 180ms, color 180ms;
}

.intro-skip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@keyframes skipPulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .intro-stage {
    display: none !important;
  }
  body.is-intro-active {
    overflow: auto;
  }
}
