@font-face {
  font-family: "Cinzel Decorative";
  src: url("../assets/fonts/CinzelDecorative-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cinzel Decorative";
  src: url("../assets/fonts/CinzelDecorative-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cinzel Decorative";
  src: url("../assets/fonts/CinzelDecorative-Black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-deep: #060408;
  --bg-panel: #0e0c14;
  --ink: #f0e8d8;
  --ink-muted: #b8a890;
  --line: #705828;
  --line-soft: rgba(180, 155, 80, 0.35);
  --red-main: #c8942a;
  --red-soft: #8a6420;
  --red-glow: rgba(200, 170, 80, 0.45);
  --scroll-track: rgba(14, 12, 20, 0.88);
  --scroll-thumb: linear-gradient(180deg, rgba(200, 170, 80, 0.85), rgba(140, 110, 40, 0.9));
  --scroll-thumb-hover: linear-gradient(180deg, rgba(220, 190, 100, 0.9), rgba(160, 130, 50, 0.92));
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 170, 80, 0.7) var(--scroll-track);
}

*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

*::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(200, 170, 80, 0.12);
}

*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 2px solid rgba(12, 10, 18, 0.92);
  box-shadow: 0 0 10px rgba(200, 170, 80, 0.25);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
  box-shadow: 0 0 14px rgba(220, 190, 100, 0.35);
}

*::-webkit-scrollbar-corner {
  background: rgba(10, 8, 16, 0.92);
}

body {
  font-family: "Segoe UI", sans-serif;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  background:
    radial-gradient(circle at 80% 20%, rgba(180, 155, 80, 0.08), transparent 42%),
    radial-gradient(circle at 20% 80%, rgba(120, 90, 30, 0.12), transparent 46%),
    linear-gradient(135deg, #04030a 0%, #0c0a16 50%, #060410 100%);
}

body * {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

.phone-orientation-lock {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 18%, rgba(232, 184, 74, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(8, 6, 12, 0.97), rgba(6, 4, 10, 0.985));
  backdrop-filter: blur(10px);
}

.phone-orientation-lock-card {
  width: min(100%, 420px);
  padding: 28px 24px;
  border: 1px solid rgba(200, 170, 80, 0.44);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(26, 18, 14, 0.95), rgba(12, 10, 18, 0.96)),
    radial-gradient(circle at top, rgba(200, 170, 80, 0.12), transparent 58%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.46);
  text-align: center;
}

.phone-orientation-lock-icon {
  position: relative;
  width: 116px;
  height: 116px;
  margin: 0 auto 18px;
}

.phone-orientation-lock-device {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 82px;
  border: 3px solid rgba(240, 232, 216, 0.92);
  border-radius: 16px;
  transform: translate(-50%, -50%);
  box-shadow: inset 0 0 0 1px rgba(200, 170, 80, 0.18), 0 0 20px rgba(200, 170, 80, 0.16);
}

.phone-orientation-lock-device::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: rgba(240, 232, 216, 0.72);
  transform: translateX(-50%);
}

.phone-orientation-lock-arrow {
  position: absolute;
  inset: 0;
}

.phone-orientation-lock-arrow::before,
.phone-orientation-lock-arrow::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff0b8, #c8942a);
}

.phone-orientation-lock-arrow::before {
  top: 28px;
  left: 20px;
  width: 74px;
  height: 74px;
  border: 4px solid rgba(232, 184, 74, 0.9);
  border-right-color: transparent;
  border-bottom-color: transparent;
  background: transparent;
  transform: rotate(-35deg);
}

.phone-orientation-lock-arrow::after {
  top: 24px;
  right: 18px;
  width: 18px;
  height: 18px;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  transform: rotate(-18deg);
  box-shadow: 0 0 18px rgba(232, 184, 74, 0.35);
}

.phone-orientation-lock-kicker {
  margin: 0 0 10px;
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(216, 191, 128, 0.74);
}

.phone-orientation-lock-card h2 {
  margin: 0;
  font-family: 'Cinzel Decorative', 'Cinzel', 'Georgia', serif;
  font-size: clamp(1.9rem, 8vw, 2.8rem);
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f0c860;
}

.phone-orientation-lock-text {
  margin: 16px 0 0;
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(240, 232, 216, 0.84);
}

html.phone-mode.phone-portrait-lock,
body.phone-mode.phone-portrait-lock {
  overflow: hidden;
}

html.phone-mode.phone-portrait-lock .app-shell,
body.phone-mode.phone-portrait-lock .app-shell {
  pointer-events: none;
  user-select: none;
}

html.phone-mode.phone-portrait-lock .phone-orientation-lock,
body.phone-mode.phone-portrait-lock .phone-orientation-lock {
  display: flex;
}

.menu-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 30;
  transform: translateX(-50%) translateY(14px);
  min-width: min(440px, calc(100vw - 32px));
  max-width: min(560px, calc(100vw - 32px));
  padding: 14px 18px;
  border: 1px solid rgba(200, 170, 80, 0.5);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(28, 24, 16, 0.96), rgba(14, 12, 8, 0.96));
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38);
  color: #f0e8d8;
  text-align: center;
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.menu-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-shell {
  min-height: 100vh;
}

.intro-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(160, 130, 50, 0.1), transparent 35%),
    linear-gradient(135deg, rgba(6, 4, 12, 0.98), rgba(12, 10, 18, 0.96));
}

.intro-video,
.intro-vignette,
.intro-noise,
.intro-grid {
  position: absolute;
  inset: 0;
}

.intro-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}

.intro-vignette {
  background:
    linear-gradient(180deg, rgba(6, 4, 12, 0.35) 0%, transparent 25%, transparent 65%, rgba(6, 4, 12, 0.7) 100%),
    radial-gradient(ellipse at 50% 50%, rgba(200, 170, 80, 0.06), transparent 40%),
    radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.85) 100%);
}

.intro-noise {
  display: none;
}

.intro-grid {
  display: none;
}

.intro-fullscreen-btn {
  position: absolute;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 3;
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(200, 170, 80, 0.4);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(26, 20, 16, 0.94), rgba(10, 8, 14, 0.94)),
    radial-gradient(circle at top, rgba(232, 184, 74, 0.16), transparent 60%);
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 244, 214, 0.08);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.intro-fullscreen-btn:hover,
.intro-fullscreen-btn:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(232, 184, 74, 0.76);
  box-shadow:
    0 18px 30px rgba(0, 0, 0, 0.38),
    0 0 22px rgba(232, 184, 74, 0.18),
    inset 0 1px 0 rgba(255, 244, 214, 0.14);
  outline: none;
}

.intro-fullscreen-btn[aria-pressed="true"] {
  border-color: rgba(232, 184, 74, 0.88);
  box-shadow:
    0 18px 32px rgba(0, 0, 0, 0.4),
    0 0 26px rgba(232, 184, 74, 0.28),
    inset 0 0 0 1px rgba(255, 236, 179, 0.16);
}

.intro-fullscreen-btn .fullscreen-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(232, 184, 74, 0.2));
  opacity: 0;
}

.intro-fullscreen-btn .fullscreen-icon-enter {
  opacity: 1;
}

.intro-fullscreen-btn[aria-pressed="true"] .fullscreen-icon-enter {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
}

.intro-fullscreen-btn[aria-pressed="true"] .fullscreen-icon-exit {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.intro-kicker {
  margin: 0 0 16px;
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 0.78rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(200, 175, 120, 0.7);
  text-shadow: 0 0 16px rgba(200, 148, 42, 0.2);
  transition: font-size 600ms ease;
}

.intro-card h1 {
  margin: 0;
  font-family: 'Cinzel Decorative', 'Cinzel', 'Georgia', serif;
  font-size: clamp(3rem, 7.5vw, 5.8rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0.08em;
  color: #e8b84a;
  background:
    linear-gradient(
      180deg,
      #fffdf5 0%,
      #f5d978 18%,
      #c8942a 42%,
      #f0c860 56%,
      #ffe8a0 72%,
      #c8942a 90%,
      #f0c860 100%
    );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 rgba(60, 35, 5, 0.7))
    drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 40px rgba(200, 148, 42, 0.2));
  transition: font-size 600ms ease;
}

.intro-version {
  margin: 16px 0 0;
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(240, 232, 216, 0.72);
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.38);
}

.intro-subtitle {
  margin: 20px 0 0;
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 0.88rem;
  font-style: italic;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(200, 185, 140, 0.6);
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  max-height: 60px;
  transition: opacity 400ms ease, max-height 400ms ease, margin 400ms ease;
}

.intro-start-btn {
  margin-top: 32px;
  min-width: min(340px, 100%);
  font: inherit;
  font-family: "Segoe UI", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  max-height: 80px;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease,
    opacity 400ms ease, max-height 400ms ease, margin 400ms ease, padding 400ms ease, border-width 400ms ease;
}

.intro-start-btn.action {
  padding: 18px 28px;
}

/* --- Intro menu elements (hidden initially, shown on reveal) --- */

.intro-menu {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 36px;
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  opacity: 0;
  transform: translateY(30px);
  pointer-events: none;
  transition: opacity 500ms ease 250ms, transform 500ms ease 250ms;
}

.intro-menu .action {
  font-size: 1rem;
  padding: 18px 10px;
}

.action.back-btn.action-menu-toggle {
  min-width: 58px;
  width: 58px;
  height: 54px;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  letter-spacing: 0;
}

.action.back-btn.action-menu-toggle .menu-toggle-bar {
  position: relative;
  z-index: 2;
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 247, 214, 0.98), rgba(240, 215, 145, 0.96));
  box-shadow: 0 0 8px rgba(255, 236, 179, 0.18);
}

.intro-socials {
  display: grid;
  grid-template-columns: repeat(4, 52px);
  gap: 14px;
  justify-content: center;
  margin-top: 28px;
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
  transition: opacity 500ms ease 400ms, transform 500ms ease 400ms;
}

/* --- Revealed state transition --- */

.intro-shell.is-revealed .intro-card {
  padding-top: 6vh;
}

.intro-shell.is-revealed .intro-card h1 {
  font-size: clamp(2.2rem, 5.5vw, 4rem);
}

.intro-shell.is-revealed .intro-kicker {
  font-size: 0.72rem;
}

.intro-shell.is-revealed .intro-subtitle {
  opacity: 0;
  max-height: 0;
  margin: 0;
  overflow: hidden;
}

.intro-shell.is-revealed .intro-start-btn {
  opacity: 0;
  max-height: 0;
  margin: 0;
  padding: 0;
  border-width: 0;
  overflow: hidden;
  pointer-events: none;
}

.intro-shell.is-revealed .intro-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.intro-shell.is-revealed .intro-socials {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Smooth transitions for the card content */
.intro-card {
  position: relative;
  z-index: 2;
  width: min(820px, calc(100vw - 40px));
  padding: 32px 24px;
  text-align: center;
  transition: padding 600ms ease;
}

.screen {
  min-height: 100vh;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
  position: absolute;
  inset: 0;
}

.screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  position: relative;
}

/* Episodios baja desde arriba como overlay centrado */
#episodesView {
  z-index: 2;
  background: transparent;
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transform: translateY(-110%);
  transition: opacity 500ms ease, transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

#episodesView.is-active {
  position: fixed;
  transform: translateY(0);
}

#episodesView.has-overlay {
  background: rgba(4, 3, 8, 0.34);
}

#episodesView.has-overlay .episodes-wrap {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#episodesView.has-overlay .episodes-wrap > :not(.episode-detail-modal):not(.prologo-character-modal) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.985);
}

#episodesView.is-leaving {
  transform: translateY(-110%);
  opacity: 0;
}

/* Escenas X: mismo overlay centrado que episodios */
#testScenesMenuView {
  z-index: 2;
  background: transparent;
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transform: translateY(-110%);
  transition: opacity 500ms ease, transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

#testScenesMenuView.is-active {
  position: fixed;
  transform: translateY(0);
}

#testScenesMenuView.is-leaving {
  transform: translateY(-110%);
  opacity: 0;
}

/* Intro se mantiene visible como fondo cuando episodios está activo */
#introView.is-bg {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
}

#introView.is-bg .intro-card {
  opacity: 0;
  pointer-events: none;
}

/* Animación de vuelta: menú sube desde abajo */
#introView.is-returning .intro-card {
  animation: menu-rise 500ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes menu-rise {
  from {
    opacity: 0;
    transform: translateY(60px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.35fr minmax(280px, 430px);
}

.stage {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-right: 1px solid var(--line-soft);
  background:
    radial-gradient(circle at 55% 50%, rgba(200, 170, 80, 0.12), transparent 36%),
    linear-gradient(120deg, rgba(18, 14, 22, 0.78), rgba(8, 6, 14, 0.84)),
    repeating-linear-gradient(90deg, rgba(200, 170, 80, 0.03) 0 2px, transparent 2px 7px);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 54% 18%, rgba(255, 230, 170, 0.16), transparent 14%),
    radial-gradient(circle at 54% 28%, rgba(255, 200, 130, 0.14), transparent 22%),
    radial-gradient(circle at 30% 52%, rgba(200, 160, 60, 0.1), transparent 20%),
    radial-gradient(circle at 74% 46%, rgba(255, 190, 100, 0.1), transparent 18%);
  mix-blend-mode: screen;
  opacity: 0.7;
  pointer-events: none;
}

.menu-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.74;
  pointer-events: none;
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}

.noise,
.vignette,
.machine-glow,
.scanline {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.noise {
  display: none;
}

.vignette {
  background: radial-gradient(circle, transparent 42%, rgba(0, 0, 0, 0.78) 100%);
}

.machine-glow {
  background:
    radial-gradient(circle at 32% 62%, rgba(200, 160, 60, 0.2), transparent 23%),
    radial-gradient(circle at 62% 38%, rgba(180, 140, 40, 0.15), transparent 18%);
  opacity: 0.72;
}

.scanline {
  display: none;
}

.title-block {
  position: absolute;
  left: clamp(22px, 5vw, 64px);
  bottom: clamp(34px, 8vh, 84px);
  max-width: 760px;
  padding-left: 0;
  z-index: 3;
  display: grid;
  gap: 6px;
  animation: rise-in 650ms ease-out;
}

.title-block::before {
  content: "";
  position: absolute;
  left: -30px;
  bottom: -40px;
  width: 460px;
  height: 260px;
  background:
    radial-gradient(ellipse at 40% 60%, rgba(255, 210, 120, 0.18), transparent 50%),
    radial-gradient(ellipse at 55% 45%, rgba(255, 180, 80, 0.12), transparent 40%),
    radial-gradient(ellipse at 30% 70%, rgba(200, 150, 50, 0.08), transparent 45%);
  opacity: 0.85;
  pointer-events: none;
}

.title-block::after {
  content: "";
  position: absolute;
  left: -40px;
  bottom: -26px;
  width: 400px;
  height: 180px;
  background:
    radial-gradient(circle at 30% 55%, rgba(255, 200, 100, 0.14), transparent 40%),
    radial-gradient(circle at 65% 40%, rgba(255, 170, 60, 0.1), transparent 35%),
    radial-gradient(circle at 48% 65%, rgba(220, 180, 80, 0.08), transparent 42%);
  opacity: 0.7;
  pointer-events: none;
}

.kicker {
  margin: 0;
  width: fit-content;
  font-family: "Cinzel", "Georgia", serif;
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: rgba(220, 195, 140, 0.92);
  text-shadow:
    0 0 10px rgba(200, 170, 80, 0.25),
    0 0 20px rgba(180, 140, 50, 0.12);
}

.title-block h1 {
  margin: 2px 0 0;
  font-family: "Cinzel Decorative", "Cinzel", "Georgia", serif;
  font-size: clamp(3.6rem, 8.2vw, 7.2rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 0.88;
  text-transform: uppercase;
  color: #e8b84a;
  background:
    linear-gradient(
      180deg,
      #fffdf5 0%,
      #fff0c8 10%,
      #f0c860 26%,
      #c8942a 40%,
      #f0c860 50%,
      #ffe8a0 58%,
      #c8942a 70%,
      #f0c860 82%,
      #fff4d8 100%
    );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(80, 45, 5, 0.75))
    drop-shadow(0 4px 0 rgba(50, 25, 0, 0.45))
    drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 28px rgba(200, 160, 60, 0.2));
}

.subtitle {
  margin: 8px 0 0;
  max-width: 24ch;
  padding-top: 12px;
  border-top: 1px solid rgba(200, 170, 80, 0.3);
  font-family: "Cinzel", "Georgia", serif;
  font-size: clamp(1rem, 1.2vw, 1.18rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.06em;
  color: rgba(240, 220, 175, 0.92);
  text-shadow:
    0 2px 12px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(200, 170, 80, 0.1);
}

.menu-panel {
  position: relative;
  padding: 18px 22px 24px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
  background: transparent;
  border-left: 0;
  box-shadow: none;
}

.menu-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(0 18px, 18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px));
  background:
    linear-gradient(47deg, transparent 29%, rgba(60, 70, 90, 0.1) 30%, transparent 31%),
    linear-gradient(137deg, transparent 52%, rgba(55, 65, 85, 0.08) 53%, transparent 54%),
    linear-gradient(213deg, transparent 68%, rgba(50, 60, 80, 0.07) 69%, transparent 70%),
    radial-gradient(ellipse at 20% 35%, rgba(40, 50, 75, 0.4), transparent 50%),
    radial-gradient(ellipse at 75% 20%, rgba(35, 45, 70, 0.35), transparent 45%),
    radial-gradient(ellipse at 55% 70%, rgba(45, 55, 80, 0.3), transparent 40%),
    linear-gradient(180deg, rgba(28, 32, 48, 0.97) 0%, rgba(16, 19, 32, 0.99) 35%, rgba(20, 23, 38, 0.98) 65%, rgba(26, 29, 43, 0.97) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(180, 155, 80, 0.3),
    inset 0 0 0 4px rgba(12, 14, 24, 0.95),
    0 0 0 1px rgba(180, 155, 80, 0.22),
    0 24px 40px rgba(0, 0, 0, 0.4),
    0 0 24px rgba(180, 155, 80, 0.08);
  pointer-events: none;
}

.menu-panel::after {
  content: "";
  position: absolute;
  inset: 14px 12px 14px 12px;
  clip-path: polygon(0 14px, 14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px));
  background:
    radial-gradient(ellipse at 50% 10%, rgba(180, 155, 80, 0.04), transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(100, 80, 40, 0.03), transparent 40%),
    linear-gradient(180deg, rgba(12, 14, 24, 0.92), rgba(8, 10, 18, 0.95));
  box-shadow: inset 0 0 0 1px rgba(180, 155, 80, 0.1), inset 0 0 28px rgba(0, 0, 0, 0.3);
  opacity: 0.95;
  pointer-events: none;
}

.menu-panel > * {
  position: relative;
  z-index: 2;
}

.menu-head {
  justify-self: start;
  width: 100%;
  padding: 16px 18px 14px;
  border: 2px solid rgba(200, 170, 80, 0.5);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 0%, rgba(200, 170, 80, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(22, 24, 38, 0.98), rgba(12, 14, 24, 0.99));
  box-shadow:
    inset 0 0 0 1px rgba(180, 155, 80, 0.1),
    0 0 0 1px rgba(100, 75, 20, 0.5),
    0 0 0 3px rgba(12, 14, 24, 0.95),
    0 0 0 4px rgba(180, 155, 80, 0.2),
    0 0 18px rgba(180, 155, 80, 0.06),
    0 12px 24px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  isolation: isolate;
}

.menu-head::before {
  display: none;
}

.menu-head::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 10px;
  height: 1px;
  background: linear-gradient(90deg, rgba(200, 170, 80, 0), rgba(200, 170, 80, 0.45), rgba(200, 170, 80, 0));
  pointer-events: none;
}

.series {
  margin: 0;
  font-family: "Cinzel", "Georgia", serif;
  font-size: 0.7rem;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: rgba(200, 175, 120, 0.75);
}

.menu-head h2 {
  margin: 10px 0 8px;
  font-family: "Cinzel Decorative", "Cinzel", "Georgia", serif;
  font-size: clamp(1.7rem, 2.6vw, 2.5rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e8b84a;
  background:
    linear-gradient(
      180deg,
      #fffdf5 0%,
      #f5d978 20%,
      #c8942a 45%,
      #f0c860 55%,
      #ffe8a0 70%,
      #c8942a 90%,
      #f0c860 100%
    );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(80, 50, 10, 0.6))
    drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

.status {
  margin: 0;
  font-family: "Cinzel", "Georgia", serif;
  font-size: 0.78rem;
  font-style: italic;
  letter-spacing: 0.06em;
  color: rgba(200, 185, 140, 0.7);
}

.menu-actions {
  display: grid;
  gap: 16px;
  align-content: start;
  padding-top: 4px;
}

.menu-socials {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-self: end;
  padding: 0 4px;
}

.menu-social-link {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 2px solid rgba(200, 170, 80, 0.6);
  border-radius: 999px;
  background:
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.04), transparent 50%),
    linear-gradient(180deg, rgba(22, 25, 42, 0.95), rgba(12, 14, 26, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(100, 75, 20, 0.5),
    0 0 0 3px rgba(12, 14, 24, 0.95),
    0 0 0 4px rgba(180, 155, 80, 0.25),
    0 8px 16px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.menu-social-link::before {
  display: none;
}

.menu-social-link:hover,
.menu-social-link:focus-visible {
  transform: translateY(-3px) scale(1.03);
  border-color: rgba(220, 195, 100, 0.95);
  box-shadow:
    0 0 0 1px rgba(160, 120, 30, 0.7),
    0 0 0 3px rgba(15, 15, 25, 0.9),
    0 0 0 4px rgba(220, 195, 100, 0.5),
    0 18px 30px rgba(0, 0, 0, 0.28),
    0 0 22px rgba(200, 170, 80, 0.25);
  outline: none;
}

.menu-social-link img {
  width: 24px;
  height: 24px;
  display: block;
  opacity: 0.88;
}

.options-modal {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-110%);
  transition: opacity 500ms ease, transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.options-modal.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.options-modal.is-leaving {
  transform: translateY(-110%);
  opacity: 0;
}

.options-card {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overflow-x: hidden;
  border: 2px solid rgba(200, 170, 80, 0.4);
  border-radius: 22px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(14, 12, 22, 0.88), rgba(6, 4, 12, 0.92)),
    radial-gradient(ellipse at 50% 0%, rgba(200, 170, 80, 0.08), transparent 45%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 0 0 1px rgba(120, 100, 40, 0.15),
    0 30px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 240, 180, 0.04);
}

.options-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.options-head h2 {
  margin: 8px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.options-groups {
  margin-top: 18px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr);
}

.options-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.options-group {
  display: flex;
  border: 1px solid rgba(180, 155, 80, 0.2);
  border-radius: 16px;
  padding: 14px;
  background: rgba(10, 8, 16, 0.82);
  min-width: 0;
  height: 100%;
}

.options-group-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 120px;
}

.options-group-intro .options-group-head {
  min-width: 0;
}

.options-group-intro .options-group-head p {
  max-width: 26ch;
}

.options-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.options-group-head h3 {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1rem;
  color: #f0e4c8;
}

.options-group-head p {
  margin: 6px 0 0;
  color: var(--ink-muted);
  line-height: 1.45;
  max-width: 34ch;
}

.options-value {
  min-width: 60px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #e8d8a8;
}

.options-toggle-btn {
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  min-height: 58px;
  margin-top: 14px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 0 18px;
  border-width: 1.5px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(42, 32, 12, 0.94), rgba(20, 16, 8, 0.97)),
    radial-gradient(circle at top, rgba(200, 170, 80, 0.08), transparent 60%);
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 160, 0.1),
    0 8px 18px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(120, 90, 20, 0.28);
}

.options-toggle-btn::before,
.options-toggle-btn::after {
  display: none;
}

#btnOptionsFullscreen {
  height: 58px;
  min-height: 58px;
  padding: 0;
}

.options-toggle-btn strong {
  min-width: 0;
  text-align: center;
  color: #f0e4c8;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
}

.options-toggle-btn[aria-pressed="false"] {
  border-color: rgba(200, 170, 80, 0.42);
  background:
    linear-gradient(180deg, rgba(42, 32, 12, 0.94), rgba(20, 16, 8, 0.97)),
    radial-gradient(circle at top, rgba(200, 170, 80, 0.08), transparent 60%);
}

.options-toggle-btn[aria-pressed="true"] {
  border-color: rgba(118, 220, 146, 0.66);
  background:
    linear-gradient(180deg, rgba(34, 104, 52, 0.94), rgba(14, 58, 28, 0.97)),
    radial-gradient(circle at top, rgba(154, 255, 182, 0.12), transparent 58%);
  box-shadow:
    inset 0 1px 0 rgba(208, 255, 220, 0.08),
    0 10px 20px rgba(0, 0, 0, 0.22),
    0 0 0 1px rgba(134, 231, 162, 0.2);
}

.options-toggle-btn:hover,
.options-toggle-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(224, 194, 110, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 160, 0.12),
    0 12px 22px rgba(0, 0, 0, 0.22),
    0 0 0 1px rgba(160, 125, 34, 0.34);
}

.options-group-intro .options-select,
.options-group-intro .options-toggle-btn {
  margin-top: 0;
  justify-self: end;
  align-self: center;
}

.options-group-intro .options-select {
  width: clamp(140px, 22vw, 168px);
  min-height: 58px;
  padding-top: 0;
  padding-bottom: 0;
}

.options-range {
  width: 100%;
  margin-top: 14px;
  accent-color: #c8942a;
}

.options-select {
  width: auto;
  margin-top: 14px;
  border: 1px solid rgba(180, 155, 80, 0.4);
  border-radius: 12px;
  padding: 12px 42px 12px 14px;
  color: #f0e4c8;
  background-color: rgba(14, 12, 22, 0.96);
  background-image:
    linear-gradient(45deg, transparent 50%, #e8d8a8 50%),
    linear-gradient(135deg, #e8d8a8 50%, transparent 50%);
  background-position:
    calc(100% - 21px) calc(50% - 3px),
    calc(100% - 15px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  color-scheme: dark;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.18);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.options-select:hover {
  border-color: rgba(220, 190, 100, 0.56);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.06),
    0 14px 28px rgba(0, 0, 0, 0.24);
}

.options-select:focus-visible {
  outline: none;
  border-color: rgba(220, 190, 100, 0.76);
  box-shadow:
    0 0 0 2px rgba(200, 170, 80, 0.22),
    inset 0 1px 0 rgba(255, 240, 180, 0.06),
    0 14px 30px rgba(0, 0, 0, 0.28);
}

.options-select option,
.options-select optgroup {
  color: #f4ead0;
  background: #15101f;
}

.options-select option {
  font-weight: 600;
}

.options-select option:checked,
.options-select option:hover,
.options-select option:focus {
  color: #fff4d0;
  background: #3f2d0b;
}

@media (min-width: 621px) {
  .options-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .options-group-span-full {
    grid-column: 1 / -1;
  }
}

.options-range:hover {
  cursor: pointer;
}

.action {
  --button-glow: rgba(200, 170, 80, 0.22);
  --button-glow-strong: rgba(200, 170, 80, 0.38);
  --button-outline: rgba(220, 190, 100, 0.3);
  position: relative;
  overflow: hidden;
  border: 3px solid rgba(200, 170, 80, 0.85);
  color: #f8f4e8;
  background:
    linear-gradient(180deg, rgba(55, 42, 12, 0.95), rgba(28, 20, 6, 0.98));
  border-radius: 14px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 1rem;
  font-weight: 700;
  padding: 18px 18px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 160, 0.2),
    inset 0 -8px 16px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(120, 90, 20, 0.7),
    0 0 0 4px rgba(15, 15, 25, 0.95),
    0 0 0 5px rgba(200, 170, 80, 0.45),
    0 0 20px var(--button-glow),
    0 12px 30px rgba(0, 0, 0, 0.25);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.action::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 235, 170, 0.22), rgba(255, 220, 140, 0.04) 34%, transparent 60%),
    radial-gradient(circle at 50% 0%, rgba(255, 250, 220, 0.12), transparent 54%),
    linear-gradient(90deg, transparent 0%, rgba(255, 235, 170, 0.16) 48%, transparent 100%);
  background-size: 100% 100%, 100% 100%, 220% 100%;
  background-position: 0 0, 0 0, 120% 0;
  animation: button-sheen 5.2s ease-in-out infinite;
  pointer-events: none;
}

.action::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  border: 1px solid var(--button-outline);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.06), 0 0 16px var(--button-glow);
  animation: button-outline-pulse 2.8s ease-in-out infinite;
  pointer-events: none;
}

.action .button-label,
.action {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 14px rgba(255, 255, 255, 0.08);
}

.action:hover,
.action:focus-visible {
  transform: translateY(-3px) scale(1.015);
  border-color: rgba(230, 200, 100, 0.96);
  box-shadow:
    0 0 0 1px rgba(140, 110, 30, 0.7),
    0 0 0 4px rgba(15, 15, 25, 0.95),
    0 0 0 5px rgba(230, 200, 100, 0.6),
    0 22px 34px rgba(0, 0, 0, 0.32),
    0 0 28px var(--button-glow-strong);
  outline: none;
}

/* All action buttons share the same gold style */

.menu-output {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px;
  color: var(--ink-muted);
  background: rgba(8, 3, 4, 0.66);
}

.menu-output p {
  margin: 0;
}

.menu-foot {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  color: #a89878;
}

.episodes-wrap {
  width: min(1200px, 95vw);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0;
  border: 2px solid rgba(180, 155, 80, 0.35);
  border-radius: 22px;
  padding: clamp(18px, 2.5vw, 28px);
  background:
    linear-gradient(180deg, rgba(14, 12, 22, 0.88), rgba(6, 4, 12, 0.92)),
    radial-gradient(ellipse at 50% 0%, rgba(200, 170, 80, 0.08), transparent 45%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 0 0 1px rgba(120, 100, 40, 0.15),
    0 30px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 240, 180, 0.04);
  transition: opacity 180ms ease, visibility 180ms ease, transform 220ms ease;
}

.test-scenes-wrap {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0;
  border: 2px solid rgba(180, 155, 80, 0.32);
  border-radius: 22px;
  padding: clamp(18px, 2.5vw, 28px);
  background:
    linear-gradient(180deg, rgba(14, 12, 22, 0.88), rgba(6, 4, 12, 0.92)),
    radial-gradient(ellipse at 50% 0%, rgba(200, 170, 80, 0.08), transparent 45%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 0 0 1px rgba(120, 100, 40, 0.15),
    0 30px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 240, 180, 0.04);
}

.test-scenes-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.test-scenes-head h2 {
  margin: 6px 0 4px;
  font-family: 'Cinzel Decorative', 'Cinzel', 'Georgia', serif;
  font-size: clamp(1.6rem, 2.8vw, 2.8rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #e8b84a;
  background:
    linear-gradient(
      180deg,
      #fffdf5 0%,
      #f5d978 20%,
      #c8942a 45%,
      #f0c860 55%,
      #ffe8a0 70%,
      #c8942a 90%,
      #f0c860 100%
    );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(80, 50, 10, 0.5))
    drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

.test-scenes-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 14px;
}

.test-mode-card {
  margin: 0;
  padding: 10px;
  border: 1.5px solid rgba(180, 155, 80, 0.25);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(18, 16, 28, 0.9), rgba(8, 6, 14, 0.94)),
    radial-gradient(ellipse at 50% 0%, rgba(200, 170, 80, 0.04), transparent 50%);
  color: #f0e8d8;
  cursor: pointer;
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.test-mode-card:hover,
.test-mode-card:focus-visible {
  transform: translateY(-5px);
  border-color: rgba(220, 190, 100, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.08),
    0 0 0 1px rgba(160, 135, 50, 0.25),
    0 0 24px rgba(200, 170, 80, 0.12),
    0 16px 32px rgba(0, 0, 0, 0.35);
  outline: none;
}

.test-mode-preview {
  position: relative;
  border-radius: 12px;
  height: 148px;
  border: 1px solid rgba(180, 155, 80, 0.2);
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, rgba(180, 155, 80, 0.06), rgba(10, 8, 16, 0.98));
}

.test-mode-preview video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.test-mode-title {
  margin: 10px 0 4px;
  display: block;
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e8d8a8;
}

.test-mode-score {
  display: block;
  margin: 0;
  color: rgba(220, 210, 180, 0.82);
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-line;
}

.test-scenes-empty {
  margin: 0;
  border: 1px dashed rgba(180, 155, 80, 0.25);
  border-radius: 14px;
  padding: 24px 18px;
  color: rgba(220, 210, 180, 0.74);
  text-align: center;
}

.episodes-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.episodes-head h2 {
  margin: 6px 0 4px;
  font-family: 'Cinzel Decorative', 'Cinzel', 'Georgia', serif;
  font-size: clamp(1.6rem, 2.8vw, 2.8rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #e8b84a;
  background:
    linear-gradient(
      180deg,
      #fffdf5 0%,
      #f5d978 20%,
      #c8942a 45%,
      #f0c860 55%,
      #ffe8a0 70%,
      #c8942a 90%,
      #f0c860 100%
    );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(80, 50, 10, 0.5))
    drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

.back-btn {
  min-width: 130px;
  padding: 12px 20px;
}

.episodes-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 16px;
}

.episode-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 44;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 3, 8, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.episode-detail-panel {
  width: min(980px, 100%);
  border: 1.5px solid rgba(180, 155, 80, 0.32);
  border-radius: 24px;
  padding: clamp(18px, 2.4vw, 26px);
  background:
    linear-gradient(180deg, rgba(16, 14, 24, 0.96), rgba(6, 5, 12, 0.98)),
    radial-gradient(circle at top, rgba(200, 170, 80, 0.08), transparent 44%);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.06),
    0 30px 80px rgba(0, 0, 0, 0.5);
}

.episode-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.episode-detail-head h3 {
  margin: 6px 0 4px;
  font-family: 'Cinzel Decorative', 'Cinzel', 'Georgia', serif;
  font-size: clamp(1.45rem, 2.6vw, 2.4rem);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #f2d382;
}

.episode-detail-head .status {
  margin: 0;
  max-width: 56ch;
  color: rgba(221, 208, 175, 0.78);
  line-height: 1.5;
}

.episode-detail-body {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.episode-detail-body.is-without-preview {
  grid-template-columns: minmax(0, 1fr);
}

.episode-detail-visual {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.episode-detail-preview-hint {
  margin: 0;
  color: rgba(232, 222, 196, 0.72);
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 0.82rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.episode-detail-art {
  height: clamp(220px, 34vw, 320px);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.04),
    0 18px 40px rgba(0, 0, 0, 0.34);
}

.episode-detail-art.is-carousel-preview::after {
  background:
    linear-gradient(180deg, rgba(3, 3, 6, 0.36), rgba(8, 6, 14, 0.7)),
    radial-gradient(circle at 70% 10%, rgba(200, 170, 80, 0.06), transparent 40%);
}

.episode-detail-art.is-carousel-preview .episode-art-video,
.episode-detail-art.is-carousel-preview .episode-art-image {
  filter: brightness(0.52) saturate(0.8);
}

.episode-detail-preview-copy {
  display: grid;
  gap: 12px;
}

.episode-detail-preview-text {
  margin: 0;
  color: rgba(232, 222, 196, 0.86);
  font-size: 0.96rem;
  line-height: 1.65;
}

.episode-detail-preview-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px dashed rgba(220, 195, 120, 0.4);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(30, 26, 16, 0.72), rgba(14, 12, 8, 0.78)),
    radial-gradient(circle at top, rgba(200, 170, 80, 0.08), transparent 60%);
  color: rgba(240, 226, 182, 0.92);
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.05),
    0 8px 18px rgba(0, 0, 0, 0.16);
  pointer-events: none;
  user-select: none;
}

.episode-detail-copy {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.episode-detail-lead {
  margin: 0;
  color: rgba(232, 222, 196, 0.86);
  font-size: 1rem;
  line-height: 1.7;
}

.episode-detail-discovery {
  border: 1px solid rgba(180, 155, 80, 0.18);
  border-radius: 18px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(20, 17, 30, 0.92), rgba(10, 8, 16, 0.96)),
    radial-gradient(circle at top, rgba(200, 170, 80, 0.05), transparent 48%);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.04),
    0 14px 30px rgba(0, 0, 0, 0.22);
}

.episode-detail-discovery h4 {
  margin: 6px 0 0;
  font-family: 'Cinzel', 'Georgia', serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1rem;
  color: #ecd79b;
}

.episode-detail-tracks {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.episode-detail-track {
  border: 1px solid rgba(180, 155, 80, 0.14);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(10, 8, 16, 0.7);
}

.episode-detail-track-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.episode-detail-track-label {
  color: #f0dfae;
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.episode-detail-track-value {
  color: rgba(211, 197, 163, 0.74);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.episode-detail-track-sigils {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.episode-detail-sigil {
  appearance: none;
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(200, 170, 80, 0.34);
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 235, 180, 0.18), rgba(90, 65, 22, 0.55));
  box-shadow: inset 0 1px 0 rgba(255, 240, 180, 0.04);
  opacity: 0.4;
}

.episode-detail-sigil.is-discovered {
  border-color: rgba(241, 212, 124, 0.92);
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 252, 218, 0.98), rgba(216, 166, 68, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 250, 230, 0.4),
    0 0 10px rgba(228, 185, 84, 0.34);
  opacity: 1;
}

.episode-detail-sigil.is-clickable {
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.episode-detail-sigil.is-clickable:hover,
.episode-detail-sigil.is-clickable:focus-visible {
  transform: scale(1.14);
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 250, 230, 0.4),
    0 0 0 1px rgba(245, 221, 150, 0.32),
    0 0 14px rgba(228, 185, 84, 0.4);
}

.episode-detail-sigil.is-selected {
  transform: scale(1.18);
  border-color: rgba(255, 233, 165, 1);
  box-shadow:
    inset 0 1px 0 rgba(255, 250, 230, 0.48),
    0 0 0 1px rgba(245, 221, 150, 0.36),
    0 0 18px rgba(228, 185, 84, 0.48);
}

.episode-detail-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.episode-detail-actions .action[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
  filter: saturate(0.65);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.02),
    0 8px 18px rgba(0, 0, 0, 0.16);
}

.episode-detail-actions .action[disabled]:hover,
.episode-detail-actions .action[disabled]:focus-visible {
  transform: none;
  border-color: rgba(200, 170, 80, 0.85);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.02),
    0 8px 18px rgba(0, 0, 0, 0.16);
}

.prologo-character-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 3, 8, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.prologo-character-panel {
  position: relative;
  width: min(1100px, 100%);
  max-height: min(500px, calc(100vh - 96px));
  border: 1.5px solid rgba(180, 155, 80, 0.32);
  border-radius: 24px;
  padding: clamp(16px, 2vw, 22px);
  background:
    linear-gradient(180deg, rgba(16, 14, 24, 0.96), rgba(6, 5, 12, 0.98)),
    radial-gradient(circle at top, rgba(200, 170, 80, 0.08), transparent 44%);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.06),
    0 30px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  isolation: isolate;
}

.prologo-character-panel::before,
.prologo-character-panel::after {
  content: "";
  position: absolute;
  inset: auto;
  pointer-events: none;
  z-index: 0;
}

.prologo-character-panel::before {
  top: -140px;
  left: -120px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(220, 88, 88, 0.18), transparent 68%);
  filter: blur(18px);
}

.prologo-character-panel::after {
  right: -140px;
  bottom: -160px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(82, 190, 112, 0.18), transparent 68%);
  filter: blur(18px);
}

.prologo-character-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.prologo-character-head h3 {
  margin: 4px 0 2px;
  font-family: 'Cinzel Decorative', 'Cinzel', 'Georgia', serif;
  font-size: clamp(1.45rem, 2.6vw, 2.4rem);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #f2d382;
}

.prologo-character-head .status {
  margin: 0;
  line-height: 1.35;
  color: rgba(221, 208, 175, 0.78);
}

.prologo-character-grid {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.prologo-character-grid::before {
  content: "";
  position: absolute;
  top: 7%;
  bottom: 7%;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background:
    linear-gradient(180deg, transparent, rgba(247, 226, 168, 0.45), transparent),
    linear-gradient(180deg, transparent, rgba(247, 226, 168, 0.2), transparent);
  box-shadow: 0 0 18px rgba(247, 226, 168, 0.22);
  pointer-events: none;
}

.prologo-character-option {
  --character-accent: rgba(226, 196, 110, 0.88);
  --character-accent-glow: rgba(226, 196, 110, 0.2);
  --character-copy-bg: linear-gradient(180deg, rgba(5, 4, 8, 0) 0%, rgba(7, 5, 12, 0.72) 34%, rgba(4, 3, 8, 0.96) 72%, rgba(4, 3, 8, 0.98) 100%);
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: clamp(286px, 43vh, 360px);
  border: 1.5px solid rgba(180, 155, 80, 0.26);
  border-radius: 26px;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(18, 16, 28, 0.7), rgba(8, 6, 14, 0.9));
  color: #f4ecdd;
  text-align: left;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.05),
    0 16px 34px rgba(0, 0, 0, 0.28);
  isolation: isolate;
  transition: transform 260ms ease, border-color 220ms ease, box-shadow 260ms ease, opacity 220ms ease;
}

.prologo-character-option::before,
.prologo-character-option::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.prologo-character-option::before {
  background:
    linear-gradient(180deg, rgba(255, 248, 220, 0.18), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 26%, transparent 72%, rgba(255, 255, 255, 0.05));
  opacity: 0.7;
}

.prologo-character-option::after {
  background:
    radial-gradient(circle at 50% 18%, var(--character-accent-glow), transparent 42%),
    linear-gradient(180deg, rgba(6, 5, 10, 0.06) 0%, rgba(6, 5, 10, 0.14) 42%, rgba(2, 2, 5, 0.6) 100%);
}

.prologo-character-option:hover,
.prologo-character-option:focus-visible {
  transform: translateY(-10px) scale(1.015);
  border-color: var(--character-accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.08),
    0 0 0 1px color-mix(in srgb, var(--character-accent) 28%, transparent),
    0 0 30px color-mix(in srgb, var(--character-accent) 20%, transparent),
    0 26px 44px rgba(0, 0, 0, 0.36);
  outline: none;
}

.prologo-character-art {
  position: absolute;
  inset: 0;
  display: block;
  height: auto;
  border-radius: inherit;
  overflow: hidden;
  border: 0;
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 250, 235, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(4, 4, 8, 0.08), rgba(4, 4, 8, 0.5));
}

.prologo-character-art::before,
.prologo-character-art::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.prologo-character-art::before {
  background:
    linear-gradient(180deg, rgba(6, 6, 10, 0.02), rgba(6, 6, 10, 0.24) 48%, rgba(2, 2, 5, 0.72) 100%),
    radial-gradient(circle at 50% 112%, rgba(0, 0, 0, 0.82), transparent 38%);
  z-index: 1;
}

.prologo-character-art::after {
  inset: auto 12% 8% 12%;
  height: 16%;
  border-radius: 999px;
  background: radial-gradient(circle, color-mix(in srgb, var(--character-accent) 34%, transparent), transparent 70%);
  filter: blur(18px);
  opacity: 0.7;
  z-index: 1;
}

.prologo-character-option-sam {
  --character-accent: rgba(239, 88, 90, 0.92);
  --character-accent-glow: rgba(239, 88, 90, 0.28);
}

.prologo-character-option-jon {
  --character-accent: rgba(92, 214, 124, 0.92);
  --character-accent-glow: rgba(92, 214, 124, 0.28);
}

.prologo-character-option .episode-art-image {
  position: relative;
  z-index: 0;
  object-fit: cover;
  object-position: center 16%;
  transform: translateZ(0) scale(0.98);
  filter: saturate(0.94) contrast(1.03) brightness(0.82);
  transition: transform 420ms ease, filter 320ms ease;
}

.prologo-character-option-sam .episode-art-image {
  object-position: center 17%;
}

.prologo-character-option-jon .episode-art-image {
  object-position: center 14%;
}

.prologo-character-copy {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: end;
  gap: 6px;
  width: 100%;
  min-height: 44%;
  margin-top: auto;
  padding: 78px 20px 18px;
  background: var(--character-copy-bg);
}

.prologo-character-copy::before {
  content: "";
  width: 74px;
  height: 2px;
  margin-bottom: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--character-accent), rgba(255, 255, 255, 0));
  box-shadow: 0 0 14px color-mix(in srgb, var(--character-accent) 34%, transparent);
}

.prologo-character-name {
  display: block;
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: clamp(1.24rem, 1.8vw, 1.58rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff2cc;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.34);
}

.prologo-character-trait {
  display: block;
  margin-top: 3px;
  max-width: 26ch;
  color: rgba(235, 227, 206, 0.86);
  font-size: 0.98rem;
  line-height: 1.45;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

.prologo-character-modal[data-active-character="Sam"] .prologo-character-option-jon,
.prologo-character-modal[data-active-character="Jon"] .prologo-character-option-sam {
  transform: scale(0.972);
  opacity: 0.8;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.22);
}

.prologo-character-modal[data-active-character="Sam"] .prologo-character-option-sam,
.prologo-character-modal[data-active-character="Jon"] .prologo-character-option-jon {
  transform: translateY(-12px) scale(1.02);
  border-color: var(--character-accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.08),
    0 0 0 1px color-mix(in srgb, var(--character-accent) 30%, transparent),
    0 0 34px color-mix(in srgb, var(--character-accent) 22%, transparent),
    0 28px 48px rgba(0, 0, 0, 0.4);
}

.prologo-character-modal[data-active-character="Sam"] .prologo-character-option-sam .episode-art-image,
.prologo-character-modal[data-active-character="Jon"] .prologo-character-option-jon .episode-art-image,
.prologo-character-option:hover .episode-art-image,
.prologo-character-option:focus-visible .episode-art-image {
  transform: translateZ(0) scale(1.03);
  filter: saturate(1.04) contrast(1.08) brightness(0.94);
}

.episode-card {
  margin: 0;
  padding: 10px;
  border: 1.5px solid rgba(180, 155, 80, 0.25);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(18, 16, 28, 0.9), rgba(8, 6, 14, 0.94)),
    radial-gradient(ellipse at 50% 0%, rgba(200, 170, 80, 0.04), transparent 50%);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.episode-card[data-available="false"] {
  cursor: default;
  opacity: 0.62;
  filter: saturate(0.4);
}

.episode-card[data-available="false"]:hover,
.episode-card[data-available="false"]:focus-visible {
  transform: none;
  border-color: rgba(180, 155, 80, 0.25);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.2);
  outline: none;
}

.episode-card:hover,
.episode-card:focus-visible {
  transform: translateY(-5px);
  border-color: rgba(220, 190, 100, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.08),
    0 0 0 1px rgba(160, 135, 50, 0.25),
    0 0 24px rgba(200, 170, 80, 0.12),
    0 16px 32px rgba(0, 0, 0, 0.35);
  outline: none;
}

.episode-art {
  position: relative;
  border-radius: 12px;
  height: 148px;
  border: 1px solid rgba(180, 155, 80, 0.2);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.episode-art::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 40%, rgba(8, 6, 14, 0.5)),
    radial-gradient(circle at 70% 10%, rgba(200, 170, 80, 0.08), transparent 40%);
}

.episode-art-video,
.episode-art-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
  transform: translateZ(0) scale(1.01);
  backface-visibility: hidden;
  will-change: transform;
}

.art-prologo {
  background-image:
    linear-gradient(130deg, rgba(200, 170, 80, 0.35), rgba(14, 12, 20, 0.9)),
    radial-gradient(circle at 35% 40%, rgba(220, 190, 100, 0.35), transparent 30%);
}

.art-eco {
  background-image:
    linear-gradient(120deg, rgba(180, 150, 60, 0.3), rgba(14, 12, 20, 0.95)),
    radial-gradient(circle at 70% 20%, rgba(200, 170, 80, 0.3), transparent 35%);
}

.art-ritual {
  background-image:
    linear-gradient(125deg, rgba(160, 130, 50, 0.45), rgba(10, 8, 16, 0.9)),
    radial-gradient(circle at 25% 75%, rgba(220, 190, 100, 0.22), transparent 30%);
}

.art-null {
  background-image:
    linear-gradient(135deg, rgba(120, 100, 40, 0.45), rgba(6, 4, 10, 0.95)),
    repeating-linear-gradient(45deg, rgba(200, 170, 80, 0.08) 0 6px, transparent 6px 12px);
}

.episode-card h3 {
  margin: 10px 0 4px;
  font-family: 'Cinzel', 'Georgia', serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1rem;
  color: #e8d8a8;
}

.episode-card p {
  margin: 0;
  color: rgba(200, 185, 140, 0.7);
  font-weight: 600;
  font-size: 0.88rem;
}

.episodes-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(180, 155, 80, 0.12);
  color: rgba(180, 160, 110, 0.6);
  font-size: 0.88rem;
  font-style: italic;
}

.test-scene {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: start start;
  padding: 14px;
  background:
    radial-gradient(circle at 50% 14%, rgba(200, 170, 80, 0.12), transparent 30%),
    linear-gradient(120deg, rgba(14, 12, 20, 0.9), rgba(6, 4, 10, 0.94));
}

.test-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}

.test-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: none;
}

.test-minigame-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.test-score-modal {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(3, 2, 4, 0.8);
}

.test-score-card {
  width: min(430px, calc(100vw - 28px));
  border: 2px solid rgba(200, 170, 80, 0.45);
  border-radius: 16px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(22, 20, 32, 0.96), rgba(12, 10, 18, 0.95)),
    radial-gradient(circle at 50% 16%, rgba(200, 170, 80, 0.08), transparent 50%);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(180, 155, 80, 0.15);
}

.test-final-advance {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(180deg, rgba(2, 2, 4, 0.46), rgba(2, 2, 4, 0.94));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: auto;
}

.test-final-advance-card {
  width: min(460px, calc(100vw - 34px));
  padding: 24px 22px 20px;
  border: 1px solid rgba(200, 170, 80, 0.52);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(18, 16, 24, 0.98), rgba(6, 5, 10, 0.985)),
    radial-gradient(circle at top, rgba(200, 170, 80, 0.08), transparent 54%);
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(120, 100, 40, 0.18),
    inset 0 1px 0 rgba(255, 240, 180, 0.05);
  text-align: center;
}

.test-final-advance-title {
  margin: 0;
  color: rgba(236, 215, 155, 0.78);
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 0.76rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.test-final-advance-message {
  margin: 12px 0 0;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  line-height: 1.45;
  letter-spacing: 0.09em;
  color: #fff2c4;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(200, 170, 80, 0.18);
}

.test-final-advance-actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.test-final-advance-actions .action {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 54px;
}

.test-final-advance-track {
  margin-top: 16px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(200, 170, 80, 0.3);
  background: rgba(8, 6, 14, 0.82);
  overflow: hidden;
}

.test-final-advance-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 242, 196, 0.98), rgba(232, 184, 74, 0.95) 38%, rgba(200, 148, 42, 0.94));
  box-shadow: 0 0 16px rgba(232, 184, 74, 0.32);
}

.test-score-title {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: #e8d8a8;
}

.test-score-stats {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.test-score-stat {
  border: 1px solid rgba(180, 155, 80, 0.25);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  background: rgba(12, 10, 18, 0.78);
}

.test-score-stat span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c8b888;
}

.test-score-stat b {
  display: block;
  margin-top: 2px;
  font-size: 1.08rem;
  color: #f0e8d8;
}

.test-score-average {
  margin: 10px 0 0;
  color: #e0d0a8;
}

.test-score-track {
  position: relative;
  margin-top: 10px;
  height: 12px;
  border: 1px solid rgba(180, 155, 80, 0.35);
  border-radius: 999px;
  background: rgba(12, 10, 18, 0.82);
  overflow: visible;
}

.test-score-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c8942a, #f0c860);
  box-shadow: 0 0 12px rgba(200, 170, 80, 0.4);
}

.test-score-mark {
  position: absolute;
  left: var(--goalPos);
  top: 100%;
  transform: translateX(-50%);
  margin-top: 6px;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c8b888;
}

.test-score-mark::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translateX(-50%);
  width: 1px;
  height: 6px;
  background: rgba(200, 170, 80, 0.6);
}

.test-score-medal {
  margin: 28px 0 10px;
  font-weight: 800;
  color: #e8d8a8;
}

#btnTestScoreClose {
  width: 100%;
}

.test-key-prompt {
  position: absolute;
  width: 94px;
  height: 94px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.test-key-prompt.scene-change {
  width: 126px;
  height: 126px;
  border-radius: 22px;
  z-index: 3;
}

.test-key-prompt.scene-change .test-key-prompt-ring {
  border-radius: 22px;
}

.test-key-prompt-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    rgba(220, 190, 100, 0.9) 0% var(--testPromptProgress, 100%),
    rgba(40, 30, 10, 0.35) var(--testPromptProgress, 100%) 100%
  );
  box-shadow: 0 0 14px rgba(200, 170, 80, 0.4);
}

.test-key-prompt-core {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(220, 195, 120, 0.9);
  background: radial-gradient(circle at 30% 20%, rgba(60, 45, 15, 0.98), rgba(25, 20, 8, 0.98));
  color: #f0e4c8;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.test-key-prompt.hit .test-key-prompt-core {
  border-color: rgba(161, 255, 178, 0.95);
  box-shadow: 0 0 14px rgba(132, 255, 166, 0.46);
  animation: prompt-shake-green 240ms ease;
}

.test-key-prompt.miss .test-key-prompt-core {
  border-color: rgba(255, 120, 132, 0.95);
  box-shadow: 0 0 14px rgba(255, 83, 102, 0.4);
  animation: prompt-shake-red 280ms ease;
}

.test-key-prompt.scene-change .test-key-prompt-core {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  padding: 0 8px;
  font-size: 1.26rem;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.test-key-prompt.scene-change.is-confirmed .test-key-prompt-core {
  border-color: rgba(161, 255, 178, 0.98);
  box-shadow: 0 0 18px rgba(132, 255, 166, 0.5);
}

.test-key-prompt.scene-change.is-blocked .test-key-prompt-core {
  border-color: rgba(255, 160, 120, 0.95);
  box-shadow: 0 0 16px rgba(255, 132, 83, 0.42);
}

.climax-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  width: min(340px, calc(100vw - 28px));
  border: 2px solid rgba(180, 155, 80, 0.45);
  border-radius: 18px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(14, 12, 22, 0.94), rgba(8, 6, 14, 0.96)),
    radial-gradient(ellipse at 20% 10%, rgba(200, 170, 80, 0.1), transparent 50%);
  box-shadow:
    0 0 0 1px rgba(120, 100, 40, 0.2),
    0 16px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 240, 180, 0.05);
}

.climax-row {
  display: flex;
  justify-content: center;
}

.climax-label {
  display: block;
  margin: 10px 0 6px;
  font-family: 'Cinzel', serif;
  color: #c8942a;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(200, 148, 42, 0.25);
}

.climax-controls {
  display: flex;
  gap: 6px;
}

.climax-btn {
  border: 2px solid rgba(180, 155, 80, 0.5);
  display: grid;
  place-items: center;
  color: #f0e8d8;
  background:
    radial-gradient(ellipse at 45% 25%, rgba(255, 255, 255, 0.06), transparent 50%),
    linear-gradient(180deg, rgba(55, 42, 12, 0.96), rgba(28, 20, 6, 0.98));
  border-radius: 10px;
  width: 40px;
  height: 36px;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.1),
    0 0 0 1px rgba(100, 80, 20, 0.4),
    0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 130ms ease, border-color 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.climax-btn-icon {
  width: 30px;
  height: 30px;
  display: block;
  pointer-events: none;
}

.climax-btn:hover,
.climax-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(230, 200, 110, 0.9);
  background:
    radial-gradient(ellipse at 45% 25%, rgba(255, 255, 255, 0.08), transparent 50%),
    linear-gradient(180deg, rgba(70, 54, 16, 0.96), rgba(38, 28, 8, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.14),
    0 0 0 1px rgba(120, 100, 30, 0.5),
    0 0 14px rgba(200, 170, 80, 0.2),
    0 8px 18px rgba(0, 0, 0, 0.4);
  outline: none;
}

.climax-btn.active {
  border-color: rgba(240, 210, 120, 0.95);
  background:
    radial-gradient(ellipse at 45% 25%, rgba(255, 255, 255, 0.1), transparent 50%),
    linear-gradient(180deg, rgba(80, 62, 18, 0.96), rgba(45, 34, 10, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.16),
    0 0 0 1px rgba(140, 115, 40, 0.6),
    0 0 18px rgba(200, 170, 80, 0.28),
    0 6px 14px rgba(0, 0, 0, 0.35);
}

.climax-btn.locked {
  opacity: 0.7;
}

.climax-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  border-color: rgba(140, 120, 70, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.04),
    0 0 0 1px rgba(90, 70, 20, 0.22),
    0 2px 8px rgba(0, 0, 0, 0.18);
}

.climax-btn:disabled:hover,
.climax-btn:disabled:focus-visible {
  transform: none;
  outline: none;
  background:
    radial-gradient(ellipse at 45% 25%, rgba(255, 255, 255, 0.04), transparent 50%),
    linear-gradient(180deg, rgba(55, 42, 12, 0.96), rgba(28, 20, 6, 0.98));
}

.climax-track {
  margin-top: 10px;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  border: 1px solid rgba(180, 155, 80, 0.28);
  background: rgba(8, 6, 14, 0.7);
  overflow: hidden;
}

.climax-track.space-impact {
  animation: test-space-impact 170ms ease;
}

.test-minigame-controls {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.test-minigame-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e0d0a8;
  font-weight: 700;
}

.test-touch-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.test-touch-pad {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 148px;
  min-width: 148px;
  height: 96px;
  padding: 0 18px 14px;
  border: 2px solid rgba(180, 155, 80, 0.58);
  border-radius: 20px;
  color: #f0e8d8;
  background:
    radial-gradient(ellipse at 45% 25%, rgba(255, 255, 255, 0.08), transparent 52%),
    linear-gradient(180deg, rgba(38, 44, 58, 0.9), rgba(18, 22, 34, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(90, 110, 150, 0.18),
    0 10px 22px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.test-touch-pad:active {
  transform: scale(0.97);
}

.test-minigame-toggle {
  border: 1px solid rgba(180, 155, 80, 0.55);
  border-radius: 10px;
  min-width: 64px;
  padding: 6px 10px;
  color: #f0e8d8;
  background: linear-gradient(180deg, rgba(80, 60, 15, 0.96), rgba(40, 30, 10, 0.97));
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  cursor: pointer;
}

.test-minigame-toggle.active {
  border-color: rgba(161, 255, 178, 0.9);
  color: #d8ffe3;
  background: linear-gradient(180deg, rgba(25, 95, 54, 0.96), rgba(12, 57, 31, 0.97));
  box-shadow: 0 0 0 1px rgba(122, 255, 162, 0.24);
}

.climax-dropdown {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  border: 1px solid rgba(180, 155, 80, 0.25);
  border-radius: 14px;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(12, 10, 20, 0.88), rgba(6, 4, 12, 0.92)),
    radial-gradient(ellipse at 50% 0%, rgba(200, 170, 80, 0.05), transparent 60%);
  box-shadow: inset 0 1px 0 rgba(255, 240, 180, 0.03);
}

.climax-option-btn {
  width: 100%;
  border: 1.5px solid rgba(180, 155, 80, 0.4);
  border-radius: 10px;
  padding: 11px 14px;
  color: #f0e8d8;
  background:
    radial-gradient(ellipse at 40% 20%, rgba(255, 255, 255, 0.04), transparent 50%),
    linear-gradient(180deg, rgba(45, 35, 10, 0.92), rgba(22, 16, 5, 0.96));
  font-size: 0.88rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.08),
    0 0 0 1px rgba(90, 72, 18, 0.35),
    0 3px 8px rgba(0, 0, 0, 0.2);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.climax-option-btn:hover,
.climax-option-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(230, 200, 110, 0.85);
  background:
    radial-gradient(ellipse at 40% 20%, rgba(255, 255, 255, 0.06), transparent 50%),
    linear-gradient(180deg, rgba(60, 46, 14, 0.94), rgba(32, 24, 7, 0.97));
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.12),
    0 0 0 1px rgba(120, 100, 30, 0.5),
    0 0 16px rgba(200, 170, 80, 0.18),
    0 8px 16px rgba(0, 0, 0, 0.3);
  outline: none;
}

.climax-option-btn.active {
  border-color: rgba(240, 215, 130, 0.95);
  background:
    radial-gradient(ellipse at 40% 20%, rgba(255, 255, 255, 0.08), transparent 50%),
    linear-gradient(180deg, rgba(72, 56, 16, 0.95), rgba(40, 30, 8, 0.97));
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.15),
    inset 0 0 16px rgba(200, 170, 80, 0.08),
    0 0 0 1px rgba(160, 135, 50, 0.6),
    0 0 20px rgba(200, 170, 80, 0.22);
}

.climax-dropdown-hint {
  margin: 8px 2px 6px;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(224, 208, 168, 0.78);
}

#climaxProgressFill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c8942a, #f0c860, #ffe8a0);
  box-shadow: 0 0 12px rgba(200, 170, 80, 0.5);
}

.story-scene {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  padding: clamp(12px, 2.5vw, 28px);
  display: grid;
  align-content: start;
  background:
    radial-gradient(circle at 70% 18%, rgba(200, 170, 80, 0.12), transparent 28%),
    radial-gradient(circle at 22% 62%, rgba(160, 130, 50, 0.14), transparent 38%),
    linear-gradient(120deg, rgba(14, 12, 20, 0.72), rgba(6, 4, 10, 0.86));
}

.story-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  pointer-events: none;
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}

.story-scene.story-scene-has-video::before {
  background: none;
}

.story-scene.story-scene-has-video .story-vignette {
  background: none;
}

.story-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.6)),
    repeating-linear-gradient(0deg, rgba(220, 200, 160, 0.04) 0 1px, transparent 1px 5px);
}

.story-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle, transparent 35%, rgba(0, 0, 0, 0.72) 100%);
}

.story-topbar,
.dialogue-box {
  position: relative;
  z-index: 2;
}

.story-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.story-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dev-karma-counter {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(149, 243, 192, 0.34);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(10, 36, 24, 0.9), rgba(7, 18, 12, 0.92));
  color: #bfffdc;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.dev-nav-btn {
  min-width: 52px;
  padding: 12px 10px;
  font-size: 1.05rem;
}

.dev-nav-btn[disabled] {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.dev-btn {
  min-width: 110px;
}

.dialogue-box {
  position: absolute;
  bottom: clamp(20px, 6vh, 42px);
  left: 50%;
  transform: translateX(-50%);
  width: min(980px, calc(100% - (clamp(12px, 2.5vw, 28px) * 2)));
  max-width: 980px;
  border: 2px solid rgba(180, 155, 80, 0.5);
  border-radius: 18px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(16, 14, 26, 0.88), rgba(8, 6, 14, 0.92)),
    radial-gradient(ellipse at 50% 0%, rgba(200, 170, 80, 0.06), transparent 60%);
  box-shadow:
    0 0 0 1px rgba(120, 100, 40, 0.25),
    0 20px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 240, 180, 0.06);
}

.speaker {
  margin: 0 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: 'Cinzel', serif;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #c8942a;
  text-shadow: 0 0 12px rgba(200, 148, 42, 0.3);
}

.speaker::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0c860, #c8942a);
  box-shadow: 0 0 8px rgba(200, 148, 42, 0.7), 0 0 20px rgba(200, 148, 42, 0.3);
  animation: pulse-glow 2.4s ease-in-out infinite;
}

.line {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.95rem);
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: #f0ece4;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.countdown-wrap {
  margin-top: 16px;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  border: 1px solid rgba(180, 155, 80, 0.3);
  background: rgba(12, 10, 18, 0.7);
  overflow: hidden;
}

.countdown-bar {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c8942a, #f0c860, #ffe8a0);
  box-shadow: 0 0 10px rgba(200, 148, 42, 0.5);
}

.countdown-toast {
  position: absolute;
  top: clamp(12px, 2.5vw, 28px);
  left: clamp(12px, 2.5vw, 28px);
  z-index: 3;
  margin-top: 0;
  width: fit-content;
  max-width: min(840px, calc(100% - (clamp(12px, 2.5vw, 28px) * 2)));
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid rgba(200, 170, 80, 0.68);
  background:
    linear-gradient(180deg, rgba(60, 45, 15, 0.96), rgba(30, 22, 8, 0.95)),
    radial-gradient(circle at 20% 20%, rgba(200, 170, 80, 0.15), transparent 40%);
  color: #f0e8d8;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 0 20px rgba(200, 148, 42, 0.28);
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transition: opacity 260ms ease, transform 260ms ease;
}

.countdown-toast::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border-radius: 50%;
  font-size: 0.86rem;
  font-weight: 900;
  color: #1a150a;
  background: linear-gradient(180deg, #f0c860, #c8942a);
  box-shadow: 0 0 10px rgba(200, 148, 42, 0.55);
}

.countdown-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.dialogue-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.dialogue-actions-one {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
}

.dialogue-actions-one .action {
  width: 100%;
  min-width: 0;
}

.dialogue-actions-two {
  width: 100%;
}

.dialogue-actions-two-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
}

.dialogue-actions-two-stack .action {
  width: 100%;
  min-width: 0;
}

.dialogue-actions-two-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: stretch;
}

.dialogue-actions-two-split .action {
  width: 100%;
  min-width: 0;
}

.dialogue-actions .action {
  min-width: 150px;
  border: 2px solid rgba(200, 170, 80, 0.7);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 0.92rem;
  letter-spacing: 0.12em;
  background:
    radial-gradient(ellipse at 40% 20%, rgba(255, 255, 255, 0.05), transparent 50%),
    linear-gradient(180deg, rgba(50, 38, 10, 0.92), rgba(25, 18, 5, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.12),
    inset 0 -4px 12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(100, 80, 20, 0.5),
    0 0 0 3px rgba(12, 10, 20, 0.92),
    0 0 0 4px rgba(180, 155, 80, 0.3),
    0 8px 20px rgba(0, 0, 0, 0.25);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.dialogue-actions .action:hover,
.dialogue-actions .action:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(230, 200, 100, 0.9);
  background:
    radial-gradient(ellipse at 40% 20%, rgba(255, 255, 255, 0.07), transparent 50%),
    linear-gradient(180deg, rgba(65, 50, 14, 0.94), rgba(35, 25, 8, 0.97));
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.16),
    0 0 0 1px rgba(120, 100, 30, 0.6),
    0 0 0 3px rgba(12, 10, 20, 0.92),
    0 0 0 4px rgba(220, 190, 100, 0.45),
    0 0 22px rgba(200, 170, 80, 0.2),
    0 14px 28px rgba(0, 0, 0, 0.3);
}

.dice-modal {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: rgba(2, 2, 4, 0.66);
}

.dice-card {
  width: min(400px, calc(100vw - 28px));
  min-height: 360px;
  border: 2px solid rgba(200, 170, 80, 0.6);
  border-radius: 16px;
  padding: 18px 20px 24px;
  background:
    linear-gradient(180deg, rgba(22, 20, 32, 0.95), rgba(12, 10, 18, 0.94)),
    radial-gradient(circle at 50% 20%, rgba(200, 170, 80, 0.12), transparent 50%);
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.45), 0 0 20px rgba(200, 170, 80, 0.22);
  text-align: center;
  outline: none;
}

.dice-caption {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #d8c898;
  font-weight: 700;
  font-size: 0.82rem;
}

.dice-target {
  margin: 4px 0 0;
  font-size: 2.3rem;
  color: #f0e4c8;
  font-weight: 900;
}

.dice-divider {
  margin: 10px 0 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 170, 80, 0.65), transparent);
}

.dice-square {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 8px auto 16px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 2px solid rgba(128, 255, 170, 0.75);
  box-shadow: 0 0 18px rgba(101, 255, 161, 0.3);
  background: linear-gradient(180deg, rgba(18, 49, 29, 0.9), rgba(9, 23, 14, 0.95));
  overflow: visible;
}

.dice-square::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 20px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.78);
}

.dice-square.is-success {
  border-color: rgba(112, 255, 160, 0.98);
  box-shadow: 0 0 22px rgba(101, 255, 161, 0.5), 0 0 42px rgba(72, 214, 118, 0.28);
}

.dice-square.is-success::after {
  background: radial-gradient(circle, rgba(122, 255, 172, 0.42) 0%, rgba(70, 255, 142, 0.18) 38%, rgba(70, 255, 142, 0.02) 68%, transparent 76%);
  animation: dice-wave-success 720ms ease-out forwards;
}

.dice-square.is-failure {
  border-color: rgba(255, 108, 108, 0.98);
  box-shadow: 0 0 22px rgba(255, 88, 88, 0.52), 0 0 42px rgba(199, 31, 31, 0.28);
  background: linear-gradient(180deg, rgba(62, 18, 18, 0.94), rgba(28, 7, 7, 0.97));
}

.dice-square.is-failure span {
  color: #ffd0d0;
  text-shadow: 0 0 14px rgba(255, 120, 120, 0.42);
}

.dice-square.is-failure::after {
  background: radial-gradient(circle, rgba(255, 110, 110, 0.42) 0%, rgba(255, 68, 68, 0.18) 38%, rgba(255, 68, 68, 0.02) 68%, transparent 76%);
  animation: dice-wave-failure 720ms ease-out forwards;
}

.dice-square span {
  font-size: 2.35rem;
  font-weight: 900;
  color: #bcffd2;
  text-shadow: 0 0 14px rgba(139, 255, 178, 0.4);
}

.dice-hint {
  min-height: 1.5em;
  margin: 14px 0 18px;
  color: #d8c898;
  font-weight: 700;
}

@keyframes dice-wave-success {
  0% {
    opacity: 0;
    transform: scale(0.78);
  }
  12% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: scale(1.48);
  }
}

@keyframes dice-wave-failure {
  0% {
    opacity: 0;
    transform: scale(0.78);
  }
  12% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: scale(1.48);
  }
}

.dev-dice-config {
  border: 1px solid rgba(180, 155, 80, 0.3);
  border-radius: 8px;
  padding: 8px;
  background: rgba(14, 12, 22, 0.55);
  display: grid;
  gap: 6px;
}

.dev-dice-route {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
}

.route-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.route-icon.plus {
  color: #0f2b18;
  background: linear-gradient(180deg, #9df8b8, #5fde8b);
}

.route-icon.minus {
  color: #1a150a;
  background: linear-gradient(180deg, #f0c860, #c8942a);
}

.route-icon.karma {
  color: #08291b;
  background: linear-gradient(180deg, #9cf2c1, #5dd78c);
}

.dev-choice-help-text {
  display: block;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #b8a878;
}

.dev-choice-karma-block {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.dev-choice-karma-routes {
  display: grid;
  gap: 6px;
}

.dev-karma-route {
  grid-template-columns: auto 74px minmax(0, 1fr) auto;
}

.dev-karma-gain-row {
  grid-template-columns: minmax(0, 1fr) 88px;
}

.dev-karma-route-remove {
  min-width: 78px;
  padding: 6px 8px;
}

.dev-panel {
  position: absolute;
  top: clamp(12px, 2vw, 24px);
  right: clamp(12px, 2vw, 24px);
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  z-index: 5;
  border: 1px solid rgba(180, 155, 80, 0.45);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(18, 16, 26, 0.97), rgba(8, 6, 14, 0.96));
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.45);
}

.dev-panel::before,
.dev-panel::after {
  content: "";
  position: sticky;
  left: 0;
  right: 0;
  display: block;
  height: 12px;
  z-index: 2;
  pointer-events: none;
}

.dev-panel::before {
  top: 0;
  margin-bottom: -12px;
  background: linear-gradient(180deg, rgba(200, 170, 80, 0.18), rgba(200, 170, 80, 0));
}

.dev-panel::after {
  bottom: 0;
  margin-top: -12px;
  background: linear-gradient(0deg, rgba(200, 170, 80, 0.14), rgba(200, 170, 80, 0));
}

.dev-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.dev-panel-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dev-panel-head h3 {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dev-fold {
  margin-top: 10px;
  border: 1px solid rgba(180, 155, 80, 0.28);
  border-radius: 10px;
  background: rgba(10, 8, 16, 0.66);
  overflow: hidden;
}

.dev-fold summary {
  cursor: pointer;
  list-style: none;
  padding: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #e8d8a8;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(180, 155, 80, 0.18);
  background: rgba(16, 14, 24, 0.85);
}

.dev-fold summary::-webkit-details-marker {
  display: none;
}

.dev-fold summary::after {
  content: "+";
  float: right;
  color: #c8942a;
}

.dev-fold[open] summary::after {
  content: "-";
}

.dev-block {
  margin-top: 0;
  border: 0;
  border-radius: 0;
  padding: 10px;
  background: transparent;
}

.dev-block label {
  display: block;
  margin: 6px 0 4px;
  color: #d8c898;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.dev-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.dev-row-title {
  align-items: center;
}

.dev-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dev-check-row label {
  margin: 0;
}

.dev-block input,
.dev-block textarea,
.dev-block select {
  width: 100%;
  border: 1px solid rgba(180, 155, 80, 0.45);
  border-radius: 8px;
  background: rgba(8, 6, 14, 0.8);
  color: #f0e8d8;
  padding: 9px;
  font: inherit;
}

.dev-block textarea {
  resize: vertical;
  min-height: 92px;
}

.dev-choices-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.dev-content-variants-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.dev-content-item {
  border: 1px solid rgba(180, 155, 80, 0.3);
  border-radius: 10px;
  background: rgba(8, 6, 14, 0.72);
}

.dev-item-fold {
  overflow: hidden;
}

.dev-item-fold summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  background: rgba(16, 14, 24, 0.75);
}

.dev-item-fold summary::-webkit-details-marker {
  display: none;
}

.dev-item-fold summary strong {
  color: #e8d8a8;
  font-size: 0.95rem;
}

.dev-item-fold summary .action {
  min-width: 92px;
  padding: 6px 10px;
  font-size: 0.9rem;
}

.dev-item-body {
  padding: 8px;
  display: grid;
  gap: 8px;
}

.dev-content-item .dev-content-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.dev-content-item .dev-content-fields {
  display: grid;
  gap: 8px;
}

.dev-inline-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e8d8a8;
  font-size: 0.92rem;
}

.dev-inline-checkbox input {
  margin: 0;
}

.dev-scene-videos-list,
.dev-asset-videos-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.dev-scene-video-item,
.dev-asset-video-item {
  border: 1px solid rgba(180, 155, 80, 0.3);
  border-radius: 10px;
  padding: 8px;
  background: rgba(8, 6, 14, 0.72);
  display: grid;
  gap: 6px;
}

.dev-scene-video-item strong,
.dev-asset-video-item strong {
  color: #e8d8a8;
  font-size: 0.9rem;
}

.dev-asset-video-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.dev-choice-item {
  border: 1px solid rgba(180, 155, 80, 0.3);
  border-radius: 10px;
  padding: 8px;
  background: rgba(8, 6, 14, 0.72);
  display: grid;
  gap: 8px;
}

.dev-choice-item .dev-choice-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.dev-choice-item .dev-choice-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dev-choice-condition {
  border: 1px solid rgba(180, 155, 80, 0.22);
  border-radius: 8px;
  padding: 8px;
  display: grid;
  gap: 6px;
  background: rgba(14, 12, 22, 0.58);
}

.dev-choice-condition strong {
  font-size: 0.9rem;
  color: #d8c898;
}

.dev-panel-foot {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.dev-panel-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dev-panel-tools .action {
  min-width: 130px;
}

#devSaveStatus {
  color: #c8b888;
  font-size: 0.92rem;
}

.dev-map-modal {
  position: fixed;
  inset: 0;
  z-index: 8;
  padding: clamp(10px, 2vw, 20px);
  background: rgba(4, 2, 4, 0.92);
}

.dev-map-shell {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(180, 155, 80, 0.4);
  border-radius: 18px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(18, 16, 26, 0.98), rgba(8, 6, 14, 0.98)),
    radial-gradient(circle at 15% 10%, rgba(200, 170, 80, 0.1), transparent 32%);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.dev-map-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.dev-map-head h3 {
  margin: 8px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dev-map-head-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.dev-map-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid rgba(180, 155, 80, 0.24);
  border-radius: 12px;
  background: rgba(10, 8, 16, 0.84);
  color: #e8d8a8;
  font-size: 0.9rem;
}

.dev-map-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
}

.dev-map-canvas-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(180, 155, 80, 0.3);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(10, 8, 16, 0.92), rgba(6, 4, 10, 0.94)),
    linear-gradient(90deg, rgba(200, 170, 80, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(200, 170, 80, 0.05) 1px, transparent 1px);
  background-size: auto, 48px 48px, 48px 48px;
  cursor: default;
}

.dev-map-canvas-wrap.is-pannable {
  cursor: grab;
}

.dev-map-canvas-wrap.is-panning {
  cursor: grabbing;
}

.dev-map-help {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(180, 155, 80, 0.28);
  border-radius: 12px;
  background: rgba(10, 8, 16, 0.88);
  color: #d8c898;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.dev-map-help span {
  font-weight: 800;
  color: #f0e8d8;
}

.dev-map-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.dev-map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  color: #e0d0a8;
  text-align: center;
  font-size: 1rem;
}

.dev-map-side {
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  align-content: start;
  gap: 12px;
}

.dev-map-card {
  min-width: 0;
  border: 1px solid rgba(180, 155, 80, 0.28);
  border-radius: 14px;
  padding: 12px;
  background: rgba(10, 8, 16, 0.78);
}

.dev-map-fold {
  display: block;
  padding: 0;
  overflow: hidden;
}

.dev-map-fold-toggle {
  display: flex;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 12px;
  background: rgba(16, 14, 24, 0.72);
  color: #e8d8a8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  border: 0;
  border-bottom: 1px solid rgba(180, 155, 80, 0.16);
  text-align: left;
}

.dev-map-fold-toggle::after {
  content: "+";
  flex: 0 0 auto;
  color: #e8d8a8;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
}

.dev-map-fold-toggle[aria-expanded="true"]::after {
  content: "-";
}

.dev-map-fold .dev-map-side-title {
  display: block;
  margin: 0;
}

.dev-map-fold-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.dev-map-card input,
.dev-map-card select,
.dev-map-card textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.dev-map-side-title {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: #e8d8a8;
}

.dev-map-connection-source {
  margin: 0 0 10px;
  color: #d8c898;
  line-height: 1.4;
}

.dev-map-form-block {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.dev-map-choices-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.dev-map-choice-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(180, 155, 80, 0.22);
  border-radius: 8px;
  background: rgba(14, 12, 22, 0.58);
}

.dev-map-choice-item .dev-choice-top,
.dev-map-choice-item .dev-choice-fields,
.dev-map-choice-item .dev-dice-config,
.dev-map-choice-item .dev-dice-route {
  min-width: 0;
}

.dev-map-choice-item .dev-choice-top {
  align-items: center;
}

.dev-map-choice-item .dev-choice-top > * {
  min-width: 0;
}

.dev-map-choice-remove {
  min-width: 92px;
  padding: 6px 10px;
  font-size: 0.88rem;
}

.dev-map-choice-item .dev-choice-top span {
  overflow-wrap: anywhere;
  text-align: right;
}

.dev-map-choice-item .dev-dice-route {
  grid-template-columns: auto minmax(0, 1fr);
}

.dev-map-choice-item .dev-karma-route {
  grid-template-columns: auto 70px minmax(0, 1fr) auto;
}

.dev-map-choice-item .dev-karma-gain-row {
  grid-template-columns: minmax(0, 1fr) 78px;
}

.dev-map-choice-item strong {
  font-size: 0.84rem;
  color: #e8d8a8;
}

.dev-map-choice-item span {
  font-size: 0.78rem;
  color: #b8a878;
}

.dev-map-hint {
  margin: 10px 0 0;
  color: #b8a878;
  line-height: 1.45;
  font-size: 0.9rem;
}

.dev-map-form-actions {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.dev-map-bakey-preview {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #f0e8d8;
  background: rgba(6, 4, 10, 0.92);
  border: 1px solid rgba(180, 155, 80, 0.24);
  border-radius: 10px;
  padding: 10px;
}

.dev-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dev-map-legend-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dev-map-legend-chip.normal {
  background: rgba(255, 207, 149, 0.18);
  color: #ffd7a0;
  border: 1px solid rgba(255, 207, 149, 0.28);
}

.dev-map-legend-chip.dice {
  background: rgba(152, 209, 255, 0.18);
  color: #b8dfff;
  border: 1px solid rgba(152, 209, 255, 0.28);
}

.dev-map-legend-chip.karma {
  background: rgba(149, 243, 192, 0.16);
  color: #bfffdc;
  border: 1px solid rgba(149, 243, 192, 0.24);
}

.dev-map-legend-chip.active {
  background: rgba(127, 255, 179, 0.16);
  color: #bfffd3;
  border: 1px solid rgba(127, 255, 179, 0.24);
}

.dev-map-node-label {
  font-size: 14px;
  font-weight: 800;
  fill: #f0e8d8;
}

.dev-map-node-subtitle {
  font-size: 11px;
  fill: #c8b888;
}

.dev-map-edge-label {
  font-size: 11px;
  font-weight: 700;
  fill: #ffe3a6;
}

.dev-map-dice-label {
  font-size: 10px;
  font-weight: 900;
  fill: #fff4f2;
  letter-spacing: 0.08em;
}

.story-scene.episode-prologo {
  background:
    radial-gradient(circle at 78% 25%, rgba(200, 170, 80, 0.14), transparent 28%),
    linear-gradient(130deg, rgba(16, 14, 22, 0.72), rgba(8, 6, 14, 0.88));
}

.story-scene.episode-eco {
  background:
    radial-gradient(circle at 65% 14%, rgba(180, 150, 60, 0.14), transparent 28%),
    linear-gradient(120deg, rgba(12, 10, 18, 0.7), rgba(6, 4, 12, 0.88));
}

.story-scene.episode-ritual {
  background:
    radial-gradient(circle at 46% 18%, rgba(200, 170, 80, 0.16), transparent 30%),
    linear-gradient(120deg, rgba(14, 12, 20, 0.72), rgba(6, 4, 10, 0.9));
}

.story-scene.episode-null {
  background:
    radial-gradient(circle at 72% 16%, rgba(160, 140, 70, 0.12), transparent 28%),
    linear-gradient(120deg, rgba(12, 10, 18, 0.74), rgba(4, 2, 8, 0.92));
}

@keyframes pulse-glow {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

@keyframes menu-panel-scan {
  0% {
    background-position: 0 0, 0 0, 0 0, 0 0;
  }
  100% {
    background-position: 0 0, 0 0, 0 0, 0 160px;
  }
}

@keyframes menu-module-sweep {
  0%,
  12% {
    transform: translateX(-180%) skewX(-24deg);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  34% {
    transform: translateX(320%) skewX(-24deg);
    opacity: 0.95;
  }
  100% {
    transform: translateX(320%) skewX(-24deg);
    opacity: 0;
  }
}

@keyframes social-orb-sweep {
  0%,
  20% {
    transform: translateX(-180%) skewX(-24deg);
    opacity: 0;
  }
  28% {
    opacity: 0.9;
  }
  46% {
    transform: translateX(360%) skewX(-24deg);
    opacity: 0.9;
  }
  100% {
    transform: translateX(360%) skewX(-24deg);
    opacity: 0;
  }
}

@keyframes button-sheen {
  0%,
  18% {
    background-position: 0 0, 0 0, 140% 0;
  }
  38% {
    background-position: 0 0, 0 0, -40% 0;
  }
  100% {
    background-position: 0 0, 0 0, -40% 0;
  }
}

@keyframes button-outline-pulse {
  0%,
  100% {
    opacity: 0.72;
    box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.06), 0 0 12px var(--button-glow);
  }
  50% {
    opacity: 1;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.08), 0 0 20px var(--button-glow-strong);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes prompt-shake-red {
  0% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

@keyframes prompt-shake-green {
  0% { transform: scale(1); }
  25% { transform: scale(1.06); }
  50% { transform: scale(0.98); }
  75% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes test-space-impact {
  0% { transform: translateX(0); box-shadow: 0 0 0 rgba(255, 140, 149, 0); }
  25% { transform: translateX(-2px); box-shadow: 0 0 12px rgba(255, 140, 149, 0.4); }
  50% { transform: translateX(2px); box-shadow: 0 0 14px rgba(255, 140, 149, 0.5); }
  75% { transform: translateX(-1px); box-shadow: 0 0 8px rgba(255, 140, 149, 0.25); }
  100% { transform: translateX(0); box-shadow: 0 0 0 rgba(255, 140, 149, 0); }
}

@media (max-width: 920px) {
  .intro-card {
    width: min(92vw, 640px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 9vh 14px 18px;
    text-align: center;
  }

  .intro-kicker,
  .intro-card h1 {
    margin-left: auto;
    margin-right: auto;
  }

  .intro-start-btn {
    display: inline-flex;
    align-self: center;
    justify-content: center;
    width: auto;
    min-width: 0;
    max-width: min(78vw, 320px);
    margin-top: 72px;
    padding-left: 24px;
    padding-right: 24px;
    font-size: 1rem;
    letter-spacing: 0.11em;
  }

  .intro-fullscreen-btn {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
    border-radius: 14px;
  }

  .intro-fullscreen-btn .fullscreen-icon {
    width: 22px;
    height: 22px;
  }

  .intro-menu {
    grid-template-columns: 1fr;
    gap: 14px;
    max-width: 400px;
  }

  .intro-socials {
    grid-template-columns: repeat(4, 48px);
    gap: 20px;
  }

  .intro-shell.is-revealed .intro-card h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
  }

  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(300px, 44vh) auto;
  }

  .stage {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .title-block {
    max-width: 90%;
  }

  .menu-panel {
    padding: 16px;
  }

  .options-head,
  .options-group-head {
    flex-direction: column;
    align-items: stretch;
  }

  .episode-detail-head {
    flex-direction: column;
    align-items: stretch;
  }

  .episode-detail-body {
    grid-template-columns: 1fr;
  }

  .episode-detail-art {
    height: 228px;
  }

  .episode-detail-actions {
    justify-content: stretch;
  }

  .episode-detail-actions .action {
    width: 100%;
  }

  .options-value {
    text-align: left;
  }

  .climax-bar {
    top: 12px;
    left: 12px;
  }

  .episodes-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .test-scenes-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .episodes-head {
    align-items: stretch;
    flex-direction: column;
  }

  .test-scenes-head {
    align-items: stretch;
    flex-direction: column;
  }

  .back-btn {
    width: 100%;
    max-width: 200px;
  }

  .story-topbar-actions {
    width: 100%;
  }

  .story-topbar-actions .action {
    flex: 1;
  }

  .dev-panel {
    position: fixed;
    inset: auto 12px 12px 12px;
    width: auto;
    max-height: 78vh;
  }

  .dev-map-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .dev-map-head-actions {
    justify-items: stretch;
  }

  .dev-map-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(46vh, 1fr) auto;
  }

  .dev-map-side {
    max-height: 34vh;
  }

  .dev-map-fold-toggle {
    padding: 10px 12px;
  }
}

@media (max-width: 620px) {
  .options-group-intro {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .options-group-intro .options-select,
  .options-group-intro .options-toggle-btn {
    width: 100%;
    max-width: none;
    justify-self: stretch;
    margin-top: 12px;
  }

  .episodes-grid {
    grid-template-columns: 1fr;
  }

  .climax-row {
    justify-content: stretch;
  }

  .climax-label {
    margin: 8px 0 6px;
  }

  .climax-controls {
    justify-content: space-between;
  }

  .climax-option-btn {
    font-size: 0.92rem;
    padding: 9px 10px;
  }

  .story-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .line {
    font-size: clamp(1.12rem, 5.2vw, 1.45rem);
  }

  .dialogue-actions {
    justify-content: stretch;
  }

  .dialogue-actions .action {
    width: 100%;
    min-width: 0;
  }

  .dialogue-actions-two-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .dev-choice-item .dev-choice-fields {
    grid-template-columns: 1fr;
  }

  .dev-panel-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .dev-panel-tools {
    flex-direction: column;
  }
  .dev-panel-head-actions {
    width: 100%;
  }

  .dev-panel-head-actions .action {
    flex: 1;
  }

  .dev-map-help {
    right: 12px;
    max-width: calc(100% - 24px);
  }
}

html.phone-mode .dialogue-box,
body.phone-mode .dialogue-box {
  bottom: 12px;
  width: min(470px, calc(100% - 26px));
  max-width: 470px;
  padding: 8px 10px 10px;
  border-radius: 12px;
}

html.phone-mode .speaker,
body.phone-mode .speaker {
  margin-bottom: 3px;
  gap: 5px;
  font-size: 0.64rem;
  letter-spacing: 0.08em;
}

html.phone-mode .speaker::before,
body.phone-mode .speaker::before {
  width: 6px;
  height: 6px;
}

html.phone-mode .line,
body.phone-mode .line {
  font-size: clamp(0.76rem, 2.35vw, 0.98rem);
  line-height: 1.1;
}

html.phone-mode .countdown-wrap,
body.phone-mode .countdown-wrap {
  margin-top: 6px;
  height: 6px;
}

html.phone-mode .countdown-toast,
body.phone-mode .countdown-toast {
  top: 10px;
  left: 10px;
  margin-top: 0;
  padding: 5px 8px;
  font-size: 0.66rem;
}

html.phone-mode .countdown-toast::before,
body.phone-mode .countdown-toast::before {
  width: 14px;
  height: 14px;
  margin-right: 5px;
  font-size: 0.66rem;
}

html.phone-mode .story-topbar,
body.phone-mode .story-topbar {
  flex-direction: row;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 5px;
}

html.phone-mode .story-topbar-actions,
body.phone-mode .story-topbar-actions {
  display: flex;
  flex-wrap: nowrap;
  width: auto;
  margin-left: auto;
  gap: 12px;
  align-items: center;
}

html.phone-mode .story-topbar .action,
body.phone-mode .story-topbar .action {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0 10px;
  height: 46px;
  font-size: 0.74rem;
}

html.phone-mode .dev-nav-btn,
body.phone-mode .dev-nav-btn {
  min-width: 46px;
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 0.72rem;
}

html.phone-mode .dev-btn,
body.phone-mode .dev-btn {
  min-width: 96px;
}

html.phone-mode .story-topbar .action-menu-toggle,
body.phone-mode .story-topbar .action-menu-toggle {
  min-width: 46px;
  width: 46px;
  height: 46px;
  padding: 0;
  gap: 5px;
  border-radius: 12px;
}

html.phone-mode .story-topbar .action-menu-toggle .menu-toggle-bar,
body.phone-mode .story-topbar .action-menu-toggle .menu-toggle-bar {
  width: 16px;
}

html.phone-mode .story-topbar .back-btn.action-menu-toggle,
body.phone-mode .story-topbar .back-btn.action-menu-toggle {
  min-width: 46px;
}

html.phone-mode .dialogue-actions,
body.phone-mode .dialogue-actions {
  margin-top: 12px;
  gap: 5px;
}

html.phone-mode .dialogue-actions .action,
body.phone-mode .dialogue-actions .action {
  min-width: 0;
  padding: 7px 10px;
  min-height: 42px;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
}

html.phone-mode .menu-toast,
body.phone-mode .menu-toast {
  bottom: 14px;
  min-width: 0;
  max-width: min(420px, calc(100vw - 28px));
  padding: 10px 12px;
  font-size: 0.78rem;
  border-radius: 12px;
}

html.phone-mode #testView .test-scene,
body.phone-mode #testView .test-scene {
  background: #000;
}

html.phone-mode #testView .test-video,
body.phone-mode #testView .test-video {
  object-fit: contain;
  object-position: center;
  background: #000;
}

html.phone-mode #testView .test-key-prompt,
body.phone-mode #testView .test-key-prompt {
  pointer-events: auto;
}

html.phone-mode #testView .test-touch-controls,
body.phone-mode #testView .test-touch-controls {
  right: 10px;
  bottom: max(10px, calc(env(safe-area-inset-bottom) + 6px));
  width: min(44vw, 220px);
  height: min(25vh, 210px);
}

html.phone-mode #testView .test-touch-pad,
body.phone-mode #testView .test-touch-pad {
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 0 14px 18px;
  border-radius: 28px;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(44, 49, 66, 0.94), rgba(16, 20, 31, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(90, 110, 150, 0.22),
    0 14px 28px rgba(0, 0, 0, 0.34);
}

html.phone-mode #testView .test-slide-prompt,
body.phone-mode #testView .test-slide-prompt {
  width: 86px;
  height: 214px;
  border-radius: 28px;
  transform: none;
  display: block;
  box-sizing: border-box;
}

html.phone-mode #testView .test-slide-prompt .test-key-prompt-ring,
body.phone-mode #testView .test-slide-prompt .test-key-prompt-ring {
  inset: 0;
  border-radius: 28px;
  background: transparent;
  box-shadow: none;
}

html.phone-mode #testView .test-slide-prompt .test-key-prompt-core,
body.phone-mode #testView .test-slide-prompt .test-key-prompt-core {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: transparent;
  font-size: 0;
  letter-spacing: 0;
  text-shadow: none;
  border-color: rgba(120, 255, 180, 0.95);
  background: radial-gradient(circle at 30% 20%, rgba(48, 34, 10, 0.98), rgba(22, 16, 6, 0.98));
  box-shadow: 0 0 0 2px rgba(120, 255, 180, 0.18);
  will-change: top;
  transition: left 80ms linear, top 80ms linear, border-color 120ms ease;
}

html.phone-mode #testView .test-slide-prompt.is-dragging .test-key-prompt-core,
body.phone-mode #testView .test-slide-prompt.is-dragging .test-key-prompt-core {
  transition: none;
}

html.phone-mode #testView .test-slide-prompt .test-key-prompt-core,
body.phone-mode #testView .test-slide-prompt .test-key-prompt-core {
  left: calc(50% - 26px);
  top: calc(154px - (146px * var(--testSlideProgressValue, 0)));
  transform: none;
}

html.phone-mode #testView .test-slide-prompt::before,
body.phone-mode #testView .test-slide-prompt::before {
  content: attr(data-slide-arrow);
  position: absolute;
  display: grid;
  place-items: center;
  font-family: "Segoe UI", sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1;
  color: rgba(230, 245, 235, 0.92);
  text-shadow: 0 0 10px rgba(120, 255, 180, 0.18);
}

html.phone-mode #testView .test-slide-prompt::before,
body.phone-mode #testView .test-slide-prompt::before {
  left: 0;
  right: 0;
  top: 6px;
  justify-items: center;
  transform: none;
}

html.phone-mode #testView .test-slide-prompt::after,
body.phone-mode #testView .test-slide-prompt::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(120, 255, 180, 0.82);
  box-shadow: 0 0 8px rgba(120, 255, 180, 0.16);
}

html.phone-mode #testView .test-slide-prompt::after,
body.phone-mode #testView .test-slide-prompt::after {
  left: calc(50% - 4px);
  top: 34px;
  bottom: 34px;
  width: 8px;
  transform: none;
}

html.phone-mode #testView .test-slide-prompt.hit .test-key-prompt-core,
body.phone-mode #testView .test-slide-prompt.hit .test-key-prompt-core {
  border-color: rgba(120, 255, 180, 0.95);
}

html.phone-mode #testView .test-slide-prompt.miss .test-key-prompt-core,
body.phone-mode #testView .test-slide-prompt.miss .test-key-prompt-core {
  border-color: rgba(255, 120, 132, 0.95);
}

html.phone-mode .climax-bar,
body.phone-mode .climax-bar {
  top: 10px;
  left: 10px;
  width: min(340px, calc((100vw - 20px) / 0.86));
  padding: 12px;
  border-radius: 18px;
  transform: scale(0.86);
  transform-origin: top left;
}

html.phone-mode .climax-row,
body.phone-mode .climax-row {
  justify-content: center;
}

html.phone-mode .climax-label,
body.phone-mode .climax-label {
  margin: 8px 0 6px;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
}

html.phone-mode .climax-controls,
body.phone-mode .climax-controls {
  width: 100%;
  justify-content: space-evenly;
  align-items: center;
  gap: 0;
}

html.phone-mode .climax-btn,
body.phone-mode .climax-btn {
  width: 40px;
  height: 36px;
  min-width: 40px;
  border-radius: 10px;
  font-size: 1rem;
}

html.phone-mode .climax-track,
body.phone-mode .climax-track {
  margin-top: 10px;
  height: 6px;
}

html.phone-mode .climax-dropdown-hint,
body.phone-mode .climax-dropdown-hint {
  margin: 8px 2px 6px;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}

html.phone-mode .climax-dropdown,
body.phone-mode .climax-dropdown {
  margin-top: 12px;
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
}

html.phone-mode .climax-option-btn,
body.phone-mode .climax-option-btn {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  letter-spacing: 0.1em;
}

html.phone-mode .test-minigame-controls,
body.phone-mode .test-minigame-controls {
  margin-top: 8px;
  gap: 10px;
}

html.phone-mode .test-minigame-label,
body.phone-mode .test-minigame-label {
  font-size: 0.7rem;
}

html.phone-mode .test-final-advance,
body.phone-mode .test-final-advance {
  padding: 12px;
}

html.phone-mode .test-final-advance-card,
body.phone-mode .test-final-advance-card {
  width: min(100%, 420px);
  padding: 20px 16px 16px;
  border-radius: 18px;
}

html.phone-mode .test-final-advance-title,
body.phone-mode .test-final-advance-title {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
}

html.phone-mode .test-final-advance-message,
body.phone-mode .test-final-advance-message {
  font-size: 0.84rem;
  letter-spacing: 0.05em;
}

html.phone-mode .test-final-advance-actions,
body.phone-mode .test-final-advance-actions {
  grid-template-columns: 1fr;
  gap: 10px;
}

html.phone-mode .test-final-advance-actions .action,
body.phone-mode .test-final-advance-actions .action {
  min-height: 48px;
}

html.phone-mode .test-final-advance-track,
body.phone-mode .test-final-advance-track {
  margin-top: 10px;
  height: 8px;
}

html.phone-mode .test-minigame-toggle,
body.phone-mode .test-minigame-toggle {
  min-width: 64px;
  padding: 6px 10px;
  font-size: 0.78rem;
}

html.phone-mode .shell,
body.phone-mode .shell {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(240px, 42vh) auto;
}

html.phone-mode .stage,
body.phone-mode .stage {
  border-right: 0;
  border-bottom: 1px solid var(--line-soft);
}

html.phone-mode .title-block,
body.phone-mode .title-block {
  left: 18px;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
}

html.phone-mode .kicker,
body.phone-mode .kicker {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
}

html.phone-mode .title-block h1,
body.phone-mode .title-block h1 {
  margin: 6px 0;
  font-size: clamp(1.9rem, 9vw, 3.5rem);
}

html.phone-mode .subtitle,
body.phone-mode .subtitle {
  font-size: 0.88rem;
}

html.phone-mode .menu-panel,
body.phone-mode .menu-panel {
  padding: 14px 12px 12px;
  gap: 12px;
}

html.phone-mode .menu-head,
body.phone-mode .menu-head {
  padding: 12px;
  border-radius: 12px;
}

html.phone-mode .series,
body.phone-mode .series {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
}

html.phone-mode .menu-head h2,
body.phone-mode .menu-head h2,
html.phone-mode .episodes-head h2,
body.phone-mode .episodes-head h2,
html.phone-mode .test-scenes-head h2,
body.phone-mode .test-scenes-head h2 {
  font-size: clamp(1.05rem, 5.8vw, 1.9rem);
}

html.phone-mode .status,
body.phone-mode .status {
  font-size: 0.86rem;
}

html.phone-mode .menu-actions,
body.phone-mode .menu-actions {
  gap: 8px;
}

html.phone-mode .action,
body.phone-mode .action {
  border-radius: 12px;
  font-size: 0.84rem;
  padding: 11px 10px;
}

html.phone-mode .menu-socials,
body.phone-mode .menu-socials {
  gap: 8px;
  padding-top: 2px;
}

html.phone-mode.phone-portrait-lock .options-modal,
body.phone-mode.phone-portrait-lock .options-modal,
html.phone-mode.phone-portrait-lock .test-score-modal,
body.phone-mode.phone-portrait-lock .test-score-modal,
html.phone-mode.phone-portrait-lock .dice-modal,
body.phone-mode.phone-portrait-lock .dice-modal,
html.phone-mode.phone-portrait-lock .dev-map-modal,
body.phone-mode.phone-portrait-lock .dev-map-modal {
  pointer-events: none;
}

html.phone-mode .menu-social-link,
body.phone-mode .menu-social-link {
  min-height: 54px;
  border-radius: 12px;
}

html.phone-mode .menu-social-link img,
body.phone-mode .menu-social-link img {
  width: 22px;
  height: 22px;
}

html.phone-mode .options-modal,
body.phone-mode .options-modal {
  align-items: stretch;
  justify-content: center;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}

html.phone-mode .options-card,
body.phone-mode .options-card {
  width: min(100%, 560px);
  max-height: calc(100dvh - 16px);
  margin: 0;
  padding: 10px 10px 12px;
  border-radius: 18px;
  border-color: var(--line-soft);
  background:
    linear-gradient(180deg, rgba(14, 12, 20, 0.9), rgba(8, 6, 14, 0.92)),
    radial-gradient(circle at top, rgba(200, 170, 80, 0.1), transparent 56%);
}

html.phone-mode .options-head,
body.phone-mode .options-head {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 2px 0 10px;
  background: linear-gradient(180deg, rgba(10, 8, 16, 0.98), rgba(10, 8, 16, 0.86) 78%, rgba(10, 8, 16, 0));
}

html.phone-mode .options-head > div,
body.phone-mode .options-head > div {
  min-width: 0;
}

html.phone-mode .options-head h2,
body.phone-mode .options-head h2 {
  font-family: 'Cinzel Decorative', 'Cinzel', 'Georgia', serif;
  font-size: clamp(1.05rem, 5.8vw, 1.9rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #e8b84a;
  background:
    linear-gradient(
      180deg,
      #fffdf5 0%,
      #f5d978 20%,
      #c8942a 45%,
      #f0c860 55%,
      #ffe8a0 70%,
      #c8942a 90%,
      #f0c860 100%
    );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(80, 50, 10, 0.5))
    drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

html.phone-mode .options-head .back-btn,
body.phone-mode .options-head .back-btn {
  width: 100%;
  min-height: 46px;
  align-self: stretch;
}

html.phone-mode .options-groups,
body.phone-mode .options-groups {
  margin-top: 12px;
  gap: 12px;
}

html.phone-mode .options-group,
body.phone-mode .options-group {
  padding: 12px;
  border-radius: 14px;
}

html.phone-mode .options-group-head,
body.phone-mode .options-group-head {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

html.phone-mode .options-group-head h3,
body.phone-mode .options-group-head h3 {
  font-size: 0.94rem;
}

html.phone-mode .options-group-head p,
body.phone-mode .options-group-head p {
  font-size: 0.8rem;
  line-height: 1.35;
}

html.phone-mode .options-value,
body.phone-mode .options-value {
  min-width: 0;
  text-align: left;
  font-size: 1rem;
}

html.phone-mode .options-select,
body.phone-mode .options-select {
  margin-top: 12px;
  min-height: 48px;
  padding: 12px 42px 12px 14px;
  font-size: 0.9rem;
  border-radius: 12px;
}

html.phone-mode .options-range,
body.phone-mode .options-range {
  margin-top: 12px;
}

html.phone-mode .options-toggle-btn,
body.phone-mode .options-toggle-btn {
  width: 100%;
  min-width: 0;
  max-width: none;
  min-height: 48px;
  margin-top: 12px;
  padding: 8px 0;
  align-self: stretch;
}

html.phone-mode #btnOptionsFullscreen,
body.phone-mode #btnOptionsFullscreen {
  width: 75px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  margin: auto 0;
}

html.phone-mode .options-toggle-btn strong,
body.phone-mode .options-toggle-btn strong {
  font-size: 0.9rem;
}

html.phone-mode .options-actions,
body.phone-mode .options-actions {
  margin-top: 14px;
}

html.phone-mode .episodes-wrap,
body.phone-mode .episodes-wrap,
html.phone-mode .test-scenes-wrap,
body.phone-mode .test-scenes-wrap {
  max-width: min(980px, calc(100vw - 18px));
  margin: 10px auto;
  padding: 12px;
  border-radius: 14px;
}

html.phone-mode .test-scenes-wrap,
body.phone-mode .test-scenes-wrap {
  border-color: var(--line-soft);
  background:
    linear-gradient(180deg, rgba(14, 12, 20, 0.9), rgba(8, 6, 14, 0.92)),
    radial-gradient(circle at top, rgba(200, 170, 80, 0.1), transparent 56%);
}

html.phone-mode #testScenesMenuView,
body.phone-mode #testScenesMenuView {
  align-items: stretch;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}

html.phone-mode .test-scenes-wrap,
body.phone-mode .test-scenes-wrap {
  width: min(100%, 560px);
  max-width: none;
  max-height: calc(100dvh - 16px);
  padding: 10px 10px 12px;
  border-radius: 18px;
}

html.phone-mode .episodes-head,
body.phone-mode .episodes-head,
html.phone-mode .test-scenes-head,
body.phone-mode .test-scenes-head {
  gap: 10px;
}

html.phone-mode .episodes-head,
body.phone-mode .episodes-head {
  position: sticky;
  top: 0;
  z-index: 2;
  flex-direction: column;
  align-items: stretch;
  padding: 2px 0 10px;
  background: linear-gradient(180deg, rgba(10, 8, 16, 0.98), rgba(10, 8, 16, 0.86) 78%, rgba(10, 8, 16, 0));
}

html.phone-mode .episodes-head > div,
body.phone-mode .episodes-head > div {
  min-width: 0;
}

html.phone-mode .test-scenes-head,
body.phone-mode .test-scenes-head {
  position: sticky;
  top: 0;
  z-index: 2;
  flex-direction: column;
  align-items: stretch;
  padding: 2px 0 10px;
  background: linear-gradient(180deg, rgba(10, 8, 16, 0.98), rgba(10, 8, 16, 0.86) 78%, rgba(10, 8, 16, 0));
}

html.phone-mode .test-scenes-head > div,
body.phone-mode .test-scenes-head > div {
  min-width: 0;
}

html.phone-mode .back-btn,
body.phone-mode .back-btn {
  min-width: 0;
}

html.phone-mode .test-scenes-head .back-btn,
body.phone-mode .test-scenes-head .back-btn {
  width: 100%;
  min-height: 46px;
  align-self: stretch;
}

html.phone-mode .episodes-head .back-btn,
body.phone-mode .episodes-head .back-btn {
  width: 100%;
  min-height: 46px;
  align-self: stretch;
}

html.phone-mode .episodes-grid,
body.phone-mode .episodes-grid,
html.phone-mode .test-scenes-grid,
body.phone-mode .test-scenes-grid {
  margin-top: 12px;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

html.phone-mode .episode-detail-modal,
body.phone-mode .episode-detail-modal,
html.phone-mode .prologo-character-modal,
body.phone-mode .prologo-character-modal {
  place-items: stretch;
  padding: 0;
  overflow: hidden;
}

html.phone-mode .episode-detail-panel,
body.phone-mode .episode-detail-panel,
html.phone-mode .prologo-character-panel,
body.phone-mode .prologo-character-panel {
  width: 100vw;
  height: 100dvh;
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding:
    calc(env(safe-area-inset-top, 0px) + 14px)
    calc(env(safe-area-inset-right, 0px) + 14px)
    calc(env(safe-area-inset-bottom, 0px) + 14px)
    calc(env(safe-area-inset-left, 0px) + 14px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

html.phone-mode .prologo-character-panel::before,
body.phone-mode .prologo-character-panel::before,
html.phone-mode .prologo-character-panel::after,
body.phone-mode .prologo-character-panel::after {
  display: none;
}

html.phone-mode .episode-detail-head,
body.phone-mode .episode-detail-head,
html.phone-mode .prologo-character-head,
body.phone-mode .prologo-character-head {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) * -1);
  z-index: 3;
  padding-top: 2px;
  background: linear-gradient(180deg, rgba(10, 8, 16, 0.98), rgba(10, 8, 16, 0.9) 78%, rgba(10, 8, 16, 0));
}

html.phone-mode .episode-detail-body,
body.phone-mode .episode-detail-body {
  grid-template-columns: 1fr;
  gap: 14px;
}

html.phone-mode .episode-detail-visual,
body.phone-mode .episode-detail-visual {
  display: grid;
  gap: 10px;
  order: 2;
}

html.phone-mode .episode-detail-copy,
body.phone-mode .episode-detail-copy {
  order: 1;
}

html.phone-mode .episode-detail-preview-hint,
body.phone-mode .episode-detail-preview-hint,
html.phone-mode .episode-detail-art,
body.phone-mode .episode-detail-art {
  display: none;
}

html.phone-mode .episode-detail-preview-copy,
body.phone-mode .episode-detail-preview-copy {
  padding: 14px;
  border: 1px solid rgba(180, 155, 80, 0.16);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(20, 17, 30, 0.88), rgba(10, 8, 16, 0.96)),
    radial-gradient(circle at top, rgba(200, 170, 80, 0.05), transparent 48%);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 180, 0.03),
    0 10px 24px rgba(0, 0, 0, 0.18);
}

html.phone-mode .episode-detail-art,
body.phone-mode .episode-detail-art {
  height: clamp(220px, 48vw, 300px);
}

html.phone-mode .episode-detail-actions,
body.phone-mode .episode-detail-actions {
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom, 0px) * -1);
  z-index: 3;
  margin-top: 14px;
  padding: 12px 0 2px;
  justify-content: flex-end;
}

html.phone-mode .episode-detail-actions .action,
body.phone-mode .episode-detail-actions .action {
  width: fit-content;
}

html.phone-mode .prologo-character-head > div,
body.phone-mode .prologo-character-head > div {
  min-width: 0;
}

html.phone-mode .prologo-character-head,
body.phone-mode .prologo-character-head {
  flex-direction: column;
  gap: 10px;
}

html.phone-mode .prologo-character-head h3,
body.phone-mode .prologo-character-head h3 {
  font-size: clamp(1.2rem, 5.4vw, 1.7rem);
  line-height: 1.04;
}

html.phone-mode .prologo-character-head .status,
body.phone-mode .prologo-character-head .status {
  font-size: 0.92rem;
  line-height: 1.32;
}

html.phone-mode .prologo-character-head .back-btn,
body.phone-mode .prologo-character-head .back-btn {
  width: auto;
  min-width: 132px;
  min-height: 46px;
  align-self: flex-start;
}

html.phone-mode .prologo-character-grid,
body.phone-mode .prologo-character-grid {
  margin-top: 10px;
  grid-template-columns: 1fr;
  gap: 10px;
}

html.phone-mode .prologo-character-grid::before,
body.phone-mode .prologo-character-grid::before {
  display: none;
}

html.phone-mode .prologo-character-option,
body.phone-mode .prologo-character-option {
  min-height: clamp(220px, 58vw, 292px);
  border-radius: 20px;
}

html.phone-mode .prologo-character-copy,
body.phone-mode .prologo-character-copy {
  min-height: auto;
  padding: 52px 16px 16px;
}

html.phone-mode .prologo-character-name,
body.phone-mode .prologo-character-name {
  font-size: clamp(1.1rem, 4.4vw, 1.38rem);
}

html.phone-mode .prologo-character-trait,
body.phone-mode .prologo-character-trait {
  max-width: none;
  font-size: 0.88rem;
  line-height: 1.32;
}

html.phone-mode .test-scenes-grid,
body.phone-mode .test-scenes-grid {
  gap: 12px;
}

html.phone-mode .episode-card,
body.phone-mode .episode-card,
html.phone-mode .test-mode-card,
body.phone-mode .test-mode-card {
  padding: 8px;
  border-radius: 12px;
}

html.phone-mode .episode-card,
body.phone-mode .episode-card {
  display: block;
  padding: 10px;
}

html.phone-mode .test-mode-card,
body.phone-mode .test-mode-card {
  display: block;
  padding: 10px;
}

html.phone-mode .episode-art,
body.phone-mode .episode-art,
html.phone-mode .test-mode-preview,
body.phone-mode .test-mode-preview {
  height: 116px;
  border-radius: 9px;
}

html.phone-mode .test-mode-preview,
body.phone-mode .test-mode-preview {
  display: block;
  width: 100%;
  height: clamp(150px, 34vw, 210px);
  min-height: 150px;
  aspect-ratio: auto;
}

html.phone-mode .episode-card h3,
body.phone-mode .episode-card h3,
html.phone-mode .test-mode-title,
body.phone-mode .test-mode-title {
  margin: 8px 0 3px;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

html.phone-mode .episode-art,
body.phone-mode .episode-art {
  display: block;
  width: 100%;
  height: clamp(150px, 34vw, 210px);
  min-height: 150px;
}

html.phone-mode .episode-card h3,
body.phone-mode .episode-card h3 {
  margin: 10px 0 4px;
  line-height: 1.2;
}

html.phone-mode .test-mode-title,
body.phone-mode .test-mode-title {
  margin: 10px 0 4px;
  line-height: 1.2;
}

html.phone-mode .episode-card p,
body.phone-mode .episode-card p,
html.phone-mode .test-mode-score,
body.phone-mode .test-mode-score {
  font-size: 0.78rem;
  line-height: 1.28;
}

html.phone-mode .test-mode-score,
body.phone-mode .test-mode-score {
  margin: 0;
}

html.phone-mode .test-mode-card:hover,
html.phone-mode .test-mode-card:focus-visible,
body.phone-mode .test-mode-card:hover,
body.phone-mode .test-mode-card:focus-visible {
  transform: none;
}

html.phone-mode .episode-card:hover,
html.phone-mode .episode-card:focus-visible,
body.phone-mode .episode-card:hover,
body.phone-mode .episode-card:focus-visible {
  transform: none;
}

@media (orientation: landscape) {
  html.phone-mode .shell,
  body.phone-mode .shell {
    grid-template-columns: minmax(0, 1.16fr) minmax(270px, 0.84fr);
    grid-template-rows: 1fr;
  }

  html.phone-mode .stage,
  body.phone-mode .stage {
    border-bottom: 0;
    border-right: 1px solid var(--line-soft);
  }

  html.phone-mode .title-block,
  body.phone-mode .title-block {
    left: 22px;
    right: auto;
    bottom: 22px;
    max-width: 320px;
  }

  html.phone-mode .menu-panel,
  body.phone-mode .menu-panel {
    padding: 18px 14px 14px;
    grid-template-rows: auto auto 1fr auto;
  }

  html.phone-mode .menu-head h2,
  body.phone-mode .menu-head h2 {
    font-size: clamp(1.2rem, 2.4vw, 1.9rem);
  }

  html.phone-mode .menu-social-link,
  body.phone-mode .menu-social-link {
    min-height: 58px;
  }

  html.phone-mode .prologo-character-modal,
  body.phone-mode .prologo-character-modal,
  html.phone-mode .episode-detail-modal,
  body.phone-mode .episode-detail-modal {
    place-items: stretch;
    padding: 0;
  }

  html.phone-mode .episode-detail-head,
  body.phone-mode .episode-detail-head,
  html.phone-mode .prologo-character-head,
  body.phone-mode .prologo-character-head {
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
  }

  html.phone-mode .episode-detail-body,
  body.phone-mode .episode-detail-body {
    margin-top: 8px;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  html.phone-mode .prologo-character-grid,
  body.phone-mode .prologo-character-grid {
    margin-top: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  html.phone-mode .episode-detail-art,
  body.phone-mode .episode-detail-art {
    height: clamp(180px, 42dvh, 280px);
  }

  html.phone-mode .prologo-character-option,
  body.phone-mode .prologo-character-option {
    min-height: clamp(188px, 54dvh, 236px);
  }

  html.phone-mode .prologo-character-copy,
  body.phone-mode .prologo-character-copy {
    padding: 42px 14px 14px;
  }

  html.phone-mode .episodes-wrap,
  body.phone-mode .episodes-wrap,
  html.phone-mode .test-scenes-wrap,
  body.phone-mode .test-scenes-wrap {
    max-width: min(1100px, calc(100vw - 20px));
    padding: 14px;
  }

  html.phone-mode .options-card,
  body.phone-mode .options-card {
    max-width: min(760px, calc(100vw - 20px));
    padding: 14px;
  }

  html.phone-mode .test-scenes-head,
  body.phone-mode .test-scenes-head {
    flex-direction: row;
    align-items: flex-start;
    padding-bottom: 8px;
  }

  html.phone-mode .options-head,
  body.phone-mode .options-head {
    flex-direction: row;
    align-items: flex-start;
    padding-bottom: 8px;
  }

  html.phone-mode .episodes-head,
  body.phone-mode .episodes-head {
    flex-direction: row;
    align-items: flex-start;
    padding-bottom: 8px;
  }

  html.phone-mode .test-scenes-head .back-btn,
  body.phone-mode .test-scenes-head .back-btn {
    width: auto;
    min-width: 132px;
    align-self: flex-start;
  }

  html.phone-mode .episodes-head .back-btn,
  body.phone-mode .episodes-head .back-btn {
    width: auto;
    min-width: 132px;
    align-self: flex-start;
  }

  html.phone-mode .options-head .back-btn,
  body.phone-mode .options-head .back-btn {
    width: auto;
    min-width: 132px;
    align-self: flex-start;
  }

  html.phone-mode .episodes-grid,
  body.phone-mode .episodes-grid,
  html.phone-mode .test-scenes-grid,
  body.phone-mode .test-scenes-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
  }

  html.phone-mode .prologo-character-grid,
  body.phone-mode .prologo-character-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
  }

  html.phone-mode .prologo-character-option,
  body.phone-mode .prologo-character-option {
    min-height: 276px;
  }

  html.phone-mode .prologo-character-copy,
  body.phone-mode .prologo-character-copy {
    padding: 56px 14px 14px;
  }

  html.phone-mode .test-scenes-grid,
  body.phone-mode .test-scenes-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html.phone-mode .test-mode-card,
  body.phone-mode .test-mode-card {
    display: block;
  }

  html.phone-mode .episode-art,
  body.phone-mode .episode-art,
  html.phone-mode .test-mode-preview,
  body.phone-mode .test-mode-preview {
    height: 154px;
  }

  html.phone-mode .back-btn,
  body.phone-mode .back-btn {
    width: auto;
    min-width: 140px;
  }
}
