:root {
  --bg: #020617;
  --bg-elevated: rgba(15, 23, 42, 0.97);
  --bg-panel: rgba(15, 23, 42, 0.92);
  --text: #f9fafb;
  --text-muted: #cbd5e1;
  --border-subtle: rgba(148, 163, 184, 0.28);
  --radius-xl: 24px;
  --radius-l: 18px;
  --radius-pill: 999px;
  --max-width: 1280px;
  --shadow-soft: 0 22px 70px rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { scroll-behavior: smooth; }
body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(1200px 800px at 12% 0%, rgba(56,189,248,0.20) 0%, transparent 60%), radial-gradient(900px 700px at 88% 10%, rgba(99,102,241,0.18) 0%, transparent 58%), radial-gradient(1000px 700px at 50% 115%, rgba(34,211,238,0.14) 0%, transparent 60%), linear-gradient(180deg, #050b1d 0%, #020617 55%, #000 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  color: var(--text);
  transition: background .35s ease, color .35s ease;
}

.bg-gradient-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #f97316, #facc15, #22c55e, #22d3ee, #6366f1, #a855f7);
  opacity: 1;
  z-index: 60;
}

.story-header {
  position: sticky;
  top: 0;
  z-index: 50;
  overflow: visible;
  backdrop-filter: blur(22px);
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.60));
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.story-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 18px 20px;
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  overflow: visible;
}

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

.story-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 20%, #e0f2fe 0, #38bdf8 34%, #0369a1 72%, #020617 100%);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.7);
  font-size: 1.1rem;
}

.story-brand-text {
  min-width: 0;
}

.story-brand-title {
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 0.84rem;
  text-transform: uppercase;
}

.story-brand-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-controls {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  overflow: visible;
}

.story-left-actions,
.story-right-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.story-right-actions {
  justify-content: flex-end;
  margin-left: 0;
  justify-self: end;
}

.back-btn,
.theme-toggle {
  min-height: 46px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.75);
  background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.20), rgba(15, 23, 42, 0.96));
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.8);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}

.back-btn {
  padding: 0 16px;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.theme-toggle {
  width: 56px;
  min-height: 56px;
  padding: 0;
  cursor: pointer;
  font-size: 1.45rem;
}

.back-btn:hover,
.theme-toggle:hover,
.nav-language-globe:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 52px rgba(15, 23, 42, 1);
  border-color: rgba(248, 250, 252, 0.95);
}

.nav-language-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.nav-language-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  pointer-events: none;
}

.nav-language-globe {
  width: 76px;
  height: 76px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.9);
  background: radial-gradient(circle at 30% 0, #38bdf8, #0f172a 65%, #020617 100%);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.98), 0 0 30px rgba(56, 189, 248, 0.55);
  position: relative;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, filter .2s ease;
}

.nav-language-globe::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: inherit;
  border: 1px solid rgba(248, 250, 251, 0.18);
  pointer-events: none;
}

.nav-language-icon {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, #e0f2fe 0, #38bdf8 34%, #0369a1 72%, #020617 100%);
  box-shadow: inset 0 3px 6px rgba(248, 250, 251, 0.4), 0 0 14px rgba(56, 189, 248, 0.8);
  overflow: hidden;
}

.nav-language-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 26% 40%, rgba(21, 128, 61, 0.9) 0, transparent 30%),
    radial-gradient(circle at 50% 65%, rgba(34, 197, 94, 0.95) 0, transparent 28%),
    radial-gradient(circle at 70% 30%, rgba(22, 163, 74, 0.9) 0, transparent 24%);
  mix-blend-mode: screen;
  opacity: 0.95;
}

.nav-language-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  padding: 26px 24px;
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.97), rgba(2, 6, 23, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.75);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.98), 0 0 24px rgba(56, 189, 248, 0.35);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  min-width: 380px;
  min-height: 480px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.985);
  transition: opacity .18s ease-out, transform .18s ease-out;
  z-index: 85;
}

.nav-language-option {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  background: transparent;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(249, 250, 251, 0.96);
  white-space: normal;
  cursor: pointer;
  user-select: none;
  transition: background .15s ease, transform .15s ease, color .15s ease;
}

.nav-language-option::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(120deg, #22d3ee, #6366f1, #a855f7);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.55);
  flex: 0 0 auto;
}

.nav-language-option-label {
  min-width: 0;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.nav-language-option:hover {
  background: rgba(56, 189, 248, 0.18);
  transform: translateY(-1px);
}

.nav-language-option.is-active {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.22), rgba(99, 102, 241, 0.18));
}

.nav-language-option.is-active::after,
.nav-language-option[data-implemented="1"]::after {
  content: "✓";
  margin-left: 0;
  justify-self: end;
  font-size: 0.95rem;
  color: #22c55e;
  opacity: 0.95;
}

.nav-language-option:disabled,
.nav-language-option[aria-disabled="true"],
.nav-language-option[data-implemented="0"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.nav-language-wrap.is-open .nav-language-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.nav-language-wrap:not(.is-open):hover .nav-language-menu,
.nav-language-wrap:not(.is-open):focus-within .nav-language-menu {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.985);
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 34px 18px 50px;
}

.story-intro {
  display: grid;
  gap: 8px;
  justify-items: start;
  align-items: start;
  text-align: left;
}

.story-intro-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.story-intro-title {
  margin: 0;
  font-size: clamp(1.7rem, 3.2vw, 2.65rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.story-intro-copy {
  max-width: 62ch;
  margin: 0;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.section {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  padding: 34px 28px 34px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 26px;
}

.panel {
  margin-top: 0;
  padding: 30px 22px 30px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(148,163,184,0.45);
  background: radial-gradient(circle at 0 0, rgba(56,189,248,0.24), rgba(15,23,42,0.98));
}

#registered-only,
#story-consent {
  max-width: 72ch;
  margin: 0 auto 18px;
  padding: 18px;
  border: 1px solid rgba(148,163,184,.45);
  border-radius: 14px;
  background: rgba(15,23,42,0.85);
}

#story-consent { margin-bottom: 32px; }

#registered-only {
  background: linear-gradient(135deg, rgba(8,15,32,0.92), rgba(15,23,42,0.88));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

#registered-only strong,
#story-consent strong,
#aes-access strong {
  display: block;
  margin-bottom: 8px;
}

.registered-only-note,
.aes-access-note,
.aes-access-meta,
.aes-security-note {
  color: var(--text-muted);
  line-height: 1.65;
}

.aes-access-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  margin-bottom: 16px;
  border-radius: 999px;
  border: 1px solid rgba(96,165,250,0.38);
  background: linear-gradient(135deg, rgba(15,23,42,0.94), rgba(30,41,59,0.96));
  color: rgba(224,242,254,0.98);
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: normal;
  text-transform: none;
  box-shadow: 0 12px 32px rgba(2,6,23,0.36);
}

.aes-access-kicker::before {
  content: none;
  display: none;
}

.aes-security-note {
  margin: 14px 0 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(56,189,248,0.24);
  background: linear-gradient(135deg, rgba(12,22,43,0.94), rgba(9,18,34,0.86));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}


#aes-access .aes-security-copy {
  margin: 8px 0 18px;
  color: var(--text-muted);
  line-height: 1.7;
}

.aes-tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
}

.aes-tech-tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.28);
  background: rgba(15,23,42,0.72);
  color: rgba(226,232,240,0.95);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#story-consent label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  margin-top: 12px;
  line-height: 1.45;
}

#story-consent input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 2px solid rgba(148,163,184,.9);
  display: inline-grid;
  place-content: center;
  margin-top: 2px;
  flex: 0 0 auto;
  background: rgba(15,23,42,0.25);
  box-shadow: 0 0 0 4px rgba(34,211,238,0.10), 0 0 18px rgba(56,189,248,0.18);
}

#story-consent input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform .12s ease;
  background: conic-gradient(#ff004c,#ff8a00,#ffe600,#00d26a,#00c2ff,#7a5cff,#ff00c8,#ff004c);
  border-radius: 3px;
}

#story-consent input[type="checkbox"]:checked::before { transform: scale(1); }

#privateGate {
  display: block;
  margin-top: 8px;
  padding-bottom: 34px;
}

#privateGate[hidden] {
  display: none !important;
}

#aes-access {
  max-width: 92ch;
  margin: 0 auto 18px;
  padding: 18px;
  border: 1px solid rgba(148,163,184,.38);
  border-radius: 14px;
  background: rgba(8,15,32,0.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.aes-access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.aes-password-input {
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.42);
  background: rgba(15,23,42,0.9);
  color: var(--text);
  font: inherit;
  outline: none;
}

.aes-password-input::placeholder { color: rgba(203,213,225,0.72); }
.aes-password-input:focus {
  border-color: rgba(56,189,248,0.7);
  box-shadow: 0 0 0 4px rgba(34,211,238,0.12);
}

.aes-password-input:disabled,
.aes-password-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.aes-password-input.is-invalid {
  border-color: rgba(239,68,68,0.98);
  box-shadow: 0 0 0 4px rgba(239,68,68,0.16);
}

.story-consent-copy{ margin-top:10px; line-height:1.8; color:var(--text-muted); }

.aes-keyfile-wrap {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
}

.aes-keyfile-label,
.aes-keyfile-meta {
  color: var(--text-muted);
  line-height: 1.5;
}

.aes-keyfile-label {
  font-size: 0.92rem;
}

.aes-keyfile-input {
  padding: 12px 14px;
}

.aes-keyfile-input::file-selector-button {
  margin-right: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.42);
  background: linear-gradient(135deg, rgba(30,41,59,0.95), rgba(15,23,42,0.98));
  color: var(--text);
  cursor: pointer;
}

.aes-keyfile-input:disabled::file-selector-button {
  opacity: 0.52;
  cursor: not-allowed;
}

.aes-password-btn,
.private-action-btn {
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.42);
  background: linear-gradient(135deg, rgba(30,41,59,0.95), rgba(15,23,42,0.98));
  color: var(--text);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: normal;
}

.story-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  margin: 0 0 22px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.45);
  background: linear-gradient(135deg, rgba(15,23,42,0.85), rgba(30,41,59,0.95));
}

.business-copy,
.story-copy {
  text-align: left;
  line-height: 1.92;
  color: var(--text);
  font-size: 1.02rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  letter-spacing: 0.01em;
  max-width: 76ch;
  margin: 0 auto;
}

.business-copy {
  white-space: pre-wrap;
  margin-bottom: 34px;
}

.story-copy p {
  margin: 0 0 1.45rem;
}

.story-copy p:last-child {
  margin-bottom: 0;
}

.story-collage {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 24px;
  align-items: start;
  justify-content: center;
}

.story-collage-img {
  position: relative;
  max-width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,0.35);
  box-shadow: 0 22px 70px rgba(0,0,0,0.75);
  object-fit: cover;
  transition: scale 0.22s ease, box-shadow 0.22s ease;
  will-change: scale;
}

.story-collage-img--top {
  transform: rotate(-2.5deg);
  scale: 0.873;
  z-index: 3;
}

.story-collage-img--top:hover {
  scale: 1.05;
  z-index: 10;
  box-shadow: 0 28px 90px rgba(0,0,0,0.85);
}

.story-collage-img--bottom {
  margin-left: 36px;
  transform: rotate(2deg);
  scale: 0.81;
}

.story-collage-img--bottom:hover {
  scale: 0.99;
  z-index: 10;
  box-shadow: 0 28px 90px rgba(0,0,0,0.85);
}

#flummiBlur {
  transition: filter 0.12s linear;
  filter: blur(10px) brightness(0.82) contrast(0.92);
}

.story-audio-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.75);
  background: rgba(15,23,42,0.92);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.82rem;
  letter-spacing: .10em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 14px 40px rgba(0,0,0,0.55);
  user-select: none;
  white-space: normal;
  justify-self: start;
  align-self: start;
  grid-column: 3;
  margin-top: 10px;
}

.story-audio-btn::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 999px;
  background: conic-gradient(#ff004c, #ff8a00, #ffe600, #00d26a, #00c2ff, #7a5cff, #ff00c8, #ff004c);
  padding: 3px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(56,189,248,0.25));
}

.story-audio-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  position: relative;
}

.story-audio-icon::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
}

.story-audio-btn.is-playing .story-audio-icon::before {
  border: none;
  width: 4px;
  height: 10px;
  left: 3px;
  top: 2px;
  background: currentColor;
  box-shadow: 6px 0 0 currentColor;
}

.footer {
  max-width: var(--max-width);
  margin: 18px auto 0;
  padding: 10px 18px 24px;
  font-size: .8rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(31,41,55,0.9);
  letter-spacing: .18em;
  text-transform: uppercase;
  text-align: center;
}

body.light-mode {
  background: radial-gradient(circle at top, #e5e7eb 0, #f9fafb 60%, #e5e7eb 100%) !important;
  color: #020617 !important;
}

body.light-mode .story-header {
  background: linear-gradient(to bottom, rgba(255,255,255,0.94), rgba(255,255,255,0.72));
  border-bottom-color: rgba(148,163,184,0.45);
}

body.light-mode .section,
body.light-mode .panel,
body.light-mode #registered-only,
body.light-mode #story-consent,
body.light-mode #aes-access {
  background: rgba(255,255,255,0.96) !important;
  color: #0f172a !important;
  border-color: rgba(148,163,184,0.55) !important;
  box-shadow: 0 20px 50px rgba(15,23,42,0.10) !important;
}

body.light-mode .business-copy,
body.light-mode .story-copy,
body.light-mode .story-brand-title,
body.light-mode #registered-only strong,
body.light-mode #story-consent strong,
body.light-mode #aes-access strong,
body.light-mode .back-btn,
body.light-mode .theme-toggle,
body.light-mode .aes-password-btn,
body.light-mode .private-action-btn,
body.light-mode .story-audio-btn {
  color: #0f172a !important;
}

body.light-mode .registered-only-note,
body.light-mode .aes-access-note,
body.light-mode .aes-access-meta,
body.light-mode .story-brand-sub,
body.light-mode .nav-language-label,
body.light-mode .story-intro-copy,
body.light-mode .story-consent-copy {
  color: #475569 !important;
}

body.light-mode .back-btn,
body.light-mode .theme-toggle,
body.light-mode .story-audio-btn,
body.light-mode .aes-password-btn,
body.light-mode .private-action-btn {
  background: rgba(255,255,255,0.96) !important;
  border-color: rgba(148,163,184,0.75) !important;
  box-shadow: 0 14px 30px rgba(15,23,42,0.12) !important;
}

body.light-mode .aes-password-input {
  background: rgba(255,255,255,0.92) !important;
  color: #0f172a !important;
  border-color: rgba(148,163,184,0.6) !important;
}

body.light-mode .story-badge {
  background: rgba(255,255,255,0.96) !important;
  color: #334155 !important;
  border-color: rgba(148,163,184,0.55) !important;
}

body.light-mode .footer { border-top-color: rgba(148,163,184,0.45); color:#475569; }
body.light-mode .nav-language-menu {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98));
}
body.light-mode .nav-language-option { color: #111827; }
body.light-mode .nav-language-option:hover { background: rgba(14,165,233,0.12); }

/* white-mode readability hardening for Storytelling access UI only */
body.light-mode .story-stage1-copy,
body.light-mode .aes-security-copy,
body.light-mode .aes-keyfile-label,
body.light-mode .aes-keyfile-meta,
body.light-mode .aes-file-picker-current,
body.light-mode .story-unlock-progress-head {
  color: #334155 !important;
}

body.light-mode .story-stage1-copy--strong,
body.light-mode .story-stage1-status--timer {
  color: #0f172a !important;
}

body.light-mode .story-stage1-status {
  color: #475569 !important;
}

body.light-mode .aes-file-picker {
  background: rgba(241,245,249,0.98) !important;
  border-color: rgba(100,116,139,0.32) !important;
}

body.light-mode .aes-file-picker-btn {
  background: linear-gradient(135deg, rgba(15,23,42,0.94), rgba(30,41,59,0.94)) !important;
  color: #f8fafc !important;
  border-color: rgba(71,85,105,0.45) !important;
}

body.light-mode .aes-password-input::placeholder {
  color: #64748b !important;
}

body.light-mode .aes-password-input:disabled,
body.light-mode .aes-password-btn:disabled,
body.light-mode .private-action-btn:disabled {
  opacity: 0.88 !important;
}

@media (max-width: 900px) {
  .story-header-inner { align-items: stretch; }
  .story-controls { align-items: flex-start; }
  .story-right-actions { margin-left: 0; }
  .story-controls { width: 100%; justify-content: space-between; }
  .story-collage { grid-template-columns: 1fr; justify-items: center; }
  .story-collage-img--bottom { margin-left: 0; }
  .story-audio-btn { justify-self: center; margin-top: 4px; }
}

@media (max-width: 640px) {
  .page { padding: 20px 14px 30px; }
  .section, .panel { padding-left: 16px; padding-right: 16px; }
  #story-consent, #aes-access { padding: 16px; }
  .aes-access-row { grid-template-columns: 1fr; }
  .aes-password-btn, .private-action-btn { width: 100%; }
  .story-copy, .business-copy { font-size: 0.98rem; line-height: 1.9; }
  .nav-language-menu { min-width: min(260px, calc(100vw - 28px)); right: 0; left: auto; max-width: calc(100vw - 28px); }
  .story-brand-sub { letter-spacing: 0.04em; }
}

html[data-protected-pending="1"] {
  visibility: hidden;
}

#privateGate[hidden],
.story-audio-btn[hidden] {
  display: none !important;
}

#storyUnlockProgress {
  margin-top: 16px;
}

.story-unlock-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: .8rem;
  color: #cbd5e1;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.story-unlock-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(148,163,184,.18);
  overflow: hidden;
  border: 1px solid rgba(148,163,184,.18);
}

.story-unlock-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg,#38bdf8,#818cf8,#f472b6);
  box-shadow: 0 0 18px rgba(56,189,248,.55);
}

#aes-access strong:empty,
.aes-access-note:empty,
.aes-access-meta:empty { display:none !important; }


/* refined buttons + security box cleanup */
#story-app-downloads {
  margin-top: 28px;
}
.story-download-actions {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  padding: 8px 0 0;
}
.story-download-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 280px;
  padding: 18px 30px;
  border-radius: 20px;
  text-decoration: none;
  color: #f8fbff;
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: .03em;
  border: 1px solid rgba(148,163,184,.34);
  box-shadow: 0 18px 48px rgba(2,6,23,.42), inset 0 1px 0 rgba(255,255,255,.16);
  overflow: hidden;
  isolation: isolate;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, filter .18s ease;
}
.story-download-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.14), rgba(255,255,255,0));
  pointer-events: none;
}
.story-download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 56px rgba(2,6,23,.5), inset 0 1px 0 rgba(255,255,255,.18);
  border-color: rgba(226,232,240,.5);
  filter: saturate(1.06);
}
.story-download-btn:active { transform: translateY(0); }
.story-download-btn--windows {
  background: linear-gradient(135deg, #0f172a 0%, #15304d 42%, #38bdf8 100%);
}
.story-download-btn--android {
  background: linear-gradient(135deg, #0f172a 0%, #2b1248 42%, #ec4899 100%);
}
.aes-security-note { display: none !important; }
@media (max-width: 720px) {
  .story-download-actions { gap: 14px; }
  .story-download-btn { width: 100%; min-width: 0; }
}


/* Vorstufe 120-Minuten-Gate */
.story-stage1 {
  display: grid;
  gap: 18px;
}
.story-stage1-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.story-stage1-badge {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: radial-gradient(circle at top left, rgba(59,130,246,0.22), rgba(15,23,42,0.96));
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.55);
}
.story-stage1-badge--secondary {
  background: radial-gradient(circle at top left, rgba(99,102,241,0.22), rgba(15,23,42,0.96));
}
.story-stage1-copy {
  margin: 0;
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.72;
}
.story-stage1-copy--strong {
  color: #e2e8f0;
  font-weight: 600;
}
.story-stage1-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 14px;
  align-items: stretch;
}
.story-stage1-btn {
  min-width: 310px;
}
.story-stage1-status {
  min-height: 24px;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.55;
}
.story-stage1-status--timer {
  color: #f8fafc;
  font-weight: 700;
}
#storyStage2[hidden] {
  display: none !important;
}
@media (max-width: 900px) {
  .story-stage1-row {
    grid-template-columns: 1fr;
  }
  .story-stage1-btn {
    min-width: 0;
    width: 100%;
  }
}

.aes-keyfile-input--native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.aes-file-picker {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,0.28);
  background: rgba(2, 6, 23, 0.45);
  cursor: pointer;
}

.aes-file-picker:focus-within,
.aes-file-picker:hover {
  border-color: rgba(56, 189, 248, 0.46);
}

.aes-file-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.42);
  background: linear-gradient(135deg, rgba(30,41,59,0.95), rgba(15,23,42,0.98));
  color: var(--text);
  font-weight: 600;
  flex: 0 0 auto;
}

.aes-file-picker-current {
  min-width: 0;
  color: var(--text);
  opacity: 0.92;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aes-keyfile-meta {
  font-size: 0.96rem;
}

@media (max-width: 720px) {
  .aes-file-picker {
    flex-direction: column;
    align-items: flex-start;
  }
  .aes-file-picker-current {
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
  }
}

.story-rate-limit-note { display: block !important; }
