/* Inner Dive · Science topics on the phone (27 Oct 2026) · goes with sci-phone.js
   Computer view: untouched. Phone view (< 820 px): Key points · Dive in · fold-out chapters · Quiz pill. */

/* ---------- computer: looks exactly as before ---------- */
.sp-pulse, .sp-pill, .sp-story { display: none; }
.science-article.sp-on .sp-ch { display: contents; }
.science-article.sp-on .sp-tog { all: unset; display: inline; cursor: default; }
.science-article.sp-on .sp-no, .science-article.sp-on .sp-chev { display: none; }
.science-article.sp-on .sp-body { display: contents; }

@media (max-width: 819.98px) {
  .science-article.sp-on { --k: var(--sp-k, #9D8CFF); }
  .science-article.sp-on .sp-ch { display: block; }
  .science-article.sp-on .sp-body { display: none; }

  /* ---------- Pulse panel ---------- */
  .sp-pulse { display: grid; gap: 12px; margin: 18px 0 6px; }
  .sp-kp {
    position: relative; padding: 16px 16px 8px; border-radius: 18px; overflow: hidden;
    background: linear-gradient(160deg, color-mix(in srgb, var(--k) 14%, #0E1430) 0%, #0B1029 70%);
    border: 1px solid color-mix(in srgb, var(--k) 38%, transparent);
    box-shadow: 0 0 0 1px rgba(255,255,255,.02) inset, 0 18px 40px -24px color-mix(in srgb, var(--k) 70%, transparent);
  }
  .sp-kp::before { content: ""; position: absolute; inset: 0; pointer-events: none;
    background: repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 1px, transparent 1px 22px), repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 1px, transparent 1px 22px);
    mask-image: linear-gradient(180deg, #000, transparent 80%); }
  .sp-kp-h { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
  .sp-kp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--k); box-shadow: 0 0 10px var(--k), 0 0 22px var(--k); animation: spBeat 2.4s ease-in-out infinite; }
  .sp-kp-t { font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: color-mix(in srgb, var(--k) 70%, #fff); font-weight: 600; }
  .sp-kp-l { list-style: none; margin: 0; padding: 0; position: relative; }
  .sp-kp-l::before { content: ""; position: absolute; left: 11px; top: 16px; bottom: 22px; width: 1px; background: linear-gradient(180deg, var(--k), transparent); opacity: .55; }
  .sp-kp-l li { position: relative; padding-left: 34px; opacity: 0; transform: translateY(6px); animation: spRise .6s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: var(--d, 0s); }
  .sp-kp-l li::before { content: counter(list-item, decimal-leading-zero); position: absolute; left: 0; top: 11px; width: 23px; height: 23px; display: grid; place-items: center;
    border-radius: 50%; font: 600 .62rem/1 var(--font-mono, ui-monospace, monospace); color: var(--k); background: #0A0F24; border: 1px solid color-mix(in srgb, var(--k) 60%, transparent);
    box-shadow: 0 0 12px -2px var(--k); }
  .sp-kp-l button { all: unset; display: block; padding: 10px 0 12px; font-size: .98rem; line-height: 1.5; color: var(--ink, #E7EBF8); cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .sp-kp-l .sp-kp-h2 { display: block; margin-bottom: 2px; font-weight: 700; color: var(--k, #FF5FC8); letter-spacing: .01em; }
  .sp-kp-l li + li button { border-top: 1px solid rgba(157,180,255,.08); }

  .sp-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px; font-size: .82rem; color: var(--muted, #9BA7CA); }
  .sp-meta > span { display: inline-flex; align-items: center; gap: 7px; }
  .sp-min svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  .sp-ring { width: 20px; height: 20px; transform: rotate(-90deg); }
  .sp-ring circle { fill: none; stroke-width: 3.4; stroke: rgba(157,180,255,.16); }
  .sp-ring .sp-ring-f { stroke: var(--k); stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); filter: drop-shadow(0 0 3px var(--k)); }
  .sp-all .sp-exp { color: color-mix(in srgb, var(--k) 75%, #fff); }

  .sp-dive {
    all: unset; box-sizing: border-box; position: relative; display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 18px; border-radius: 18px; cursor: pointer; overflow: hidden;
    background: linear-gradient(120deg, color-mix(in srgb, var(--k) 36%, #12183A), #141A3E 60%, color-mix(in srgb, var(--k) 22%, #12183A));
    border: 1px solid color-mix(in srgb, var(--k) 65%, transparent);
    box-shadow: 0 0 24px -8px var(--k), 0 0 0 1px rgba(255,255,255,.04) inset; -webkit-tap-highlight-color: transparent;
  }
  .sp-dive::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.12) 50%, transparent 70%); transform: translateX(-100%); animation: spSheen 4.5s ease-in-out 1.2s infinite; pointer-events: none; }
  .sp-dive:active { transform: scale(.985); }
  .sp-dive-wave { display: flex; align-items: center; gap: 3px; height: 30px; flex: none; }
  .sp-dive-wave i { width: 3px; height: 100%; border-radius: 2px; background: var(--k); box-shadow: 0 0 8px var(--k); transform-origin: center; animation: spWave 1.3s ease-in-out infinite; }
  .sp-dive-wave i:nth-child(1) { animation-delay: -.1s } .sp-dive-wave i:nth-child(2) { animation-delay: -.35s } .sp-dive-wave i:nth-child(3) { animation-delay: -.6s }
  .sp-dive-wave i:nth-child(4) { animation-delay: -.2s } .sp-dive-wave i:nth-child(5) { animation-delay: -.8s } .sp-dive-wave i:nth-child(6) { animation-delay: -.45s } .sp-dive-wave i:nth-child(7) { animation-delay: -.7s }
  .sp-dive-tx { display: grid; gap: 2px; flex: 1; min-width: 0; }
  .sp-dive-tx b { font-size: 1.12rem; font-weight: 650; color: #fff; letter-spacing: .01em; }
  .sp-dive-tx small { font-size: .8rem; color: color-mix(in srgb, var(--k) 40%, #C9D2EE); }
  .sp-dive-go { font-size: 1.3rem; color: #fff; }

  .sp-chl { margin: 10px 4px -4px; font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted, #9BA7CA); display: flex; align-items: center; gap: 10px; }
  .sp-chl::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(157,180,255,.25), transparent); }

  /* ---------- fold-out chapters ---------- */
  .science-article.sp-on .sp-ch { margin-top: 8px; border-radius: 14px; border: 1px solid rgba(157,180,255,.12); background: rgba(18,25,53,.55); transition: border-color .3s, background .3s, box-shadow .3s; }
  .science-article.sp-on .sp-ch.sp-open { border-color: color-mix(in srgb, var(--k) 45%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--k) 9%, #111836), rgba(14,20,46,.6)); box-shadow: 0 12px 34px -22px var(--k); }
  .science-article.sp-on h3.sp-h { margin: 0 !important; font-size: 1rem; }
  .science-article.sp-on .sp-tog { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 12px 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; color: var(--ink, #E7EBF8); font-weight: 600; line-height: 1.3; }
  .science-article.sp-on .sp-open .sp-tog { color: color-mix(in srgb, var(--k) 55%, #fff); }
  .science-article.sp-on .sp-no { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 9px; font: 600 .7rem/1 var(--font-mono, ui-monospace, monospace); color: var(--muted, #9BA7CA); border: 1px solid rgba(157,180,255,.18); background: rgba(10,15,36,.7); transition: all .3s; }
  .science-article.sp-on .sp-done .sp-no { color: var(--k); border-color: color-mix(in srgb, var(--k) 50%, transparent); }
  .science-article.sp-on .sp-open .sp-no { color: #0A0F24; background: var(--k); border-color: var(--k); box-shadow: 0 0 14px -2px var(--k); }
  .science-article.sp-on .sp-tt { flex: 1; min-width: 0; }
  .science-article.sp-on .sp-chev { display: block; flex: none; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); opacity: .6; transition: transform .3s; }
  .science-article.sp-on .sp-open .sp-chev { transform: rotate(-135deg) translate(-2px, -2px); opacity: 1; }
  .science-article.sp-on .sp-open .sp-body { display: block; padding: 0 16px 16px; animation: spOpen .45s cubic-bezier(.2,.8,.2,1); }
  .science-article.sp-on .sp-body > :first-child { margin-top: 2px; }
  .science-article.sp-on .sp-body ul.bands { font-family: inherit; }

  /* ---------- floating Quiz pill ---------- */
  .sp-pill {
    display: inline-flex; position: fixed; z-index: 8; right: 16px; bottom: calc(var(--tabbar-h, 64px) + 14px + env(safe-area-inset-bottom, 0px));
    align-items: center; gap: 8px; padding: 10px 16px 10px 12px; border-radius: 999px; text-decoration: none; color: #fff;
    background: linear-gradient(135deg, color-mix(in srgb, var(--sp-k, #9D8CFF) 55%, #1A2050), #141A3E);
    border: 1px solid color-mix(in srgb, var(--sp-k, #9D8CFF) 70%, transparent); box-shadow: 0 0 22px -6px var(--sp-k, #9D8CFF), 0 10px 24px -10px #000;
    opacity: 0; transform: translateY(14px) scale(.94); pointer-events: none; transition: opacity .35s, transform .35s cubic-bezier(.2,.8,.2,1);
  }
  .sp-pill.sp-show { opacity: 1; transform: none; pointer-events: auto; }
  .sp-pill svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
  .sp-pill b { font-size: .9rem; font-weight: 600; }

  /* ---------- Dive in · story mode ---------- */
  html.sp-lock, html.sp-lock body { overflow: hidden; }
  .sp-story { display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 60; background: #050818; color: var(--ink, #E7EBF8);
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px calc(env(safe-area-inset-bottom, 0px) + 14px); --k: var(--sp-k, #9D8CFF); }
  .sp-story[hidden] { display: none; }
  .sp-st-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden;
    background: radial-gradient(60% 40% at 15% 0%, color-mix(in srgb, var(--k) 30%, transparent), transparent 70%), radial-gradient(50% 35% at 100% 100%, color-mix(in srgb, var(--k) 20%, transparent), transparent 70%); }
  .sp-st-bg::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(157,180,255,.035) 0 1px, transparent 1px 28px), repeating-linear-gradient(0deg, rgba(157,180,255,.03) 0 1px, transparent 1px 28px); mask-image: radial-gradient(80% 60% at 50% 30%, #000, transparent); }
  .sp-st-top { position: relative; display: grid; gap: 10px; }
  .sp-st-seg { display: flex; gap: 4px; }
  .sp-st-seg i { flex: 1; height: 3px; border-radius: 2px; background: rgba(157,180,255,.16); overflow: hidden; position: relative; }
  .sp-st-seg i.on { background: var(--k); box-shadow: 0 0 6px var(--k); }
  .sp-st-seg i.cur { background: rgba(157,180,255,.16); }
  .sp-st-seg i.cur::after { content: ""; position: absolute; inset: 0; background: var(--k); box-shadow: 0 0 6px var(--k); animation: spFill .7s cubic-bezier(.2,.8,.2,1) forwards; transform-origin: left; }
  .sp-st-row { display: flex; align-items: center; justify-content: space-between; }
  .sp-st-no { font: 600 .78rem/1 var(--font-mono, ui-monospace, monospace); letter-spacing: .14em; color: var(--k); }
  .sp-st-x { all: unset; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid rgba(157,180,255,.2); background: rgba(18,25,53,.7); cursor: pointer; }
  .sp-st-x svg, .sp-st-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .sp-st-mid { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
  .sp-st-card { position: relative; flex: 0 1 auto; min-height: 0; max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; margin: 14px 0; padding: 20px 18px 24px; border-radius: 22px;
    background: linear-gradient(180deg, rgba(20,27,60,.88), rgba(11,16,40,.92)); border: 1px solid color-mix(in srgb, var(--k) 35%, transparent);
    box-shadow: 0 0 0 1px rgba(255,255,255,.03) inset, 0 30px 60px -30px color-mix(in srgb, var(--k) 60%, transparent); backdrop-filter: blur(10px); }
  .sp-st-card.sp-in { animation: spSlide .45s cubic-bezier(.2,.8,.2,1); }
  .sp-st-card::before { content: attr(data-no); position: absolute; right: 14px; top: 4px; font: 700 5.2rem/1 var(--font-mono, ui-monospace, monospace); color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--k) 35%, transparent); opacity: .55; pointer-events: none; }
  .sp-st-wave { display: block; width: 100%; height: 34px; margin-top: 18px; opacity: .8; }
  .sp-st-wave path { fill: none; stroke: var(--k); stroke-width: 1.6; filter: drop-shadow(0 0 4px var(--k)); stroke-dasharray: 6 0; animation: spDrift 6s linear infinite; }
  .sp-st-t { position: relative; margin: 0 0 12px; padding-right: 70px; font-size: 1.35rem; line-height: 1.25; font-weight: 650; color: #fff; letter-spacing: -.01em; }
  .sp-st-t::after { content: ""; display: block; width: 44px; height: 2px; margin-top: 12px; border-radius: 2px; background: var(--k); box-shadow: 0 0 10px var(--k); }
  .sp-st-body { font-size: 1.02rem; line-height: 1.65; }
  .sp-st-body .sp-body { display: block !important; padding: 0 !important; animation: none !important; }
  .sp-st-body .sp-body > * + * { margin-top: 12px; }
  .sp-st-body ul, .sp-st-body ol { padding-left: 1.2em; }
  .sp-st-body .quiz-cta-wrap { margin-top: 18px; }
  .sp-st-end { display: grid; justify-items: center; gap: 12px; padding: 18px 0 6px; text-align: center; }
  .sp-st-end p { margin: 0; color: var(--muted, #9BA7CA); }
  .sp-st-orb { position: relative; width: 110px; height: 110px; }
  .sp-st-orb i { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--k); box-shadow: 0 0 18px -4px var(--k); animation: spOrb 3s ease-out infinite; }
  .sp-st-orb i:nth-child(2) { animation-delay: 1s } .sp-st-orb i:nth-child(3) { animation-delay: 2s }
  .sp-st-orb::after { content: "✦"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.8rem; color: var(--k); text-shadow: 0 0 14px var(--k); }
  .sp-st-nav { position: relative; display: flex; gap: 10px; }
  .sp-st-nav button { all: unset; box-sizing: border-box; height: 52px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 16px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .sp-st-nav .sp-st-p { width: 56px; border: 1px solid rgba(157,180,255,.2); background: rgba(18,25,53,.7); }
  .sp-st-nav .sp-st-p:disabled { opacity: .3; cursor: default; }
  .sp-st-nav .sp-st-n { flex: 1; font-weight: 600; color: #0A0F24; background: linear-gradient(120deg, var(--k), color-mix(in srgb, var(--k) 70%, #fff)); box-shadow: 0 0 22px -6px var(--k); }
  .sp-st-nav .sp-st-n[hidden] { display: none; }
  .sp-st-nav button:active { transform: scale(.97); }
}

@keyframes spBeat { 50% { transform: scale(.7); opacity: .6; } }
@keyframes spRise { to { opacity: 1; transform: none; } }
@keyframes spWave { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
@keyframes spSheen { 0% { transform: translateX(-100%); } 40%, 100% { transform: translateX(100%); } }
@keyframes spOpen { from { opacity: 0; transform: translateY(-6px); } }
@keyframes spSlide { from { opacity: 0; transform: translateX(var(--dx, 24px)); } }
@keyframes spFill { from { transform: scaleX(0); } }
@keyframes spDrift { to { transform: translateX(-80px); } }
@keyframes spOrb { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sp-story *, .sp-pulse *, .sp-ch * { animation: none !important; } .sp-kp-l li { opacity: 1; transform: none; } }

/* ---------- Explore rewards (sci-explore.js) ---------- */
.ex-strip, .ex-burst { display: none; }
@media (max-width: 819.98px) {
  .ex-strip { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 16px; background: rgba(14,20,46,.7); border: 1px solid rgba(157,180,255,.12); }
  .ex-days { display: flex; gap: 5px; flex: none; }
  .ex-day { display: grid; justify-items: center; gap: 4px; }
  .ex-day i { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(157,180,255,.28); background: rgba(10,15,36,.8); transition: all .4s; }
  .ex-day.on i { background: var(--k); border-color: var(--k); box-shadow: 0 0 8px var(--k); }
  .ex-day.now i { outline: 1px solid color-mix(in srgb, var(--k) 60%, transparent); outline-offset: 2px; }
  .ex-day small { font: 600 .56rem/1 var(--font-mono, ui-monospace, monospace); color: var(--muted, #9BA7CA); text-transform: uppercase; }
  .ex-tx { display: grid; gap: 2px; flex: 1; min-width: 0; }
  .ex-tx b { font-size: .86rem; font-weight: 600; color: color-mix(in srgb, var(--k) 55%, #fff); }
  .ex-tx span { font-size: .74rem; color: var(--muted, #9BA7CA); }
  .ex-snd { all: unset; flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid rgba(157,180,255,.18); color: var(--muted, #9BA7CA); cursor: pointer; }
  .ex-snd.on { color: var(--k); border-color: color-mix(in srgb, var(--k) 45%, transparent); }
  .ex-snd svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

  .ex-burst { display: block; position: fixed; z-index: 90; width: 0; height: 0; pointer-events: none; --k: var(--sp-k, #9D8CFF); }
  .ex-burst i { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--k); box-shadow: 0 0 8px var(--k), 0 0 16px var(--k); animation: exFly .9s cubic-bezier(.15,.7,.3,1) forwards; }
  .ex-burst i:nth-child(3n) { background: #fff; width: 4px; height: 4px; }
  .ex-burst b { position: absolute; left: 0; top: -10px; transform: translateX(-50%); white-space: nowrap; font: 700 .95rem/1 var(--font-mono, ui-monospace, monospace); color: #fff; text-shadow: 0 0 10px var(--k), 0 0 22px var(--k); animation: exUp 1.25s cubic-bezier(.2,.8,.2,1) forwards; }
  .ex-big i { width: 8px; height: 8px; animation-duration: 1.5s; }
  .ex-big b { top: -30px; padding: 10px 16px; border-radius: 999px; font-size: 1rem; background: rgba(10,15,36,.85); border: 1px solid var(--k); box-shadow: 0 0 26px -4px var(--k); animation-duration: 2.3s; }
  .ex-lv { display: grid; gap: 8px; width: 100%; margin-top: 8px; padding: 14px 16px; border-radius: 16px; text-align: left; background: rgba(10,15,36,.7); border: 1px solid color-mix(in srgb, var(--k) 30%, transparent); }
  .ex-lv b { font-size: .95rem; color: #fff; }
  .ex-lv small { font-size: .78rem; color: var(--muted, #9BA7CA); }
  .ex-lv .ex-got { margin: 0; font: 700 .82rem/1.2 var(--font-mono, ui-monospace, monospace); letter-spacing: .06em; color: var(--k); text-shadow: 0 0 10px var(--k); }
  .ex-bar { height: 6px; border-radius: 4px; background: rgba(157,180,255,.14); overflow: hidden; }
  .ex-bar i { display: block; height: 100%; width: var(--w); border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--k) 60%, #5A6BFF), var(--k)); box-shadow: 0 0 10px var(--k); animation: exGrow 1.2s cubic-bezier(.2,.8,.2,1) .3s both; }
}
@keyframes exFly { 0% { transform: translate(0,0) scale(1); opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(.2); opacity: 0; } }
@keyframes exUp { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.8); } 20% { opacity: 1; transform: translate(-50%, -8px) scale(1.08); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -38px) scale(1); } }
@keyframes exGrow { from { width: 0; } }
@media (prefers-reduced-motion: reduce) { .ex-burst { display: none !important; } .ex-bar i { animation: none; } }
