/* style.css — Perpetūra */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Cinzel:wght@400;600&family=Raleway:wght@300;400;500&display=swap');

/* ── RESET & BASE ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:        #c9a96e;
  --gold-bright: #ddb87a;
  --gold-dim:    rgba(201,169,110,0.5);
  --gold-faint:  rgba(201,169,110,0.15);
  --bg:          #0d0a09;
  --bg-mid:      #111009;
  --text:        #e2d4bc;
  --text-dim:    #c8b898;
  --text-faint:  #907860;
  --border:      rgba(201,169,110,0.28);
  --border-hover:rgba(201,169,110,0.65);
}

html, body {
  height: 100%;
  background: #0d0a09;
  color: var(--text);
  font-family: 'Crimson Pro', serif;
  overflow-x: hidden;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
input, textarea, [contenteditable] {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* ── SCENE BACKGROUNDS ───────────────────────────────────────────────────── */
/* Gradients are painted on body::before so they can cross-fade properly.
   Browsers can't tween radial-gradient values directly, but they can fade
   opacity — so we layer the gradient on a pseudo-element and animate that. */
body::before {
  content: '';
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease, background 0s 1.4s; /* fade out, then swap */
  background: transparent;
}

/* Each scene fades the overlay in with its gradient */
body[data-scene="prologue"]::before {
  opacity: 1;
  transition: opacity 1.4s ease;
  background:
    radial-gradient(ellipse at 60% 100%, rgba(90,60,20,0.18)  0%, transparent 65%),
    radial-gradient(ellipse at 20% 0%,   rgba(40,30,15,0.25)  0%, transparent 60%);
}

body[data-scene="hyunjae"]::before {
  opacity: 1;
  transition: opacity 1.4s ease;
  background:
    radial-gradient(ellipse at 15% 95%,  rgba(120,80,20,0.22)  0%, transparent 55%),
    radial-gradient(ellipse at 85% 5%,   rgba(30,40,65,0.38)   0%, transparent 60%),
    radial-gradient(ellipse at 50% 50%,  rgba(20,15,10,0.4)    0%, transparent 80%);
}

body[data-scene="codex"]::before {
  opacity: 1;
  transition: opacity 1.4s ease;
  background:
    radial-gradient(ellipse at 50% 40%,  rgba(100,75,25,0.15)  0%, transparent 60%),
    radial-gradient(ellipse at 80% 90%,  rgba(60,40,10,0.12)   0%, transparent 50%);
}

body[data-scene="stories"]::before {
  opacity: 1;
  transition: opacity 1.4s ease;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(40,35,25,0.2)    0%, transparent 60%);
}

/* title scene: overlay fades back to transparent (no gradient) */
body[data-scene="title"]::before {
  opacity: 0;
  transition: opacity 1.4s ease;
}

/* ── SCENE BACKGROUND IMAGES ──────────────────────────────────────────────── */
/* Photographic backgrounds behind all content. Each scene gets its own image
   shown at low opacity through a heavy dark overlay, adding atmospheric depth
   without hurting text readability. Driven by body[data-scene] — no JS needed. */
#scene-bg {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
#scene-bg::before {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
}

/* Title — dark cosmic dust / warm nebula */
body[data-scene="title"] #scene-bg {
  background-image: url('images/backgrounds/title-bg.jpg');
}
body[data-scene="title"] #scene-bg::before {
  background: linear-gradient(
    180deg,
    rgba(13,10,9,0.80) 0%,
    rgba(13,10,9,0.72) 40%,
    rgba(13,10,9,0.82) 100%
  );
}

/* Prologue — uses the same cosmic background as the title screen */
body[data-scene="prologue"] #scene-bg {
  background-image: url('images/backgrounds/title-bg.jpg');
}
body[data-scene="prologue"] #scene-bg::before {
  background: linear-gradient(
    180deg,
    rgba(13,10,9,0.84) 0%,
    rgba(13,10,9,0.78) 50%,
    rgba(13,10,9,0.86) 100%
  );
}

/* Stories screen — clockwork mechanism */
body[data-scene="stories"] #scene-bg {
  background-image: url('images/backgrounds/stories-bg.jpg');
}
body[data-scene="stories"] #scene-bg::before {
  background: linear-gradient(
    180deg,
    rgba(13,10,9,0.94) 0%,
    rgba(13,10,9,0.92) 50%,
    rgba(13,10,9,0.95) 100%
  );
}

/* Codex screen — same clockwork image */
body[data-scene="codex"] #scene-bg {
  background-image: url('images/backgrounds/stories-bg.jpg');
}
body[data-scene="codex"] #scene-bg::before {
  background: linear-gradient(
    180deg,
    rgba(13,10,9,0.95) 0%,
    rgba(13,10,9,0.93) 50%,
    rgba(13,10,9,0.96) 100%
  );
}

/* Hyunjae — misty mountains / moonlit pine forest (Joseon 1742) */
body[data-scene="hyunjae"] #scene-bg {
  background-image: url('images/backgrounds/hyunjae-bg.jpg');
}
body[data-scene="hyunjae"] #scene-bg::before {
  background: linear-gradient(
    180deg,
    rgba(13,10,9,0.90) 0%,
    rgba(13,10,9,0.86) 40%,
    rgba(13,10,9,0.92) 100%
  );
}

/* Reine — candlelit studio / Parisian warmth (Belle Époque 1893) */
body[data-scene="reine"] #scene-bg {
  background-image: url('images/backgrounds/reine-bg.jpg');
}
body[data-scene="reine"] #scene-bg::before {
  background: linear-gradient(
    180deg,
    rgba(13,10,9,0.90) 0%,
    rgba(13,10,9,0.86) 40%,
    rgba(13,10,9,0.92) 100%
  );
}

/* Liuyan — desert dunes at dusk / Silk Road (Tang Dynasty ~750 AD) */
body[data-scene="liuyan"] #scene-bg {
  background-image: url('images/backgrounds/liuyan-bg.jpg');
}
body[data-scene="liuyan"] #scene-bg::before {
  background: linear-gradient(
    180deg,
    rgba(13,10,9,0.90) 0%,
    rgba(13,10,9,0.86) 40%,
    rgba(13,10,9,0.92) 100%
  );
}

/* ── AMBIENT PARTICLES ───────────────────────────────────────────────────── */
#stars-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.petal {
  position: fixed; width: 4px; height: 6px;
  background: rgba(180,150,100,0.07);
  border-radius: 50% 50% 50% 0;
  pointer-events: none; animation: fall linear infinite; z-index: 0;
}
@keyframes fall {
  from { transform: translateY(-20px) rotate(0deg); opacity: 0.3; }
  to   { transform: translateY(110vh)  rotate(360deg); opacity: 0; }
}

/* ── ABOUT SCREEN ────────────────────────────────────────────────────────── */
.about-box { max-width: 560px; width: 100%; }
.about-content {
  margin-top: 0.8rem;
  max-height: 55vh; overflow-y: auto; padding-right: 4px;
  scrollbar-width: thin; scrollbar-color: rgba(201,169,110,0.2) transparent;
}
.about-content::-webkit-scrollbar { width: 2px; }
.about-content::-webkit-scrollbar-thumb { background: rgba(201,169,110,0.2); }
.about-tab { display: none; }
.about-tab.on { display: block; }
.about-section {
  margin-bottom: 1.8rem;
  padding-bottom: 1.4rem;
  border-bottom: 0.5px solid rgba(201,169,110,0.06);
}
.about-section:last-child { border-bottom: none; margin-bottom: 0; }
.about-heading {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(201,169,110,0.8);
  margin-bottom: 0.9rem;
}
.about-body {
  font-family: 'Crimson Pro', serif;
  font-size: 18px;
  line-height: 1.8;
  color: rgba(235,225,200,0.9);
  margin-bottom: 0.7rem;
}
.about-body:last-child { margin-bottom: 0; }
.about-muted { color: rgba(235,225,200,0.5); font-style: italic; }
.about-story-name {
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: 16px;
  letter-spacing: 1px;
}
.about-highlight {
  color: var(--gold);
  letter-spacing: 1px;
}
.about-list { display: flex; flex-direction: column; gap: 0.8rem; }
.about-item {
  font-family: 'Crimson Pro', serif;
  font-size: 17.5px;
  line-height: 1.75;
  color: rgba(235,225,200,0.85);
  padding-left: 0.4rem;
}
.about-copyright {
  text-align: center;
  padding-top: 1rem;
}
.about-copyright .about-body {
  font-family: 'Raleway', sans-serif;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(201,169,110,0.3);
}

/* ── FLOWCHART NODE POPUP ─────────────────────────────────────────────────── */
.flow-popup-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  animation: fo 0.2s ease reverse;
}
.flow-popup {
  background: #14100c; border: 0.5px solid rgba(184,150,96,0.25);
  max-width: 420px; width: 90%; padding: 1.4rem 1.6rem;
  position: relative;
}
.flow-popup-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1rem;
}
.flow-popup-title {
  font-family: 'Cinzel', serif; font-size: 14px;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold); line-height: 1.4;
}
.flow-popup-close {
  background: none; border: none; color: rgba(201,169,110,0.5);
  font-size: 16px; cursor: pointer; padding: 0 0 0 12px;
  line-height: 1; flex-shrink: 0;
}
.flow-popup-close:hover { color: var(--gold); }
.flow-popup-body {
  font-family: 'Crimson Pro', serif; font-size: 17px;
  line-height: 1.75; color: rgba(235,225,200,0.85);
}
.flow-popup-badge {
  font-family: 'Raleway', sans-serif; font-size: 9px;
  letter-spacing: 2px; text-transform: uppercase;
  color: rgba(201,169,110,0.5); margin-bottom: 0.8rem;
}

/* ── PLATFORM OVERRIDES (itch.io / GameJolt) ─────────────────────────────── */
/* Hide feedback buttons and cloud sync UI when running inside third-party iframes */
.platform-itch .mbtn-feedback,
.platform-itch .screen-footer,
.platform-itch #reader-fb-btn,
.platform-itch #auth-btn,
.platform-gamejolt .mbtn-feedback,
.platform-gamejolt .screen-footer,
.platform-gamejolt #reader-fb-btn,
.platform-gamejolt #auth-btn { display: none !important; }

/* ── UPDATE BANNER ───────────────────────────────────────────────────────── */
.update-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: rgba(20,16,12,0.95);
  border-bottom: 0.5px solid rgba(201,169,110,0.35);
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 10px 16px;
  animation: fadeUp 0.4s ease;
}
.update-msg {
  font-family: 'Raleway', sans-serif; font-size: 10px;
  letter-spacing: 2px; text-transform: uppercase;
  color: rgba(201,169,110,0.8);
}
.update-btn {
  background: transparent;
  border: 0.5px solid rgba(201,169,110,0.5);
  color: #e8d090; font-family: 'Raleway', sans-serif;
  font-size: 9px; letter-spacing: 3px; text-transform: uppercase;
  padding: 5px 14px; cursor: pointer; transition: all 0.3s;
}
.update-btn:hover { border-color: var(--gold); color: #f0e0c0; background: rgba(201,169,110,0.08); }
.update-dismiss {
  background: transparent; border: none;
  color: rgba(201,169,110,0.35); font-size: 14px;
  cursor: pointer; transition: color 0.3s; padding: 0 4px; line-height: 1;
}
.update-dismiss:hover { color: rgba(201,169,110,0.7); }

/* ── GOOGLE AUTH BUTTON ──────────────────────────────────────────────────── */
.auth-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-bottom: 0.9rem;
  background: transparent;
  font-family: 'Raleway', sans-serif; font-size: 10px;
  letter-spacing: 2px; text-transform: uppercase;
  cursor: pointer; transition: all 0.3s; padding: 7px 14px;
  border-radius: 2px;
}
.auth-btn-out {
  border: 0.5px solid rgba(201,169,110,0.3);
  color: rgba(201,169,110,0.5);
}
.auth-btn-out:hover {
  border-color: rgba(201,169,110,0.6);
  color: rgba(201,169,110,0.85);
  background: rgba(201,169,110,0.04);
}
.auth-btn-in {
  border: 0.5px solid rgba(201,169,110,0.25);
  color: rgba(201,169,110,0.45);
}
.auth-btn-in:hover {
  border-color: rgba(201,169,110,0.5);
  color: rgba(201,169,110,0.75);
}
.auth-avatar {
  width: 18px; height: 18px;
  border-radius: 50%; object-fit: cover;
}
.auth-google-ico {
  width: 14px; height: 14px; flex-shrink: 0;
}

/* ── SCREENS ─────────────────────────────────────────────────────────────── */
.scr {
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh; padding: 2.5rem 2rem;
  position: relative; z-index: 10;
}
.scr.on { display: flex; animation: fadeUp 0.5s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── TITLE SCREEN ────────────────────────────────────────────────────────── */
.orn {
  font-size: 11px; letter-spacing: 7px; color: var(--gold);
  text-transform: uppercase; font-family: 'Raleway', sans-serif;
  font-weight: 300; margin-bottom: 1.4rem; opacity: 0.8;
}
.ttl {
  font-family: 'Cinzel', serif;
  font-size: clamp(32px, 6vw, 58px);
  font-weight: 600; color: #f8f0e0;
  text-align: center; letter-spacing: 3px;
  text-shadow: 0 0 50px rgba(201,169,110,0.3);
}
.sub {
  font-family: 'Crimson Pro', serif;
  font-size: clamp(17px, 2vw, 21px);
  color: rgba(201,169,110,0.75);
  letter-spacing: 2px; text-align: center;
  margin-top: 0.8rem; font-style: italic;
}
.divd { display: flex; align-items: center; gap: 12px; margin: 1.8rem 0; width: 240px; }
.dl { flex: 1; height: 0.5px; background: linear-gradient(to right, transparent, rgba(201,169,110,0.5), transparent); }
.dg { width: 5px; height: 5px; background: rgba(201,169,110,0.65); transform: rotate(45deg); }

.menu { display: flex; flex-direction: column; gap: 10px; margin-top: 2.2rem; width: 100%; max-width: 280px; }
.mbtn {
  background: rgba(13,10,9,0.35);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  border: 0.5px solid rgba(201,169,110,0.38);
  color: #e8d8bc;
  font-family: 'Raleway', sans-serif; font-weight: 300;
  font-size: 13px; letter-spacing: 5px; text-transform: uppercase;
  padding: 15px 36px; cursor: pointer;
  transition: all 0.4s; width: 100%; text-align: center;
}
.mbtn:hover { border-color: var(--gold); color: #f8e8c8; background: rgba(13,10,9,0.5); letter-spacing: 7px; }

/* Continue button — shown when a story is in progress */
.mbtn-continue { border-color: rgba(201,169,110,0.55) !important; color: #f0e0c0 !important; letter-spacing: 3px !important; }
.mbtn-continue::before { content: '▶ '; font-size: 9px; opacity: 0.7; }

/* Credit lines pinned to the bottom of the title screen */
.title-footer {
  position: absolute;
  bottom: 1.6rem;
  left: 0; right: 0;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
}
.title-credit {
  font-family: 'Raleway', sans-serif;
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
  color: rgba(201,169,110,0.28); text-align: center; line-height: 1.8;
}
.reload-btn {
  margin-top: 0.5rem;
  background: transparent; border: none;
  font-family: 'Raleway', sans-serif; font-size: 10px;
  letter-spacing: 2px; text-transform: uppercase;
  color: rgba(201,169,110,0.25); cursor: pointer;
  transition: color 0.3s; padding: 4px 8px;
}
.reload-btn:hover { color: rgba(201,169,110,0.6); }

/* ── PROLOGUE ────────────────────────────────────────────────────────────── */
.pbox { max-width: 520px; width: 100%; }
.clbl {
  font-family: 'Cinzel', serif; font-size: 12px;
  letter-spacing: 5px; color: var(--gold);
  text-transform: uppercase; margin-bottom: 1.6rem; opacity: 0.9;
}
.ptxt {
  font-size: 21px; line-height: 2.1; color: #ddd0b8;
  font-weight: 400; text-align: center; min-height: 80px;
}
.pchoices { display: flex; flex-direction: column; gap: 10px; margin-top: 2rem; }
.pcbtn {
  background: transparent; border: 0.5px solid var(--border);
  color: #d0c0a0; font-family: 'Crimson Pro', serif; font-size: 18px;
  padding: 15px 22px; cursor: pointer; transition: all 0.3s;
  text-align: left; line-height: 1.65;
}
.pcbtn:hover { border-color: var(--border-hover); color: #eeddc0; background: rgba(201,169,110,0.05); padding-left: 30px; }
.pcbtn::before { content: '◆ '; font-size: 7px; vertical-align: 2px; color: var(--gold); opacity: 0; transition: opacity 0.3s; }
.pcbtn:hover::before { opacity: 1; }

.pro-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 2.2rem; }
.pro-skip-btn {
  background: transparent; border: none;
  font-family: 'Raleway', sans-serif; font-size: 10px;
  letter-spacing: 3px; color: rgba(201,169,110,0.38);
  text-transform: uppercase; cursor: pointer; transition: color 0.3s; padding: 0;
}
.pro-skip-btn:hover { color: rgba(201,169,110,0.75); }

.screen-footer {
  display: flex; justify-content: flex-end; align-items: center;
  margin-top: 2.4rem; padding-top: 1.4rem;
  border-top: 0.5px solid rgba(201,169,110,0.08);
}
.back {
  font-family: 'Raleway', sans-serif; font-size: 11px;
  letter-spacing: 3px; color: #7a6a55; text-transform: uppercase;
  cursor: pointer; border: none; background: transparent; transition: color 0.3s; display: block;
}
.back:hover { color: var(--gold); }

/* ── DIALOGS ─────────────────────────────────────────────────────────────── */
.confirm-dialog {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(13,10,9,0.9);
  display: flex; align-items: center; justify-content: center;
  animation: fadeUp 0.2s ease;
}
.confirm-box {
  max-width: 360px; width: 90%;
  border: 0.5px solid rgba(201,169,110,0.22);
  background: #0f0c0b; padding: 2.6rem 2.2rem; text-align: center;
}
.confirm-msg {
  font-family: 'Crimson Pro', serif;
  font-size: 19px; color: #cfc0a0; line-height: 1.85; margin-bottom: 2.2rem;
}
.confirm-msg strong { color: #e0d0b0; font-weight: 500; }
.confirm-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.confirm-yes {
  background: transparent; border: 0.5px solid rgba(201,169,110,0.35); color: #d0c0a0;
  font-family: 'Raleway', sans-serif; font-size: 10px; letter-spacing: 3px; text-transform: uppercase;
  padding: 10px 22px; cursor: pointer; transition: all 0.3s;
}
.confirm-yes:hover { border-color: rgba(201,169,110,0.65); color: #f0e0c0; }
.confirm-no {
  background: transparent; border: none; color: #6a5e48;
  font-family: 'Raleway', sans-serif; font-size: 10px; letter-spacing: 3px; text-transform: uppercase;
  padding: 10px 22px; cursor: pointer; transition: color 0.3s;
}
.confirm-no:hover { color: var(--gold); }
.confirm-cancel {
  background: transparent; border: none; color: #4a4038;
  font-family: 'Raleway', sans-serif; font-size: 10px; letter-spacing: 3px; text-transform: uppercase;
  padding: 10px 22px; cursor: pointer; transition: color 0.3s; width: 100%; margin-top: 4px;
}
.confirm-cancel:hover { color: #8a7860; }
.resume-btns { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.resume-btns .confirm-yes, .resume-btns .confirm-no, .resume-btns .confirm-cancel { width: 200px; }

/* ── STORIES SCREEN ──────────────────────────────────────────────────────── */
.stories-box { max-width: 580px; width: 100%; text-align: center; }
.cgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; width: 100%; margin-top: 1.4rem;
}
.ccard {
  border: 0.5px solid var(--border); padding: 18px 14px; cursor: pointer;
  transition: all 0.35s; text-align: center;
  background: rgba(13,10,9,0.65);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.ccard:hover:not(.sealed) { border-color: var(--border-hover); background: rgba(13,10,9,0.72); transform: translateY(-2px); }
.ccard.sealed { opacity: 0.35; cursor: default; }
.ccard.completed { border-color: rgba(201,169,110,0.32); }
.ccard.completed:hover { border-color: rgba(201,169,110,0.65); }
.eico { font-size: 22px; margin-bottom: 10px; }
.story-icon-img { width: 48px; height: 48px; object-fit: contain; display: block; margin: 0 auto 10px; }
.sealed-ico { opacity: 0.2; }
.enm { font-family: 'Cinzel', serif; font-size: 12px; letter-spacing: 2px; color: #ddb87a; display: block; margin-bottom: 5px; }
.sealed-nm { color: #3a3028; }
.edsc { font-family: 'Crimson Pro', serif; font-size: 15px; color: #9a8868; line-height: 1.5; }
.story-desc { font-family: 'Crimson Pro', serif; font-size: 14px; color: #786858; margin-top: 7px; line-height: 1.5; }
.seal-lbl { font-family: 'Raleway', sans-serif; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: #5a4e3a; margin-top: 7px; display: block; }
.pbar-wrap { margin-top: 10px; height: 1.5px; background: rgba(201,169,110,0.12); border-radius: 2px; overflow: hidden; }
.pbar { height: 100%; background: rgba(201,169,110,0.65); border-radius: 2px; transition: width 0.7s ease; }
.pct-lbl { font-family: 'Raleway', sans-serif; font-size: 10px; color: #6a5a48; margin-top: 3px; text-align: right; }
.prog-hint { font-family: 'Raleway', sans-serif; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #5a4e3a; margin-top: 1.4rem; text-align: center; }
.completed-badge { display: inline-block; font-family: 'Raleway', sans-serif; font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: rgba(201,169,110,0.6); margin-top: 7px; }
.story-action-row { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.story-action-lbl { font-family: 'Raleway', sans-serif; font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: rgba(201,169,110,0.5); }

/* ── CODEX SCREEN ────────────────────────────────────────────────────────── */
.codex-box { max-width: 560px; width: 100%; }
.codex-topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.2rem;
}
.cnav {
  display: flex; gap: 0;
  border-bottom: 0.5px solid rgba(201,169,110,0.2);
  margin-bottom: 1.6rem; width: 100%; flex-wrap: wrap;
}
.ctab {
  background: transparent; border: none;
  font-family: 'Raleway', sans-serif; font-size: 11px;
  letter-spacing: 3px; text-transform: uppercase;
  color: #7a6e60; padding: 9px 14px; cursor: pointer; transition: all 0.3s;
  border-bottom: 1.5px solid transparent; margin-bottom: -0.5px;
}
.ctab.act  { color: var(--gold); border-bottom-color: var(--gold); }
.ctab:hover:not(.veiled) { color: #d0a870; }
.ctab.veiled { color: #3a3028; cursor: default; }

.codex-list {
  display: flex; flex-direction: column; gap: 9px;
  max-height: 55vh; overflow-y: auto; padding-right: 4px;
  scrollbar-width: thin; scrollbar-color: rgba(201,169,110,0.2) transparent;
}
.codex-list::-webkit-scrollbar { width: 2px; }
.codex-list::-webkit-scrollbar-thumb { background: rgba(201,169,110,0.2); }

.centry {
  border: 0.5px solid var(--gold-faint); padding: 15px 18px; transition: all 0.3s;
  background: rgba(13,10,9,0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.centry.open:hover { border-color: rgba(201,169,110,0.4); background: rgba(13,10,9,0.68); }
.centry.sealed-e { opacity: 0.45; }
.entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.etitle { font-family: 'Cinzel', serif; font-size: 13px; letter-spacing: 2px; color: #f0d898; flex: 1; line-height: 1.5; }
.etitle.st { color: #5a4e3a; }
.etag { font-family: 'Raleway', sans-serif; font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: #7a7060; white-space: nowrap; }
.etag.ul { color: rgba(201,169,110,0.75); }
.ebody { margin-top: 11px; font-size: 17px; color: #cfc0a0; line-height: 1.8; }
.ehint { margin-top: 7px; font-size: 15px; color: #7a6a52; line-height: 1.6; }

.veiled-block { text-align: center; padding: 2.5rem 1rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.veiled-ico { font-size: 24px; opacity: 0.2; }
.veiled-msg { font-family: 'Crimson Pro', serif; font-size: 18px; color: #6a6050; line-height: 1.9; max-width: 340px; }

.codex-divider { height: 0.5px; background: rgba(201,169,110,0.1); margin: 1.4rem 0; }
.codex-sec-lbl { font-family: 'Raleway', sans-serif; font-size: 10px; letter-spacing: 3px; color: rgba(201,169,110,0.5); text-transform: uppercase; margin-bottom: 0.8rem; display: block; }
.codex-empty { color: rgba(201,169,110,0.4); font-size: 16px; padding: 0.5rem 0; }

/* ── FLOWCHART ────────────────────────────────────────────────────────────── */
/* Top-to-bottom layout. viewBox is 460×800.
   Rendered at full container width so nodes are always large enough to read.
   The codex-list has max-height:55vh with overflow-y:auto, so the tall
   flowchart scrolls naturally inside it. */
.flow-wrap { width: 100%; margin-top: 0.8rem; margin-bottom: 0.8rem; }
.flow-wrap svg {
  display: block;
  width: 100%;     /* fill the codex container — ~520px on desktop */
  height: auto;    /* proportional: at 520px wide → ~904px tall */
}

.flow-node-visited rect { fill: rgba(201,169,110,0.13); stroke: rgba(201,169,110,0.7); stroke-width: 1; }
.flow-node-visited text { fill: #ead89a; }

.flow-node-sealed rect { fill: rgba(201,169,110,0.025); stroke: rgba(201,169,110,0.22); stroke-width: 0.5; }
.flow-node-sealed text { fill: rgba(201,169,110,0.35); }

.flow-node-unique rect { fill: rgba(201,169,110,0.08); stroke: rgba(201,169,110,0.6); stroke-width: 1; stroke-dasharray: 5 3; }
.flow-node-unique.flow-node-sealed rect { fill: rgba(201,169,110,0.025); stroke: rgba(201,169,110,0.22); stroke-dasharray: 4 3; }
.flow-node-unique text { fill: rgba(201,169,110,0.42); }
.flow-node-unique.flow-node-visited text { fill: #ead89a; }

.flow-gem { fill: rgba(201,169,110,0.65); stroke: rgba(201,169,110,0.95); stroke-width: 0.5; }

.flow-edge         { stroke: rgba(201,169,110,0.2);  stroke-width: 1;   fill: none; }
.flow-edge-visited { stroke: rgba(201,169,110,0.58); stroke-width: 1.5; fill: none; }

.flow-sealed-msg { font-family: 'Crimson Pro', serif; font-size: 17px; color: rgba(201,169,110,0.4); padding: 1.2rem 0; text-align: center; }
.flow-sealed-ico { font-size: 20px; opacity: 0.18; display: block; margin-bottom: 0.6rem; }
.flow-hint { font-family: 'Raleway', sans-serif; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: rgba(201,169,110,0.4); margin-bottom: 0.6rem; }

/* Playthrough story sub-tabs */
.flow-tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 0.5px solid rgba(184,150,96,0.15); margin-bottom: 1.2rem; }
.flow-tab {
  background: transparent; border: none;
  font-family: 'Raleway', sans-serif; font-size: 10px;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: rgba(184,150,96,0.38); padding: 8px 14px;
  cursor: pointer; transition: all 0.3s;
  border-bottom: 1.5px solid transparent; margin-bottom: -0.5px;
}
.flow-tab.act { color: var(--gold); border-bottom-color: var(--gold); }
.flow-tab:hover:not(.veiled) { color: rgba(184,150,96,0.68); }
.flow-tab.veiled { color: rgba(184,150,96,0.18); cursor: default; }

/* ── READER ───────────────────────────────────────────────────────────────── */
#reader-container { position: fixed; inset: 0; z-index: 20; display: none; overflow-y: auto; background: transparent; scrollbar-width: none; }
#reader-container::-webkit-scrollbar { display: none; }
#reader-container.open { display: block; }

.ch-header-fixed {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(to bottom, rgba(13,10,9,1) 65%, rgba(13,10,9,0));
  padding: 1rem 1.2rem 0.8rem;
  display: flex; justify-content: space-between; align-items: center;
  max-width: 640px; margin: 0 auto; gap: 10px;
}

/* Inline gear button — lives inside the header, never overlaps */
.gear-btn-inline {
  flex-shrink: 0;
  width: 38px; height: 38px;
  background: transparent;
  border: none; color: rgba(184,150,96,0.45);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  border-radius: 2px; transition: color 0.3s; padding: 0;
}
.gear-btn-inline:hover { color: rgba(184,150,96,0.8); }
.gear-icon { width: 28px; height: 28px; display: block; }
.pbar-wrap { flex: 1; min-width: 0; padding: 4px 0; }
.pbar-track { position: relative; width: 100%; height: 2px; background: rgba(180,150,100,0.15); border-radius: 1px; }
.pbar-fill { height: 100%; background: rgba(180,150,100,0.5); border-radius: 1px; transition: width 0.6s ease; }
.pbar-marker { position: absolute; top: 50%; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 6px rgba(184,150,96,0.6); transform: translate(-50%, -50%); transition: left 0.6s ease; }
.ch-ctr-r { flex-shrink: 0; font-family: 'Raleway', sans-serif; font-size: 12px; letter-spacing: 3px; color: rgba(201,169,110,0.85); text-transform: uppercase; white-space: nowrap; }

.reading-area { max-width: 560px; margin: 0 auto; padding: 0 2rem 5rem; }

.unique-badge-r { display: block; font-family: 'Raleway', sans-serif; font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: rgba(184,150,96,0.6); border: 0.5px solid rgba(184,150,96,0.25); padding: 4px 12px; margin: 0 auto 1.4rem; width: fit-content; }
.ch-label-r { font-family: 'Cinzel', serif; font-size: 13px; letter-spacing: 5px; color: rgba(201,169,110,0.9); text-transform: uppercase; margin-bottom: 2rem; line-height: 1.8; display: block; text-align: center; }

.beat-block { margin-bottom: 1.6em; }
.beat-block p { font-size: 19px; line-height: 2.0; color: #cfc0a8; font-weight: 400; letter-spacing: 0.01em; margin-bottom: 0.9em; }
.beat-block p:last-child { margin-bottom: 0; }
.beat-block em { color: #e0d0b8; font-style: italic; }

.beat-sep { display: flex; align-items: center; gap: 10px; margin: 1.6em 0; opacity: 0; transition: opacity 0.5s; }
.beat-sep.visible { opacity: 1; }
.bsl { flex: 1; height: 0.5px; background: linear-gradient(to right, transparent, rgba(184,150,96,0.14), transparent); }
.bsg { width: 3px; height: 3px; background: rgba(184,150,96,0.22); transform: rotate(45deg); flex-shrink: 0; }

.cur { display: inline-block; width: 1.5px; height: 1em; background: var(--gold); vertical-align: text-bottom; animation: blink 0.9s step-end infinite; margin-left: 1px; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.choices-block { margin-top: 2.4rem; opacity: 0; transform: translateY(8px); transition: opacity 0.5s, transform 0.5s; }
.choices-block.visible { opacity: 1; transform: none; }
.choice-label-r { font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: 4px; color: rgba(184,150,96,0.32); text-transform: uppercase; margin-bottom: 1.2rem; display: block; }
.choices-r { display: flex; flex-direction: column; gap: 10px; }
.choice-btn-r:disabled { pointer-events: none; opacity: 0; }
.choice-btn-r {
  background: transparent; border: 0.5px solid rgba(184,150,96,0.18); color: #c0b098;
  font-family: 'Crimson Pro', serif; font-size: 18px;
  padding: 14px 20px; cursor: pointer; transition: all 0.3s;
  text-align: left; line-height: 1.65; letter-spacing: 0.01em;
}
.choice-btn-r:hover { border-color: rgba(184,150,96,0.5); color: #ddd0b8; background: rgba(184,150,96,0.03); padding-left: 28px; }
.choice-btn-r::before { content: '◆ '; font-size: 7px; vertical-align: 2px; color: var(--gold); opacity: 0; transition: opacity 0.3s; }
.choice-btn-r:hover::before { opacity: 1; }

.ending-section { margin-top: 2.4rem; text-align: center; }
.ending-rule-r { height: 0.5px; background: linear-gradient(to right, transparent, rgba(184,150,96,0.25), transparent); margin: 1.4rem 0; }
.ending-lbl-r { font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: 4px; color: rgba(184,150,96,0.32); text-transform: uppercase; display: block; margin-bottom: 1rem; }
.ending-quote-r { font-size: 19px; color: #a09880; line-height: 1.95; max-width: 420px; margin: 0 auto 1.8rem; }
.ending-btn-r { background: transparent; border: 0.5px solid rgba(184,150,96,0.22); color: rgba(184,150,96,0.5); font-family: 'Raleway', sans-serif; font-size: 10px; letter-spacing: 4px; text-transform: uppercase; padding: 11px 24px; cursor: pointer; transition: all 0.3s; }
.ending-btn-r:hover { border-color: rgba(184,150,96,0.45); color: rgba(184,150,96,0.8); background: rgba(184,150,96,0.04); }

.ending-replay-btn { display: block; margin: 1rem auto 0; background: transparent; border: none; font-family: 'Raleway', sans-serif; font-size: 10px; letter-spacing: 3px; text-transform: uppercase; color: rgba(201,169,110,0.3); cursor: pointer; transition: color 0.3s; padding: 8px 0; }
.ending-replay-btn:hover { color: rgba(201,169,110,0.62); }

/* ── SKIP BAR ─────────────────────────────────────────────────────────────── */
.skip-bar { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 40; display: none; }
.skip-btn { background: rgba(13,10,9,0.9); border: 0.5px solid rgba(184,150,96,0.22); font-family: 'Raleway', sans-serif; font-size: 9px; letter-spacing: 3px; color: rgba(184,150,96,0.4); text-transform: uppercase; cursor: pointer; padding: 7px 18px; transition: all 0.3s; }
.skip-btn:hover { color: rgba(184,150,96,0.75); border-color: rgba(184,150,96,0.45); }

/* Floating gear button — kept in HTML but never shown; replaced by .gear-btn-inline in header */
.gear-btn { display: none !important; }

/* ── PAUSE OVERLAY ────────────────────────────────────────────────────────── */
.pause-overlay { position: fixed; inset: 0; background: var(--bg); z-index: 80; display: none; flex-direction: column; align-items: center; justify-content: flex-start; padding: 2rem; overflow-y: auto; overflow-x: hidden; }
.pause-overlay.open { display: flex; animation: fadeUp 0.2s ease; }
.pause-inner { max-width: 440px; width: 100%; overflow-x: hidden; }
.pause-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; padding-bottom: 1.2rem; border-bottom: 0.5px solid rgba(184,150,96,0.15); }
.pause-title { font-family: 'Cinzel', serif; font-size: 11px; letter-spacing: 6px; color: rgba(184,150,96,0.65); text-transform: uppercase; }
.xbtn { background: transparent; border: none; cursor: pointer; font-size: 18px; color: rgba(184,150,96,0.45); transition: color 0.3s; padding: 0; line-height: 1; }
.xbtn:hover { color: rgba(184,150,96,0.85); }

/* Pause tabs */
.ptabs { display: flex; border-bottom: 0.5px solid rgba(184,150,96,0.15); margin-bottom: 1.8rem; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.ptabs::-webkit-scrollbar { display: none; }
.ptab {
  background: transparent; border: none;
  font-family: 'Raleway', sans-serif; font-size: 10px;
  letter-spacing: 2px; text-transform: uppercase;
  color: rgba(184,150,96,0.42); padding: 9px 18px;
  cursor: pointer; transition: all 0.3s;
  border-bottom: 1.5px solid transparent; margin-bottom: -0.5px;
  flex-shrink: 0; white-space: nowrap;
}
.ptab.act { color: var(--gold); border-bottom-color: var(--gold); }
.ptab:hover { color: rgba(184,150,96,0.72); }

/* Navigation tab sections */
.psec { margin-bottom: 1.8rem; }
.psec-lbl {
  font-family: 'Raleway', sans-serif; font-size: 9px;
  letter-spacing: 3px; color: rgba(184,150,96,0.5);
  text-transform: uppercase; margin-bottom: 0.8rem; display: block;
}

/* Navigation buttons */
.pmenu-btn {
  display: block; width: 100%; background: transparent; border: none;
  border-bottom: 0.5px solid rgba(184,150,96,0.1);
  color: #c8b898;
  font-family: 'Crimson Pro', serif; font-size: 20px;
  padding: 13px 0; cursor: pointer; text-align: left;
  transition: color 0.25s, padding-left 0.25s;
}
.pmenu-btn:last-child { border-bottom: none; }
.pmenu-btn:hover { color: #eeddc0; padding-left: 10px; }
.pmenu-btn-danger { color: rgba(210,130,110,0.65) !important; }
.pmenu-btn-danger:hover { color: rgba(235,160,140,0.9) !important; padding-left: 10px; }

/* Progress tab */
.prog-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 0.5px solid rgba(184,150,96,0.1); }
.prog-row:last-child { border-bottom: none; }
.prog-lbl { font-family: 'Raleway', sans-serif; font-size: 10px; letter-spacing: 1px; color: rgba(184,150,96,0.55); text-transform: uppercase; }
.prog-val { font-family: 'Crimson Pro', serif; font-size: 18px; color: #d4be90; }

/* Resume reading button */
.presume {
  display: block; width: 100%;
  background: transparent; border: 0.5px solid rgba(184,150,96,0.3);
  color: rgba(184,150,96,0.65);
  font-family: 'Raleway', sans-serif; font-size: 9px;
  letter-spacing: 4px; text-transform: uppercase;
  padding: 13px 0; cursor: pointer;
  transition: all 0.3s; margin-top: 2rem; text-align: center;
}
.presume:hover { border-color: rgba(184,150,96,0.6); color: rgba(184,150,96,0.9); background: rgba(184,150,96,0.04); }

/* ── NOTIFICATIONS ───────────────────────────────────────────────────────── */
.notif { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: rgba(13,10,9,0.97); border: 0.5px solid rgba(184,150,96,0.2); font-family: 'Raleway', sans-serif; font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); padding: 7px 16px; z-index: 100; white-space: normal; text-align: center; max-width: 85vw; animation: notifUp 0.4s ease, fo 0.5s ease 2.8s both; pointer-events: none; }
@keyframes notifUp { from { transform: translate(-50%, 40px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes fo { to { opacity: 0; } }
.flash { position: fixed; inset: 0; background: rgba(184,150,96,0.03); z-index: 5; animation: fla 1s ease both; pointer-events: none; }
@keyframes fla { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }

/* Speed selector in Progress tab */
.speed-btns { display: flex; gap: 8px; margin-top: 0.4rem; flex-wrap: wrap; }
.speed-btn {
  flex: 1 1 calc(50% - 4px);  /* two per row on narrow screens */
  min-width: 60px;
  background: transparent;
  border: 0.5px solid rgba(184,150,96,0.25);
  color: #c8b898;
  font-family: 'Raleway', sans-serif; font-size: 10px;
  letter-spacing: 2px; text-transform: uppercase;
  padding: 10px 4px; cursor: pointer; transition: all 0.25s; text-align: center;
}
.speed-btn:hover { border-color: rgba(184,150,96,0.55); color: #eeddc0; }
.speed-btn.act {
  border-color: rgba(184,150,96,0.7); color: #eeddc0;
  background: rgba(184,150,96,0.08);
}

/* On wider screens, keep all four on one row */
@media (min-width: 400px) {
  .speed-btn { flex: 1 1 auto; }
}
.speed-hint {
  font-family: 'Crimson Pro', serif; font-size: 14px;
  color: rgba(184,150,96,0.32); margin-top: 0.7rem; line-height: 1.5;
}

/* ── MORE TEXT INDICATOR ─────────────────────────────────────────────────── */
/* Appears at the bottom of the screen when new text has typed in below the
   visible area. Tapping it scrolls down gently. Never forces movement. */
.reader-more-ind {
  position: fixed;
  bottom: 60px; /* sits above the skip bar */
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  font-size: 22px;
  color: rgba(201,169,110,0.5);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  animation: indBob 1.6s ease-in-out infinite;
  user-select: none;
  -webkit-user-select: none;
}
.reader-more-ind.visible {
  opacity: 1;
  pointer-events: auto;
}
@keyframes indBob {
  0%, 100% { transform: translateX(-50%) translateY(0);   }
  50%       { transform: translateX(-50%) translateY(5px); }
}
.feedback-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(13,10,9,0.88);
  display: none; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.feedback-overlay.open { display: flex; animation: fadeUp 0.25s ease; }

.feedback-inner {
  width: 100%; max-width: 480px;
  background: #0f0c0b;
  border: 0.5px solid rgba(201,169,110,0.25);
  padding: 2.2rem 2rem;
  max-height: 90vh; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(201,169,110,0.2) transparent;
}

.feedback-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.8rem; padding-bottom: 1rem;
  border-bottom: 0.5px solid rgba(201,169,110,0.15);
}
.feedback-title {
  font-family: 'Cinzel', serif; font-size: 11px;
  letter-spacing: 5px; text-transform: uppercase;
  color: rgba(201,169,110,0.75);
}

.fb-field { margin-bottom: 1.4rem; }
.fb-label {
  display: block; font-family: 'Raleway', sans-serif;
  font-size: 9px; letter-spacing: 3px; text-transform: uppercase;
  color: rgba(201,169,110,0.5); margin-bottom: 0.6rem;
}
.fb-optional { color: rgba(201,169,110,0.3); letter-spacing: 1px; text-transform: none; }

/* Type toggle buttons */
.fb-types { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-type {
  background: transparent;
  border: 0.5px solid rgba(201,169,110,0.25);
  color: rgba(201,169,110,0.45);
  font-family: 'Raleway', sans-serif; font-size: 9px;
  letter-spacing: 2px; text-transform: uppercase;
  padding: 7px 14px; cursor: pointer; transition: all 0.25s;
}
.fb-type:hover { border-color: rgba(201,169,110,0.55); color: rgba(201,169,110,0.8); }
.fb-type.act {
  border-color: rgba(201,169,110,0.7); color: #e8d090;
  background: rgba(201,169,110,0.07);
}

/* Textarea & input */
.fb-textarea, .fb-input {
  width: 100%; background: rgba(201,169,110,0.03);
  border: 0.5px solid rgba(201,169,110,0.2);
  color: #cfc0a0; font-family: 'Crimson Pro', serif; font-size: 17px;
  padding: 12px 14px; resize: vertical; transition: border-color 0.25s;
  outline: none; line-height: 1.6;
}
.fb-textarea:focus, .fb-input:focus { border-color: rgba(201,169,110,0.5); }
.fb-textarea::placeholder, .fb-input::placeholder { color: rgba(201,169,110,0.25); }
.fb-input { resize: none; }

.fb-char {
  font-family: 'Raleway', sans-serif; font-size: 9px;
  color: rgba(201,169,110,0.3); text-align: right; margin-top: 4px;
}

/* Actions */
.fb-actions { display: flex; gap: 10px; align-items: center; margin-top: 1.6rem; }
.fb-submit {
  background: transparent;
  border: 0.5px solid rgba(201,169,110,0.45); color: #d8c898;
  font-family: 'Raleway', sans-serif; font-size: 10px;
  letter-spacing: 4px; text-transform: uppercase;
  padding: 11px 28px; cursor: pointer; transition: all 0.3s;
}
.fb-submit:hover:not(:disabled) { border-color: var(--gold); color: #f0e0c0; background: rgba(201,169,110,0.06); }
.fb-submit:disabled { opacity: 0.5; cursor: default; }
.fb-cancel {
  background: transparent; border: none; color: rgba(201,169,110,0.3);
  font-family: 'Raleway', sans-serif; font-size: 10px;
  letter-spacing: 3px; text-transform: uppercase;
  cursor: pointer; transition: color 0.3s; padding: 11px 0;
}
.fb-cancel:hover { color: rgba(201,169,110,0.65); }

/* Success / error */
.fb-success {
  margin-top: 1.2rem; font-family: 'Crimson Pro', serif;
  font-size: 17px; color: rgba(201,169,110,0.75); text-align: center;
  padding: 0.8rem 0;
}
.fb-error {
  margin-top: 1.2rem; font-family: 'Crimson Pro', serif;
  font-size: 16px; color: rgba(210,130,110,0.75); text-align: center;
  padding: 0.8rem 0;
}

/* Feedback button on main menu — subtly dimmer than other buttons */
.mbtn-feedback {
  opacity: 0.7;
  font-size: 11px !important;
  letter-spacing: 4px !important;
}
.mbtn-feedback:hover { opacity: 1; }

/* ── AUTH UI ─────────────────────────────────────────────────────────────── */
.auth-btn-wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-top: 1.8rem; flex-wrap: wrap;
}
.auth-btn {
  background: transparent;
  border: 0.5px solid rgba(201,169,110,0.35);
  color: #d0c0a0;
  font-family: 'Raleway', sans-serif; font-size: 10px;
  letter-spacing: 3px; text-transform: uppercase;
  padding: 10px 18px; cursor: pointer;
  transition: all 0.3s; display: flex; align-items: center; gap: 8px;
}
.auth-btn:hover { border-color: rgba(201,169,110,0.65); color: #f0e0c0; background: rgba(201,169,110,0.05); }
.auth-btn-out { border-color: rgba(201,169,110,0.2); color: rgba(201,169,110,0.45); font-size: 9px; padding: 7px 14px; }
.auth-btn-out:hover { border-color: rgba(201,169,110,0.4); color: rgba(201,169,110,0.75); }
.google-icon { width: 16px; height: 16px; }
.auth-avatar { width: 26px; height: 26px; border-radius: 50%; border: 0.5px solid rgba(201,169,110,0.3); }
.auth-name { font-family: 'Raleway', sans-serif; font-size: 10px; letter-spacing: 2px; color: rgba(201,169,110,0.65); }
.auth-sync-dot { font-size: 10px; color: rgba(201,169,110,0.55); }

@media (max-width: 500px) {
  /* Title screen: top-aligned on mobile, scrollable when content overflows */
  #s-title {
    justify-content: flex-start;
    padding-top: 12vh;
    overflow-y: auto;
    padding-bottom: 1.6rem;
  }
  #s-title .title-footer {
    position: static;
    margin-top: auto;
    padding-top: 1.6rem;
  }
  .cgrid { grid-template-columns: 1fr 1fr; }
  .reading-area { padding: 0 1.2rem 4rem; }
  .ch-header-fixed { padding: 1rem 1.2rem 0.8rem; }
  .cnav { flex-wrap: wrap; }
  .ctab { font-size: 9px; padding: 8px 10px; letter-spacing: 2px; }
  .ptab { padding: 9px 12px; font-size: 9px; letter-spacing: 1.5px; }

  /* Background images: GPU-accelerate for smooth mobile scrolling */
  #scene-bg {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: background-image;
  }

  /* Slightly heavier overlays on mobile for better readability */
  body[data-scene="stories"] #scene-bg::before,
  body[data-scene="codex"] #scene-bg::before {
    background: rgba(13,10,9,0.95);
  }
  body[data-scene="hyunjae"] #scene-bg::before,
  body[data-scene="reine"] #scene-bg::before,
  body[data-scene="liuyan"] #scene-bg::before {
    background: rgba(13,10,9,0.93);
  }

  /* Cards: stronger backdrop on smaller screens */
  .ccard {
    background: rgba(13,10,9,0.75);
  }
  .centry {
    background: rgba(13,10,9,0.72);
  }

  /* Menu buttons: slightly more opaque on mobile */
  .mbtn {
    background: rgba(13,10,9,0.45);
  }

  /* Prologue & reader choice buttons: dark backdrop on mobile */
  .pcbtn {
    background: rgba(13,10,9,0.45);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  }
  .choice-btn-r {
    background: rgba(13,10,9,0.4);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  }
}

/* ── MUSIC CONTROLS ────────────────────────────────────────────────────── */
.music-controls { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.music-mute-btn { min-width: 4.5rem; }
.volume-row { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 120px; }
.vol-label { font-family: 'Crimson Pro', serif; font-size: 0.85rem; color: var(--muted); }
.vol-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
.vol-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
.vol-slider:disabled { opacity: 0.3; cursor: not-allowed; }


/* ── FEEDBACK SCREENSHOT STATUS ────────────────────────────────────────── */
.fb-screenshot-status {
  font-family: 'Raleway', sans-serif;
  font-size: 10px;
  letter-spacing: 1px;
  color: rgba(184,150,96,0.5);
  text-align: center;
  margin-top: 0.6rem;
}


/* ── READER FEEDBACK BUTTON ────────────────────────────────────────────── */
.ch-header-icons {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.ch-header-icons .gear-btn-inline {
  width: 32px;
  height: 32px;
}
.ch-header-icons .gear-icon {
  width: 22px;
  height: 22px;
}

/* ── TITLE CLEAR DATA BUTTON ───────────────────────────────────────────── */
.title-clear-btn {
  background: transparent;
  border: none;
  font-family: 'Raleway', sans-serif;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(210,130,110,0.3);
  cursor: pointer;
  margin-top: 0.8rem;
  padding: 4px 8px;
  transition: color 0.3s;
}
.title-clear-btn:hover { color: rgba(210,130,110,0.65); }
