/* EDURA Kickstarter Series – notes site */
@font-face {
  font-family: "Cinzel";
  src: url("/fonts/Cinzel-Variable.woff2") format("woff2");
  font-weight: 400 900; font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("/fonts/Montserrat-Variable.woff2") format("woff2");
  font-weight: 100 900; font-display: swap;
}

:root {
  --bg: #031412;
  --bg-2: #062521;
  --panel: rgba(10, 46, 41, 0.55);
  --panel-2: rgba(255, 255, 255, 0.035);
  --line: rgba(160, 230, 205, 0.12);
  --line-gold: rgba(232, 196, 108, 0.35);
  --emerald: #10b981;
  --emerald-2: #34d399;
  --teal: #14b8a6;
  --gold: #e8c46c;
  --gold-2: #f6dc94;
  --gold-3: #b8923b;
  --ink: #eaf6f1;
  --muted: #9fc4b9;
  --dim: #6e958b;
  --radius: 18px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.7);
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --ui: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--ui); font-size: 16px; line-height: 1.55;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 10px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: #1a1405; padding: 8px 14px; border-radius: 10px; z-index: 100; font-weight: 700; }
.skip:focus { left: 12px; }

/* --- starfield --- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(20, 184, 166, 0.16), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(16, 185, 129, 0.10), transparent 60%),
    radial-gradient(1000px 800px at 50% 120%, rgba(232, 196, 108, 0.06), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, #041b18 45%, var(--bg) 100%);
}
.stars { position: absolute; inset: -50%; background-repeat: repeat; opacity: .55; }
.stars.s1 {
  background-image:
    radial-gradient(1px 1px at 20px 30px, #fff, transparent 60%),
    radial-gradient(1px 1px at 120px 80px, #cfe, transparent 60%),
    radial-gradient(1.5px 1.5px at 200px 160px, #fff, transparent 60%),
    radial-gradient(1px 1px at 260px 40px, #def, transparent 60%),
    radial-gradient(1px 1px at 60px 210px, #fff, transparent 60%),
    radial-gradient(1.2px 1.2px at 330px 250px, #fea, transparent 60%);
  background-size: 360px 300px;
  animation: drift 160s linear infinite;
}
.stars.s2 {
  background-image:
    radial-gradient(1px 1px at 50px 90px, #9fe, transparent 60%),
    radial-gradient(1px 1px at 300px 20px, #fff, transparent 60%),
    radial-gradient(1.6px 1.6px at 420px 300px, #fff, transparent 60%),
    radial-gradient(1px 1px at 180px 380px, #cfe, transparent 60%);
  background-size: 520px 460px; opacity: .35;
  animation: drift 260s linear infinite reverse;
}
.orbit {
  position: absolute; width: 1400px; height: 1400px; right: -700px; top: 260px; border-radius: 50%;
  border: 1px solid rgba(232, 196, 108, 0.07);
  box-shadow: inset 0 0 0 120px rgba(16, 185, 129, 0.015), 0 0 0 220px rgba(16, 185, 129, 0.012);
}
@keyframes drift { to { transform: translate3d(180px, 120px, 0); } }
@media (prefers-reduced-motion: reduce) { .stars { animation: none; } html { scroll-behavior: auto; } }

/* --- top bar --- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px clamp(16px, 4vw, 40px); padding-top: max(12px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(3, 20, 18, 0.92), rgba(3, 20, 18, 0.72));
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand img { width: 40px; height: 40px; filter: drop-shadow(0 0 10px rgba(16, 185, 129, .35)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-family: var(--display); font-weight: 700; letter-spacing: .14em; font-size: 1.12rem; }
.brand-text small { color: var(--gold); font-size: .66rem; letter-spacing: .28em; text-transform: uppercase; font-weight: 600; margin-top: 3px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.class-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: rgba(232, 196, 108, 0.08); border: 1px solid var(--line-gold); color: var(--gold-2); font-weight: 600; font-size: .86rem;
  transition: background .2s, transform .2s;
}
.class-pill svg { width: 16px; height: 16px; }
.class-pill:hover { background: rgba(232, 196, 108, 0.16); }
.account { display: flex; align-items: center; min-height: 40px; }
.gsi-slot { min-height: 0; }
.user { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; }
.user-btn img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--bg-2); }
.user-btn span { max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: .88rem; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 12px; border-radius: 14px;
  background: #072723; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.user-email { margin: 0 0 10px; color: var(--muted); font-size: .8rem; word-break: break-all; }
.user-menu button { width: 100%; text-align: left; padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); font-weight: 600; }
.user-menu button:hover { background: rgba(255, 255, 255, .1); }

/* --- hero / landing --- */
.hero { position: relative; overflow: hidden; min-height: calc(100vh - 66px); display: flex; align-items: center; }
.hero.compact { min-height: 0; }
.hero-art { position: absolute; inset: 0; z-index: 0; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: 70% 40%; opacity: .78; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background:
    linear-gradient(90deg, rgba(3, 20, 18, .96) 0%, rgba(3, 20, 18, .82) 38%, rgba(3, 20, 18, .25) 75%, rgba(3, 20, 18, .45) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 30%);
}
.hero-inner { position: relative; z-index: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: clamp(40px, 8vh, 96px) clamp(18px, 4vw, 40px) clamp(48px, 8vh, 90px); }
.kicker {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 22px; padding: 7px 16px 7px 12px; border-radius: 999px;
  border: 1.5px solid var(--gold); color: var(--gold-2); text-transform: uppercase; letter-spacing: .22em; font-weight: 700; font-size: .74rem;
  background: rgba(232, 196, 108, 0.07); box-shadow: 0 0 24px -6px rgba(232, 196, 108, .45);
}
.kicker svg { width: 16px; height: 16px; color: var(--gold); transform: rotate(35deg); }
.hero h1 {
  font-family: var(--display); font-weight: 700; margin: 0; line-height: 1.02; letter-spacing: .02em;
  font-size: clamp(2.5rem, 6.4vw, 5rem);
  background: linear-gradient(180deg, #fff 30%, #cfeee3 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(16, 185, 129, .15);
}
.hero h1 span {
  display: block; font-size: .52em; margin-top: .25em; letter-spacing: .06em;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 55%, var(--gold-3)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { max-width: 540px; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.12rem); margin: 18px 0 0; }
.picker { margin-top: clamp(28px, 5vh, 48px); max-width: 720px; }
.picker-q { font-family: var(--display); font-weight: 600; font-size: clamp(1.25rem, 2.4vw, 1.6rem); margin: 0 0 16px; letter-spacing: .04em; }
.picker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.class-card {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 18px; align-items: center; text-align: left;
  padding: 22px 22px 20px; border-radius: 22px; min-height: 150px; overflow: hidden;
  background: linear-gradient(160deg, rgba(16, 185, 129, .14), rgba(6, 37, 33, .7) 60%);
  border: 1px solid rgba(160, 230, 205, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), var(--shadow);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform .25s ease, border-color .25s, box-shadow .25s;
}
.class-card::before {
  content: ""; position: absolute; width: 220px; height: 220px; right: -90px; top: -90px; border-radius: 50%;
  border: 1px dashed rgba(232, 196, 108, .25); transition: transform .6s ease;
}
.class-card:hover, .class-card:focus-visible { transform: translateY(-4px); border-color: var(--line-gold); box-shadow: 0 24px 60px -20px rgba(16, 185, 129, .45); }
.class-card:hover::before { transform: rotate(60deg) scale(1.08); }
.class-card.is-current { border-color: var(--gold); }
.cc-num {
  grid-row: 1 / 4; font-family: var(--display); font-weight: 800; font-size: 3.6rem; line-height: 1;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 60%, var(--gold-3)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cc-label { font-weight: 700; font-size: 1.25rem; }
.cc-sub { color: var(--muted); font-size: .86rem; line-height: 1.4; margin-top: 2px; }
.cc-go { color: var(--gold); font-weight: 700; font-size: .85rem; margin-top: 10px; letter-spacing: .04em; }

/* --- library --- */
.library { max-width: 1180px; margin: 0 auto; padding: clamp(28px, 5vw, 48px) clamp(16px, 4vw, 40px) 72px; }
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { margin: 0 0 6px; color: var(--gold); letter-spacing: .2em; text-transform: uppercase; font-size: .72rem; font-weight: 700; }
.lib-head h2 { font-family: var(--display); font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 0; letter-spacing: .03em; }
.link-btn { background: none; border: 0; color: var(--emerald-2); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; padding: 6px 2px; }
.link-btn:hover { color: var(--gold-2); }
.tabs {
  display: inline-flex; gap: 4px; padding: 5px; border-radius: 999px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
  margin-bottom: 18px; max-width: 100%; overflow-x: auto;
}
.tabs [role="tab"] {
  border: 0; background: transparent; color: var(--muted); padding: 10px 22px; border-radius: 999px; font-weight: 600; font-size: .95rem; white-space: nowrap;
  transition: background .2s, color .2s;
}
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] {
  color: #10241f; background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 6px 18px -6px rgba(232, 196, 108, .6);
}
.panel:focus-visible { outline-offset: 6px; }
.stat { color: var(--dim); font-size: .86rem; margin: 0 0 14px; }
.chapters { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.ch {
  position: relative; display: flex; gap: 16px; align-items: center; padding: 16px 18px; border-radius: var(--radius);
  background: var(--panel-2); border: 1px solid var(--line); min-height: 86px;
}
.ch-num {
  flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; color: var(--dim); background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
}
.ch-body { flex: 1; min-width: 0; }
.ch-title { margin: 0; font-weight: 600; font-size: 1rem; line-height: 1.3; }
.ch-meta { margin: 4px 0 0; font-size: .8rem; color: var(--dim); display: flex; align-items: center; gap: 6px; }
.soon {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 600; letter-spacing: .06em;
  color: var(--muted); background: rgba(255, 255, 255, .04); border: 1px dashed rgba(160, 230, 205, .22); text-transform: uppercase;
}
.soon svg { width: 12px; height: 12px; opacity: .8; }
.ch.available {
  grid-column: 1 / -1; padding: 18px; gap: 22px; align-items: stretch;
  background: linear-gradient(135deg, rgba(16, 185, 129, .16), rgba(6, 37, 33, .65) 55%, rgba(232, 196, 108, .07));
  border-color: var(--line-gold); box-shadow: var(--shadow);
}
.ch.available .ch-num { color: #10241f; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border: 0; }
.ch-thumb {
  flex: none; width: 128px; aspect-ratio: 210 / 297; border-radius: 10px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .8); transform: rotate(-2deg); background: #0a2e29; padding: 0; cursor: zoom-in;
  transition: transform .3s;
}
.ch-thumb:hover { transform: rotate(0) scale(1.03); }
.ch-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ch.available .ch-body { display: flex; flex-direction: column; justify-content: center; }
.ch.available .ch-title { font-family: var(--display); font-size: clamp(1.3rem, 2.4vw, 1.75rem); letter-spacing: .02em; }
.ch-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--emerald-2); font-weight: 700; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 6px; }
.ch-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--emerald-2); box-shadow: 0 0 10px var(--emerald-2); }
.ch-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.ch-note { margin: 10px 0 0; font-size: .78rem; color: var(--dim); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: .92rem;
  border: 1px solid transparent; text-decoration: none; transition: transform .15s, box-shadow .2s, background .2s; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn-gold { color: #14200f; background: linear-gradient(180deg, var(--gold-2), var(--gold) 60%, #d6ae52); box-shadow: 0 10px 24px -10px rgba(232, 196, 108, .7), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn-gold:hover { box-shadow: 0 14px 30px -10px rgba(232, 196, 108, .9), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn-ghost { color: var(--ink); background: rgba(255, 255, 255, .05); border-color: rgba(160, 230, 205, .25); }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); border-color: var(--line-gold); }
.btn[aria-busy="true"] { opacity: .8; cursor: progress; }
.btn-sm { padding: 8px 14px; font-size: .84rem; }
.lock { font-size: .7rem; font-weight: 600; opacity: .75; }

/* --- footer --- */
.footer { border-top: 1px solid var(--line); background: rgba(2, 14, 12, .6); padding: 28px clamp(16px, 4vw, 40px) calc(24px + env(safe-area-inset-bottom)); }
.foot-inner { max-width: 1180px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 20px 40px; justify-content: space-between; align-items: center; }
.foot-brand { display: flex; gap: 12px; align-items: center; }
.foot-brand strong { font-family: var(--display); letter-spacing: .06em; }
.foot-brand p, .foot-yt p { margin: 2px 0; color: var(--muted); font-size: .88rem; }
.foot-yt strong { color: var(--ink); }
.yt-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: #ff3d3d; margin-right: 8px; box-shadow: 0 0 10px rgba(255, 61, 61, .6); }
.fine { max-width: 1180px; margin: 18px auto 0; color: var(--dim); font-size: .76rem; }

/* (reader, modal, toast styles: see the v6 section at the end of this file) */
/* --- responsive --- */
@media (max-width: 760px) {
  .brand-text small { letter-spacing: .18em; }
  .hero { min-height: auto; }
  .hero-art img { object-position: 78% 30%; opacity: .55; }
  .hero::after { background: linear-gradient(180deg, rgba(3, 20, 18, .7) 0%, rgba(3, 20, 18, .9) 55%, var(--bg) 100%); }
  .picker-grid { grid-template-columns: 1fr; }
  .class-card { min-height: 0; padding: 18px; }
  .cc-num { font-size: 3rem; }
  .chapters { grid-template-columns: 1fr; }
  .ch.available { flex-direction: column; align-items: flex-start; }
  .ch.available .ch-num { position: absolute; top: 16px; right: 16px; }
  .ch-thumb { width: 112px; }
  .ch-actions .btn { flex: 1; }
}
@media (max-width: 420px) {
  .brand-text small { display: none; }
  .class-pill { padding: 7px 10px; font-size: .8rem; }
  .tabs [role="tab"] { padding: 9px 14px; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.foot-links { max-width: 1180px; margin: 18px auto 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.foot-links a { color: var(--muted); font-size: .84rem; font-weight: 600; text-decoration: none; }
.foot-links a:hover, .foot-links a:focus-visible { color: var(--gold-2); text-decoration: underline; text-underline-offset: 4px; }
/* legal pages */
.legal { max-width: 820px; margin: 0 auto; padding: clamp(32px, 6vw, 64px) clamp(18px, 4vw, 40px) 72px; }
.legal h1 { font-family: var(--display); font-size: clamp(2rem, 5vw, 2.8rem); margin: 0 0 6px; letter-spacing: .03em; }
.legal .updated { color: var(--dim); font-size: .85rem; margin: 0 0 28px; }
.legal-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 4vw, 36px); }
.legal h2 { font-family: var(--display); font-size: 1.2rem; color: var(--gold-2); margin: 28px 0 8px; letter-spacing: .03em; }
.legal h2:first-child { margin-top: 0; }
.legal p, .legal li { color: #cfe3dc; }
.legal ul { padding-left: 1.2em; }
.legal li { margin: 4px 0; }
.legal a:not(.btn) { color: var(--emerald-2); text-underline-offset: 3px; }
.legal .back { display: inline-flex; margin-top: 28px; }
.highlight { border-left: 3px solid var(--gold); padding: 10px 16px; background: rgba(232,196,108,.06); border-radius: 0 12px 12px 0; }

/* --- class launch ("coming soon") state --- */
.launch {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(220px, 0.8fr) 1.2fr; align-items: center; gap: clamp(16px, 4vw, 48px);
  min-height: 520px; padding: clamp(28px, 5vw, 56px); border-radius: 28px;
  background:
    radial-gradient(600px 400px at 20% 60%, rgba(16, 185, 129, .20), transparent 70%),
    radial-gradient(500px 360px at 95% 0%, rgba(232, 196, 108, .10), transparent 70%),
    linear-gradient(160deg, rgba(10, 52, 46, .85), rgba(3, 20, 18, .9));
  border: 1px solid var(--line-gold); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.launch::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .7;
  background-image:
    radial-gradient(1px 1px at 30px 40px, #fff, transparent 60%), radial-gradient(1.4px 1.4px at 160px 120px, #fea, transparent 60%),
    radial-gradient(1px 1px at 260px 60px, #cfe, transparent 60%), radial-gradient(1px 1px at 90px 200px, #fff, transparent 60%);
  background-size: 300px 240px;
}
.launch-sky { position: relative; height: 420px; display: grid; place-items: center; }
.ring { position: absolute; border-radius: 50%; border: 1px dashed rgba(232, 196, 108, .28); }
.ring.r1 { width: 220px; height: 220px; animation: spinr 40s linear infinite; }
.ring.r2 { width: 320px; height: 320px; border-color: rgba(160, 230, 205, .16); animation: spinr 70s linear infinite reverse; }
.ring.r3 { width: 420px; height: 420px; border-style: solid; border-color: rgba(160, 230, 205, .06); }
.ring.r1::after { content: ""; position: absolute; top: -5px; left: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 14px var(--gold); }
.ring.r2::after { content: ""; position: absolute; bottom: 30px; right: 20px; width: 7px; height: 7px; border-radius: 50%; background: var(--emerald-2); box-shadow: 0 0 12px var(--emerald-2); }
.planet { position: absolute; width: 90px; height: 90px; right: 6%; bottom: 8%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5eead4, #0f766e 55%, #042f2e); box-shadow: 0 0 40px rgba(20, 184, 166, .35); opacity: .85; }
.launch-rocket { position: relative; width: 120px; height: 220px; filter: drop-shadow(0 0 24px rgba(16, 185, 129, .35)); animation: hover 4s ease-in-out infinite; transform: rotate(8deg); }
.launch-rocket .flame { transform-origin: 60px 150px; animation: flicker .18s ease-in-out infinite alternate; }
@keyframes spinr { to { transform: rotate(360deg); } }
@keyframes hover { 0%, 100% { transform: translateY(0) rotate(8deg); } 50% { transform: translateY(-12px) rotate(8deg); } }
@keyframes flicker { from { transform: scaleY(.85); opacity: .85; } to { transform: scaleY(1.1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ring, .launch-rocket, .launch-rocket .flame { animation: none; } }
.launch-body { position: relative; z-index: 1; }
.launch-body h3 { font-family: var(--display); font-size: clamp(1.9rem, 4.2vw, 3rem); line-height: 1.08; margin: 0 0 16px; letter-spacing: .02em; }
.launch-body h3 span { display: block;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 55%, var(--gold-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.launch-text { color: var(--muted); max-width: 520px; margin: 0 0 22px; }
.launch-subjects { list-style: none; padding: 0; margin: 0 0 26px; display: flex; flex-wrap: wrap; gap: 10px; }
.launch-subjects li { display: flex; flex-direction: column; padding: 10px 16px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px dashed rgba(160, 230, 205, .22); min-width: 120px; }
.launch-subjects span { font-weight: 700; }
.launch-subjects small { color: var(--dim); font-size: .78rem; }
.launch-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.launch-note { color: var(--dim); font-size: .8rem; margin: 18px 0 0; }
@media (max-width: 760px) {
  .launch { grid-template-columns: 1fr; min-height: 0; text-align: left; }
  .launch-sky { height: 240px; }
  .ring.r3 { display: none; } .ring.r2 { width: 240px; height: 240px; } .ring.r1 { width: 170px; height: 170px; }
  .launch-rocket { width: 84px; height: 154px; }
  .planet { width: 60px; height: 60px; }
  .launch-actions .btn { width: 100%; }
}

/* ======================================================================
   v6 – YouTube links, account area, sign-in modal, reader, EDURA AI chat
   ====================================================================== */

/* --- YouTube --- */
.yt-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px 0 11px; border-radius: 999px; text-decoration: none;
  color: var(--ink); font-weight: 600; font-size: .86rem; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); transition: background .2s, border-color .2s;
}
.yt-pill svg { width: 22px; height: 22px; }
.yt-pill:hover { background: rgba(255, 0, 51, .1); border-color: rgba(255, 80, 100, .4); }
.yt-link { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(232, 196, 108, .4); }
.yt-link:hover { color: var(--gold-2); }
.launch-text a { color: var(--gold-2); text-underline-offset: 3px; }
.btn-yt { margin-top: 10px; color: #fff; background: linear-gradient(180deg, #ff2950, #d4002a); box-shadow: 0 10px 24px -12px rgba(255, 0, 51, .8); }
.btn-yt:hover { filter: brightness(1.08); }

/* --- account (header) --- */
.account { position: relative; display: flex; align-items: center; min-height: 40px; }
.signin-wrap { position: relative; display: flex; align-items: center; min-height: 40px; }
.gsi-slot { display: flex; align-items: center; min-height: 40px; border-radius: 999px; }
.gsi-slot iframe { border-radius: 999px; }
/* match the GIS iframe's light scheme so Chrome keeps it transparent (no white box) */
.gsi-slot, .gsi-modal-slot { color-scheme: light; }
.gsi-skeleton { display: none; width: 196px; height: 40px; border-radius: 999px; background: linear-gradient(90deg, rgba(255,255,255,.05) 0%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.05) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border: 1px solid var(--line); }
.account[data-state="loading"] .gsi-skeleton { display: block; }
.account[data-state="loading"] .gsi-slot { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
@keyframes shimmer { to { background-position: -200% 0; } }
/* Google-branded fallback button (Google brand guidelines: white/dark surface, 4-colour G, Roboto-like label) */
.g-btn {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px 0 4px; border-radius: 999px;
  background: #131314; color: #e3e3e3; border: 1px solid #8e918f; font: 500 14px/1 Roboto, var(--ui); letter-spacing: .01em;
}
.g-btn:hover { background: #1f1f20; }
.g-logo { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #fff; }
.g-logo svg { width: 18px; height: 18px; }
.user { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 3px 10px 3px 3px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); transition: background .2s, border-color .2s;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .1); border-color: var(--line-gold); }
.user-first { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: .88rem; }
.user-btn .chev { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
.user-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.avatar { position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--emerald), #0f766e); box-shadow: 0 0 0 2px rgba(232, 196, 108, .55); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.avatar.has-img img { opacity: 1; }
.avatar-initial { font-weight: 800; font-size: .95rem; color: #fff; }
.avatar-lg { width: 48px; height: 48px; }
.avatar-lg .avatar-initial { font-size: 1.3rem; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 10px); width: 300px; max-width: calc(100vw - 24px); padding: 8px; border-radius: 18px; z-index: 40;
  background: linear-gradient(170deg, #0a332d, #061f1b); border: 1px solid var(--line-gold); box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .9);
  animation: pop .16s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.um-head { display: flex; align-items: center; gap: 12px; padding: 12px 10px 10px; }
.um-id { min-width: 0; }
.um-name { margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.um-email { margin: 2px 0 0; color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.um-badge { display: flex; align-items: center; gap: 8px; margin: 0 6px 8px; padding: 8px 10px; border-radius: 10px; font-size: .74rem; color: var(--emerald-2); background: rgba(16, 185, 129, .1); border: 1px solid rgba(52, 211, 153, .2); font-weight: 600; }
.g-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald-2); box-shadow: 0 0 8px var(--emerald-2); flex: none; }
.um-items { border-top: 1px solid var(--line); padding-top: 6px; display: grid; gap: 2px; }
.um-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; background: none; border: 0; color: var(--ink); font-weight: 600; font-size: .9rem; text-decoration: none; text-align: left; }
.um-item svg { width: 18px; height: 18px; color: var(--muted); }
.um-item:hover, .um-item:focus-visible { background: rgba(255, 255, 255, .07); outline-offset: -2px; }
.um-signout:hover svg { color: #ff8a8a; }

/* --- sign-in modal --- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(1, 10, 9, .74); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal-card {
  position: relative; width: min(440px, 100%); text-align: center; padding: 34px 28px 22px; border-radius: 26px;
  background: radial-gradient(420px 220px at 50% -10%, rgba(16, 185, 129, .22), transparent 70%), linear-gradient(170deg, #0b3a33, #052520 65%);
  border: 1px solid var(--line-gold); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .06);
  animation: pop .2s ease-out;
}
.mc-logo { width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: rgba(3, 20, 18, .6); border: 1px solid var(--line-gold); box-shadow: 0 0 30px -6px rgba(16, 185, 129, .6); }
.mc-logo img { filter: drop-shadow(0 0 10px rgba(16, 185, 129, .5)); }
.modal-card h2 { font-family: var(--display); margin: 0 0 8px; font-size: 1.5rem; letter-spacing: .02em; }
.mc-text { color: var(--muted); margin: 0 0 14px; font-size: .93rem; }
.mc-chapter svg { width: 15px; height: 15px; flex: none; }
.mc-chapter { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 14px; padding: 7px 12px; border-radius: 10px; font-size: .82rem; font-weight: 600; color: var(--gold-2); background: rgba(232, 196, 108, .08); border: 1px solid var(--line-gold); }
.mc-free { display: flex; align-items: center; gap: 10px; text-align: left; margin: 0 0 18px; padding: 10px 14px; border-radius: 14px; background: rgba(16, 185, 129, .1); border: 1px solid rgba(52, 211, 153, .22); font-size: .85rem; color: #cfeee3; }
.mc-free svg { width: 22px; height: 22px; flex: none; color: var(--emerald-2); }
.mc-free strong { color: var(--emerald-2); }
.gsi-box { display: grid; place-items: center; min-height: 66px; padding: 11px; border-radius: 18px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(160, 230, 205, .18); }
.gsi-modal-slot { display: flex; justify-content: center; min-height: 44px; width: 100%; }
.gsi-modal-slot:empty { display: none; }
.gsi-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .88rem; font-weight: 600; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(16, 185, 129, .25); border-top-color: var(--emerald); animation: spin .8s linear infinite; }
.modal-card[data-state="error"] .gsi-box { display: none; }
.mc-error { margin-top: 4px; padding: 14px; border-radius: 14px; background: rgba(255, 90, 90, .08); border: 1px solid rgba(255, 120, 120, .35); }
.mc-error p { margin: 0 0 10px; color: #ffd1d1; font-size: .86rem; }
.mc-points { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 6px; text-align: left; }
.mc-points li { position: relative; padding-left: 22px; color: var(--muted); font-size: .8rem; }
.mc-points li::before { content: ""; position: absolute; left: 4px; top: .45em; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--gold); }
.mc-legal { margin: 14px 0 0; color: var(--dim); font-size: .74rem; }
.mc-legal a { color: var(--emerald-2); }
.modal-x { position: absolute; top: 12px; right: 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90;
  padding: 12px 18px; border-radius: 14px; background: #0b3a33; border: 1px solid var(--line-gold); box-shadow: var(--shadow); font-weight: 600; font-size: .9rem; max-width: calc(100% - 32px);
  animation: pop .18s ease-out;
}
body.reader-open .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

/* --- library: reading progress --- */
.ch-progress { height: 5px; max-width: 280px; margin-top: 10px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.ch-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--emerald), var(--gold)); border-radius: inherit; }

/* --- reader --- */
.reader {
  --r-bg: #07100e; --r-bar: rgba(3, 20, 18, .86); --r-ink: var(--ink); --r-muted: var(--muted); --r-line: rgba(160, 230, 205, .14); --r-btn: rgba(255, 255, 255, .06); --r-btn-h: rgba(255, 255, 255, .12); --r-accent: var(--gold);
  position: fixed; inset: 0; z-index: 60; color: var(--r-ink); background: var(--r-bg); overflow: hidden;
}
.reader[data-bg="dark"] { background: radial-gradient(1000px 600px at 50% -10%, rgba(16, 185, 129, .09), transparent 70%), var(--r-bg); }
.reader[data-bg="sepia"] { --r-bg: #e8dcc0; --r-bar: rgba(244, 235, 212, .92); --r-ink: #3a2e18; --r-muted: #6f5d3c; --r-line: rgba(90, 70, 30, .18); --r-btn: rgba(90, 70, 30, .07); --r-btn-h: rgba(90, 70, 30, .14); --r-accent: #9a6b12; }
.reader[data-bg="light"] { --r-bg: #e9eeec; --r-bar: rgba(255, 255, 255, .92); --r-ink: #10241f; --r-muted: #4c6660; --r-line: rgba(16, 36, 31, .12); --r-btn: rgba(16, 36, 31, .05); --r-btn-h: rgba(16, 36, 31, .1); --r-accent: #0f766e; }
.r-bar {
  position: absolute; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 10px; color: var(--r-ink);
  background: var(--r-bar); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition: transform .28s ease, opacity .28s ease;
}
.r-top { top: 0; padding: 8px clamp(8px, 2vw, 18px); padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 1px solid var(--r-line); }
.r-foot { bottom: 0; padding: 8px clamp(10px, 3vw, 22px); padding-bottom: max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--r-line); gap: 14px; }
.reader.chrome-hidden .r-top { transform: translateY(-105%); opacity: 0; }
.reader.chrome-hidden .r-foot { transform: translateY(105%); opacity: 0; }
.reader.chrome-hidden .nav-btn { opacity: 0; pointer-events: none; }
.reader.chrome-hidden { cursor: none; }
.reader.chrome-hidden .r-thumbs { cursor: auto; }
.r-title { flex: 1; min-width: 0; }
.r-eyebrow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; color: var(--r-accent); font-size: .64rem; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; }
.r-title h2 { margin: 0; font-family: var(--display); font-size: clamp(.95rem, 1.8vw, 1.15rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-tools { display: flex; align-items: center; gap: 6px; }
.reader .icon-btn { color: var(--r-ink); background: var(--r-btn); border-color: var(--r-line); }
.reader .icon-btn:hover, .reader .icon-btn.on { background: var(--r-btn-h); }
.reader .icon-btn.on { border-color: var(--r-accent); }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); flex: none; color: inherit;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: rgba(255, 255, 255, .1); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.r-ai img { width: 24px; height: 24px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--r-btn); border: 1px solid var(--r-line); }
.seg-btn { display: grid; place-items: center; min-width: 34px; height: 32px; padding: 0 8px; border: 0; border-radius: 9px; background: none; color: var(--r-muted); font-weight: 600; font-size: .82rem; }
.seg-btn svg { width: 18px; height: 18px; }
.seg-btn[aria-pressed="true"] { background: var(--r-accent); color: #10241f; }
.reader[data-bg="light"] .seg-btn[aria-pressed="true"], .reader[data-bg="sepia"] .seg-btn[aria-pressed="true"] { color: #fff; }
.zoom-grp { display: inline-flex; align-items: center; gap: 2px; }
.zoom-val { min-width: 58px; height: 40px; border-radius: 12px; border: 1px solid var(--r-line, var(--line)); background: transparent; font-weight: 700; font-size: .8rem; color: var(--r-muted, var(--muted)); font-variant-numeric: tabular-nums; }
.r-body { position: absolute; inset: 0; display: flex; }
.r-stage { position: relative; flex: 1; min-width: 0; display: flex; }
.r-scroll {
  flex: 1; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch;
  padding: calc(66px + env(safe-area-inset-top)) 0 calc(68px + env(safe-area-inset-bottom)); scrollbar-color: rgba(128, 160, 150, .35) transparent; outline: none;
}
.r-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; width: max-content; min-width: 100%; padding: 12px 12px 0; box-sizing: border-box; }
.reader[data-mode="single"] .r-page:not(.current) { display: none; }
.r-page {
  position: relative; flex: none; background: #fff; border-radius: 4px; overflow: hidden;
  box-shadow: 0 22px 60px -26px rgba(0, 0, 0, .85), 0 0 0 1px rgba(0, 0, 0, .06); contain: layout paint;
}
.reader[data-bg="dark"] .r-page { box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .95), 0 0 0 1px rgba(255, 255, 255, .06); }
.r-page img { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; opacity: 0; transition: opacity .25s; }
.r-page.loaded img { opacity: 1; }
.r-page.loaded .r-spin { display: none; }
.r-page.failed::after { content: "Couldn't load this page – check your connection"; position: absolute; inset: 0; display: grid; place-items: center; color: #555; font-size: .85rem; padding: 20px; text-align: center; }
.r-spin { position: absolute; inset: 0; margin: auto; width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(16, 185, 129, .2); border-top-color: var(--emerald); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center; background: var(--r-bar); border: 1px solid var(--r-line); color: var(--r-ink); backdrop-filter: blur(8px);
  transition: background .2s, opacity .28s; box-shadow: 0 10px 30px -14px rgba(0, 0, 0, .7);
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn:hover { background: var(--r-btn-h); }
.nav-btn:disabled { opacity: 0 !important; pointer-events: none; }
.nav-btn.prev { left: clamp(8px, 2vw, 24px); }
.nav-btn.next { right: clamp(8px, 2vw, 24px); }
.reader[data-mode="scroll"] .nav-btn { display: none; }
.r-jump { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--r-muted); }
.r-jump input { width: 3.2em; height: 34px; text-align: center; border-radius: 10px; border: 1px solid var(--r-line); background: var(--r-btn); color: var(--r-ink); font: inherit; font-weight: 700; }
.r-jump input:focus { outline: 2px solid var(--r-accent); outline-offset: 1px; }
#rSlider { flex: 1; min-width: 60px; accent-color: var(--r-accent); }
.r-hint { color: var(--r-muted); font-size: .74rem; white-space: nowrap; }
/* thumbnails */
.r-thumbs { flex: none; width: 150px; overflow-y: auto; padding: calc(70px + env(safe-area-inset-top)) 10px 76px 12px; background: var(--r-bar); border-right: 1px solid var(--r-line); z-index: 2; scrollbar-width: thin; }
.r-thumbs ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.r-thumbs button { position: relative; display: block; width: 100%; padding: 0; border: 2px solid transparent; border-radius: 6px; background: none; }
.r-thumbs img { width: 100%; height: auto; aspect-ratio: 1600 / 2263; object-fit: cover; border-radius: 4px; background: #fff; box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .6); }
.r-thumbs span { position: absolute; bottom: 4px; right: 4px; min-width: 22px; padding: 1px 6px; border-radius: 6px; font-size: .7rem; font-weight: 700; background: rgba(3, 20, 18, .8); color: #fff; }
.r-thumbs button[aria-current="page"] { border-color: var(--r-accent); }
.r-thumbs button[aria-current="page"] span { background: var(--r-accent); color: #10241f; }
/* view settings popover */
.r-view {
  position: absolute; z-index: 5; top: calc(60px + env(safe-area-inset-top)); right: clamp(8px, 2vw, 18px); width: 290px; max-height: calc(100% - 140px); overflow: auto;
  padding: 14px; border-radius: 18px; background: var(--r-bar); color: var(--r-ink); border: 1px solid var(--r-line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .8); animation: pop .16s ease-out;
}
.rv-label { margin: 10px 2px 6px; font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--r-muted); }
.rv-label:first-child { margin-top: 0; }
.seg-wide { display: flex; }
.seg-wide .seg-btn { flex: 1; }
.rv-zoom { display: flex; align-items: center; gap: 6px; }
.rv-zoom .zoom-val { flex: 1; }
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--r-line); background: var(--r-btn); color: var(--r-ink); font-size: .78rem; font-weight: 600; }
.swatch span { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(128, 128, 128, .4); }
.sw-dark span { background: #07100e; } .sw-sepia span { background: #e8dcc0; } .sw-light span { background: #e9eeec; }
.swatch[aria-checked="true"] { border-color: var(--r-accent); box-shadow: inset 0 0 0 1px var(--r-accent); }
.rv-row { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--r-line); background: var(--r-btn); color: var(--r-ink); font-weight: 600; font-size: .86rem; }
.rv-row svg { width: 18px; height: 18px; }
.rv-keys { margin-top: 12px; font-size: .8rem; }
.rv-keys summary { cursor: pointer; font-weight: 600; color: var(--r-muted); padding: 4px 2px; }
.rv-keys dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 2px 0; }
.rv-keys dt { font-weight: 700; font-family: ui-monospace, monospace; color: var(--r-accent); white-space: nowrap; }
.rv-keys dd { margin: 0; color: var(--r-muted); }
.r-mob { display: none; }

/* --- EDURA AI chat --- */
.chat-fab {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 55;
  display: flex; align-items: center; gap: 0; height: 62px; padding: 0 12px; border-radius: 999px; border: 0;
  background: radial-gradient(circle at 30% 25%, #1fd39b, #0b8f6a 55%, #064a3d); color: #fff;
  box-shadow: 0 18px 40px -14px rgba(16, 185, 129, .75), 0 0 0 2px var(--gold), 0 0 0 5px rgba(232, 196, 108, .18);
  transition: transform .2s ease, box-shadow .2s, gap .25s;
}
.chat-fab img { width: 38px; height: 38px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35)); }
.fab-label { max-width: 0; overflow: hidden; white-space: nowrap; font-weight: 700; font-size: .9rem; color: #fff8e1; transition: max-width .3s ease, margin .3s ease; }
.chat-fab:hover, .chat-fab:focus-visible { transform: translateY(-2px); }
.chat-fab:hover .fab-label, .chat-fab:focus-visible .fab-label { max-width: 140px; margin: 0 6px 0 8px; }
.fab-ring { position: absolute; inset: -5px; border-radius: inherit; border: 2px solid rgba(232, 196, 108, .55); animation: ring 2.8s ease-out infinite; pointer-events: none; }
@keyframes ring { 0% { transform: scale(.95); opacity: .9; } 80%, 100% { transform: scale(1.25); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fab-ring { animation: none; opacity: 0; } }
body.reader-open .chat-fab, body.chat-open .chat-fab { display: none; }
.chat {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 75;
  width: min(420px, calc(100vw - 36px)); height: min(680px, calc(100vh - 110px)); display: flex; flex-direction: column; overflow: hidden;
  border-radius: 24px; background: linear-gradient(175deg, #0a3029, #041a17 60%); border: 1px solid var(--line-gold);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .06); animation: pop .2s ease-out;
}
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--line); background: rgba(3, 20, 18, .55); }
.chat-head > img { filter: drop-shadow(0 0 8px rgba(16, 185, 129, .5)); }
.chat-id { flex: 1; min-width: 0; }
.chat-id h2 { margin: 0; font-family: var(--display); font-size: 1.02rem; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-id h2 span { color: var(--gold-2); }
.chat-id p { margin: 1px 0 0; display: flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--muted); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald-2); box-shadow: 0 0 8px var(--emerald-2); }
.chat-head .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
.chat-head .icon-btn svg { width: 18px; height: 18px; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; scrollbar-width: thin; }
.chat-log:focus-visible { outline-offset: -3px; }
.chat-welcome { text-align: center; padding: 8px 6px; }
.chat-welcome > img { margin: 0 auto 8px; filter: drop-shadow(0 0 12px rgba(16, 185, 129, .5)); }
.chat-welcome h3 { font-family: var(--display); margin: 0 0 6px; font-size: 1.2rem; }
.chat-welcome p { margin: 0 0 10px; color: var(--muted); font-size: .86rem; }
.cw-sub { font-size: .7rem !important; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--gold) !important; margin-top: 14px !important; }
.starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.starter { padding: 8px 12px; border-radius: 999px; border: 1px solid rgba(160, 230, 205, .22); background: rgba(255, 255, 255, .04); color: var(--ink); font-size: .8rem; font-weight: 600; text-align: left; transition: background .2s, border-color .2s; }
.starter:hover { background: rgba(232, 196, 108, .1); border-color: var(--line-gold); }
.cw-yt { margin-top: 16px !important; font-size: .78rem !important; }
.cw-yt a, .msg-b a { color: var(--gold-2); text-underline-offset: 3px; }
.msg { display: flex; gap: 8px; align-items: flex-start; max-width: 100%; }
.msg.me { justify-content: flex-end; }
.msg-av { flex: none; margin-top: 2px; border-radius: 50%; background: rgba(3, 20, 18, .7); padding: 2px; border: 1px solid var(--line-gold); }
.msg-b { position: relative; min-width: 0; max-width: 100%; padding: 10px 14px; border-radius: 16px; font-size: .9rem; line-height: 1.6; overflow-wrap: anywhere; }
.msg.me .msg-b { max-width: 85%; background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #14200f; border-bottom-right-radius: 6px; white-space: pre-wrap; font-weight: 500; }
.msg.ai .msg-b { flex: 1; background: rgba(255, 255, 255, .045); border: 1px solid var(--line); border-top-left-radius: 6px; }
.msg.err .msg-b { background: rgba(255, 90, 90, .08); border-color: rgba(255, 120, 120, .35); color: #ffd1d1; }
.msg-b p { margin: 0 0 8px; } .msg-b p:last-child { margin-bottom: 0; }
.msg-b h3, .msg-b h4 { font-family: var(--ui); font-size: .95rem; margin: 10px 0 6px; color: var(--gold-2); }
.msg-b ul, .msg-b ol { margin: 4px 0 8px; padding-left: 1.3em; }
.msg-b li { margin: 2px 0; }
.msg-b strong { color: #fff; }
.msg-b code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; padding: 1px 5px; border-radius: 5px; background: rgba(0, 0, 0, .3); }
.msg-b pre { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .35); overflow-x: auto; }
.msg-b pre code { padding: 0; background: none; }
.msg-b blockquote { margin: 6px 0; padding: 6px 12px; border-left: 3px solid var(--gold); background: rgba(232, 196, 108, .06); border-radius: 0 8px 8px 0; }
.msg-b hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.msg-b .tbl { overflow-x: auto; margin: 6px 0; }
.msg-b table { border-collapse: collapse; font-size: .84rem; }
.msg-b th, .msg-b td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; }
.msg-b th { background: rgba(255, 255, 255, .05); }
.math-d { overflow-x: auto; overflow-y: hidden; margin: 6px 0; padding: 2px 0; }
.msg-b .katex { font-size: 1.06em; }
.msg-b .katex-display { margin: .4em 0; }
.math-raw { font-family: ui-monospace, monospace; }
.msg-tools { display: flex; justify-content: flex-end; margin-top: 6px; }
.msg-copy { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: .72rem; font-weight: 600; opacity: .8; }
.msg-copy svg { width: 14px; height: 14px; }
.msg-copy:hover { opacity: 1; color: var(--ink); background: rgba(255, 255, 255, .06); }
.msg .retry { margin-top: 10px; }
.caret { display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--gold); border-radius: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald-2); animation: bounce 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.chat-form { display: flex; align-items: flex-end; gap: 8px; margin: 6px 12px 0; padding: 6px 6px 6px 14px; border-radius: 18px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(160, 230, 205, .22); }
.chat-form:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 196, 108, .15); }
.chat-form textarea { flex: 1; min-height: 24px; max-height: 140px; resize: none; border: 0; background: none; color: var(--ink); font: inherit; font-size: .92rem; line-height: 1.45; padding: 8px 0; outline: none; }
.chat-form textarea::placeholder { color: var(--dim); }
.chat-send { flex: none; width: 40px; height: 40px; border-radius: 12px; border: 0; display: grid; place-items: center; color: #14200f; background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 6px 16px -8px rgba(232, 196, 108, .8); }
.chat-send svg { width: 18px; height: 18px; }
.chat-stop { background: rgba(255, 255, 255, .12); color: var(--ink); box-shadow: none; }
.chat-disclaimer { margin: 6px 14px 10px; text-align: center; font-size: .68rem; color: var(--dim); }
.chat-disclaimer a { color: var(--muted); }

/* --- responsive (v6) --- */
@media (max-width: 900px) {
  .r-hint { display: none; }
}
@media (max-width: 760px) {
  .yt-pill span { display: none; }
  .yt-pill { width: 40px; padding: 0; justify-content: center; }
  .user-first, .user-btn .chev { display: none; }
  .user-btn { padding: 3px; }
  .gsi-skeleton { width: 96px; }
  .r-desk { display: none !important; }
  .r-top { gap: 6px; }
  .r-tools { gap: 4px; }
  #rDownload span { display: none; }
  #rDownload { width: 40px; height: 40px; padding: 0; }
  .reader .icon-btn { width: 38px; height: 38px; }
  .r-eyebrow { font-size: .58rem; letter-spacing: .14em; }
  .r-pages { gap: 10px; padding: 6px 6px 0; }
  .nav-btn { width: 44px; height: 44px; top: auto; bottom: calc(66px + env(safe-area-inset-bottom)); transform: none; }
  .r-thumbs { position: absolute; left: 0; right: 0; bottom: calc(52px + env(safe-area-inset-bottom)); width: auto; height: 150px; padding: 10px 12px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-top: 1px solid var(--r-line); z-index: 4; }
  .r-thumbs ol { grid-auto-flow: column; grid-auto-columns: 84px; gap: 10px; height: 100%; }
  .r-thumbs img { height: 112px; width: auto; }
  .r-view { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(60px + env(safe-area-inset-bottom)); max-height: calc(100% - 140px); }
  .chat-fab { height: 58px; padding: 0 10px; }
  .chat-fab img { width: 36px; height: 36px; }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .chat-id h2 { white-space: normal; font-size: .92rem; line-height: 1.15; letter-spacing: .02em; }
  .chat { inset: 0; right: 0; bottom: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); animation: sheet .24s ease-out; }
  @keyframes sheet { from { transform: translateY(30px); opacity: 0; } }
  .modal { place-items: end center; padding: 0; }
  .modal-card { width: 100%; border-radius: 26px 26px 0 0; padding: 28px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 100dvh; overflow-y: auto; animation: sheet .24s ease-out; }
  .user-menu { position: fixed; top: 64px; right: 12px; }
}
@media (max-width: 440px) {
  .top-actions { gap: 6px; }
  .topbar .yt-pill { display: none; }
  .class-pill { white-space: nowrap; }
}
