:root {
  --bg-deep: #070b16;
  --bg-panel: rgba(13, 21, 42, 0.86);
  --bg-card: rgba(20, 32, 62, 0.78);
  --bg-glass: rgba(15, 25, 48, 0.68);
  --gold-primary: #f5c451;
  --gold-light: #ffe394;
  --gold-dim: rgba(245, 196, 81, 0.28);
  --cyan-primary: #38bdf8;
  --cyan-glow: rgba(56, 189, 248, 0.35);
  --purple-rift: #a855f7;
  --emerald-ok: #10b981;
  --rose-err: #f43f5e;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-subtle: rgba(148, 163, 184, 0.2);
  --border-gold: rgba(245, 196, 81, 0.45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.65);
  --radius-lg: 18px;
  --radius-md: 12px;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  --font-mono: "JetBrains Mono", "Consolas", "Courier New", monospace;
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  line-height: 1.6;
  user-select: none;
}

/* Background Canvas & Rift Overlay */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: auto;
  cursor: crosshair;
}

.chrono-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 20%, rgba(56, 189, 248, 0.08), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.08), transparent 50%),
    radial-gradient(circle at 50% 50%, transparent 55%, rgba(3, 6, 14, 0.85) 100%);
  animation: cosmicVignetteBreath 8s ease-in-out infinite;
  transition: background 1.2s ease;
}

@keyframes cosmicVignetteBreath {
  0%, 100% {
    opacity: 0.92;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

body.restored .chrono-vignette {
  background:
    radial-gradient(circle at 50% 20%, rgba(245, 196, 81, 0.16), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.12), transparent 55%),
    radial-gradient(circle at 50% 50%, transparent 65%, rgba(5, 12, 24, 0.65) 100%);
  animation: cosmicVignetteDawn 7s ease-in-out infinite;
}

@keyframes cosmicVignetteDawn {
  0%, 100% {
    opacity: 0.94;
    filter: brightness(1);
  }
  50% {
    opacity: 1;
    filter: brightness(1.12);
  }
}

/* Main App Container */
.app-shell {
  position: relative;
  z-index: 2;
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100vh;
}

/* Top HUD Header */
.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 22px;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-emblem {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #fffdf2 72%, #fef08a 100%);
  border: 2px solid var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  box-shadow: 0 0 20px rgba(245, 196, 81, 0.42), inset 0 0 6px rgba(245, 196, 81, 0.35);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.brand-emblem:hover {
  transform: scale(1.08) rotate(-3deg);
  box-shadow: 0 0 28px rgba(245, 196, 81, 0.75);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  position: relative;
  z-index: 1;
}

.brand-titles h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #fff 0%, var(--gold-light) 55%, var(--cyan-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.school-motto-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(245, 196, 81, 0.14);
  color: var(--gold-light);
  border: 1px solid rgba(245, 196, 81, 0.38);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(244, 63, 94, 0.18);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.status-pill.restored {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.45);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulseDot 1.5s infinite;
}

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

/* LET Key Slots in HUD */
.key-matrix-hud {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(7, 11, 22, 0.72);
  padding: 8px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
}

.key-matrix-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 4px;
}

.key-slot {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1.5px dashed rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.key-slot .slot-index {
  font-size: 0.6rem;
  color: var(--text-muted);
  line-height: 1;
}

.key-slot .slot-char {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: rgba(148, 163, 184, 0.4);
  line-height: 1.1;
}

.key-slot.unlocked {
  border-style: solid;
  border-color: var(--gold-primary);
  background: linear-gradient(135deg, rgba(245, 196, 81, 0.25), rgba(56, 189, 248, 0.15));
  box-shadow: 0 0 16px rgba(245, 196, 81, 0.4);
  transform: translateY(-2px);
}

.key-slot.unlocked .slot-char {
  color: var(--gold-light);
  text-shadow: 0 0 10px var(--gold-primary);
}

.key-slot.active-target {
  border-color: var(--cyan-primary);
  box-shadow: 0 0 12px var(--cyan-glow);
}

/* Mode Switcher in HUD */
.mode-switcher-hud {
  display: inline-flex;
  align-items: center;
  background: rgba(7, 11, 22, 0.78);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 3px 5px;
  gap: 4px;
}

.mode-switcher-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0 4px;
}

.btn-mode-tab {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.22s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.btn-mode-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-mode-tab.active {
  background: linear-gradient(135deg, rgba(245, 196, 81, 0.25), rgba(56, 189, 248, 0.2));
  color: #fff;
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px rgba(245, 196, 81, 0.35);
}

/* HUD Controls & Timer */
.hud-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chrono-timer {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  padding: 7px 12px;
  border-radius: 10px;
  background: rgba(7, 11, 22, 0.75);
  border: 1px solid var(--border-subtle);
  color: var(--cyan-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-hud {
  background: rgba(30, 41, 59, 0.75);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-hud:hover {
  border-color: var(--gold-primary);
  color: var(--gold-light);
  background: rgba(245, 196, 81, 0.12);
  transform: translateY(-1px);
}

.btn-hud.active {
  border-color: var(--cyan-primary);
  background: rgba(56, 189, 248, 0.18);
  color: #e0f2fe;
}

/* Navigation Stage Bar */
.stage-nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.stage-tab {
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.25s ease;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.stage-tab:hover:not(:disabled) {
  border-color: rgba(245, 196, 81, 0.5);
  color: var(--text-main);
  transform: translateY(-2px);
}

.stage-tab.active {
  background: linear-gradient(135deg, rgba(245, 196, 81, 0.2), rgba(56, 189, 248, 0.18));
  border-color: var(--gold-primary);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(245, 196, 81, 0.15);
}

.stage-tab.completed {
  border-color: rgba(16, 185, 129, 0.5);
}

.stage-tab.completed .tab-badge {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border-color: #10b981;
}

.stage-tab:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.tab-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.stage-tab.active .tab-badge {
  background: var(--gold-primary);
  color: #090d16;
  border-color: var(--gold-light);
}

.tab-info {
  overflow: hidden;
}

.tab-title {
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-sub {
  font-size: 0.7rem;
  opacity: 0.78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main Workspace Layout */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 18px;
  flex: 1;
  align-items: start;
}

/* Primary Stage Viewport */
.stage-viewport {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Interactive Visual Scene Banner */
.scene-visual-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 3;
  background: #050811;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
}

.scene-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), filter 0.8s ease;
  filter: contrast(1.06) saturate(1.08);
}

.scene-visual-wrapper.rift-active .scene-image {
  animation: subtleGlitch 8s infinite;
}

@keyframes subtleGlitch {
  0%, 94%, 100% { filter: contrast(1.06) saturate(1.08) hue-rotate(0deg); transform: scale(1.01); }
  95% { filter: contrast(1.25) saturate(1.4) hue-rotate(-15deg); transform: scale(1.02) translate(-2px, 1px); }
  96% { filter: contrast(1.15) saturate(0.9) hue-rotate(18deg); transform: scale(1.015) translate(2px, -1px); }
  97% { filter: contrast(1.06) saturate(1.08) hue-rotate(0deg); transform: scale(1.01); }
}

.scene-overlay-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(7, 11, 22, 0.12) 0%,
    rgba(7, 11, 22, 0.04) 55%,
    rgba(7, 11, 22, 0.86) 100%
  );
  pointer-events: none;
}

/* Scene Top Badges */
.scene-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(7, 11, 22, 0.88);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 4;
}

.location-badge {
  pointer-events: auto;
  background: rgba(7, 11, 22, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-gold);
  padding: 5px 14px 5px 8px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold-light);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.loc-logo-wrap {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #fffbeb 75%, #fde68a 100%);
  border: 1px solid var(--gold-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px;
  flex-shrink: 0;
}

.loc-logo-mini {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.scene-actions {
  pointer-events: auto;
  display: flex;
  gap: 8px;
}

.btn-scene-tool {
  background: rgba(7, 11, 22, 0.78);
  backdrop-filter: blur(8px);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-scene-tool:hover {
  border-color: var(--cyan-primary);
  color: var(--cyan-primary);
}

/* Interactive Hotspots on 01.jpg and 02.jpg */
.hotspots-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.scene-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(13, 21, 42, 0.85);
  border: 1.5px solid var(--gold-primary);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 18px rgba(245, 196, 81, 0.45);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.scene-hotspot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-primary);
  animation: pulseDot 1.4s infinite;
}

.scene-hotspot.inspected {
  border-color: var(--cyan-primary);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

.scene-hotspot.inspected::before {
  background: var(--cyan-primary);
  box-shadow: 0 0 8px var(--cyan-primary);
}

.scene-hotspot:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: rgba(245, 196, 81, 0.95);
  color: #070b16;
}

.scene-hotspot:hover::before {
  background: #070b16;
}

/* Scene Caption Overlay */
.scene-caption-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 22px;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.scene-caption-text h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.scene-caption-text p {
  font-size: 0.86rem;
  color: #cbd5e1;
  max-width: 720px;
}

.scene-emblem-floater {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  background: rgba(9, 15, 32, 0.84);
  backdrop-filter: blur(10px);
  border: 1.5px solid var(--border-gold);
  color: var(--text-main);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(245, 196, 81, 0.25);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: left;
}

.scene-emblem-floater:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: var(--gold-primary);
  box-shadow: 0 8px 25px rgba(245, 196, 81, 0.45);
}

.scene-emblem-floater.inspected {
  border-color: var(--cyan-primary);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.4);
}

.floater-logo-medallion {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #fffbeb 75%, #fef08a 100%);
  border: 1.5px solid var(--gold-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1.5px;
  flex-shrink: 0;
}

.floater-logo-medallion img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.floater-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.floater-meta strong {
  font-size: 0.78rem;
  color: var(--gold-light);
}

.floater-meta small {
  font-size: 0.68rem;
  color: #cbd5e1;
}

/* Stage Content Body */
.stage-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Narrative Box */
.narrative-card {
  background: linear-gradient(135deg, rgba(20, 32, 62, 0.85), rgba(15, 23, 42, 0.9));
  border-left: 4px solid var(--gold-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.narrative-speaker {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.narrative-text {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.75;
  user-select: text;
}

.narrative-text strong {
  color: var(--gold-light);
}

.riddle-poem {
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(7, 11, 22, 0.65);
  border: 1px dashed var(--border-gold);
  border-radius: 10px;
  font-family: var(--font-serif);
  font-size: 0.98rem;
  color: var(--gold-light);
  line-height: 1.8;
}

/* Interactive Puzzle Containers */
.puzzle-workbench {
  background: rgba(9, 14, 28, 0.78);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.workbench-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.workbench-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--cyan-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Puzzle 1: 5x5 Campus Star Axis Grid (Answer: L) */
.p1-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
}

.star-grid-board {
  display: grid;
  grid-template-columns: repeat(5, 56px);
  grid-template-rows: repeat(5, 56px);
  gap: 8px;
  padding: 16px;
  background:
    linear-gradient(rgba(7, 11, 22, 0.78), rgba(7, 11, 22, 0.78)),
    url("../asset/images/01.jpg") center/cover no-repeat;
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.8);
}

.grid-cell {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.75);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  padding: 2px;
}

.grid-cell:hover {
  border-color: var(--gold-primary);
  transform: scale(1.05);
}

.grid-cell.active {
  background: linear-gradient(135deg, rgba(245, 196, 81, 0.88), rgba(234, 179, 8, 0.75));
  color: #070b16;
  border-color: #fff;
  box-shadow: 0 0 16px rgba(245, 196, 81, 0.75);
  font-weight: 800;
}

.grid-cell .cell-coord {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  opacity: 0.75;
}

/* Puzzle 2: Six-Discipline Resonance & 7-Segment Matrix (Answer: E) */
.p2-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 22px;
  align-items: center;
}

.discipline-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.discipline-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 11px 13px;
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.discipline-card:hover {
  border-color: var(--cyan-primary);
  transform: translateY(-2px);
}

.discipline-card.resonated {
  border-color: var(--gold-primary);
  background: linear-gradient(135deg, rgba(245, 196, 81, 0.16), rgba(56, 189, 248, 0.12));
  box-shadow: 0 0 14px rgba(245, 196, 81, 0.22);
}

.disc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--gold-light);
}

.disc-clue {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.discipline-card.resonated .disc-clue {
  color: #e2e8f0;
}

/* 7-Segment / Glyph Synthesizer for E */
.glyph-synth-box {
  background: rgba(7, 11, 22, 0.85);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.segment-board {
  position: relative;
  width: 140px;
  height: 200px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 12px;
  padding: 16px;
}

.seg-bar {
  position: absolute;
  background: rgba(148, 163, 184, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.seg-bar:hover {
  border-color: var(--cyan-primary);
}

.seg-bar.on {
  background: var(--gold-primary);
  border-color: #fff;
  box-shadow: 0 0 16px var(--gold-primary);
}

/* Horizontal bars: top, mid, bottom */
.seg-top { top: 18px; left: 30px; width: 88px; height: 20px; }
.seg-mid { top: 90px; left: 30px; width: 78px; height: 20px; }
.seg-bot { bottom: 18px; left: 30px; width: 88px; height: 20px; }
/* Vertical bars: left-top, left-bot, right-top, right-bot */
.seg-lt { top: 22px; left: 18px; width: 20px; height: 84px; }
.seg-lb { bottom: 22px; left: 18px; width: 20px; height: 84px; }
.seg-rt { top: 22px; right: 18px; width: 20px; height: 78px; }
.seg-rb { bottom: 22px; right: 18px; width: 20px; height: 78px; }

/* Puzzle 3: Chrono Pendulum & T-Beam Calibrator (Answer: T) */
.p3-layout {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 22px;
  align-items: center;
}

.t-calibrator-stage {
  background: rgba(7, 11, 22, 0.88);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.t-visual-frame {
  width: 210px;
  height: 190px;
  background: radial-gradient(circle at 50% 30%, rgba(56, 189, 248, 0.14), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.t-beam-horiz {
  position: absolute;
  top: 28px;
  height: 22px;
  width: 140px;
  background: linear-gradient(90deg, var(--cyan-primary), var(--gold-primary), var(--cyan-primary));
  border-radius: 8px;
  box-shadow: 0 0 16px rgba(245, 196, 81, 0.65);
  transition: left 0.06s linear;
}

.t-pillar-vert {
  position: absolute;
  top: 46px;
  width: 24px;
  height: 120px;
  background: linear-gradient(180deg, var(--gold-primary), var(--cyan-primary));
  border-radius: 0 0 8px 8px;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.65);
  transition: left 0.06s linear;
}

.t-target-guide {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.t-target-guide::before {
  content: "";
  position: absolute;
  top: 28px;
  left: 35px;
  width: 140px;
  height: 22px;
  border: 1.5px dashed rgba(245, 196, 81, 0.42);
  border-radius: 8px;
}

.t-target-guide::after {
  content: "";
  position: absolute;
  top: 46px;
  left: 93px;
  width: 24px;
  height: 120px;
  border: 1.5px dashed rgba(56, 189, 248, 0.42);
  border-radius: 0 0 8px 8px;
}

.slider-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
}

.slider-row label {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}

.slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--gold-primary);
  cursor: pointer;
}

/* Answer Submission Terminal Bar */
.answer-terminal {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(20, 32, 62, 0.95));
  border: 1.5px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.terminal-prompt {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.terminal-prompt .prompt-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gold-light);
}

.terminal-prompt .prompt-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.terminal-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.letter-input {
  width: 90px;
  height: 48px;
  border-radius: 10px;
  border: 2px solid var(--cyan-primary);
  background: rgba(7, 11, 22, 0.9);
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
  transition: all 0.2s;
}

.letter-input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 20px rgba(245, 196, 81, 0.5);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-primary), #eab308);
  color: #070b16;
  border: none;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(245, 196, 81, 0.35);
  transition: all 0.22s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(245, 196, 81, 0.55);
  filter: brightness(1.06);
}

.btn-secondary {
  background: rgba(56, 189, 248, 0.14);
  color: #e0f2fe;
  border: 1px solid rgba(56, 189, 248, 0.45);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(56, 189, 248, 0.26);
  transform: translateY(-1px);
}

.feedback-banner {
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 10px;
}

.feedback-banner.show {
  display: flex;
}

.feedback-banner.success {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
}

.feedback-banner.error {
  background: rgba(244, 63, 94, 0.18);
  border: 1px solid rgba(244, 63, 94, 0.5);
  color: #fda4af;
}

/* Right Sidebar: Investigator Notebook, Hints & Lore */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.side-card {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.dossier-watermark-logo {
  position: absolute;
  right: -18px;
  bottom: -18px;
  width: 120px;
  height: 120px;
  object-fit: contain;
  opacity: 0.08;
  pointer-events: none;
  transform: rotate(-12deg);
}

.mini-medallion {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #fffbeb 75%, #fef08a 100%);
  border: 1px solid var(--gold-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px;
  flex-shrink: 0;
}

.mini-medallion img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.side-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
  position: relative;
  z-index: 1;
}

/* Prologue & Stage School Emblem Banner */
.prologue-emblem-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(7, 11, 22, 0.72);
  border: 1px dashed var(--border-gold);
  position: relative;
  overflow: hidden;
}

.prologue-logo-medallion {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #fffdf2 74%, #fef08a 100%);
  border: 2px solid var(--gold-primary);
  box-shadow: 0 0 18px rgba(245, 196, 81, 0.38);
  padding: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prologue-logo-medallion img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Hint Accordion Buttons */
.hint-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hint-item {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
}

.hint-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--cyan-primary);
}

.hint-item-body {
  margin-top: 8px;
  color: var(--text-main);
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
  padding-top: 8px;
  line-height: 1.55;
}

/* Clues Log List */
.clue-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
  position: relative;
  z-index: 1;
}

.clue-entry {
  background: rgba(15, 23, 42, 0.75);
  border-left: 3px solid var(--cyan-primary);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.clue-entry .clue-title {
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 2px;
}

.clue-entry .clue-desc {
  color: var(--text-muted);
  font-size: 0.76rem;
}

/* Finale / Victory Certificate View */
.victory-certificate {
  background:
    radial-gradient(circle at 50% 0%, rgba(245, 196, 81, 0.28), transparent 70%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(9, 14, 28, 0.98));
  border: 2px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 0 55px rgba(245, 196, 81, 0.35), inset 0 0 35px rgba(245, 196, 81, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

/* Golden God-Rays Rotating Aura */
.victory-godrays-aura {
  position: absolute;
  top: -40%;
  left: -20%;
  width: 140%;
  height: 180%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(245, 196, 81, 0.045) 0deg 12deg,
    transparent 12deg 24deg
  );
  border-radius: 50%;
  animation: rotateGodRays 48s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes rotateGodRays {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.victory-honor-ribbon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(245, 196, 81, 0.16), rgba(16, 185, 129, 0.22), rgba(245, 196, 81, 0.16));
  border: 1.5px solid var(--border-gold);
  color: var(--gold-light);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 2px;
  box-shadow: 0 0 24px rgba(245, 196, 81, 0.35);
  position: relative;
  z-index: 2;
  animation: ribbonGlow 3.5s ease-in-out infinite;
}

@keyframes ribbonGlow {
  0%, 100% { box-shadow: 0 0 16px rgba(245, 196, 81, 0.3); border-color: var(--border-gold); }
  50% { box-shadow: 0 0 32px rgba(245, 196, 81, 0.65), 0 0 16px rgba(56, 189, 248, 0.4); border-color: #fef08a; }
}

.victory-emblem-medallion {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #fffdf2 75%, #fef08a 100%);
  border: 2.5px solid var(--gold-primary);
  box-shadow: 0 0 35px rgba(245, 196, 81, 0.6), inset 0 0 8px rgba(245, 196, 81, 0.35);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.victory-emblem-medallion.stamped {
  animation: emblemStampBounce 0.85s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes emblemStampBounce {
  0% { transform: scale(2.4); opacity: 0; filter: blur(4px); }
  65% { transform: scale(0.92); opacity: 1; filter: blur(0); }
  100% { transform: scale(1); opacity: 1; }
}

.emblem-shockwave-ring {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 2px solid var(--gold-primary);
  animation: emblemShockwave 2.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  pointer-events: none;
}

@keyframes emblemShockwave {
  0% { transform: scale(0.85); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

.victory-emblem-medallion img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.victory-seal-watermark {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 170px;
  height: 170px;
  object-fit: contain;
  opacity: 0.14;
  transform: rotate(-15deg);
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.35));
}

.let-hero-badges {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin: 8px 0;
  position: relative;
  z-index: 2;
}

.let-hero-card {
  width: 96px;
  height: 112px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(245, 196, 81, 0.25), rgba(56, 189, 248, 0.2));
  border: 2px solid var(--gold-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(245, 196, 81, 0.35);
  position: relative;
  overflow: hidden;
}

.let-hero-card.celebrate {
  box-shadow: 0 0 35px rgba(245, 196, 81, 0.45);
}

.let-hero-card.celebrate::after {
  content: "";
  position: absolute;
  inset: -60%;
  background: linear-gradient(
    120deg,
    transparent 35%,
    rgba(255, 255, 255, 0.48) 50%,
    transparent 65%
  );
  transform: rotate(25deg);
  animation: letShimmerSweep 3.2s infinite;
}

@keyframes letShimmerSweep {
  0% { transform: translateX(-160%) rotate(25deg); }
  40%, 100% { transform: translateX(160%) rotate(25deg); }
}

.let-hero-card .big-letter {
  font-family: var(--font-mono);
  font-size: 2.6rem;
  font-weight: 900;
  color: var(--gold-light);
  line-height: 1;
  text-shadow: 0 0 16px var(--gold-primary);
}

.let-hero-card .letter-word {
  font-size: 0.72rem;
  color: #e2e8f0;
  margin-top: 6px;
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 680px;
  position: relative;
  z-index: 2;
}

.stat-box {
  background: rgba(7, 11, 22, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
}

.stat-box .stat-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--cyan-primary);
}

.stat-box .stat-lbl {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Modal for Image Zoom & Audit Log */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 14, 0.88);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: var(--bg-panel);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.modal-close {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
}

.modal-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.guardian-name-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  background: rgba(7, 11, 22, 0.78);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 0.88rem;
  position: relative;
  z-index: 2;
}

.guardian-name-input {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--cyan-primary);
  border-radius: 8px;
  color: var(--gold-light);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 4px 10px;
  width: 170px;
  text-align: center;
  outline: none;
}

.guardian-name-input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px rgba(245, 196, 81, 0.4);
}

/* Dual Mode Selector Card in Prologue */
.dual-mode-selector-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mode-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.mode-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.mode-option-box {
  background: rgba(7, 11, 22, 0.72);
  border: 1.5px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.mode-option-box:hover {
  border-color: rgba(245, 196, 81, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.mode-option-box.active {
  border-color: var(--gold-primary);
  background: linear-gradient(145deg, rgba(20, 32, 62, 0.85), rgba(15, 23, 42, 0.95));
  box-shadow: 0 0 18px rgba(245, 196, 81, 0.25);
}

.mode-opt-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mode-opt-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(245, 196, 81, 0.18);
  color: var(--gold-light);
  border: 1px solid var(--border-gold);
}

.mode-status-pill {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.mode-option-box.active .mode-status-pill {
  color: #6ee7b7;
  font-weight: 700;
}

.mode-opt-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.mode-option-box.active .mode-opt-title {
  color: var(--gold-light);
}

.mode-opt-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

/* Quiz Mode Workbench & Word Tiles */
.quiz-workbench-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.quiz-word-panel {
  background: rgba(7, 11, 22, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.quiz-badge-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.quiz-tag-pill {
  font-size: 0.74rem;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.word-tiles-display {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 10px 0;
}

.word-tile {
  width: 52px;
  height: 64px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 900;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  user-select: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.word-tile.normal {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.85));
  border: 1.5px solid var(--border-subtle);
  color: #f1f5f9;
}

.word-tile.missing {
  background: rgba(7, 11, 22, 0.9);
  border: 2px dashed var(--gold-primary);
  color: var(--gold-light);
  box-shadow: 0 0 18px rgba(245, 196, 81, 0.35);
  animation: pulseMissingTile 2s infinite ease-in-out;
}

.word-tile.missing.filled {
  border-style: solid;
  color: #fff;
  background: linear-gradient(135deg, rgba(245, 196, 81, 0.3), rgba(56, 189, 248, 0.25));
}

.word-tile.solved {
  background: linear-gradient(135deg, #059669, #10b981);
  border: 2px solid #6ee7b7;
  color: #ffffff;
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.6);
  transform: scale(1.06);
}

@keyframes pulseMissingTile {
  0%, 100% { box-shadow: 0 0 12px rgba(245, 196, 81, 0.25); border-color: var(--gold-primary); }
  50% { box-shadow: 0 0 24px rgba(56, 189, 248, 0.55); border-color: var(--cyan-primary); }
}

.word-tile.shake-error {
  animation: shakeTile 0.45s ease-in-out;
  border-color: var(--rose-err) !important;
}

@keyframes shakeTile {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.word-meta-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.word-phonetic-badge {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--cyan-primary);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 3px 10px;
  border-radius: 6px;
}

.word-meaning-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold-light);
}

.word-context-box {
  width: 100%;
  max-width: 660px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.86rem;
  line-height: 1.6;
}

.context-item {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.context-label {
  font-weight: 700;
  color: var(--text-main);
  flex-shrink: 0;
}

.context-val {
  color: var(--text-main);
}

/* Quiz Input & Candidate Actions */
.quiz-input-action-area {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.cand-pills-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-cand-pill {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.9);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-cand-pill:hover {
  border-color: var(--gold-primary);
  color: var(--gold-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 196, 81, 0.35);
}

.manual-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-letter-input {
  width: 52px;
  height: 44px;
  border-radius: 10px;
  background: rgba(7, 11, 22, 0.9);
  border: 2px solid var(--cyan-primary);
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 900;
  text-align: center;
  outline: none;
  transition: all 0.2s ease;
}

.quiz-letter-input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 14px rgba(245, 196, 81, 0.45);
}

.quiz-feedback-banner {
  border-radius: 12px;
  padding: 14px 18px;
  animation: fadeInDown 0.3s ease;
}

.quiz-feedback-banner.success {
  background: rgba(16, 185, 129, 0.16);
  border: 1.5px solid rgba(16, 185, 129, 0.45);
}

/* Floating Toast Notification */
.floating-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(7, 11, 22, 0.94);
  border: 1px solid var(--gold-primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 16px rgba(245, 196, 81, 0.3);
  color: var(--gold-light);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 10px 22px;
  border-radius: 999px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==================== 响应式设计与全端适配引擎 ==================== */

/* ---------- 1. 超大屏幕与高分屏优化 (2K / 4K / 宽屏大触控屏) ---------- */
@media (min-width: 1920px) {
  html {
    font-size: 17px;
  }
  .app-shell {
    max-width: 1600px;
    padding: 24px 32px 50px;
    gap: 22px;
  }
  .star-grid-board {
    grid-template-columns: repeat(5, 68px);
    grid-template-rows: repeat(5, 68px);
    gap: 10px;
    padding: 20px;
  }
  .word-tile {
    width: 60px;
    height: 74px;
    font-size: 2.2rem;
  }
  .btn-cand-pill {
    width: 52px;
    height: 52px;
    font-size: 1.35rem;
  }
}

@media (min-width: 2560px) {
  html {
    font-size: 19px;
  }
  .app-shell {
    max-width: 1980px;
    padding: 30px 40px 60px;
    gap: 26px;
  }
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) 440px;
    gap: 24px;
  }
  .star-grid-board {
    grid-template-columns: repeat(5, 80px);
    grid-template-rows: repeat(5, 80px);
    gap: 12px;
    padding: 24px;
  }
  .word-tile {
    width: 70px;
    height: 86px;
    font-size: 2.6rem;
  }
  .btn-cand-pill {
    width: 60px;
    height: 60px;
    font-size: 1.55rem;
  }
  .let-hero-card {
    width: 118px;
    height: 138px;
  }
  .let-hero-card .big-letter {
    font-size: 3.2rem;
  }
  .modal-dialog {
    max-width: 1240px;
    padding: 32px;
  }
}

/* ---------- 2. 平板与窄屏桌面适配 (<= 1080px) ---------- */
@media (max-width: 1080px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .stage-nav {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .sidebar-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}

/* ---------- 3. 手机与小屏幕深度优化 (<= 768px) ---------- */
@media (max-width: 768px) {
  .app-shell {
    padding: 10px 10px 32px;
    gap: 12px;
  }

  /* HUD 顶部精简排列 */
  .hud-header {
    padding: 10px 12px;
    gap: 10px;
    border-radius: var(--radius-md);
  }
  .brand-group {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
  }
  .brand-emblem {
    width: 44px;
    height: 44px;
  }
  .brand-titles h1 {
    font-size: 1.15rem;
  }
  .brand-subtitle {
    font-size: 0.72rem;
    gap: 6px;
  }
  .school-motto-pill {
    display: none; /* 移动端精简头部，校训已保留在校徽与卡片中 */
  }

  /* 密钥卡槽与模式切换行 */
  .key-matrix-hud {
    padding: 5px 10px;
    gap: 6px;
  }
  .key-matrix-label {
    font-size: 0.74rem;
    margin-right: 2px;
  }
  .key-slot {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }
  .key-slot .slot-index {
    font-size: 0.55rem;
  }
  .key-slot .slot-char {
    font-size: 1.1rem;
  }

  .mode-switcher-hud {
    padding: 2px 4px;
  }
  .btn-mode-tab {
    padding: 5px 8px;
    font-size: 0.76rem;
  }

  /* HUD 按钮与控制 */
  .hud-controls {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .chrono-timer {
    padding: 5px 8px;
    font-size: 0.78rem;
  }
  .btn-hud {
    padding: 5px 8px;
    font-size: 0.74rem;
    border-radius: 8px;
  }

  /* 章节导航条：移动端整洁双行排布 */
  .stage-nav {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .stage-tab {
    padding: 7px 8px;
    min-height: 44px;
    gap: 6px;
    border-radius: 8px;
  }
  .tab-badge {
    width: 22px;
    height: 22px;
    font-size: 0.68rem;
  }
  .tab-title {
    font-size: 0.74rem;
  }
  .tab-sub {
    font-size: 0.62rem;
  }

  /* 布局退化为单列 */
  .sidebar-panel {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .p1-layout, .p2-layout, .p3-layout, .modal-image-grid, .mode-options-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* 场景图片与热点层 */
  .scene-top-bar {
    padding: 8px 12px;
  }
  .location-badge {
    font-size: 0.74rem;
    padding: 3px 10px 3px 6px;
  }
  .loc-logo-wrap {
    width: 20px;
    height: 20px;
  }
  .btn-scene-tool {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  .scene-visual-wrapper {
    aspect-ratio: 16 / 11;
  }
  .scene-hotspot {
    font-size: 0.7rem;
    padding: 3px 8px;
    gap: 4px;
  }

  .scene-caption-bar {
    padding: 8px 12px;
    gap: 8px;
  }
  .scene-caption-text h2 {
    font-size: 0.96rem;
  }
  .scene-caption-text p {
    font-size: 0.72rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .scene-emblem-floater {
    padding: 3px 6px;
  }
  .scene-emblem-floater .floater-meta {
    display: none;
  }
  .floater-logo-medallion {
    width: 30px;
    height: 30px;
  }

  /* 工作区内容 */
  .stage-body {
    padding: 14px 12px;
    gap: 14px;
  }
  .narrative-card {
    padding: 12px 14px;
  }
  .narrative-text {
    font-size: 0.88rem;
    line-height: 1.65;
  }
  .riddle-poem {
    font-size: 0.86rem;
    padding: 10px 12px;
    line-height: 1.7;
  }
  .puzzle-workbench {
    padding: 14px 12px;
    gap: 14px;
  }

  /* 谜题一：5x5 网格自适应（杜绝横向撑爆） */
  .star-grid-board {
    width: 100%;
    max-width: 310px;
    margin: 0 auto;
    padding: 10px;
    gap: 6px;
    aspect-ratio: 1;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
  }
  .grid-cell {
    font-size: 0.65rem;
    padding: 1px;
    border-radius: 6px;
  }
  .grid-cell .cell-coord {
    font-size: 0.55rem;
  }

  /* 谜题二：学科卡片与数码管 */
  .discipline-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .discipline-card {
    padding: 8px 10px;
  }
  .disc-header {
    font-size: 0.8rem;
  }
  .disc-clue {
    font-size: 0.7rem;
  }
  .glyph-synth-box {
    padding: 14px 10px;
    max-width: 260px;
    margin: 0 auto;
    width: 100%;
  }
  .segment-board {
    width: 120px;
    height: 170px;
    padding: 12px;
  }
  .seg-top, .seg-bot { width: 72px; height: 16px; left: 24px; }
  .seg-mid { width: 64px; height: 16px; left: 24px; top: 76px; }
  .seg-top { top: 14px; }
  .seg-bot { bottom: 14px; }
  .seg-lt, .seg-rt { top: 18px; width: 16px; height: 68px; }
  .seg-lb, .seg-rb { bottom: 18px; width: 16px; height: 68px; }
  .seg-lt, .seg-lb { left: 14px; }
  .seg-rt, .seg-rb { right: 14px; }

  /* 谜题三：天梁立柱对齐仪 */
  .t-calibrator-stage {
    padding: 14px 10px;
    max-width: 270px;
    margin: 0 auto;
    width: 100%;
  }
  .t-visual-frame {
    width: 200px;
    height: 170px;
  }

  /* 输入终端 */
  .answer-terminal {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 12px 14px;
    gap: 10px;
  }
  .terminal-input-group {
    justify-content: center;
    width: 100%;
    gap: 8px;
  }
  .letter-input {
    width: 72px;
    height: 44px;
    font-size: 1.4rem;
  }
  .btn-primary, .btn-secondary {
    padding: 10px 16px;
    font-size: 0.88rem;
  }

  /* 单词答题模式自适应 */
  .word-tiles-display {
    gap: 4px;
    margin: 8px 0;
  }
  .word-tile {
    width: clamp(28px, 8.5vw, 42px);
    height: clamp(42px, 12vw, 54px);
    font-size: clamp(1.2rem, 5vw, 1.55rem);
    border-radius: 8px;
  }
  .word-meta-info {
    font-size: 0.84rem;
    gap: 8px;
  }
  .word-context-box {
    padding: 10px 12px;
    font-size: 0.82rem;
    gap: 6px;
  }
  .quiz-input-action-area {
    padding: 12px;
    gap: 10px;
  }
  .quiz-input-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .cand-pills-group {
    justify-content: center;
    gap: 6px;
  }
  .btn-cand-pill {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    border-radius: 10px;
  }
  .manual-input-group {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  .quiz-letter-input {
    width: 52px;
    height: 44px;
    font-size: 1.4rem;
  }

  /* 终章荣誉证书与加冕礼 */
  .victory-certificate {
    padding: 20px 12px;
    gap: 14px;
  }
  .victory-certificate h2 {
    font-size: 1.35rem;
  }
  .victory-honor-ribbon {
    padding: 4px 14px;
    font-size: 0.78rem;
    letter-spacing: 1px;
  }
  .victory-emblem-medallion {
    width: 68px;
    height: 68px;
  }
  .let-hero-badges {
    gap: 8px;
    margin: 4px 0;
  }
  .let-hero-card {
    width: 72px;
    height: 84px;
    border-radius: 12px;
  }
  .let-hero-card .big-letter {
    font-size: 1.85rem;
  }
  .let-hero-card .letter-word {
    font-size: 0.64rem;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stat-box {
    padding: 8px 10px;
  }
  .stat-box .stat-val {
    font-size: 1.1rem;
  }
  .stat-box .stat-lbl {
    font-size: 0.7rem;
  }
  .certificate-credits-bar {
    padding: 6px 14px;
    font-size: 0.78rem;
    gap: 10px;
  }
  .guardian-name-bar {
    padding: 6px 12px;
    font-size: 0.82rem;
  }
  .guardian-name-input {
    width: 140px;
    font-size: 0.84rem;
  }

  /* 弹窗小屏优化 */
  .modal-backdrop {
    padding: 10px;
  }
  .modal-dialog {
    padding: 16px 14px;
    max-height: 88vh;
    border-radius: var(--radius-md);
  }

  /* 页脚移动端流式对齐 */
  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  .footer-meta {
    justify-content: center;
    font-size: 0.76rem;
  }
  .footer-credits {
    justify-content: center;
  }
}

/* ---------- 4. 超小屏手机极限适配 (<= 400px，如 iPhone SE, 窄屏安卓) ---------- */
@media (max-width: 400px) {
  .brand-titles h1 {
    font-size: 1.05rem;
  }
  .key-matrix-hud {
    width: 100%;
    justify-content: space-around;
  }
  .stage-nav {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .stage-tab {
    padding: 6px 4px;
    gap: 4px;
  }
  .stage-tab .tab-sub {
    display: none; /* 超小屏仅保留标题，保持单行清爽 */
  }
  .tab-title {
    font-size: 0.7rem;
  }
  .word-tile {
    width: clamp(26px, 8vw, 36px);
    height: clamp(38px, 11vw, 48px);
    font-size: 1.25rem;
  }
  .btn-cand-pill {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }
  .let-hero-card {
    width: 64px;
    height: 76px;
  }
  .let-hero-card .big-letter {
    font-size: 1.6rem;
  }
  .star-grid-board {
    max-width: 270px;
    padding: 6px;
    gap: 4px;
  }
}

/* ==================== 制作者与预留指导老师荣誉栏 ==================== */
.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.credit-pill.author-pill {
  background: rgba(245, 196, 81, 0.12);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
}

.credit-pill.author-pill:hover {
  background: rgba(245, 196, 81, 0.22);
  box-shadow: 0 0 12px rgba(245, 196, 81, 0.35);
}

.credit-pill.mentor-pill {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: var(--cyan-primary);
}

.credit-pill.mentor-pill:hover {
  background: rgba(56, 189, 248, 0.22);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.app-footer {
  margin-top: 14px;
  background: rgba(13, 21, 42, 0.84);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 2;
}

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

.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-title {
  font-weight: 700;
  color: var(--gold-light);
}

.footer-sep {
  opacity: 0.4;
}

.footer-credits {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 通关证书上的制作者与指导老师荣誉签名栏 */
.certificate-credits-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  background: rgba(7, 11, 22, 0.82);
  border: 1px solid var(--border-gold);
  padding: 8px 24px;
  border-radius: 999px;
  font-size: 0.86rem;
  box-shadow: 0 0 16px rgba(245, 196, 81, 0.2);
}

.cert-credit-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
