:root {
  --vn-text-scale: 1;
}

/* Adventure Theme Tokens
   Hinweis: bewusst als statische Datei in /public, damit FTP-Deploy ohne npm build funktioniert.
*/

/* Base */
body[data-theme] {
  --bg: #0b0f19;
  --panel: rgba(255,255,255,0.04);
  --panel-2: rgba(255,255,255,0.06);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);
  --accent: #6d7cff;
  --accent-2: #94a3ff;
  --danger: #ff5a73;
  --ok: #43d19e;
  --ring: rgba(255,255,255,0.12);
  --shadow: 0 18px 50px rgba(0,0,0,0.45);
}

/* Cinematic Dark (Theme A) */
body[data-theme="cinematic-dark"] {
  --bg: #07090d;
  --panel: rgba(255,255,255,0.045);
  --panel-2: rgba(255,255,255,0.075);
  --text: rgba(255,255,255,0.94);
  --muted: rgba(255,255,255,0.66);
  --accent: #d6b56f;
  --accent-2: #f1d79a;
  --ring: rgba(214,181,111,0.18);
  --shadow: 0 24px 70px rgba(0,0,0,0.55);
}

/* Parchment Light (Theme B) */
body[data-theme="parchment-light"] {
  --bg: #f2e8d4;
  --panel: rgba(35,24,10,0.06);
  --panel-2: rgba(35,24,10,0.09);
  --text: rgba(35,24,10,0.92);
  --muted: rgba(35,24,10,0.66);
  --accent: #7c4a1a;
  --accent-2: #a36b33;
  --ring: rgba(124,74,26,0.18);
  --shadow: 0 20px 50px rgba(35,24,10,0.18);
}

/* Helpers */
[hidden] { display: none !important; }
.adv-bg { background: var(--bg); color: var(--text); }
.adv-panel { background: var(--panel); border: 1px solid var(--ring); box-shadow: var(--shadow); }
.adv-panel-soft { background: var(--panel-2); border: 1px solid var(--ring); }
.adv-muted { color: var(--muted); }
.adv-accent { color: var(--accent); }
.adv-ring { border-color: var(--ring); }

.adv-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.adv-footer__links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.adv-footer a,
.legal-page a {
  color: var(--accent-2);
  text-decoration: none;
}
.adv-footer a:hover,
.legal-page a:hover {
  text-decoration: underline;
}
.legal-page {
  line-height: 1.65;
}
.legal-page h2 {
  margin-top: 1.5rem;
  margin-bottom: 0.45rem;
  font-size: 1.05rem;
  font-weight: 700;
}
.legal-page h2:first-child {
  margin-top: 0;
}
.legal-page p,
.legal-page ul {
  margin: 0.45rem 0 0;
}
.legal-page ul {
  padding-left: 1.25rem;
  list-style: disc;
}

/* Form controls (Admin + simple pages)
   Note: Admin views use Tailwind, but we keep a minimal control style here so they
   stay usable even when no component layer is available.
*/
.adv-input,
.adv-textarea,
.adv-select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--ring);
  border-radius: 14px;
  padding: 10px 12px;
  width: 100%;
  caret-color: var(--text);
}

/* Nicer file inputs (Admin uploads) */
.adv-input[type="file"] {
  padding: 10px 12px;
}
.adv-input[type="file"]::file-selector-button {
  background: var(--panel);
  border: 1px solid var(--ring);
  border-radius: 12px;
  padding: 8px 10px;
  margin-right: 10px;
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}
.adv-input[type="file"]::file-selector-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.22);
}

.adv-textarea { min-height: 120px; }

.adv-input::placeholder,
.adv-textarea::placeholder {
  color: var(--muted);
}

.adv-input:focus,
.adv-textarea:focus,
.adv-select:focus {
  outline: none;
  border-color: rgba(109,124,255,0.45);
  box-shadow: 0 0 0 4px rgba(109,124,255,0.18);
}
body[data-theme="cinematic-dark"] .adv-input:focus,
body[data-theme="cinematic-dark"] .adv-textarea:focus,
body[data-theme="cinematic-dark"] .adv-select:focus {
  border-color: rgba(214,181,111,0.45);
  box-shadow: 0 0 0 4px rgba(214,181,111,0.18);
}
body[data-theme="parchment-light"] .adv-input:focus,
body[data-theme="parchment-light"] .adv-textarea:focus,
body[data-theme="parchment-light"] .adv-select:focus {
  border-color: rgba(124,74,26,0.45);
  box-shadow: 0 0 0 4px rgba(124,74,26,0.18);
}

/* Auth (Breeze) – make form controls readable on dark theme */
.adv-auth input[type="email"],
.adv-auth input[type="password"],
.adv-auth input[type="text"],
.adv-auth input[type="search"],
.adv-auth input[type="url"],
.adv-auth input[type="number"],
.adv-auth textarea,
.adv-auth select {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 10px 12px;
  caret-color: var(--text);
}

.adv-auth input::placeholder,
.adv-auth textarea::placeholder {
  color: rgba(255,255,255,0.55);
}

.adv-auth input:focus,
.adv-auth textarea:focus,
.adv-auth select:focus {
  outline: none;
  border-color: rgba(214,181,111,0.45);
  box-shadow: 0 0 0 4px rgba(214,181,111,0.18);
}

.adv-auth input[type="checkbox"] {
  accent-color: var(--accent);
}

.adv-auth .text-gray-600,
.adv-auth .text-gray-700,
.adv-auth .text-gray-800,
.adv-auth .text-gray-900 {
  color: rgba(255,255,255,0.78) !important;
}

.adv-auth a { color: rgba(214,181,111,0.92); }
.adv-auth a:hover { color: rgba(241,215,154,0.98); }


.adv-note {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--ring);
  background: rgba(255,255,255,0.04);
}
.adv-note--ok {
  border-color: rgba(95, 220, 170, 0.35);
  background: rgba(95, 220, 170, 0.08);
}

/* Buttons */
.adv-btn {
  background: var(--panel-2);
  border: 1px solid var(--ring);
  border-radius: 14px;
  padding: 12px 14px;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}
.adv-btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.22); }
body[data-theme="cinematic-dark"] .adv-btn:hover { border-color: rgba(214,181,111,0.30); }
.adv-btn-primary {
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  border-color: rgba(255,255,255,0.18);
}
body[data-theme="cinematic-dark"] .adv-btn-primary {
  background: linear-gradient(180deg, rgba(214,181,111,0.22), rgba(214,181,111,0.08));
  border-color: rgba(214,181,111,0.30);
}

/* Explicit golden CTA variant (used for Start button on story cards) */
.adv-btn-gold {
  background: linear-gradient(180deg, #d7ae57, #9a6f1f);
  border-color: rgba(177,127,33,0.78);
  color: #140f05;
  font-weight: 700;
}
.adv-btn-gold:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  border-color: rgba(177,127,33,0.92);
}
.adv-btn-gold[disabled], .adv-btn-gold.disabled {
  filter: grayscale(0.35);
  opacity: 0.55;
}
.adv-btn[disabled], .adv-btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.adv-btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.16);
}
body[data-theme="cinematic-dark"] .adv-btn-ghost {
  border-color: rgba(214,181,111,0.28);
}
.adv-btn-ghost:hover {
  background: rgba(255,255,255,0.04);
}

.adv-locale-switch {
  position: relative;
  display: inline-block;
  min-width: 0;
  --adv-locale-text: var(--text, #111827);
  --adv-locale-muted: var(--muted, rgba(17,24,39,0.72));
  --adv-locale-ring: var(--ring, rgba(15,23,42,0.14));
  --adv-locale-surface: var(--panel, rgba(255,255,255,0.94));
  --adv-locale-surface-soft: var(--panel-2, rgba(255,255,255,0.84));
  --adv-locale-shadow: 0 18px 50px rgba(0,0,0,0.26);
}

.adv-locale-switch__summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--adv-locale-ring);
  background: var(--adv-locale-surface-soft);
  color: var(--adv-locale-text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 8px 26px rgba(0,0,0,0.18);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.adv-locale-switch__summary::-webkit-details-marker {
  display: none;
}

.adv-locale-switch__summary:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.22);
  box-shadow: 0 12px 32px rgba(0,0,0,0.22);
}

.adv-locale-switch__summary:focus-visible {
  outline: none;
  border-color: rgba(214,181,111,0.42);
  box-shadow: 0 0 0 4px rgba(214,181,111,0.16);
}

.adv-locale-switch__summary-icon,
.adv-locale-switch__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.adv-locale-switch__summary-icon--globe {
  width: 18px;
  height: 18px;
  font-size: 17px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.28));
}

.adv-locale-switch__summary-icon svg {
  width: 15px;
  height: 15px;
  opacity: 0.88;
}

.adv-locale-switch__summary-code {
  font-weight: 800;
  letter-spacing: 0.08em;
}

.adv-locale-switch__summary-text {
  color: var(--adv-locale-muted);
  font-size: 12px;
  font-weight: 600;
}

.adv-locale-switch__chevron svg {
  width: 15px;
  height: 15px;
}

.adv-locale-switch[open] {
  z-index: 120;
}

.adv-locale-switch[open] .adv-locale-switch__summary {
  border-color: rgba(214,181,111,0.35);
  background: var(--adv-locale-surface);
}

.adv-locale-switch[open] .adv-locale-switch__chevron {
  transform: rotate(180deg);
}

.adv-locale-switch__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  max-width: min(260px, calc(100vw - 24px));
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--adv-locale-ring);
  background: var(--adv-locale-surface);
  box-shadow: var(--adv-locale-shadow);
  backdrop-filter: blur(14px);
}

.adv-locale-switch__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--adv-locale-text);
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}

.adv-locale-switch__option:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.06);
}

.adv-locale-switch__option.is-active {
  background: rgba(214,181,111,0.12);
}

.adv-locale-switch__option-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.adv-locale-switch__code {
  font-weight: 800;
  letter-spacing: 0.05em;
  min-width: 40px;
}

.adv-locale-switch__name {
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adv-locale-switch__check {
  color: rgba(214,181,111,0.96);
  font-size: 14px;
  font-weight: 800;
  opacity: 0;
}

.adv-locale-switch__option.is-active .adv-locale-switch__check {
  opacity: 1;
}

body[data-theme="cinematic-dark"] .adv-locale-switch__summary:hover,
body[data-theme="cinematic-dark"] .adv-locale-switch__option:hover {
  border-color: rgba(214,181,111,0.30);
}

@media (max-width: 640px) {
  .adv-locale-switch__summary {
    min-height: 44px;
    padding: 0 11px;
  }

  .adv-locale-switch__summary-text {
    display: none;
  }

  .adv-locale-switch__menu {
    min-width: min(220px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }
}

.adv-btn-warn {
  background: rgba(255,90,115,0.10);
  border-color: rgba(255,90,115,0.40);
}
.adv-btn-warn:hover {
  background: rgba(255,90,115,0.14);
  border-color: rgba(255,90,115,0.55);
}

/* Compact select (used on Home for admin version picker) */
.adv-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border-radius: 999px;
  padding: 10px 34px 10px 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(12,12,14,0.55);
  color: rgba(255,255,255,0.92);
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 8px 26px rgba(0,0,0,0.22);
}
.adv-select--compact { padding: 8px 30px 8px 12px; font-size: 12px; }
.adv-select:focus { outline: none; border-color: rgba(214,181,111,0.45); box-shadow: 0 0 0 3px rgba(214,181,111,0.16); }

/* Simple chevron */
.adv-select {
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.75) 50%),
    linear-gradient(135deg, rgba(255,255,255,0.75) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

body[data-theme="default"] .adv-select {
  background: rgba(255,255,255,0.72);
  border-color: rgba(0,0,0,0.10);
  color: rgba(12,12,14,0.92);
  box-shadow: 0 10px 24px rgba(0,0,0,0.10);
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(0,0,0,0.55) 50%),
    linear-gradient(135deg, rgba(0,0,0,0.55) 50%, transparent 50%);
}

/* Choice Cards */
.adv-choice {
  display: block;
  width: 100%;
  text-align: left;
}

/* Film frame */
.adv-frame {
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--ring);
  background: rgba(0,0,0,0.25);
}
body[data-theme="parchment-light"] .adv-frame {
  background: rgba(35,24,10,0.05);
}

/* Footer */
.adv-footer {
  opacity: 0.75;
  font-size: 10px;
  line-height: 1.1;
}

/* Home footer should waste as little vertical space as possible (mobile-friendly). */
footer.adv-footer {
  padding-top: 4px !important;
  padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)) !important;
}

/* ------------------------------------------------------------
   Story Selection (Home)
------------------------------------------------------------ */


/* Home landing polish */
.adv-home.adv-bg {
  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(214,181,111,0.12), rgba(214,181,111,0.00) 60%),
    radial-gradient(900px 520px at 85% 0%, rgba(109,124,255,0.10), rgba(109,124,255,0.00) 55%),
    var(--bg);
}

.home-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 14px;
  position: relative;
}

.home-brand {
  min-width: min(100%, 260px);
  flex: 1 1 680px;
}

.home-locale-header {
  position: absolute;
  top: 4px;
  right: 0;
  z-index: 2;
}

.home-kicker {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-right: 170px;
}

.home-title {
  font-weight: 860;
  letter-spacing: -0.01em;
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 1.05;
  margin-top: 4px;
}

.home-title--with-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.home-title__logo {
  width: clamp(34px, 3.8vw, 48px);
  height: clamp(34px, 3.8vw, 48px);
  flex: 0 0 auto;
  border-radius: 20%;
  filter: saturate(1.18) contrast(1.08) drop-shadow(0 8px 18px rgba(0,0,0,0.28));
  opacity: 1;
}

.home-tagline {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.45;
  max-width: 96ch;
}

.home-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

@media (max-width: 700px) {
  .home-kicker { padding-right: 104px; }
}

.home-hero {
  border-radius: 24px;
  padding: 14px;
  margin: 12px 0 16px;
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: '';
  position: absolute;
  inset: -2px;
  background:
    radial-gradient(900px 260px at 20% 0%, rgba(255,255,255,0.10), rgba(255,255,255,0.00) 60%),
    radial-gradient(700px 240px at 90% 10%, rgba(255,255,255,0.07), rgba(255,255,255,0.00) 60%);
  pointer-events: none;
}

body[data-theme="cinematic-dark"] .home-hero::before {
  background:
    radial-gradient(900px 260px at 20% 0%, rgba(214,181,111,0.18), rgba(214,181,111,0.00) 62%),
    radial-gradient(700px 240px at 90% 10%, rgba(214,181,111,0.10), rgba(214,181,111,0.00) 65%);
}

.home-hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 920px) {
  .home-hero__inner { grid-template-columns: 1fr; }
}

.home-hero__headline {
  font-weight: 780;
  letter-spacing: 0.01em;
  font-size: 18px;
  margin-bottom: 8px;
}

/* Compact how-to steps (Home) */
.home-howto {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 6px;
}

@media (min-width: 720px) {
  .home-howto { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .home-howto { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.home-howto__step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--ring);
  background: rgba(255,255,255,0.03);
}

.home-howto__n {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-weight: 900;
  color: var(--accent);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--ring);
}

.home-howto__t {
  font-weight: 800;
  letter-spacing: 0.01em;
  font-size: 15px;
  line-height: 1.15;
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.home-howto__icon { font-size: 16px; }

.home-howto__d {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.35;
  color: rgba(255,255,255,0.86);
}

body[data-theme="parchment-light"] .home-howto__d {
  color: rgba(35,24,10,0.82);
}

.home-hero__tip {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.02);
}

body[data-theme="parchment-light"] .home-hero__tip {
  border-color: rgba(35,24,10,0.18);
  background: rgba(35,24,10,0.03);
}

.home-hero__tipIcon {
  font-size: 14px;
  margin-top: 1px;
}

.home-steps {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-steps li {
  line-height: 1.35;
  color: rgba(255,255,255,0.90);
}

body[data-theme="parchment-light"] .home-steps li {
  color: rgba(35,24,10,0.86);
}

.home-hero__note {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.35;
}

.home-badges {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 520px) and (max-width: 919px) {
  .home-badges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.home-badge {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 16px;
  border: 1px solid var(--ring);
  background: rgba(255,255,255,0.04);
}

.home-badge__icon { font-size: 15px; }

.home-hero__stats {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.home-stat__n { color: var(--accent); font-weight: 800; }

.home-section {
  margin: 18px 0 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.home-section__title {
  font-weight: 820;
  letter-spacing: 0.01em;
  font-size: 16px;
}

.home-section__subtitle { font-size: 13px; }

/* Story card hover polish */
.story-card {
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.story-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.055);
}

body[data-theme="cinematic-dark"] .story-card:hover {
  border-color: rgba(214,181,111,0.28);
}

.story-card__img {
  transition: transform 220ms ease, filter 220ms ease;
}

.story-card:hover .story-card__img {
  transform: scale(1.01);
  filter: saturate(1.05) contrast(1.03);
}

@media (prefers-reduced-motion: reduce) {
  .story-card, .story-card:hover,
  .story-card__img, .story-card:hover .story-card__img {
    transition: none;
    transform: none;
    filter: none;
  }
}


.story-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 840px) {
  .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .story-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.story-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 22px;
  align-items: stretch;
}

.story-card__media { width: 100%; }

.story-card__img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--ring);
  background: rgba(0,0,0,0.18);
}

body[data-theme="parchment-light"] .story-card__img {
  background: rgba(35,24,10,0.06);
}

.story-card__img--empty {
  display: block;
  position: relative;
  overflow: hidden;
}

.story-card__img--empty::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(520px 160px at 30% 0%, rgba(255,255,255,0.10), rgba(255,255,255,0.00)),
    linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.00));
  opacity: 0.9;
}

.story-card__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.story-card__title {
  font-weight: 750;
  letter-spacing: 0.01em;
  font-size: 16px;
  line-height: 1.2;
}

.story-card__subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.story-card__teaser {
  color: rgba(255,255,255,0.86);
  font-size: 13px;
  line-height: 1.28;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.story-card__teaser.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.story-card__teaser-toggle {
  align-self: flex-start;
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  opacity: 0.9;
}

.story-card__teaser-toggle[hidden] { display: none !important; }

body[data-theme="parchment-light"] .story-card__teaser {
  color: rgba(35,24,10,0.84);
}

.story-card__footer {
  margin-top: 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.story-card__actions {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.story-card__actions > [data-progress-btn] {
  grid-column: 1;
  text-wrap: balance;
}

.story-card__actions > form[data-reset-form] {
  grid-column: 2;
}

.story-card__actions > form[data-start-form],
.story-card__actions > form[data-checkout-form] {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: flex-end;
  align-self: stretch;
}

.story-card__actions > form[data-reset-form],
.story-card__actions > form[data-start-form],
.story-card__actions > form[data-checkout-form],
.story-card__actions > [data-progress-btn] {
  min-width: 0;
}

.story-card__actions .adv-btn,
.story-card__actions .adv-select--compact {
  width: 100%;
  min-width: 0;
}

.story-card__actions > form[data-reset-form],
.story-card__actions > form[data-start-form],
.story-card__actions > form[data-checkout-form] {
  display: flex;
  align-self: stretch;
}

/* Ensure Reset form truly disappears when hidden (overrides display:flex above) */
.story-card__actions > form[data-reset-form][hidden] {
  display: none !important;
}

.story-card__actions > form[data-start-form] .adv-select--compact {
  min-height: 40px;
}

.story-card__actions > form[data-reset-form] .adv-btn,
.story-card__actions > form[data-start-form] .adv-btn,
.story-card__actions > form[data-checkout-form] .adv-btn {
  min-height: 50px;
  height: 100%;
}

.story-card__actions .adv-btn {
  min-height: 50px;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;
  line-height: 1.15;
  padding-top: 10px;
  padding-bottom: 10px;
}

@media (max-width: 900px) {
  .story-card__actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story-card__actions > [data-progress-btn] {
    grid-column: 1 / -1;
  }

  .story-card__actions > form[data-reset-form] {
    grid-column: 1;
  }

  .story-card__actions > form[data-start-form],
  .story-card__actions > form[data-checkout-form] {
    grid-column: 2;
  }
}

@media (max-width: 560px) {
  .story-card__actions {
    grid-template-columns: 1fr;
  }

  .story-card__actions > [data-progress-btn],
  .story-card__actions > form[data-reset-form],
  .story-card__actions > form[data-start-form],
  .story-card__actions > form[data-checkout-form] {
    grid-column: 1;
  }
}

.story-card__chips {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.story-chip {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--ring);
  background: rgba(255,255,255,0.04);
  font-size: 12px;
}

.story-chip--access {
  border-color: rgba(245, 158, 11, 0.42);
  background: rgba(245, 158, 11, 0.10);
  color: rgba(255, 244, 214, 0.95);
}

.story-card__payment-note {
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
}

/* ------------------------------------------------------------
   Visual-Novel Player Layout (no page scroll)
   Scope: body.adv-play
------------------------------------------------------------ */

body.adv-play {
  /* iPad/Safari fullscreen stability:
     dvh/vh can fluctuate on tap (toolbars / visualViewport quirks).
     JS keeps --vn-vh/--vn-vw in sync with the *actual* viewport.
     Fallback stays valid even without JS. */
  height: calc(var(--vn-vh, 1vh) * 100);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

/* While inline player is active, hide page-level footer completely
   so no copyright line can peek below the stage on Safari/iPad. */
body.adv-play .adv-footer {
  display: none !important;
}

.adv-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

.vn-stage {
  position: fixed;
  inset: 0;
  height: calc(var(--vn-vh, 1vh) * 100);
  min-height: 100dvh;
  width: calc(var(--vn-vw, 1vw) * 100);
  min-width: 100dvw;
  overflow: hidden;
  overscroll-behavior: none;
  z-index: 99990;
  /* Base fallback. Desktop gets a softer letterbox vignette below. */
  background: #000;
}

/* Ensure the stage always fills fullscreen exactly (some Safari builds are picky). */
.vn-stage:fullscreen,
.vn-stage:-webkit-full-screen {
  width: 100% !important;
  height: 100% !important;
}

/* Desktop letterbox polish (PC): keep artwork uncropped (contain) but make the bars feel less "hard black".
   We paint a very dark, subtle vignette on the stage itself. Since .vn-bg is transparent outside the contained image,
   this gradient shows through only in the empty (letterboxed/pillarboxed) areas. */
@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
  body[data-theme="cinematic-dark"] .vn-stage {
    background:
      radial-gradient(140% 110% at 50% 40%, rgba(18,18,18,0.98) 0%, rgba(0,0,0,1) 68%),
      radial-gradient(120% 100% at 50% 55%, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.55) 100%),
      #000;
  }

  body[data-theme="parchment-light"] .vn-stage {
    background:
      radial-gradient(140% 110% at 50% 40%, rgba(28,20,12,0.92) 0%, rgba(0,0,0,1) 70%),
      radial-gradient(120% 100% at 50% 55%, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.50) 100%),
      #000;
  }
}

.vn-bg {
  position: absolute;
  inset: -2px;
  background-image: var(--vn-bg);
  /* PC/Desktop: never crop the artwork.
     We scale proportionally (contain) and allow letterboxing/pillarboxing.
     The bar styling (soft vignette) is painted on .vn-stage, so keep this transparent outside the image. */
  background-color: transparent;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transform: none;
  filter: saturate(1.02) contrast(1.02);
}

/* Optional blurred fill behind a "contain" image on mobile portrait.
   Default: off (desktop uses letterboxing). */
.vn-bg-blur {
  display: none;
  position: absolute;
  inset: -6px;
  background-image: var(--vn-bg);
  background-size: cover;
  background-position: center;
  transform: scale(1.08);
  filter: blur(18px) saturate(1.12) contrast(1.05);
  opacity: 0.70;
}

.vn-scrim {
  position: absolute;
  inset: 0;
  /* Lighter scrim so the artwork remains visible behind the (now very transparent) text panel.
     The panel itself is only a light glass layer; the previous scrim was doing most of the darkening. */
  background:
    radial-gradient(1100px 680px at 50% 18%, rgba(0,0,0,0.03), rgba(0,0,0,0.22)),
    linear-gradient(to top, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0.04) 60%, rgba(0,0,0,0.008) 100%);
}


.vn-bg-blur,
.vn-bg,
.vn-scrim {
  pointer-events: none;
}



body[data-theme="parchment-light"] .vn-scrim {
  background:
    radial-gradient(1100px 680px at 50% 18%, rgba(242,232,212,0.10), rgba(35,24,10,0.06)),
    linear-gradient(to top, rgba(35,24,10,0.085) 0%, rgba(35,24,10,0.03) 65%, rgba(35,24,10,0.012) 100%);
}


.vn-hud {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  color: var(--text);
  text-shadow: 0 2px 10px rgba(0,0,0,0.55);
}

.vn-hud__left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.vn-hud__back {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--ring);
}

.vn-hud__back:hover { border-color: rgba(255,255,255,0.22); }
body[data-theme="cinematic-dark"] .vn-hud__back:hover { border-color: rgba(214,181,111,0.30); }

.vn-hud__title { min-width: 0; }

.vn-hud__story {
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vn-hud__muted { color: var(--muted); font-weight: 500; }

.vn-hud__meta {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--ring);
  color: var(--muted);
}
.vn-pill[data-stat] {
  cursor: pointer;
  user-select: none;
}
.vn-pill[data-stat]:focus-visible {
  outline: 2px solid rgba(214,181,111,0.72);
  outline-offset: 2px;
}

.vn-trend {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--ring);
  background: rgba(0,0,0,0.18);
  font-size: 12px;
  line-height: 1;
  transform: translateY(-0.5px);
  user-select: none;
}
.vn-pill__short { display: none; }

.vn-trend--up {
  color: rgba(67,209,158,0.98);
  border-color: rgba(67,209,158,0.38);
  background: rgba(67,209,158,0.10);
}
.vn-trend--down {
  color: rgba(255,90,115,0.98);
  border-color: rgba(255,90,115,0.38);
  background: rgba(255,90,115,0.10);
}
.vn-trend--flat {
  color: rgba(255,200,110,0.98);
  border-color: rgba(255,200,110,0.30);
  background: rgba(255,200,110,0.10);
}

.vn-pill--ok {
  color: rgba(67,209,158,0.92);
  border-color: rgba(67,209,158,0.30);
  background: rgba(67,209,158,0.10);
}

.vn-accent { color: var(--accent); font-weight: 650; }

.vn-hud__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vn-iconbtn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  text-decoration: none;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--ring);
  color: var(--text);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.vn-iconbtn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.22); }
body[data-theme="cinematic-dark"] .vn-iconbtn:hover { border-color: rgba(214,181,111,0.30); }

.vn-iconbtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Panel stack wrapper (used mainly for mobile portrait docking of the compact HUD row).
   Default: no layout impact; the panel remains absolutely positioned. */
.vn-panelstack {
  position: static;
}

.vn-panel {
  position: absolute;
  z-index: 3;
  left: 16px;
  right: 16px;
  /* Keep the panel as low as possible so more of the artwork stays visible.
     User feedback: footer was still "too far above" the window bottom. */
  bottom: 4px;
  max-width: 1060px;
  margin: 0 auto;

  border-radius: 20px;
  border: 1px solid var(--ring);
  box-shadow: var(--shadow);
  /* Panel overlay should not hide the background art too much.
     User request: "Transparenz ... auf 70%" → keep readable but clearly more see-through. */
  /* Player text panel: almost transparent so the artwork stays visible.
     User request: "fast durchsichtig" */
  /* Even lighter panel so artwork stays clearly visible.
     User request: "noch nicht durchsichtig genug" → reduce opacity further. */
  background: rgba(16,16,18,0.015);
  backdrop-filter: blur(6px);

  display: flex;
  flex-direction: column;
  gap: 6px;

  /* Bottom padding should be minimal (we already clamp the action area and keep text scrollable).
     Keep safe-area support for iOS, but avoid a desktop minimum that creates visible "air". */
  padding: 12px 12px max(2px, env(safe-area-inset-bottom)) 12px;
  /* Mehr Luft für den Text (weniger Scrollen), ohne die Choices „aufzublasen“.
     Gleichzeitig bleibt alles innerhalb des Panels (overflow: hidden). */
  /* Default action budget (3+ options): keep buttons always visible,
     but avoid wasting vertical space on short nodes. */
  --vn-actions-h: clamp(128px, 17dvh, 176px);
  /* Important UX: The panel should NOT have a fixed height on large screens.
     Otherwise short nodes create a huge empty strip under the footer (as reported).
     We keep a strict max-height budget so text scrolls internally when needed. */
  max-height: min(72dvh, 680px, calc(100dvh - 90px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  height: auto;
  min-height: 0;
  overflow: hidden; /* keep UI inside panel (no protruding cards) */
  isolation: isolate;
  transition: transform 300ms cubic-bezier(.2,.8,.2,1), opacity 220ms ease;
  will-change: transform;
}

/* Collapsed panel state (all devices): slide the text/choice area down so the
   artwork can be viewed. Keep a small glass edge visible at the bottom, plus
   a dedicated restore pill, so the state never feels like the UI disappeared.
   Applied directly to .vn-panel because on desktop the wrapper has no layout
   height (the panel is absolutely positioned), which Firefox handles
   differently from Chromium when translating by %. */
.vn-panel.is-collapsed {
  transform: translateY(calc(100% - 18px));
  opacity: 0.92;
  pointer-events: none;
}

.vn-panel.is-collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 18px;
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--ring);
  border-bottom: 0;
  background: rgba(16,16,18,0.26);
  backdrop-filter: blur(10px);
  box-shadow: 0 -10px 36px rgba(0,0,0,0.28);
  z-index: 20;
}

body[data-theme="parchment-light"] .vn-panel.is-collapsed::after {
  background: rgba(242,232,212,0.56);
}

body.vn-reduce-motion .vn-panel {
  transition: none !important;
}

/* If there are only 1–2 choices (very common: "Weiter"), the fixed action area must shrink,
   otherwise you get a big unused block above/below the single button. */
.vn-panel[data-choice-count="0"],
.vn-panel[data-choice-count="1"] {
  --vn-actions-h: clamp(104px, 14dvh, 140px);
}
.vn-panel[data-choice-count="2"] {
  --vn-actions-h: clamp(116px, 15dvh, 156px);
}

/* ------------------------------------------------------------
   Ending layout
   The ending screen shows an "ending note" plus the choice cards.
   With a fixed action area this can clip the lowest choice buttons.
   Make the action area taller (only on endings) and keep the ending note compact.
------------------------------------------------------------ */
.vn-panel.is-ending {
  --vn-actions-h: clamp(210px, 28dvh, 320px);
}

.vn-panel.is-ending .vn-choices {
  gap: 6px;
}

.vn-panel.is-ending .vn-ending-note {
  padding: 8px 10px;
  border-radius: 14px;
}

.vn-panel.is-ending .vn-ending-note__title {
  font-size: 13px;
}

.vn-panel.is-ending .vn-ending-note__text {
  font-size: 12px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vn-panel.is-ending .vn-ending-note__actions {
  margin-top: 8px;
}

/* Give a tiny bit more room to the cards (reduce vertical padding) */
.vn-panel.is-ending .vn-choices__scroll {
  padding-top: 10px;
  padding-bottom: 10px;
}

body[data-theme="cinematic-dark"] .vn-panel {
  text-shadow: 0 1px 10px rgba(0,0,0,0.55);
}

body[data-theme="parchment-light"] .vn-panel {
  background: rgba(242,232,212,0.04);
  backdrop-filter: blur(4px);
}

.vn-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.vn-panel__header--no-title {
  justify-content: flex-end;
}

.vn-panel__headerActions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.vn-panel__hidebtn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--ring);
  background: rgba(16,16,18,0.22);
  color: var(--text);
  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
  cursor: pointer;
  line-height: 1;
  font-size: 19px;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}
.vn-panel__hidebtn:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.08);
}
.vn-panel__hidebtn:active { transform: translateY(1px); }
body[data-theme="cinematic-dark"] .vn-panel__hidebtn:hover { border-color: rgba(214,181,111,0.34); }
body[data-theme="parchment-light"] .vn-panel__hidebtn { background: rgba(242,232,212,0.36); }

/* Panel HUD row (mobile portrait): compact status pills + actions.
   On touch phones it gets docked ABOVE the panel (not inside), so it doesn't steal text height. */
.vn-panel__hudrow[hidden] { display: none !important; }
.vn-panel__hudrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}
.vn-panel__hudmeta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.vn-panel__hudmeta::-webkit-scrollbar { display: none; }
.vn-panel__hudactions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

/* Mobile: "bottom sheet" handle to hide the whole panel so the artwork is visible.
   Hidden by default; enabled in mobile touch media queries further below. */
.vn-panel__grab {
  display: none;
  align-self: center;
  width: 74px;
  height: 18px;
  padding: 0;
  margin: -2px 0 2px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}

.vn-panel__grabbar {
  display: block;
  width: 58px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.24);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 6px 18px rgba(0,0,0,0.22);
}

body[data-theme="parchment-light"] .vn-panel__grabbar {
  background: rgba(35,24,10,0.14);
  border-color: rgba(35,24,10,0.16);
  box-shadow: 0 8px 18px rgba(0,0,0,0.10);
}

/* "Peek" button (only shown when the panel is hidden). */
.vn-peekbtn[hidden] { display: none !important; }
.vn-peekbtn {
  position: absolute;
  left: 50%;
  /* Keep the "peek" button close to the window bottom (consistent with the lower panel). */
  bottom: calc(6px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--ring);
  background: rgba(16,16,18,0.38);
  color: var(--text);
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);
}
body[data-theme="parchment-light"] .vn-peekbtn { background: rgba(242,232,212,0.78); }
.vn-peekbtn__icon { font-size: 14px; opacity: 0.92; }
.vn-peekbtn:active { transform: translateX(-50%) translateY(1px); }

.vn-node-title {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.15;
}

.vn-ending-badge {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(67,209,158,0.12);
  border: 1px solid rgba(67,209,158,0.26);
  color: rgba(67,209,158,0.95);
}

.vn-textbox {
  /* Critical: the text box must be the flexible/scrolling area.
     Otherwise (at small window heights / browser zoom) the panel hits max-height
     and the lower UI (choices) gets clipped by .vn-panel { overflow: hidden }. */
  /* Don't "grow" on short nodes – otherwise the panel inflates to its max-height
     and you get a big empty area inside the textbox (reported on iPad + desktop). */
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-right: 2px;
  color: var(--text);
  line-height: 1.55;
  font-size: calc(17px * var(--vn-text-scale, 1));
  position: relative;
  z-index: 1;
}

.vn-story-scroll {
  display: contents;
}

/* Keep non-text parts from shrinking into the scroll area */
.vn-panel__header,
.vn-readhint,
.vn-choices,
.vn-footer {
  flex: 0 0 auto;
}

/* Endings: slightly tighter typography to help fit into one page */
.vn-textbox--ending {
  font-size: calc(16px * var(--vn-text-scale, 1));
  line-height: 1.48;
}
.vn-textbox--ending .vn-p { margin-bottom: 8px; }

.vn-textbox--measure {
  position: absolute;
  left: -9999px;
  top: -9999px;
  visibility: hidden;
  max-height: none;
}

.vn-p { margin: 0 0 10px 0; }
.vn-p:last-child { margin-bottom: 0; }

.vn-readhint {
  margin-top: 0;
  font-size: 11px;
  opacity: 0.88;
  user-select: none;
  text-align: right;
  min-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vn-readhint.is-end {
  text-align: left;
  opacity: 0.95;
}

.vn-choices {
  padding-top: 2px;
  position: relative;
  z-index: 30;

  /* Fixed action area: text should never push the buttons out of view.
     If there are many options, they stay horizontally scrollable. */
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 var(--vn-actions-h);
  min-height: var(--vn-actions-h);
  max-height: var(--vn-actions-h);
  overflow: hidden;
}

.vn-ending-note {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--ring);
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 0;
}

.vn-ending-note__title { font-weight: 650; }
.vn-ending-note__text { color: var(--muted); font-size: 13px; margin-top: 2px; }
.vn-ending-note__actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  scrollbar-width: none;
}

/*
  Choice Cards (Visual Novel)
  Ziele:
  - 3 Karten nebeneinander (Desktop), gleiche Grundgröße unabhängig von Textlänge
  - Smoothes Hover: Karte wird deutlich größer, ohne Layout-Jumps
  - Long labels: geklemmt (Ellipsis), damit Karten gleich hoch bleiben
*/
.vn-choices__list {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow: visible;
  padding: 1px 1px 1px;
  scroll-snap-type: x proximity;
}

.vn-choices__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: relative;
  z-index: 5;
  /* Make horizontal scrolling feel natural on desktop */
  cursor: grab;
  touch-action: pan-x;
  /* Responsive padding so cards stay inside the panel at any zoom/viewport size. */
  container-type: inline-size;
  /* Choice sizing variables (base, no scaling → text stays sharp) */
  --vn-choice-w: clamp(196px, calc((100cqw - 28px) / 3), 320px);
  /* Choices sollen keinen unnötig großen „Puffer“ fressen – Text soll mehr Platz bekommen.
     Trotzdem: Karten dürfen nie aus dem Panel herausragen. */
  /* Slightly smaller cards → less wasted vertical space on short nodes.
     Labels are line-clamped, so this doesn't cause overflow. */
  --vn-choice-h: clamp(78px, 9.4dvh, 104px);
  --vn-choice-pad-y: clamp(4px, 0.8dvh, 8px);
  --vn-choice-pad-x: clamp(10px, 1.2dvh, 14px);
  --vn-choice-pad-b: clamp(4px, 0.75dvh, 8px);
  --vn-choice-font: clamp(14px, 1.65cqw, 17px);
  /* Weniger vertikales Padding = mehr Textfläche; seitlich bleibt genug, damit nichts anstößt. */
  padding: clamp(4px, 0.8dvh, 8px) clamp(10px, 2.8cqw, 36px) clamp(4px, 0.8dvh, 8px);
  scroll-padding-left: clamp(12px, 2.8cqw, 36px);
  scroll-padding-right: clamp(12px, 2.8cqw, 36px);
}

.vn-choices__scroll.is-dragging { cursor: grabbing; user-select: none; }

.vn-choices__scroll::-webkit-scrollbar { height: 0; }

.vn-choices__list form {
  margin: 0;
  flex: 0 0 auto;
  width: var(--vn-choice-w, 268px);
  max-width: 78vw;
  scroll-snap-align: start;
  position: relative;
  overflow: visible;
  counter-increment: vnChoice;
}

.vn-choices__list { counter-reset: vnChoice; }

.vn-choices__list form:hover { z-index: 999; }

@media (max-width: 980px) {
  .vn-choices__list {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow: visible;
  padding: 1px 1px 1px;
  scroll-snap-type: x proximity;
}
}

@media (max-width: 680px) {
  .vn-choices__list {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow: visible;
  padding: 1px 1px 1px;
  scroll-snap-type: x proximity;
}
}

@keyframes vnChoiceIn {
  from { opacity: 0; transform: translateY(16px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.vn-choice {
  position: relative;
  width: 100%;
  height: var(--vn-choice-h, 120px);
  min-height: var(--vn-choice-h, 120px);
  max-height: var(--vn-choice-h, 120px);
  padding: var(--vn-choice-pad-y, 16px) var(--vn-choice-pad-x, 16px) var(--vn-choice-pad-b, 14px);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.14);
  background: radial-gradient(140% 140% at 10% 0%, rgba(255,255,255,0.10), rgba(255,255,255,0.02));
  box-shadow: 0 14px 28px rgba(0,0,0,0.30);
  overflow: hidden;
  transition: transform 240ms cubic-bezier(.2,.9,.2,1), border-color 240ms ease, box-shadow 240ms ease, background 240ms ease;
  transform: translateZ(0) scale(1);
  backface-visibility: hidden;
  will-change: transform;
  text-align: left;
}

/* ensure hovered card is always on top (also while inside scroller) */
.vn-choices__list form:hover .vn-choice,
.vn-choices__list form:focus-within .vn-choice {
  z-index: 60;
}

.vn-choice > * { position: relative; z-index: 2; }

/* Number badge */
.vn-choice::before {
  content: counter(vnChoice);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-weight: 750;
  font-size: 12px;
  color: rgba(255,255,255,0.88);
  background: rgba(0,0,0,0.32);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 999px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
  pointer-events: none;
}

/* Subtle glow layer (no "reflection" effect) */
.vn-choice::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  /* Inner glow (radial only) so it feels warm, not like a glossy reflection */
  background:
    radial-gradient(120% 120% at 22% 10%, rgba(214,181,111,0.18), rgba(214,181,111,0.00) 60%),
    radial-gradient(120% 120% at 90% 0%, rgba(255,255,255,0.10), rgba(255,255,255,0.00) 62%);
  opacity: 0.28;
  transition: opacity 240ms ease;
  pointer-events: none;
  z-index: 1;
}

@media (hover: hover) and (pointer: fine) {
  .vn-choice:hover::after { opacity: 0.88; }
}


@media (hover: hover) and (pointer: fine) {
  /* soften non-hovered cards when hovering the group */
  .vn-choices__list:hover .vn-choice:not(.is-locked) {
    opacity: 0.92;
    transform: translateY(0);
    filter: saturate(0.98);
  }

  .vn-choice:hover {
    transform: translate3d(0,-8px,0) !important;
    border-color: rgba(255,255,255,0.28);
    background: radial-gradient(140% 160% at 18% 0%, rgba(214,181,111,0.16), rgba(255,255,255,0.06) 46%, rgba(255,255,255,0.03) 100%);
    z-index: 10;
    box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 0 28px rgba(214,181,111,0.18), 0 0 0 1px rgba(214,181,111,0.12);
    filter: brightness(1.06) saturate(1.03);
  }

  .vn-choices__list:hover .vn-choice:hover {
    opacity: 1;
    transform: translate3d(0,-8px,0) !important;
    filter: brightness(1.06) saturate(1.03);
  }


  .vn-choices__list form:hover .vn-choice:not(.is-locked),
  .vn-choices__list form:focus-within .vn-choice:not(.is-locked) {
    transform: translate3d(0,-8px,0) !important;
  }
}

body[data-theme="cinematic-dark"] .vn-choice:hover { border-color: rgba(214,181,111,0.30); }

/* Keyboard focus */
.vn-choice:focus-visible {
  outline: 2px solid rgba(214,181,111,0.55);
  outline-offset: 3px;
}

.vn-choice.is-locked, .vn-choice:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: 0 10px 26px rgba(0,0,0,0.18);
}

.vn-choice:active {
  transform: translateY(-2px);
}

/* Reduce motion: keep choices visible (no intro animation) */
body.vn-reduce-motion .vn-choice {
  opacity: 1 !important;
  animation: none !important;
  transform: translateY(0) scale(1);
  transition: none !important;
}

.vn-choice.is-loading {
  opacity: 0.72;
}

.vn-choice.is-loading::after {
  content: '…';
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-weight: 700;
  opacity: 0.85;
}

.vn-choice__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-left: 32px; /* space for number badge */
}

.vn-choice__label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--vn-choice-font, 16px);
  line-height: 1.18;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.vn-choice__seen {
  display: inline-flex;
  margin-left: 8px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--ring);
  color: var(--muted);
}

.vn-choice__arrow { color: var(--muted); flex: 0 0 auto; margin-top: 2px; }

.vn-choice__locked {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255,90,115,0.92);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.vn-footer {
  /* Keep the copyright/version strip as tiny as possible (more space for text + choices). */
  /* Panel uses flex-gap; compress the footer row as much as possible. */
  margin-top: -6px;
  padding: 0;
  font-size: 9px;
  line-height: 1;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vn-iconbtn--warn {
  border-color: rgba(255,90,115,0.40) !important;
  background: rgba(255,90,115,0.10);
}

/* ------------------------------------------------------------
   Mobile layout fixes
   - Portrait: show full landscape artwork (contain) with blurred fill
   - Landscape: move panel to the side for readable text
   Targets: touch devices (hover:none + coarse pointer)
------------------------------------------------------------ */

@media (max-width: 900px) and (orientation: portrait) {
  /* Show the whole artwork (no heavy crop). */
  .vn-bg-blur { display: block; }
  .vn-bg {
    inset: 0;
    transform: none;
    background-size: contain;
    background-repeat: no-repeat;
    /* Anchor the contain-image to the top so the scene isn't hidden by the bottom text panel. */
    background-position: top center;
    /* Keep it crisp; blur is handled by .vn-bg-blur behind. */
    filter: saturate(1.05) contrast(1.03);
  }

  .vn-bg-blur {
    background-position: top center;
  }

  /* When the text panel is hidden, prioritize a clean full-artwork view over
     the decorative blurred fill. */
  .vn-stage.is-panel-collapsed .vn-bg {
    background-position: center center;
  }
  .vn-stage.is-panel-collapsed .vn-bg-blur {
    opacity: 0.16;
  }
  .vn-stage.is-panel-collapsed .vn-scrim {
    background: linear-gradient(to top, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0.012) 58%, rgba(0,0,0,0.002) 100%);
  }

  /* Scrim much lighter so the picture reads through the (very transparent) panel. */
  .vn-scrim {
    background:
      radial-gradient(900px 560px at 50% 18%, rgba(0,0,0,0.02), rgba(0,0,0,0.12)),
      linear-gradient(to top, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0.018) 65%, rgba(0,0,0,0.004) 100%);
  }
  body[data-theme="parchment-light"] .vn-scrim {
    background:
      radial-gradient(900px 560px at 50% 18%, rgba(242,232,212,0.06), rgba(35,24,10,0.045)),
      linear-gradient(to top, rgba(35,24,10,0.06) 0%, rgba(35,24,10,0.018) 70%, rgba(35,24,10,0.006) 100%);
  }

  /* Give the text a little more room on tall phones without hiding the image too much. */
  .vn-panel {
    max-height: min(64dvh, 640px);
  }

  .vn-panel__grab { display: inline-flex; }
}

@media (max-width: 900px) and (orientation: landscape) and (hover: none) and (pointer: coarse) {
  /* Landscape phones:
     - Text panel is large and centered (single column)
     - Choices are centered at the bottom
     - Panel can be slid down (hidden) to inspect the artwork
  */
  .vn-bg-blur { display: none; }

  .vn-panel__grab { display: inline-flex; }

  .vn-panel {
    left: 10px;
    right: 10px;
    top: calc(54px + env(safe-area-inset-top));
    bottom: calc(4px + env(safe-area-inset-bottom));
    width: auto;
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
    max-height: none; /* use top/bottom insets */
    height: auto;
    border-radius: 18px;
    /* Maximise text area: less padding + smaller inter-section gaps. */
    padding: 6px 8px 6px;

    /* Back to single-column layout (readable). */
    display: flex;
    flex-direction: column;
    gap: 6px;

    /* Slide-down hide animation (used by JS). */
    transition: transform 280ms cubic-bezier(.2,.8,.2,1), opacity 220ms ease;
    will-change: transform;
  }

  .vn-panel.is-collapsed {
    transform: translateY(calc(100% - 18px));
    opacity: 0.92;
    pointer-events: none;
  }

  /* Center the choices strip at the bottom.
     If it overflows, it stays scrollable. */
  .vn-choices { padding-top: 2px; }
  .vn-choices__scroll {
    --vn-choice-w: clamp(210px, calc((100cqw - 44px) / 3), 310px);
    /* Reduce vertical footprint of choices to give text more height. */
    --vn-choice-h: clamp(62px, 14dvh, 90px);
    padding: 4px 6px 6px;
    scroll-padding-left: 6px;
    scroll-padding-right: 6px;
  }
  .vn-choices__list { gap: 8px; }

  .vn-node-title { font-size: 16px; }
  .vn-choices__list { justify-content: center; }

  .vn-hud {
    padding-left: 10px;
    padding-right: 10px;
  }

  /* Keep HUD compact (avoid 2-line wrap) without losing stats: make pills horizontally scrollable. */
  .vn-hud__meta {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 6px;
  }
  .vn-hud__meta::-webkit-scrollbar { display: none; }
  .vn-hud__meta .vn-pill { font-size: 11px; padding: 3px 8px; }
}

@media (max-width: 640px) and (orientation: portrait) {
  .vn-panel {
    left: 10px;
    right: 10px;
    bottom: 4px;
    max-height: min(72dvh, 620px);
    height: auto;
    min-height: 0;
    border-radius: 18px;
    /* Mobile reading mode: keep the panel/background stable and scroll only
       the actual text field when a node contains a long passage. */
    overflow-y: hidden;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .vn-textbox {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    max-height: none !important;
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 18px;
    scroll-padding-bottom: 18px;
  }

  .vn-choices {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
  }

  .vn-hud { padding: 12px 10px; }
  .vn-hud__meta { gap: 5px; }
  .vn-iconbtn { width: 38px; height: 38px; border-radius: 13px; }

  /* Slightly tighter choices on small portrait screens (also helps desktop narrow windows). */
  .vn-choices { padding-top: 4px; }
  .vn-choices__scroll {
    /* less "air" around the strip, but keep enough to avoid edge clipping */
    padding: 6px 10px 8px;
    scroll-padding-left: 10px;
    scroll-padding-right: 10px;
  }
  .vn-choices__list { gap: 10px; }
}

/* Portrait phones (touch): move status + settings controls off the top artwork and into the panel. */
@media (max-width: 640px) and (orientation: portrait) {
  .vn-hud { display: none; }

  /* Dock the compact HUD row ABOVE the panel, tightly stacked.
     This keeps the artwork area free while NOT stealing vertical space inside the text panel. */
  .vn-panelstack {
    position: absolute;
    z-index: 3;
    left: 10px;
    right: 10px;
    top: calc(8px + env(safe-area-inset-top));
    bottom: calc(4px + env(safe-area-inset-bottom));
    max-width: 1060px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: transform 300ms cubic-bezier(.2,.8,.2,1), opacity 220ms ease;
    will-change: transform;
  }

  /* In portrait, the compact status/settings strip is docked above the panel.
     When the text panel is hidden, move the whole stack so the status strip
     follows it downward instead of staying behind as a floating bar. */
  .vn-panelstack.is-collapsed {
    transform: translateY(calc(100% - 18px));
    opacity: 0.92;
    pointer-events: none;
  }

  .vn-panel {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    max-width: none;
    margin: 0;
    flex: 1 1 auto;
    height: auto;
    max-height: none;
    min-height: 0;
  }

  .vn-panelstack.is-collapsed .vn-panel.is-collapsed {
    transform: none;
  }

  /* Make the docked strip small and readable, sitting just above the panel (outside). */
  #vnPanelHudRow {
    padding: 4px 6px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(16,16,18,0.16);
    backdrop-filter: blur(10px);
    gap: 4px;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  body[data-theme="parchment-light"] #vnPanelHudRow {
    border-color: rgba(35,24,10,0.14);
    background: rgba(242,232,212,0.52);
    backdrop-filter: blur(8px);
  }

  /* Keep the docked HUD compact so the text box stays tall. */
  #vnPanelHudMeta {
    flex: 1 1 auto;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
  }
  #vnPanelHudMeta .vn-pill {
    font-size: 10px;
    padding: 2px 4px;
    gap: 3px;
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    white-space: nowrap;
  }
  #vnPanelHudMeta .vn-pill__label { display: none; }
  #vnPanelHudMeta .vn-pill__short { display: inline; }
  #vnPanelHudMeta .vn-trend { display: none; }

  .vn-panel__hudactions,
  .vn-panel__hudactions .vn-hud__right {
    gap: 4px;
  }

  .vn-panel__hudactions .vn-iconbtn {
    width: 30px;
    height: 30px;
    border-radius: 11px;
  }
  .vn-panel__hudactions .vn-iconbtn:hover { transform: none; }

  /* Even tighter choices spacing on phones. */
  .vn-choices { padding-top: 2px; }
  .vn-choices__scroll {
    padding: 4px 6px 6px;
    scroll-padding-left: 6px;
    scroll-padding-right: 6px;
  }
  .vn-choices__list { gap: 8px; }
}

/* Mobile portrait reading layout (v1.1.42)
   Final model requested by Nico:
   - no text paging / no left-right tap zones
   - one continuous text block inside #vnTextBox
   - only #vnTextBox scrolls vertically
   - choices stay below the textbox and scroll horizontally when needed */
@media (max-width: 640px) and (orientation: portrait) {
  .vn-stage {
    background: #050505;
  }

  .vn-bg-blur,
  .vn-bg,
  .vn-scrim {
    inset: 0;
    height: auto;
  }

  .vn-bg-blur {
    display: block;
    background-size: cover;
    background-position: top center;
    opacity: 0.70;
    transform: scale(1.08);
  }

  .vn-bg {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: top center;
    background-color: transparent;
    filter: saturate(1.04) contrast(1.03);
  }

  .vn-scrim {
    background:
      radial-gradient(900px 560px at 50% 18%, rgba(0,0,0,0.02), rgba(0,0,0,0.12)),
      linear-gradient(to top, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0.018) 65%, rgba(0,0,0,0.004) 100%);
  }

  .vn-stage.is-panel-collapsed .vn-bg,
  .vn-stage.is-panel-collapsed .vn-bg-blur {
    background-position: center top;
  }

  .vn-panelstack {
    top: auto;
    bottom: calc(4px + env(safe-area-inset-bottom));
    gap: 4px;
  }

  #vnPanelHudRow {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    background: rgba(16,16,18,0.16);
    border-color: rgba(255,255,255,0.12);
    box-shadow: none;
  }
  body[data-theme="parchment-light"] #vnPanelHudRow {
    background: rgba(242,232,212,0.52);
  }

  .vn-panel {
    flex: 0 0 auto;
    height: min(62dvh, 620px);
    max-height: min(62dvh, 620px);
    min-height: 0;
    padding: 12px 12px max(2px, env(safe-area-inset-bottom)) 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden !important;
    overflow-x: hidden !important;
    touch-action: auto;
    border-radius: 18px;
    background: rgba(16,16,18,0.015);
    backdrop-filter: blur(6px);
  }
  body[data-theme="parchment-light"] .vn-panel {
    background: rgba(242,232,212,0.04);
  }

  .vn-panel__grab {
    display: inline-flex !important;
  }
  .vn-peekbtn {
    display: inline-flex;
  }

  .vn-story-scroll {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden !important;
    gap: 6px;
  }

  .vn-panel__header,
  .vn-readhint,
  .vn-choices,
  .vn-footer {
    flex: 0 0 auto;
  }

  .vn-node-title {
    font-size: 16px;
    line-height: 1.2;
  }

  .vn-textbox {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 0 4px 12px 0;
    scroll-padding-bottom: 12px;
    line-height: 1.54;
  }

  .vn-readhint {
    display: block;
    min-height: 14px;
    text-align: right;
  }

  .vn-choices {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: none;
    height: auto;
    overflow: visible;
    padding-top: 2px;
    gap: 6px;
  }

  .vn-choices__scroll {
    flex: 0 0 auto;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
    touch-action: pan-x;
    padding: 4px 6px 6px;
    scroll-padding-left: 6px;
    scroll-padding-right: 6px;
    --vn-choice-w: clamp(210px, 72vw, 310px);
    --vn-choice-h: clamp(62px, 14dvh, 90px);
  }

  .vn-choices__list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow: visible;
    padding: 1px 6px 1px 1px;
    scroll-snap-type: x proximity;
  }

  .vn-choices__list form {
    flex: 0 0 auto;
    width: var(--vn-choice-w, 268px);
    max-width: 82vw;
    scroll-snap-align: start;
  }

  .vn-choice {
    width: 100%;
    height: var(--vn-choice-h, 90px);
    min-height: var(--vn-choice-h, 90px);
    max-height: var(--vn-choice-h, 90px);
    padding: 8px 12px 8px;
    text-align: left;
  }

  .vn-choice__label {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
  }

  .vn-ending-note {
    padding: 10px;
  }

  .vn-ending-note__text {
    white-space: normal;
  }

  .vn-ending-note__actions {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
  }

  .vn-ending-note__actions .vn-btn,
  .vn-ending-note__actions form,
  .vn-ending-note__actions form .vn-btn,
  .vn-ending-note__actions form button {
    width: auto;
    white-space: nowrap;
  }

  .vn-footer {
    display: block;
  }
}


@media (min-width: 900px) {
  .vn-textbox { font-size: calc(18px * var(--vn-text-scale, 1)); }
}


/* Settings Modal */
.vn-modal[hidden] { display: none !important; }
.vn-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
}
.vn-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(2px);
}
.vn-modal__panel {
  position: relative;
  width: min(560px, calc(100% - 24px));
  border-radius: 20px;
  border: 1px solid var(--ring);
  box-shadow: 0 22px 70px rgba(0,0,0,0.55);
  background: rgba(16,16,18,0.78);
  backdrop-filter: blur(12px);
  padding: 16px 16px 14px 16px;
  color: var(--text);
}
body[data-theme="parchment-light"] .vn-modal__panel {
  background: rgba(242,232,212,0.90);
}
.vn-modal__title {
  font-weight: 750;
  font-size: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.vn-modal__close {
  border-radius: 12px;
  border: 1px solid var(--ring);
  background: rgba(255,255,255,0.06);
  padding: 8px 10px;
  color: var(--text);
}
.vn-setting {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  margin-bottom: 10px;
}
.vn-setting__label {
  font-weight: 650;
}
.vn-setting__sub {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  margin-top: -6px;
}
.vn-range { width: 220px; }
.vn-select {
  width: 240px;
  border-radius: 12px;
  border: 1px solid var(--ring);
  /* iOS/Safari sometimes ignores custom select backgrounds -> keep text DARK for readability */
  background: rgba(255,255,255,0.92);
  color: #111;
  padding: 10px 10px;
}
.vn-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(214,181,111,0.28);
}
.vn-select option {
  color: #111;
  background: #fff;
}
.vn-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.vn-toggle input { transform: scale(1.2); }
.vn-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.vn-btn {
  border-radius: 14px;
  border: 1px solid var(--ring);
  background: rgba(255,255,255,0.06);
  padding: 10px 12px;
  color: var(--text);
}
.vn-btn--primary {
  background: rgba(214,181,111,0.12);
  border-color: rgba(214,181,111,0.32);
}

/* Reduce motion */
body.vn-reduce-motion * {
  transition: none !important;
  animation: none !important;
}

/* Achievements */
.vn-ach-list {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow: auto;
  padding-right: 6px;
}

.vn-ach {
  border-radius: 16px;
  border: 1px solid var(--ring);
  padding: 10px 10px;
  background: rgba(255,255,255,0.05);
}

.vn-ach.is-locked { opacity: 0.72; }
.vn-ach.is-unlocked { border-color: rgba(214,181,111,0.42); background: rgba(214,181,111,0.10); }

.vn-ach__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.vn-ach__name { font-weight: 700; font-size: 14px; }
.vn-ach__badge {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ring);
  background: rgba(255,255,255,0.06);
}
.vn-ach.is-unlocked .vn-ach__badge { border-color: rgba(214,181,111,0.55); background: rgba(214,181,111,0.20); color: rgba(16,16,18,0.95); }

.vn-ach__desc { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.35; }

/* Summit */
.vn-summit {
  display: grid;
  gap: 12px;
}

.vn-summit__stack {
  display: grid;
  gap: 10px;
}

.vn-summit__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 520px) {
  .vn-summit__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.vn-summit__card {
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  padding: 12px 12px;
}

.vn-summit__card--full { width: 100%; }

body[data-theme="cinematic-dark"] .vn-summit__card {
  border-color: rgba(214,181,111,0.18);
  background: rgba(214,181,111,0.06);
}

.vn-summit__kicker {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.vn-summit__headline {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.vn-summit__muted { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.35; }

.vn-summit__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.vn-stat {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 14px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.18);
  min-width: 0;
}

body[data-theme="parchment-light"] .vn-stat { background: rgba(35,24,10,0.05); }

.vn-stat span {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.70);
}
.vn-stat strong {
  font-size: clamp(20px, 3.4vw, 28px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  color: rgba(255,255,255,0.95);
}

/* Home progress modal */
.vn-modal__panel--wide {
  width: min(820px, calc(100% - 28px));
}

.home-prog {
  display: grid;
  gap: 12px;
}

.home-prog__summary {
  color: var(--muted);
  font-size: 13px;
}

.home-prog__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 760px) {
  .home-prog__grid { grid-template-columns: 1fr 1fr; }
}

.home-prog__card {
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  padding: 12px 12px;
}
body[data-theme="cinematic-dark"] .home-prog__card {
  border-color: rgba(214,181,111,0.18);
  background: rgba(214,181,111,0.06);
}

.home-prog__kicker {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.home-prog__list {
  display: grid;
  gap: 10px;
}

.home-prog__item {
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  padding: 10px 10px;
}
body[data-theme="parchment-light"] .home-prog__item { background: rgba(35,24,10,0.05); }

.home-prog__name {
  font-weight: 750;
  font-size: 13px;
  line-height: 1.25;
}

.home-prog__desc {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.home-prog__meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.vn-summit__sectionTitle {
  font-weight: 750;
  font-size: 13px;
  margin: 6px 0 4px 0;
}

/* Achievement popup (non-blocking, works in fullscreen) */
.vn-ach-pop {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 74px);
  transform: translateX(-50%);
  z-index: 120;
  width: min(560px, calc(100% - 44px));
  pointer-events: none;
}

/* IMPORTANT: author CSS sets display, so we must re-enable the native [hidden] behavior */
.vn-ach-pop[hidden] { display: none !important; }

.vn-ach-pop__card {
  pointer-events: auto;

  position: relative;
  width: 100%;
  border-radius: 22px;
  border: 1px solid rgba(214,181,111,0.48);
  background: linear-gradient(135deg, rgba(214,181,111,0.26), rgba(16,16,18,0.86) 55%, rgba(16,16,18,0.82));
  overflow: hidden;
  isolation: isolate;
  backdrop-filter: blur(12px);
  /* Non-blocking “dim” via huge box-shadow (shadow doesn't capture pointer events). */
  box-shadow:
    0 0 0 9999px rgba(0,0,0,0.24),
    0 30px 100px rgba(0,0,0,0.60),
    0 0 60px rgba(214,181,111,0.16);
  padding: 18px 18px 16px;
  transform: translateY(14px) scale(0.96);
  opacity: 0;
  will-change: transform, opacity;
  transition: none;
}

.vn-ach-pop__card::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background:
    radial-gradient(520px 260px at 25% 15%, rgba(255,240,200,0.24), rgba(255,240,200,0.00) 60%),
    radial-gradient(520px 300px at 80% 35%, rgba(214,181,111,0.18), rgba(214,181,111,0.00) 60%),
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.00));
  opacity: 0.95;
  pointer-events: none;
  z-index: 0;
}

.vn-ach-pop__card > * { position: relative; z-index: 1; }

.vn-ach-pop__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.18);
  color: rgba(255,255,255,0.88);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.vn-ach-pop__close:hover { background: rgba(0,0,0,0.28); }
.vn-ach-pop__close:active { transform: scale(0.98); }

.vn-ach-pop__kicker {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
  color: rgba(214,181,111,0.92);
}

.vn-ach-pop__name {
  margin-top: 6px;
  font-weight: 820;
  font-size: 20px;
  line-height: 1.15;
}

.vn-ach-pop__desc {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.vn-ach-pop__hint {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  text-align: right;
}

@keyframes vnAchPopIn {
  0% { opacity: 0; transform: translateY(14px) scale(0.96); }
  55% { opacity: 1; transform: translateY(0) scale(1.015); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes vnAchPopOut {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(8px) scale(0.985); }
}

@keyframes vnAchPopGlow {
  0% { opacity: 0.55; }
  45% { opacity: 1; }
  100% { opacity: 0.95; }
}

.vn-ach-pop.is-in .vn-ach-pop__card {
  animation: vnAchPopIn 560ms cubic-bezier(.18,.92,.26,1) both;
}

.vn-ach-pop.is-in .vn-ach-pop__card::before {
  animation: vnAchPopGlow 980ms ease-out both;
}

.vn-ach-pop.is-out .vn-ach-pop__card {
  animation: vnAchPopOut 260ms ease-in both;
}

/* Reduce motion: no pop/glow animations */
body.vn-reduce-motion .vn-ach-pop__card,
body.vn-reduce-motion .vn-ach-pop__card::before {
  animation: none !important;
}

/* Reduce motion: without animations we must still show the card. */
body.vn-reduce-motion .vn-ach-pop.is-in .vn-ach-pop__card {
  opacity: 1 !important;
  transform: none !important;
}
body.vn-reduce-motion .vn-ach-pop.is-out .vn-ach-pop__card {
  opacity: 0 !important;
  transform: translateY(8px) scale(0.985) !important;
}



/* Fullscreen hint (mobile nudge) */
.vn-fs-hint {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 115;
  pointer-events: none;
}

.vn-fs-hint__bubble {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 10px;
  max-width: 290px;
  border-radius: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(214,181,111,0.32);
  background: rgba(16,16,18,0.72);
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45), 0 0 30px rgba(214,181,111,0.12);
  transform: translateY(-6px) scale(0.98);
  opacity: 0;
  will-change: transform, opacity;
}

.vn-fs-hint__title {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
  color: rgba(214,181,111,0.92);
}

.vn-fs-hint__text {
  grid-column: 1 / 2;
  font-size: 13px;
  line-height: 1.25;
  color: rgba(255,255,255,0.92);
}

.vn-fs-hint__close {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  align-self: start;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.88);
}

.vn-fs-hint__close:hover { border-color: rgba(214,181,111,0.30); }

@keyframes vnFsHintIn {
  0% { opacity: 0; transform: translateY(-10px) scale(0.98); }
  60% { opacity: 1; transform: translateY(0) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes vnFsHintOut {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-6px) scale(0.99); }
}

.vn-fs-hint.is-in .vn-fs-hint__bubble { animation: vnFsHintIn 420ms cubic-bezier(.18,.92,.26,1) both; }
.vn-fs-hint.is-out .vn-fs-hint__bubble { animation: vnFsHintOut 220ms ease-in both; }

body.vn-reduce-motion .vn-fs-hint__bubble { animation: none !important; transform: none !important; opacity: 1; }

body[data-theme="parchment-light"] .vn-fs-hint__bubble {
  background: rgba(255,255,255,0.86);
  border-color: rgba(214,181,111,0.34);
  color: rgba(18,14,9,0.95);
}
body[data-theme="parchment-light"] .vn-fs-hint__text { color: rgba(18,14,9,0.86); }
body[data-theme="parchment-light"] .vn-fs-hint__close {
  border-color: rgba(35,24,10,0.18);
  background: rgba(35,24,10,0.06);
  color: rgba(18,14,9,0.86);
}
/* Toasts */
.vn-toasts {
  /* Toasts are used for small UX notices (e.g. chapter replay resets) and error feedback.
     Achievements use the center popup (no duplicate toasts). */
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 70px);
  transform: translateX(-50%);
  z-index: 90;
  display: grid;
  gap: 10px;
  width: min(520px, calc(100% - 28px));
  pointer-events: none;
}

.vn-toast {
  pointer-events: auto;
  text-align: center;
  font-size: 13px;

  border-radius: 16px;
  border: 1px solid rgba(214,181,111,0.40);
  background: rgba(16,16,18,0.78);
  backdrop-filter: blur(10px);
  padding: 12px 12px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.45);
  transform: translateY(0);
  opacity: 1;
  transition: transform 240ms ease, opacity 240ms ease;
}

.vn-toast.is-out { opacity: 0; transform: translateY(12px); }

/* Horizontal choice strip: hide scrollbar (still scrollable) */
.vn-choices__scroll::-webkit-scrollbar { height: 0; }

/* Hover tooltips removed (they looked like "reflections" above the cards) */
.vn-choice__tooltip { display: none !important; }

/* In-place player overlay (iframe) to preserve BGM across navigation */
.adv-player-overlay{
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(8px);
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 14px;
}
.adv-player-overlay__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(20,20,22,.55);
}
.adv-player-overlay__frame{
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 18px;
  margin-top: 12px;
  background: #0b0b0c;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
}


/* Ensure HTML [hidden] works even when overlay has display set */
.adv-player-overlay[hidden]{display:none !important;}

/* ------------------------------------------------------------
   Admin – Story Text Editor (Polish)
   (v0.3.61)
------------------------------------------------------------ */

.adv-adminbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 12px;
  margin: -6px 0 16px;
  border-radius: 18px;
  border: 1px solid var(--ring);
  background: rgba(0,0,0,0.28);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
}

.adv-adminbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.adv-adminbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.adv-adminbar__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.adv-adminbar__title {
  font-weight: 800;
  letter-spacing: -0.01em;
}

.adv-adminbar__sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adv-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--ring);
  background: rgba(255,255,255,0.05);
  font-size: 12px;
  font-weight: 700;
}

.adv-badge--warn {
  border-color: rgba(255, 207, 126, 0.45);
  background: rgba(255, 207, 126, 0.12);
  color: rgba(255,255,255,0.92);
}

body[data-theme="cinematic-dark"] .adv-badge--warn {
  border-color: rgba(214,181,111,0.55);
  background: rgba(214,181,111,0.12);
}

.adv-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.18);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  font-weight: 700;
}

.adv-editor-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 900px) {
  .adv-editor-tools {
    grid-template-columns: 260px 1fr 260px;
    align-items: start;
  }
}

.adv-editor-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 1024px) {
  .adv-editor-grid {
    grid-template-columns: 320px 1fr;
    align-items: start;
  }
}

.adv-editor-nav {
  max-height: calc(100vh - 180px);
  overflow: auto;
}

@media (min-width: 1024px) {
  .adv-editor-nav {
    position: sticky;
    top: 92px;
  }
}

.adv-editor-nav__title { margin-bottom: 10px; }

.adv-editor-nav__list {
  display: grid;
  gap: 8px;
}

.adv-node-link {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.10);
  text-decoration: none;
  color: var(--text);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.adv-node-link:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
}

body[data-theme="cinematic-dark"] .adv-node-link:hover {
  border-color: rgba(214,181,111,0.22);
}

.adv-node-link__key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  font-weight: 800;
  opacity: 0.92;
}

.adv-node-link__title {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adv-node-block {
  scroll-margin-top: 110px;
}

.adv-dirtybar {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 60;
  pointer-events: none;
}

.adv-dirtybar__inner {
  pointer-events: auto;
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--ring);
  background: rgba(0,0,0,0.34);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  box-shadow: 0 24px 70px rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.adv-dirtybar__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.adv-dirtybar__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.vn-ending-note__actions::-webkit-scrollbar {
  display: none;
}
.vn-ending-note__actions > * {
  flex: 0 0 auto;
  white-space: nowrap;
}
