:root {
  color-scheme: dark;
  --bg-gradient: radial-gradient(circle at 20% 20%, rgba(77, 97, 238, 0.32), rgba(16, 17, 40, 0.92) 60%),
    radial-gradient(circle at 80% 0%, rgba(255, 126, 56, 0.24), rgba(17, 24, 39, 0.9) 55%), #0f172a;
  --panel-bg: rgba(15, 23, 42, 0.76);
  --panel-border: rgba(255, 255, 255, 0.08);
  --highlight: #f97316;
  --primary: linear-gradient(145deg, #38bdf8, #2563eb);
  --secondary: linear-gradient(145deg, #f97316, #ea580c);
  --surface: rgba(255, 255, 255, 0.06);
  --text-main: #f8fafc;
  --text-sub: #cbd5f5;
  --shadow-strong: 0 25px 60px rgba(15, 23, 42, 0.4);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-gradient);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 24px 56px;
}

.app-shell {
  width: min(1240px, 100%);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow-strong);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 36px 16px;
  gap: 24px;
}

.title-stack h1 {
  margin: 0;
  font-size: clamp(26px, 2vw + 12px, 34px);
  letter-spacing: 0.04em;
}

.subtitle {
  margin: 6px 0 0;
  font-size: 16px;
  color: var(--text-sub);
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.subtitle::before {
  content: "";
  width: 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 255, 0.6), transparent);
  display: inline-block;
}

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  position: relative;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: var(--surface);
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 12px 24px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(10px);
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
}

.btn-secondary {
  background: var(--secondary);
}

.btn-ghost {
  background: rgba(148, 163, 255, 0.12);
  color: var(--text-sub);
  border: 1px solid rgba(148, 163, 255, 0.2);
  box-shadow: none;
}

.main-area {
  padding: 0 36px 28px;
  display: grid;
  --stage-column: minmax(0, 2.35fr);
  --history-column: minmax(240px, 0.95fr);
  grid-template-columns: var(--stage-column) var(--history-column);
  gap: 28px;
  transition: grid-template-columns 0.45s var(--ease-smooth), gap 0.45s var(--ease-smooth);
}

.main-area.expanded {
  --stage-column: minmax(0, 1fr);
  --history-column: minmax(0, 0fr);
  gap: 0;
}

.stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.video-frame {
  position: relative;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 255, 0.14);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 30px 45px rgba(6, 11, 23, 0.45);
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.video-info-bar {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px 24px;
  background: linear-gradient(140deg, rgba(15, 23, 42, 0.88), rgba(30, 41, 59, 0.72));
  border: 1px solid rgba(148, 163, 255, 0.24);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(14px);
  flex-wrap: wrap;
}

.video-info-left {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2.2vw, 16px);
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.video-info-left > * {
  flex: 0 1 auto;
}

.explore-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 255, 0.22);
  background: rgba(30, 41, 59, 0.36);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1;
  flex: 0 1 280px;
  min-width: 240px;
}

.explore-progress-label {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.explore-progress-meter {
  position: relative;
  flex: 1 1 auto;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 255, 0.2);
  overflow: hidden;
}

.explore-progress-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.75), rgba(59, 130, 246, 0.95));
  transition: width 0.35s var(--ease-smooth);
}

.explore-progress-count {
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
  font-weight: 600;
}

.video-info-bar .btn {
  margin-left: auto;
  flex-shrink: 0;
}

.video-progress {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 24px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  z-index: 3;
  user-select: none;
  touch-action: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.video-frame:hover .video-progress,
.video-progress.scrubbing,
.video-progress:focus-within {
  opacity: 1;
  pointer-events: auto;
}

.video-progress-track {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 255, 0.24);
  overflow: visible;
  transition: background 0.2s ease;
}

.video-progress-buffered,
.video-progress-played {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: inherit;
  width: 0;
}

.video-progress-buffered {
  background: rgba(148, 163, 255, 0.28);
}

.video-progress-played {
  background: linear-gradient(145deg, #38bdf8, #2563eb);
}

.video-progress-handle {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #38bdf8;
  border: 2px solid rgba(15, 23, 42, 0.85);
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.45);
  transform: translate(-50%, -50%);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  pointer-events: none;
}

.video-progress-control {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 255, 0.42);
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.6), rgba(37, 99, 235, 0.72));
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #fff;
  cursor: pointer;
  flex: 0 0 40px;
  transition: transform 0.2s var(--ease-smooth), box-shadow 0.2s ease, filter 0.2s ease;
  outline: none;
  backdrop-filter: blur(8px);
}

.video-progress-control:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 20px 38px rgba(15, 23, 42, 0.5);
}

.video-progress-control:active {
  transform: scale(0.95);
}

.video-progress-control:focus-visible {
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.5), 0 16px 32px rgba(15, 23, 42, 0.45);
}

.video-progress-control:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: saturate(0.6);
  box-shadow: none;
}

.video-progress-control:disabled:hover,
.video-progress-control:disabled:active {
  transform: none;
  filter: saturate(0.6);
}

.video-progress-control-icon {
  position: relative;
  width: 12px;
  height: 16px;
  display: inline-block;
}

.video-progress-control-icon::before,
.video-progress-control-icon::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.video-progress-control.is-playing .video-progress-control-icon::before,
.video-progress-control.is-playing .video-progress-control-icon::after {
  width: 4px;
}

.video-progress-control.is-playing .video-progress-control-icon::before {
  transform: translateX(0);
}

.video-progress-control.is-playing .video-progress-control-icon::after {
  transform: translateX(8px);
}

.video-progress-control.is-paused .video-progress-control-icon::before {
  width: 0;
  border-style: solid;
  border-width: 8px 0 8px 12px;
  border-color: transparent transparent transparent currentColor;
  background: none;
  bottom: auto;
  top: 50%;
  left: 2px;
  transform: translateY(-50%);
}

.video-progress-control.is-paused .video-progress-control-icon::after {
  opacity: 0;
}

.video-progress:hover .video-progress-handle,
.video-progress.scrubbing .video-progress-handle {
  transform: translate(-50%, -50%) scale(1.12);
  box-shadow: 0 10px 24px rgba(56, 189, 248, 0.6);
}

.video-progress.scrubbing .video-progress-track {
  background: rgba(148, 163, 255, 0.32);
}

.video-progress-time {
  position: absolute;
  right: 0;
  bottom: calc(50% + 6px);
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(148, 163, 255, 0.25);
  color: var(--text-main);
  font-size: 12px;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.4);
}

.state-pill {
  --state-accent: #60a5fa;
  --state-accent-soft: rgba(96, 165, 250, 0.24);
  --state-accent-strong: rgba(96, 165, 250, 0.45);
  --state-glow: rgba(96, 165, 250, 0.26);
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid var(--state-accent-strong);
  background: linear-gradient(135deg, var(--state-accent-soft), rgba(15, 23, 42, 0.82));
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-main);
  text-transform: none;
  line-height: 1.1;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.35), 0 0 18px var(--state-glow);
  transition: background 0.25s var(--ease-smooth), border-color 0.25s var(--ease-smooth),
    box-shadow 0.25s var(--ease-smooth), transform 0.25s var(--ease-smooth);
}

.state-pill::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-right: 10px;
  background: var(--state-accent);
  box-shadow: 0 0 0 4px var(--state-glow);
  flex: 0 0 auto;
}

.state-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.42), 0 0 18px var(--state-glow);
}

.state-pill--type {
  --state-accent: #38bdf8;
  --state-accent-soft: rgba(56, 189, 248, 0.24);
  --state-accent-strong: rgba(56, 189, 248, 0.5);
  --state-glow: rgba(56, 189, 248, 0.24);
}

.state-pill--status {
  --state-accent: #f97316;
  --state-accent-soft: rgba(249, 115, 22, 0.24);
  --state-accent-strong: rgba(249, 115, 22, 0.5);
  --state-glow: rgba(249, 115, 22, 0.26);
}

.state-badge {
  letter-spacing: 0.06em;
}

.choice-layer,
.game-layer,
.start-overlay,
.ending-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(24px, 4vw, 40px);
  gap: 20px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.86), rgba(8, 15, 33, 0.94));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  transform: translateY(12px);
  z-index: 4;
}

.choice-layer.active,
.game-layer.active,
.start-overlay.active,
.ending-overlay.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.choice-headline {
  font-size: clamp(22px, 2.2vw, 28px);
  text-align: center;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.choice-subtitle {
  max-width: 520px;
  text-align: center;
  color: var(--text-sub);
  font-size: 15px;
  line-height: 1.6;
}

.choice-buttons {
  width: 100%;
  display: grid;
  gap: 14px;
}

.choice-buttons.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-card {
  border-radius: 18px;
  padding: 18px 20px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 35px rgba(8, 15, 33, 0.5);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.choice-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.choice-card:hover {
  transform: translateY(-4px);
  border-color: rgba(96, 165, 250, 0.7);
  box-shadow: 0 25px 45px rgba(15, 23, 42, 0.55);
}

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

.choice-card h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.choice-card span {
  font-size: 13px;
  color: rgba(226, 232, 240, 0.72);
  line-height: 1.5;
}

.choice-card.bad-option {
  border-color: rgba(248, 113, 113, 0.35);
}

.choice-card.bad-option:hover {
  border-color: rgba(248, 113, 113, 0.7);
}

.door-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  width: 100%;
}

.door-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 255, 0.22);
  border-radius: 18px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.door-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(56, 189, 248, 0.12), transparent 65%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.door-card:hover {
  transform: translateY(-6px);
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 24px 38px rgba(15, 23, 42, 0.55);
}

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

.door-icon {
  font-size: 36px;
}

.door-card span {
  font-size: 14px;
  letter-spacing: 0.08em;
}

.door-card.bad-option {
  border-color: rgba(248, 113, 113, 0.4);
}

.door-card.bad-option:hover {
  border-color: rgba(248, 113, 113, 0.7);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 30px);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(248, 250, 252, 0.18);
  border-radius: 14px;
  padding: 12px 26px;
  font-size: 15px;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  z-index: 6;
  box-shadow: 0 20px 35px rgba(15, 23, 42, 0.55);
}

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

.video-meta {
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.84), rgba(30, 41, 59, 0.7));
  border: 1px solid rgba(148, 163, 255, 0.22);
  padding: clamp(18px, 2.8vw, 26px) clamp(22px, 3vw, 30px);
  line-height: 1.65;
  font-size: 15px;
  color: rgba(226, 232, 240, 0.88);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 26px rgba(15, 23, 42, 0.32);
  transition: background 0.25s var(--ease-smooth), border-color 0.25s var(--ease-smooth),
    box-shadow 0.25s var(--ease-smooth);
}

.video-meta strong {
  color: var(--text-main);
  font-size: 16px;
  letter-spacing: 0.04em;
}

.side-panel {
  position: relative;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 255, 0.18);
  background: rgba(15, 23, 42, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 100%;
  min-width: 0;
  overflow: hidden;
  transition: opacity 0.35s var(--ease-smooth), transform 0.45s var(--ease-smooth), padding 0.45s var(--ease-smooth), border-color 0.45s var(--ease-smooth), max-height 0.45s var(--ease-smooth), box-shadow 0.45s var(--ease-smooth);
  will-change: transform, opacity;
}

.side-panel.collapsed {
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
  padding: 0;
  border-color: rgba(148, 163, 255, 0);
  max-height: 0;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .main-area,
  .side-panel {
    transition: none !important;
  }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-header h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.panel-header button {
  font-size: 12px;
  padding: 6px 12px;
}

#history-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 60vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 255, 0.5) transparent;
}

#history-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.68);
  border: 1px solid rgba(148, 163, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  font-size: 13px;
  line-height: 1.5;
}

#history-list li.jumpable {
  border-color: rgba(56, 189, 248, 0.22);
  cursor: default;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#history-list li.jumpable:hover {
  border-color: rgba(56, 189, 248, 0.38);
  box-shadow: 0 12px 28px rgba(13, 42, 78, 0.35);
}

#history-list li.current {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 14px 32px rgba(13, 42, 78, 0.45);
}

#history-list li .index {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-weight: 600;
  font-size: 12px;
  color: #bae6fd;
}

#history-list li .content strong {
  color: #e0f2fe;
  font-weight: 600;
}

#history-list li .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(148, 163, 255, 0.16);
  border: 1px solid rgba(148, 163, 255, 0.32);
  margin-bottom: 4px;
}

.history-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.history-jump {
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(14, 23, 44, 0.6);
  color: #e0f2fe;
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.history-jump:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 10px 20px rgba(13, 42, 78, 0.45);
}

.history-jump:active {
  transform: scale(0.96);
}

.history-jump:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.9);
  outline-offset: 2px;
}

.start-overlay h2 {
  font-size: clamp(28px, 2.5vw + 18px, 44px);
  margin: 0;
  text-align: center;
  letter-spacing: 0.08em;
}

.start-overlay p {
  text-align: center;
  max-width: 520px;
  color: rgba(226, 232, 240, 0.78);
  line-height: 1.8;
}

.big-start-btn {
  margin-top: 12px;
  padding: 16px 42px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.45);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: transform 0.3s ease;
}

.big-start-btn:hover {
  transform: translateY(-2px);
}

.ending-overlay .ending-card {
  background: rgba(15, 23, 42, 0.82);
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 255, 0.24);
  padding: clamp(24px, 4vw, 40px);
  box-shadow: 0 28px 45px rgba(8, 15, 33, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  max-width: 480px;
}

.ending-overlay .ending-card h3 {
  margin: 0;
  font-size: clamp(24px, 2vw, 30px);
}

.ending-overlay .ending-card p {
  margin: 0;
  color: rgba(226, 232, 240, 0.82);
  line-height: 1.7;
}

.ending-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.video-play-toggle {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.86);
  color: #e0f2fe;
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.video-play-toggle.visible {
  opacity: 1;
  pointer-events: auto;
}

.video-play-toggle span {
  padding: 16px 30px;
  border: 1px solid rgba(148, 163, 255, 0.4);
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.7);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.55);
}

.footnote {
  padding: 18px 36px 32px;
  color: rgba(148, 163, 255, 0.65);
  font-size: 13px;
  letter-spacing: 0.04em;
  border-top: 1px solid rgba(148, 163, 255, 0.08);
  background: rgba(15, 23, 42, 0.78);
}

.game-wrapper {
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  text-align: center;
}

.game-title {
  margin: 0;
  font-size: clamp(22px, 2vw, 28px);
}

.game-description {
  margin: 0;
  line-height: 1.65;
  color: rgba(226, 232, 240, 0.78);
  font-size: 15px;
}

.game-status {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  color: rgba(224, 231, 255, 0.82);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 255, 0.24);
  position: relative;
}

.progress-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.15s ease;
}

.lockpick-button {
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 16px;
  border: none;
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.4);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.jump-area {
  width: 100%;
  height: 120px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 255, 0.24);
  background: rgba(15, 23, 42, 0.72);
  position: relative;
  overflow: hidden;
}

.jump-safe-zone {
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 30%;
  right: 30%;
  border-radius: 14px;
  border: 2px dashed rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.12);
}

.jump-pointer {
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 24px;
  border-radius: 999px;
  background: linear-gradient(145deg, #f97316, #fb923c);
  box-shadow: 0 10px 25px rgba(251, 146, 60, 0.35);
}

.jump-button {
  padding: 12px 26px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  color: #fff;
  background: var(--secondary);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.drag-area {
  width: 100%;
  height: 160px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 255, 0.24);
  background: rgba(15, 23, 42, 0.74);
  position: relative;
  overflow: hidden;
}

.drag-key {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(145deg, #facc15, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  cursor: grab;
  box-shadow: 0 18px 30px rgba(234, 179, 8, 0.4);
  user-select: none;
  touch-action: none;
}

.drag-target {
  position: absolute;
  right: 32px;
  bottom: 32px;
  width: 96px;
  height: 96px;
  border-radius: 22px;
  border: 2px dashed rgba(96, 165, 250, 0.7);
  background: rgba(30, 64, 175, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: rgba(191, 219, 254, 0.9);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.drag-target.highlight {
  border-color: rgba(125, 211, 252, 0.9);
  background: rgba(59, 130, 246, 0.22);
  box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.16);
}

.grid-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(360px, 100%);
  margin-top: 6px;
}

.grid-cell {
  aspect-ratio: 1;
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(148, 163, 255, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.grid-cell.show {
  background: rgba(56, 189, 248, 0.35);
  border-color: rgba(56, 189, 248, 0.8);
  transform: scale(1.05);
}

.grid-cell.error {
  background: rgba(248, 113, 113, 0.32);
  border-color: rgba(248, 113, 113, 0.7);
}

.game-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

@media (max-width: 1024px) {
  body {
    padding: 24px 12px 40px;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .main-area {
    grid-template-columns: 1fr;
  }

  .side-panel {
    order: -1;
  }
}

@media (max-width: 768px) {
  .app-shell {
    border-radius: 18px;
  }

  .explore-progress {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
  }

  .video-frame {
    border-radius: 16px;
  }

  .choice-buttons.two-columns {
    grid-template-columns: 1fr;
  }

  .door-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .top-bar {
    padding: 24px 24px 12px;
  }

  .main-area {
    padding: 0 24px 24px;
  }

  .footnote {
    padding: 16px 24px 24px;
  }
}
