/* ============================================================
   ASCEND · Trading Academy — premium responsive styling
   Luxury dark theme, gold + emerald accents, custom animations.
   ============================================================ */

:root {
  --bg: #0a0b0f;
  --bg-soft: #12141c;
  --card: #171a24;
  --card-2: #1e2230;
  --line: #2a2f3d;
  --text: #f4f6fb;
  --muted: #9aa2b6;
  --gold: #f0c75e;
  --gold-deep: #d4af37;
  --emerald: #3ddc97;
  --red: #ff5c7a;
  --blue: #5aa9ff;
  --violet: #a78bfa;
  --radius: 20px;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
  --glow-gold: 0 0 40px rgba(240,199,94,.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(1200px 700px at 50% -10%, #16182400 0%, var(--bg) 60%), var(--bg);
  color: var(--text);
  overflow-x: hidden;
  padding-bottom: 92px;
}
h1,h2,h3,h4,.brand-name,.unit-title,.hero-title { font-family: 'Sora', sans-serif; }

/* ---- Animated background orbs ---- */
.bg-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .35; animation: float 18s ease-in-out infinite; }
.orb-1 { width: 380px; height: 380px; background: var(--gold-deep); top: -120px; left: -80px; }
.orb-2 { width: 320px; height: 320px; background: var(--emerald); bottom: -100px; right: -60px; animation-delay: -6s; }
.orb-3 { width: 260px; height: 260px; background: var(--violet); top: 40%; left: 60%; animation-delay: -11s; }
@keyframes float { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(30px,-40px) scale(1.1)} }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: rgba(10,11,15,.72); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.brand-mark { color: var(--gold); font-size: 22px; filter: drop-shadow(0 0 10px rgba(240,199,94,.6)); }
.brand-name { font-weight: 800; letter-spacing: 3px; font-size: 18px; background: linear-gradient(90deg,#fff,var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stats { display: flex; gap: 10px; }
.stat { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 14px; padding: 6px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.stat-ico { font-size: 14px; }
.stat-streak span:last-child { color: #ff9d3d; }
.stat-xp span:last-child { color: var(--gold); }
.stat-gems span:last-child { color: var(--emerald); }

/* ---- Layout ---- */
.app { position: relative; z-index: 2; max-width: 720px; margin: 0 auto; padding: 18px; }

/* ---- Hero ---- */
.hero {
  text-align: center; padding: 30px 20px 26px;
  border-radius: var(--radius); position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--card-2), var(--card));
  border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise .6s ease both;
}
.hero-badge { display:inline-block; font-size:12px; letter-spacing:2px; text-transform:uppercase; color:var(--gold); border:1px solid rgba(240,199,94,.35); padding:5px 12px; border-radius:999px; margin-bottom:14px; }
.hero-title { font-size: 30px; font-weight: 800; line-height: 1.1; margin-bottom: 10px; }
.hero-title span { background: linear-gradient(90deg,var(--gold),var(--emerald)); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.hero-sub { color: var(--muted); max-width: 440px; margin: 0 auto 18px; font-size: 15px; }
.hero-cta { display:inline-flex; align-items:center; gap:8px; background: linear-gradient(90deg,var(--gold),var(--gold-deep)); color:#1a1400; font-weight:800; padding: 13px 26px; border-radius:999px; border:none; cursor:pointer; font-size:15px; box-shadow: var(--glow-gold); transition: transform .15s; }
.hero-cta:hover { transform: translateY(-2px) scale(1.02); }

/* ---- Section titles ---- */
.section-title { display:flex; align-items:center; gap:10px; margin: 26px 4px 14px; font-size: 18px; font-weight: 700; }
.section-title .line { flex:1; height:1px; background: var(--line); }

/* ---- Roadmap / path ---- */
.path { display:flex; flex-direction: column; align-items: center; gap: 0; position: relative; }
.unit-head {
  width: 100%; margin: 22px 0 6px; padding: 16px 18px; border-radius: 16px;
  background: linear-gradient(120deg, var(--card-2), var(--card));
  border: 1px solid var(--line); display:flex; align-items:center; justify-content:space-between;
  animation: rise .5s ease both;
}
.unit-head .u-left { display:flex; flex-direction:column; gap:3px; }
.unit-kicker { font-size:11px; letter-spacing:2px; text-transform:uppercase; color: var(--gold); }
.unit-title { font-size: 17px; font-weight: 700; }
.unit-ico { font-size: 26px; }

.nodes { display:flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding: 6px 0 4px; }
.node-wrap { display:flex; justify-content:center; width: 100%; }
/* zigzag offsets */
.node-wrap:nth-child(4n+1){ transform: translateX(-70px); }
.node-wrap:nth-child(4n+2){ transform: translateX(0); }
.node-wrap:nth-child(4n+3){ transform: translateX(70px); }
.node-wrap:nth-child(4n+4){ transform: translateX(0); }
@media(max-width:480px){
  .node-wrap:nth-child(4n+1){ transform: translateX(-52px); }
  .node-wrap:nth-child(4n+3){ transform: translateX(52px); }
}

.node {
  position: relative; width: 76px; height: 76px; border-radius: 50%; cursor: pointer;
  display:flex; align-items:center; justify-content:center; font-size: 30px;
  background: radial-gradient(circle at 30% 25%, var(--card-2), var(--card));
  border: 2px solid var(--line); box-shadow: 0 8px 22px rgba(0,0,0,.4);
  transition: transform .15s;
}
.node:hover { transform: scale(1.06); }
.node.done { border-color: var(--emerald); box-shadow: 0 0 22px rgba(61,220,151,.35); }
.node.current { border-color: var(--gold); box-shadow: var(--glow-gold); animation: pulse 2s infinite; }
.node.locked { opacity: .4; cursor: not-allowed; filter: grayscale(.6); }
.node .check { position:absolute; bottom:-4px; right:-4px; width:24px; height:24px; border-radius:50%; background:var(--emerald); color:#04220f; display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:900; }
.node .lock { position:absolute; bottom:-4px; right:-4px; font-size:16px; }
.node-label { text-align:center; font-size:12px; color: var(--muted); margin-top:6px; max-width: 120px; }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 0 rgba(240,199,94,.4)} 50%{box-shadow:0 0 0 12px rgba(240,199,94,0)} }

/* ---- Cards (leaderboard, vault, profile) ---- */
.card { background: linear-gradient(150deg,var(--card-2),var(--card)); border:1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); animation: rise .5s ease both; }
.lb-row { display:flex; align-items:center; gap:12px; padding: 12px 8px; border-radius: 12px; }
.lb-row + .lb-row { border-top: 1px solid var(--line); }
.lb-rank { width: 26px; text-align:center; font-weight:800; color: var(--muted); }
.lb-rank.top1{color:var(--gold)} .lb-rank.top2{color:#cfd6e6} .lb-rank.top3{color:#d9a066}
.lb-av { width:40px; height:40px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:20px; background:var(--card); border:1px solid var(--line); }
.lb-name { flex:1; font-weight:600; }
.lb-xp { font-weight:800; color: var(--gold); }
.lb-row.me { background: rgba(240,199,94,.08); border:1px solid rgba(240,199,94,.3); }

.vault-grid { display:grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
.vault-item { background: linear-gradient(160deg,var(--card-2),var(--card)); border:1px solid var(--line); border-radius:16px; padding:16px; text-align:center; position:relative; overflow:hidden; }
.vault-item .vico { font-size:40px; display:block; margin-bottom:8px; }
.vault-item .vname { font-weight:700; font-size:14px; }
.vault-item .vcost { margin-top:8px; font-weight:800; color:var(--emerald); font-size:14px; }
.vault-item button { margin-top:10px; width:100%; padding:9px; border-radius:10px; border:none; font-weight:700; cursor:pointer; background:var(--card); color:var(--text); border:1px solid var(--line); }
.vault-item.owned button { background: var(--emerald); color:#04220f; }
.vault-item.locked { opacity:.55; }

/* ---- Progress bar ---- */
.pbar { height: 10px; background: var(--card); border-radius:999px; overflow:hidden; border:1px solid var(--line); }
.pbar > i { display:block; height:100%; background: linear-gradient(90deg,var(--gold),var(--emerald)); border-radius:999px; transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* ---- Overlay (lesson + quiz) ---- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(6,7,10,.92); backdrop-filter: blur(6px); display:none; opacity:0; transition: opacity .25s; }
.overlay.open { display:block; opacity:1; }
.sheet { max-width: 640px; margin: 0 auto; min-height: 100%; display:flex; flex-direction:column; padding: 18px; }
.sheet-top { display:flex; align-items:center; gap:14px; margin-bottom: 18px; }
.sheet-close { width:38px; height:38px; border-radius:50%; border:1px solid var(--line); background:var(--card); color:var(--muted); font-size:18px; cursor:pointer; }
.sheet-prog { flex:1; }
.sheet-hearts { font-weight:700; }

.lesson-card { background: linear-gradient(160deg,var(--card-2),var(--card)); border:1px solid var(--line); border-radius: var(--radius); padding: 24px; flex:1; animation: rise .4s ease both; }
.lesson-emoji { font-size: 54px; text-align:center; display:block; margin-bottom: 14px; animation: pop .5s ease; }
.lesson-h { font-size: 22px; font-weight:800; margin-bottom: 12px; text-align:center; }
.lesson-body { color: #d6dbe8; line-height: 1.7; font-size: 15.5px; }
.lesson-body p { margin-bottom: 14px; }
.lesson-body strong { color: var(--gold); }
.lesson-body .tip { background: rgba(61,220,151,.08); border-left: 3px solid var(--emerald); padding: 12px 14px; border-radius: 8px; margin: 14px 0; font-size: 14.5px; }
.lesson-body .warn { background: rgba(255,92,122,.08); border-left: 3px solid var(--red); padding: 12px 14px; border-radius: 8px; margin: 14px 0; font-size: 14.5px; }

.q-h { font-size: 20px; font-weight:800; margin-bottom: 18px; }
.q-options { display:flex; flex-direction:column; gap: 12px; }
.q-opt { text-align:left; padding: 16px 18px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--text); font-size: 15px; font-weight:600; cursor:pointer; transition: all .12s; }
.q-opt:hover { border-color: var(--muted); transform: translateY(-1px); }
.q-opt.correct { border-color: var(--emerald); background: rgba(61,220,151,.14); }
.q-opt.wrong { border-color: var(--red); background: rgba(255,92,122,.14); }
.q-opt.disabled { pointer-events: none; opacity: .8; }

/* ---- Bottom action bar in sheet ---- */
.sheet-foot { position: sticky; bottom: 0; padding-top: 14px; }
.btn { width:100%; padding: 15px; border-radius: 14px; border:none; font-weight:800; font-size:16px; cursor:pointer; transition: transform .12s; font-family:'Sora',sans-serif; }
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(90deg,var(--gold),var(--gold-deep)); color:#1a1400; box-shadow: var(--glow-gold); }
.btn-success { background: var(--emerald); color:#04220f; }
.btn-danger { background: var(--red); color:#33000f; }
.btn:disabled { opacity:.4; cursor: not-allowed; }

.feedback { padding: 14px 16px; border-radius: 12px; margin-bottom: 12px; font-weight:600; display:none; }
.feedback.show { display:block; animation: rise .3s ease; }
.feedback.good { background: rgba(61,220,151,.14); color: var(--emerald); }
.feedback.bad { background: rgba(255,92,122,.14); color: var(--red); }

/* ---- Complete screen ---- */
.complete { text-align:center; padding: 40px 20px; }
.complete .big { font-size: 64px; animation: pop .5s ease; }
.complete h2 { font-size: 26px; margin: 12px 0; }
.reward-chips { display:flex; gap:12px; justify-content:center; margin: 20px 0; flex-wrap:wrap; }
.reward-chip { padding: 12px 18px; border-radius: 14px; background: var(--card); border:1px solid var(--line); font-weight:800; }
.reward-chip.xp{ color:var(--gold);} .reward-chip.gem{ color:var(--emerald);}

/* ---- Bottom nav ---- */
.bottomnav {
  position: fixed; bottom: 0; left:0; right:0; z-index: 40;
  display:flex; justify-content: space-around; align-items:center;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10,11,15,.9); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
}
.nav-btn { background:none; border:none; color: var(--muted); display:flex; flex-direction:column; align-items:center; gap:2px; font-size:11px; cursor:pointer; padding:6px 14px; border-radius:12px; transition: all .15s; }
.nav-btn span { font-size: 22px; }
.nav-btn.active { color: var(--gold); }
.nav-btn.active span { filter: drop-shadow(0 0 8px rgba(240,199,94,.5)); transform: translateY(-2px); }

/* ---- FX canvas ---- */
.fx { position: fixed; inset: 0; z-index: 80; pointer-events: none; }

/* ---- Animations ---- */
@keyframes rise { from{opacity:0; transform: translateY(14px);} to{opacity:1; transform:none;} }
@keyframes pop { 0%{transform:scale(.6); opacity:0} 70%{transform:scale(1.12)} 100%{transform:scale(1); opacity:1} }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); z-index: 90; background: var(--card-2); border:1px solid var(--line); padding: 12px 20px; border-radius: 999px; font-weight:700; box-shadow: var(--shadow); opacity:0; transition: opacity .3s, transform .3s; }
.toast.show { opacity:1; transform: translateX(-50%) translateY(-6px); }

/* ---- Desktop refinements ---- */
@media(min-width: 780px){
  body { padding-bottom: 0; }
  .bottomnav { top: 50%; left: 24px; right: auto; bottom: auto; transform: translateY(-50%); flex-direction: column; border: 1px solid var(--line); border-radius: 22px; padding: 14px 10px; gap: 6px; }
  .app { padding-left: 120px; padding-right: 40px; max-width: 860px; }
  .hero-title { font-size: 40px; }
}

/* ============================================================
   ARTWORK + EXTRA ANIMATIONS
   ============================================================ */

/* Hero candlestick chart */
.art-chart { width: 100%; max-width: 360px; height: auto; margin: 6px auto 0; display: block; }
.art-chart .candle { transform-origin: center bottom; animation: candleRise .5s cubic-bezier(.2,.9,.3,1.2) both; animation-delay: calc(var(--i) * 0.06s); }
@keyframes candleRise { from{ transform: scaleY(0); opacity:0 } to{ transform: scaleY(1); opacity:1 } }
.art-chart .trendline { stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1.6s ease-out .5s forwards; filter: drop-shadow(0 0 6px rgba(240,199,94,.5)); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.art-chart .area { opacity:0; animation: fadeIn 1.2s ease 1.2s forwards; }
.art-chart .trend-dot { opacity:0; animation: fadeIn .4s ease 2s forwards, ping 2.4s ease-in-out 2s infinite; }
@keyframes fadeIn { to{opacity:1} }
@keyframes ping { 0%,100%{ r:5; filter: drop-shadow(0 0 4px #f0c75e) } 50%{ r:7; filter: drop-shadow(0 0 14px #f0c75e) } }

/* Bull mascot */
.art-bull { width: 130px; height: 130px; }
.art-bull .bull-body { transform-origin: center bottom; animation: bounce 1.4s ease-in-out infinite; }
@keyframes bounce { 0%,100%{ transform: translateY(0) rotate(-2deg) } 50%{ transform: translateY(-10px) rotate(2deg) } }

/* Reward icons */
.art-rocket, .art-trophy, .art-coin, .art-diamond { width: 46px; height: 46px; }
.art-rocket { animation: launch 2s ease-in-out infinite; }
@keyframes launch { 0%,100%{ transform: translateY(0) } 50%{ transform: translateY(-8px) } }
.art-rocket .flame { transform-origin: center top; animation: flick .18s ease-in-out infinite alternate; }
@keyframes flick { from{ transform: scaleY(.7); opacity:.7 } to{ transform: scaleY(1.15); opacity:1 } }
.art-coin { animation: spin 3s linear infinite; }
@keyframes spin { from{ transform: rotateY(0) } to{ transform: rotateY(360deg) } }
.art-trophy { animation: shine 2.4s ease-in-out infinite; }
@keyframes shine { 0%,100%{ filter: drop-shadow(0 0 2px #f0c75e) } 50%{ filter: drop-shadow(0 0 12px #f0c75e) } }
.art-diamond { animation: floaty 2.6s ease-in-out infinite; }
@keyframes floaty { 0%,100%{ transform: translateY(0) rotate(-3deg) } 50%{ transform: translateY(-7px) rotate(3deg) } }

/* Node entrance stagger */
.node-wrap { animation: rise .4s ease both; animation-delay: calc(var(--n,0) * .05s); }

/* Level-up modal */
.levelup { position: fixed; inset:0; z-index:100; display:flex; align-items:center; justify-content:center; background: rgba(6,7,10,.9); backdrop-filter: blur(8px); opacity:0; pointer-events:none; transition: opacity .3s; }
.levelup.show { opacity:1; pointer-events:auto; }
.levelup-card { text-align:center; padding: 34px 30px; border-radius: 26px; background: linear-gradient(160deg,var(--card-2),var(--card)); border:1px solid rgba(240,199,94,.4); box-shadow: var(--glow-gold), var(--shadow); animation: pop .5s ease; max-width: 340px; }
.levelup-card .lvl-num { font-family:'Sora'; font-size: 60px; font-weight:800; background:linear-gradient(90deg,var(--gold),var(--emerald)); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.levelup-card h3 { font-size: 22px; margin: 4px 0 8px; }
.levelup-card p { color: var(--muted); margin-bottom: 18px; }

/* Ripple on buttons */
.btn, .hero-cta, .q-opt { position: relative; overflow: hidden; }
.ripple { position:absolute; border-radius:50%; transform: translate(-50%,-50%); background: rgba(255,255,255,.35); pointer-events:none; animation: rip .5s ease-out; }
@keyframes rip { from{ width:0; height:0; opacity:.5 } to{ width:320px; height:320px; opacity:0 } }

/* Shimmer on hero badge */
.hero-badge { position: relative; overflow: hidden; }
.hero-badge::after { content:""; position:absolute; top:0; left:-60%; width:40%; height:100%; background: linear-gradient(90deg,transparent,rgba(240,199,94,.4),transparent); animation: sweep 3s ease-in-out infinite; }
@keyframes sweep { 0%{ left:-60% } 60%,100%{ left:120% } }

/* Count-up pulse on stats */
.stat.bump { animation: bump .35s ease; }
@keyframes bump { 0%{transform:scale(1)} 40%{transform:scale(1.25)} 100%{transform:scale(1)} }

/* ============================================================
   UI FIXES + NEW COMPONENTS (v3)
   ============================================================ */

/* --- Top bar fix: compact so nothing gets cut off --- */
.topbar { padding: 10px 12px; gap: 8px; }
.brand-name { font-size: 15px; letter-spacing: 2px; }
.brand-mark { font-size: 18px; }
.stats { gap: 5px; flex-shrink: 0; }
.stat { padding: 5px 8px; font-size: 13px; gap: 4px; }
.stat-ico { font-size: 12px; }
@media(max-width: 430px){
  .brand-name { display: none; }           /* show just the ✦ mark on small phones */
  .stat { padding: 4px 7px; font-size: 12px; }
}

/* --- Bottom nav: 5 items, tighter --- */
.nav-btn { padding: 6px 8px; }
.nav-btn span { font-size: 20px; }
.nav-btn small { font-size: 10px; }

/* --- Hearts empty / timer --- */
.hearts-lock { text-align:center; padding: 30px 20px; }
.hearts-lock .hl-ico { font-size: 60px; animation: bounce 1.4s ease-in-out infinite; }
.hearts-lock h2 { font-size: 22px; margin: 12px 0 6px; }
.hearts-lock .timer { font-family:'Sora'; font-size: 40px; font-weight:800; color: var(--gold); margin: 10px 0; letter-spacing: 2px; }
.hearts-lock p { color: var(--muted); max-width: 320px; margin: 0 auto; }

/* --- Chart quiz --- */
.chart-quiz { background: #0d0f16; border:1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 16px; }
.chart-quiz svg { width: 100%; height: auto; display:block; }
.q-updown { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.q-updown .q-opt { text-align:center; font-size: 17px; }
.q-updown .q-opt.up { border-color: rgba(61,220,151,.4); }
.q-updown .q-opt.down { border-color: rgba(255,92,122,.4); }

/* --- Book --- */
.book-hero { text-align:center; padding: 24px 18px; border-radius: var(--radius); background: linear-gradient(160deg,#241d0e,#12141c); border:1px solid rgba(240,199,94,.3); box-shadow: var(--shadow); margin-bottom: 18px; }
.book-hero .bico { font-size: 46px; }
.book-hero h2 { font-size: 24px; margin: 6px 0 4px; }
.book-hero p { color: var(--muted); font-size: 14px; }
.chapter { display:flex; align-items:center; gap: 14px; padding: 16px; border-radius: 16px; background: linear-gradient(150deg,var(--card-2),var(--card)); border:1px solid var(--line); margin-bottom: 12px; cursor:pointer; transition: transform .15s, border-color .15s; animation: rise .4s ease both; }
.chapter:hover { transform: translateX(4px); border-color: var(--gold); }
.chapter .ch-num { width: 40px; height:40px; border-radius: 12px; background: var(--card); border:1px solid var(--line); display:flex; align-items:center; justify-content:center; font-size: 20px; flex-shrink:0; }
.chapter .ch-t { font-weight:700; font-size: 15px; }
.chapter .ch-s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.chapter .ch-arrow { margin-left:auto; color: var(--muted); }

.reader { max-width: 680px; margin: 0 auto; padding: 18px; }
.reader h1 { font-size: 26px; margin: 6px 0 4px; }
.reader .r-kicker { color: var(--gold); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
.reader .r-body { line-height: 1.8; font-size: 15.5px; color: #d6dbe8; margin-top: 16px; }
.reader .r-body h3 { font-family:'Sora'; font-size: 18px; margin: 22px 0 8px; color: #fff; }
.reader .r-body p { margin-bottom: 14px; }
.reader .r-body strong { color: var(--gold); }
.reader .r-body .tip { background: rgba(61,220,151,.08); border-left: 3px solid var(--emerald); padding: 12px 14px; border-radius: 8px; margin: 14px 0; }
.reader .r-body .warn { background: rgba(255,92,122,.08); border-left: 3px solid var(--red); padding: 12px 14px; border-radius: 8px; margin: 14px 0; }
.reader .r-body .quote { font-style: italic; color: var(--gold); border-left: 3px solid var(--gold); padding: 8px 14px; margin: 16px 0; }
.reader .r-fig { background:#0d0f16; border:1px solid var(--line); border-radius: 14px; padding: 14px; margin: 16px 0; }
.reader .r-fig svg { width:100%; height:auto; }
.reader .r-fig .cap { text-align:center; color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.reader .back { display:inline-flex; align-items:center; gap:6px; background:var(--card); border:1px solid var(--line); color:var(--text); padding:9px 16px; border-radius:999px; cursor:pointer; font-weight:600; margin-bottom: 8px; }

/* Portrait rows in the book */
.portrait { width: 64px; height: 64px; flex-shrink: 0; }
.figrow { display:flex; align-items:center; gap: 14px; background: linear-gradient(150deg,var(--card-2),var(--card)); border:1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin: 16px 0; }
.figrow .fig-name { font-family:'Sora'; font-weight:700; font-size: 15px; color:#fff; }
.figrow .fig-role { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---- UI FIX v4: more clearance so content never hides behind the nav ---- */
body { padding-bottom: 112px; }
.app { padding-bottom: 12px; }
.hero { margin-bottom: 6px; }
@media(min-width: 780px){ body { padding-bottom: 0; } }

/* ---- Phone polish (v5) ---- */
@media(max-width: 480px){
  .app { padding: 14px 12px; }
  .hero { padding: 24px 16px 22px; }
  .hero-title { font-size: 26px; }
  .hero-sub { font-size: 14px; }
  .node { width: 68px; height: 68px; font-size: 26px; }
  .node-wrap:nth-child(4n+1){ transform: translateX(-46px); }
  .node-wrap:nth-child(4n+3){ transform: translateX(46px); }
  .figrow { gap: 10px; padding: 10px 12px; }
  .portrait { width: 52px; height: 52px; }
  .reader { padding: 14px; }
  .reader h1 { font-size: 22px; }
  .reader .r-body { font-size: 15px; }
  .lesson-card { padding: 18px; }
  .lesson-h { font-size: 20px; }
  .vault-grid { gap: 10px; }
  .q-opt { padding: 14px 15px; font-size: 14.5px; }
}
@media(max-width: 360px){
  .nav-btn { padding: 6px 4px; }
  .nav-btn span { font-size: 18px; }
  .nav-btn small { font-size: 9px; }
  .stat { padding: 3px 6px; font-size: 11px; }
  .stat-ico { font-size: 10px; }
  .stats { gap: 4px; }
  .hero-title { font-size: 23px; }
  .node { width: 60px; height: 60px; font-size: 23px; }
}

/* ============================================================
   ACCOUNTS + CLOUD SAVE
   ============================================================ */
.topbar .stats { margin-left: auto; }
.acct-btn {
  position: relative; flex-shrink: 0; display: flex; align-items: center; gap: 5px;
  height: 34px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  font: 700 13px 'Sora', sans-serif; color: #1a1400;
  background: linear-gradient(90deg, var(--gold), var(--gold-deep)); border: none;
  box-shadow: 0 3px 0 #8a6d1d, var(--glow-gold);
  transition: transform .12s, box-shadow .2s;
}
.acct-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a6d1d; }
.acct-btn small { font-size: 12px; font-weight: 800; }
.acct-btn.in { width: 34px; padding: 0; justify-content: center; background: linear-gradient(135deg, var(--emerald), #23b879); color: #04220f; box-shadow: 0 3px 0 #13744b; }
.acct-av { font-weight: 800; font-size: 14px; }
.acct-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.acct-btn .acct-dot { position: absolute; right: -1px; bottom: -1px; border: 2px solid var(--bg); }
.acct-dot.synced { background: var(--emerald); }
.acct-dot.syncing { background: var(--gold); animation: dotPulse .9s ease-in-out infinite; }
.acct-dot.offline, .acct-dot.error { background: var(--red); }
@keyframes dotPulse { 50% { opacity: .35; } }
@media (max-width: 430px) { .acct-btn.guest small { display: none; } .acct-btn.guest { width: 34px; padding: 0; justify-content: center; } }

.guest-banner {
  display: flex; align-items: center; gap: 12px; margin: 4px 0 22px; padding: 12px 14px;
  border-radius: 16px; border: 1px dashed rgba(240,199,94,.45);
  background: linear-gradient(120deg, rgba(240,199,94,.08), rgba(61,220,151,.06));
  animation: rise .5s ease both;
}
.gb-ico { font-size: 24px; }
.gb-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gb-txt b { font-size: 14px; }
.gb-txt small { color: var(--muted); font-size: 12px; }
.gb-btn { flex-shrink: 0; padding: 9px 14px; border-radius: 12px; border: none; cursor: pointer; font: 800 13px 'Sora', sans-serif; color: #1a1400; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); }

.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.sync-line { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); }

.auth-modal {
  position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 16px;
  background: rgba(6,7,10,.8); backdrop-filter: blur(8px);
}
.auth-modal.open { display: flex; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.auth-card {
  position: relative; width: 100%; max-width: 400px; max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 28px 22px 22px; border-radius: 24px; text-align: center;
  background: linear-gradient(160deg, var(--card-2), var(--card)); border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 0 60px rgba(240,199,94,.12);
  animation: authPop .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes authPop { from { opacity: 0; transform: translateY(16px) scale(.95); } }
.auth-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; font-size: 15px; }
.auth-mark {
  width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 16px; display: grid; place-items: center;
  font-size: 24px; color: #0a0b0f; background: linear-gradient(135deg, var(--gold), var(--gold-deep) 55%, var(--emerald));
  box-shadow: 0 8px 30px rgba(240,199,94,.35);
}
.auth-card h2 { font-size: 22px; }
.auth-sub { color: var(--muted); font-size: 14px; margin: 6px 0 16px; line-height: 1.5; }
.auth-sub b { color: var(--text); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 16px; border-radius: 14px; background: var(--bg-soft); border: 1px solid var(--line); }
.auth-tabs button { padding: 9px; border-radius: 10px; border: none; cursor: pointer; background: none; color: var(--muted); font: 700 14px 'Sora', sans-serif; }
.auth-tabs button.on { background: var(--card-2); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
#authForm { display: flex; flex-direction: column; gap: 12px; text-align: left; }
#authForm label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
#authForm input {
  padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-soft);
  color: var(--text); font: 500 16px 'Inter', sans-serif; outline: none; transition: border-color .2s, box-shadow .2s;
}
#authForm input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(240,199,94,.18); }
.auth-err { min-height: 18px; color: var(--red); font-size: 13px; font-weight: 600; }
.auth-err:empty { min-height: 0; }
.auth-link { margin-top: 14px; background: none; border: none; color: var(--muted); font: 600 13px 'Inter', sans-serif; cursor: pointer; text-decoration: underline; }
.auth-note { margin-top: 14px; padding: 10px; border-radius: 12px; font-size: 13px; color: var(--emerald); background: rgba(61,220,151,.08); border: 1px solid rgba(61,220,151,.25); }
.lb-sub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 2px; }

/* ---- Logo + sign-up wall ---- */
.brand-logo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(240,199,94,.45); }
.auth-mark { padding: 3px; border-radius: 50%; width: 76px; height: 76px; background: linear-gradient(135deg, var(--gold), var(--gold-deep) 55%, var(--emerald)); }
.auth-mark img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.auth-modal.gated { background: rgba(6,7,10,.72); backdrop-filter: blur(10px) saturate(1.2); }
.auth-modal.gated .auth-mark { animation: markGlow 2.6s ease-in-out infinite; }
@keyframes markGlow { 0%,100% { box-shadow: 0 8px 30px rgba(240,199,94,.35); } 50% { box-shadow: 0 8px 44px rgba(61,220,151,.55); } }

.boot-splash { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; background: var(--bg); }
.boot-splash img { width: 84px; height: 84px; border-radius: 50%; box-shadow: 0 0 0 3px var(--gold), 0 0 40px rgba(240,199,94,.4); animation: splashPulse 1.2s ease-in-out infinite; }
@keyframes splashPulse { 50% { transform: scale(.92); opacity: .7; } }
body.auth-pending .boot-splash { display: grid; }
