/* Selah — "Aurora" design system.
   The palette comes from the splash screen: a midnight-navy sky (#03050F → #071330 → #0B1E3F)
   lit by cyan, blue, teal and violet glows. Type: Inter (UI), Fraunces (scripture & display
   accents), JetBrains Mono (numbers, labels). */
:root {
  /* Sky */
  --bg0: #03050F;
  --bg1: #071330;
  --bg2: #0B1E3F;
  /* Aurora lights */
  --cyan: #2EC5FF;
  --blue: #3B6CFF;
  --teal: #19E6C1;
  --violet: #7A5CFF;
  /* Surfaces (glass over the sky) */
  --ground: #060C22;
  --surface: rgba(18, 32, 70, 0.55);
  --surface-solid: #0D1A3A;
  --surface2: rgba(8, 16, 40, 0.62);
  --raised: #15254D;
  --control: rgba(140, 180, 255, 0.06);
  --line: rgba(140, 180, 255, 0.12);
  --line2: rgba(140, 180, 255, 0.2);
  --nav: rgba(5, 10, 28, 0.82);
  /* Text */
  --text: #EAF4FF;
  --soft: #C6DAF4;
  --body: #A9BFDF;
  --muted: #8EA5C9;
  --dim: #6F86AD;
  --faint: #50658F;
  /* Roles */
  --accent: #4CC9FF;
  --on-accent: #03122A;
  --sage: #2EE6C1;
  --sage-bg: rgba(25, 230, 193, 0.12);
  --sage-line: rgba(25, 230, 193, 0.34);
  --sage-text: #8FF5E0;
  --coral: #FF8A7A;
  --peri: #8FA8FF;
  --lilac: #B79CFF;
  --gold: #FFC46B;
  --grad: linear-gradient(135deg, #6FE6FF 0%, #3B9BFF 48%, #7A5CFF 100%);
  --grad-btn: linear-gradient(135deg, #8AEEFF 0%, #4CC9FF 45%, #5B8CFF 100%);
  --grad-text: linear-gradient(120deg, #EAF4FF 0%, #9FE6FF 45%, #A894FF 100%);
  --grad-soft: linear-gradient(135deg, rgba(46, 197, 255, 0.16), rgba(122, 92, 255, 0.14));
  --glow: 0 0 0 1px rgba(110, 200, 255, 0.25), 0 10px 40px -10px rgba(46, 197, 255, 0.45);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 50px -24px rgba(0, 0, 0, 0.8);
  /* Type */
  --display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Layout */
  --side-w: 264px;
  --content-max: 1280px;
  --pad-x: 40px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg0); color: var(--text); font-family: var(--body-font); font-size: 15px; line-height: 1.5; font-optical-sizing: auto; font-feature-settings: "cv11", "ss01", "ss03"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { overscroll-behavior: none; overflow: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }
a { color: var(--accent); }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
::selection { background: rgba(76, 201, 255, 0.35); }
* { scrollbar-width: thin; scrollbar-color: rgba(140, 180, 255, 0.22) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(140, 180, 255, 0.2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(140, 180, 255, 0.34); }

/* ---------- The sky behind everything ---------- */
.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: linear-gradient(180deg, var(--bg0) 0%, var(--bg1) 55%, var(--bg2) 100%); }
.aurora i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; will-change: transform; animation: drift 46s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { width: 52vw; height: 46vw; left: -10vw; top: -18vw; background: radial-gradient(circle, rgba(46,197,255,.42), rgba(46,197,255,0) 68%); }
.aurora i:nth-child(2) { width: 50vw; height: 44vw; right: -14vw; top: -10vw; background: radial-gradient(circle, rgba(59,108,255,.5), rgba(59,108,255,0) 68%); animation-duration: 58s; animation-delay: -12s; }
.aurora i:nth-child(3) { width: 44vw; height: 36vw; left: 22vw; bottom: -20vw; background: radial-gradient(circle, rgba(25,230,193,.26), rgba(25,230,193,0) 68%); animation-duration: 64s; animation-delay: -30s; }
.aurora i:nth-child(4) { width: 40vw; height: 40vw; right: -8vw; bottom: -12vw; background: radial-gradient(circle, rgba(122,92,255,.42), rgba(122,92,255,0) 68%); animation-duration: 52s; animation-delay: -20s; }
.aurora .stars { position: absolute; inset: 0; opacity: .55;
  background-image: radial-gradient(1px 1px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 28% 62%, #cfe8ff, transparent), radial-gradient(1.5px 1.5px at 44% 12%, #fff, transparent),
    radial-gradient(1px 1px at 61% 41%, #dfefff, transparent), radial-gradient(1px 1px at 72% 8%, #fff, transparent), radial-gradient(1.5px 1.5px at 86% 30%, #cfe8ff, transparent),
    radial-gradient(1px 1px at 92% 72%, #fff, transparent), radial-gradient(1px 1px at 8% 84%, #dfefff, transparent), radial-gradient(1px 1px at 52% 88%, #fff, transparent), radial-gradient(1px 1px at 36% 34%, #fff, transparent);
  background-size: 900px 700px; }
@keyframes drift { 0% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(4vw, 3vw, 0) scale(1.08); } 100% { transform: translate3d(-3vw, 5vw, 0) scale(.96); } }

/* ---------- App shell ---------- */
#app { position: relative; z-index: 1; height: 100dvh; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.view { position: relative; flex: 1; min-height: 0; display: flex; }
.view > .screen { flex: 1; min-width: 0; }

.sidebar { position: relative; display: flex; flex-direction: column; gap: 20px; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 18px 14px 16px;
  background: linear-gradient(180deg, rgba(5, 11, 30, .82), rgba(4, 9, 26, .62)); border-right: 1px solid var(--line); backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2); }
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 4px; text-align: left; border-radius: 14px; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: radial-gradient(circle at 30% 20%, rgba(111, 230, 255, .28), rgba(122, 92, 255, .12) 70%); box-shadow: inset 0 0 0 1px rgba(140, 200, 255, .22), 0 8px 24px -8px rgba(46, 197, 255, .5); }
.brand-words { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1.05; letter-spacing: -0.035em; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-tag { font-family: var(--serif); font-style: italic; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-head { font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--dim); padding: 0 12px 8px; }
.side-item { position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px; color: var(--body); font-weight: 600; font-size: 14px; text-align: left; transition: background .18s, color .18s; }
.side-item:hover { background: rgba(140, 180, 255, .07); color: var(--text); }
.side-item .side-ic { display: inline-flex; color: var(--muted); transition: color .18s, transform .25s var(--ease); }
.side-item .side-ic .ic { width: 20px; height: 20px; }
.side-item:hover .side-ic { transform: translateX(1px); color: var(--soft); }
.side-item.on { color: var(--text); background: linear-gradient(90deg, rgba(46, 197, 255, .17), rgba(122, 92, 255, .06)); box-shadow: inset 0 0 0 1px rgba(110, 200, 255, .16); }
.side-item.on .side-ic { color: var(--accent); }
.side-item.on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); box-shadow: 0 0 12px rgba(76, 201, 255, .8); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.side-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: left; transition: border-color .2s, background .2s; }
.side-card:hover, .side-card.on { border-color: rgba(110, 200, 255, .35); background: rgba(22, 40, 86, .6); }
.side-ring { position: relative; width: 40px; height: 40px; flex: none; }
.side-ring > svg { position: absolute; inset: 0; }
.side-avatar { position: absolute; inset: 7px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; background: var(--raised); }
.side-card-text { display: flex; flex-direction: column; min-width: 0; }
.side-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-sub { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.side-sub .flame { color: var(--gold); display: inline-flex; }
.side-path { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 4px; }
.gbar { height: 6px; border-radius: 3px; background: rgba(140, 180, 255, .14); overflow: hidden; }
.gbar > i { display: block; height: 100%; border-radius: 3px; background: var(--grad); box-shadow: 0 0 12px rgba(76, 201, 255, .55); transition: width .8s var(--ease); }

.topbar { flex: none; height: 66px; display: flex; align-items: center; gap: 14px; padding: 0 var(--pad-x); border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(5, 11, 30, .62), rgba(5, 11, 30, .38)); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); position: relative; z-index: 5; }
.top-back { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--control); border: 1px solid var(--line); color: var(--soft); flex: none; transition: background .2s, transform .2s; }
.top-back:hover { background: rgba(140, 180, 255, .12); color: var(--text); transform: translateX(-1px); }
.top-back .ic { width: 18px; height: 18px; }
.crumbs { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; font-weight: 600; }
.crumb { color: var(--muted); white-space: nowrap; }
button.crumb:hover { color: var(--text); }
.crumb.cur { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { color: var(--faint); }
.top-search { width: clamp(220px, 32vw, 440px); height: 40px; border-radius: 12px; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 12px; color: var(--muted); font-size: 13.5px; text-align: left;
  background: rgba(140, 180, 255, .06); border: 1px solid var(--line); transition: border-color .2s, background .2s; }
.top-search:hover { border-color: rgba(110, 200, 255, .32); background: rgba(140, 180, 255, .09); color: var(--soft); }
.top-search .ic { width: 18px; height: 18px; }
.top-search > span.grow { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kbd-hint { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 7px; border: 1px solid var(--line2); color: var(--muted); background: rgba(0, 0, 0, .18); white-space: nowrap; }
.top-avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(var(--raised), var(--raised)) padding-box, var(--grad) border-box; border: 2px solid transparent; transition: transform .2s; }
.top-avatar:hover { transform: scale(1.05); }
.pad-live { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--accent);
  background: rgba(46, 197, 255, .1); border: 1px solid rgba(46, 197, 255, .3); white-space: nowrap; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 3px; border-radius: 2px; background: currentColor; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(1) { height: 6px; } .eq i:nth-child(2) { height: 12px; animation-delay: -.3s; } .eq i:nth-child(3) { height: 8px; animation-delay: -.6s; }
@keyframes eq { 50% { transform: scaleY(.35); } }

/* Phones: bottom navigation */
.nav { display: none; }

/* ---------- Screen scaffold ---------- */
.screen { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; container-type: inline-size; container-name: page;
  padding: 32px max(var(--pad-x), calc((100% - var(--content-max)) / 2)) 56px; display: flex; flex-direction: column; gap: 18px; scroll-padding-top: 24px; }
.scroll.tight { gap: 14px; }
.scroll > *, .col > .hscroll { flex-shrink: 0; }
.narrow-page { max-width: 920px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.reading { max-width: 760px; }
.dock { position: relative; z-index: 3; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: min(calc(100% - 2 * var(--pad-x)), var(--content-max)); margin: 0 auto 20px; padding: 12px 14px; border-radius: 24px;
  background: linear-gradient(180deg, rgba(16, 30, 66, .82), rgba(10, 20, 48, .86)); border: 1px solid var(--line2); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .85), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3); }

/* Two-column layouts that collapse when the page is narrow. */
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.split > .main-col, .split > .aside-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@container page (min-width: 820px) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 28px; }
  .split.wide-aside { grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); }
  .split.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .split > .aside-col.sticky { position: sticky; top: 0; }
  .split.aside-left { grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); }
}
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--min, 260px), 100%), 1fr)); gap: 14px; }
@container page (min-width: 900px) { .grid-auto { gap: 16px; } }

/* ---------- Screen transitions ---------- */
.screen.leaving { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.screen.leaving.dir-fwd { animation: out-left .24s ease-in both; }
.screen.leaving.dir-back { animation: out-right .24s ease-in both; }
.screen.leaving.dir-tab { animation: fade-out .2s ease-in both; }
.screen.entering { z-index: 1; }
.screen.entering.dir-fwd { animation: in-right .46s var(--ease) both; }
.screen.entering.dir-back { animation: in-left .46s var(--ease) both; }
.screen.entering.dir-tab .scroll > * { animation: rise .55s var(--ease) both; }
.screen.entering.dir-tab .scroll > *:nth-child(2) { animation-delay: 40ms; }
.screen.entering.dir-tab .scroll > *:nth-child(3) { animation-delay: 80ms; }
.screen.entering.dir-tab .scroll > *:nth-child(4) { animation-delay: 120ms; }
.screen.entering.dir-tab .scroll > *:nth-child(5) { animation-delay: 160ms; }
.screen.entering.dir-tab .scroll > *:nth-child(n+6) { animation-delay: 200ms; }
@keyframes in-right { from { opacity: 0; transform: translate3d(36px, 0, 0); } }
@keyframes in-left { from { opacity: 0; transform: translate3d(-36px, 0, 0); } }
@keyframes out-left { to { opacity: 0; transform: translate3d(-24px, 0, 0); } }
@keyframes out-right { to { opacity: 0; transform: translate3d(24px, 0, 0); } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translate3d(0, 16px, 0); } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.stage-in { animation: stage-in .5s var(--ease) both; }
@keyframes stage-in { from { opacity: 0; transform: translate3d(0, 10px, 0) scale(.99); filter: blur(4px); } }

/* ---------- Typography ---------- */
.display { font-family: var(--display); font-weight: 750; letter-spacing: -0.032em; line-height: 1.1; }
.serif { font-family: var(--serif); font-optical-sizing: auto; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); font-weight: 700; font-feature-settings: "zero" 0; }
.eyebrow { font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.t-title { font-family: var(--display); font-weight: 800; font-size: clamp(34px, 4.2cqi, 52px); letter-spacing: -0.04em; line-height: 1.02; }
.grad-text { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.h2 { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.022em; }
.small { font-size: 12.5px; } .tiny { font-size: 11px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .body-c { color: var(--body); } .soft { color: var(--soft); }
.accent { color: var(--accent); } .sage { color: var(--sage-text); } .coral { color: var(--coral); }
.bold { font-weight: 700; } .xbold { font-weight: 800; }
.center { text-align: center; }
.tnum { font-variant-numeric: tabular-nums; }
p { margin: 0; }
h1, h2, h3 { margin: 0; }

/* ---------- Layout helpers ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.row.top { align-items: flex-start; }
.row.bottom { align-items: flex-end; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 4px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.hscroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 4px; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll.wrapwide { flex-wrap: wrap; overflow: visible; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grid6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.grid7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
@container page (min-width: 900px) { .grid6.keys12 { grid-template-columns: repeat(12, 1fr); } }
.spacer { height: 4px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 760px) { .mobile-only { display: none !important; } }
@media (max-width: 759px) { .desktop-only { display: none !important; } }

/* ---------- Components ---------- */
.panel { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.panel.ground { background: rgba(4, 9, 26, .55); border-color: var(--line); }
.panel.s2 { background: var(--surface2); }
.panel.big { border-radius: 26px; padding: 26px; gap: 14px; }
.panel.glow { border-color: rgba(110, 200, 255, .28); background: linear-gradient(160deg, rgba(30, 60, 130, .55), rgba(14, 26, 62, .6) 55%, rgba(40, 28, 110, .45)); box-shadow: var(--glow); }
.panel.hero { overflow: hidden; border-radius: 28px; padding: 30px; border-color: rgba(110, 200, 255, .24);
  background: radial-gradient(120% 140% at 0% 0%, rgba(46, 197, 255, .22), transparent 55%), radial-gradient(120% 140% at 100% 100%, rgba(122, 92, 255, .28), transparent 55%), linear-gradient(160deg, #0E2250, #0A1638); }
.panel-head { display: flex; align-items: center; gap: 10px; }
.panel-head .eyebrow { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; transition: border-color .2s, background .2s, transform .2s var(--ease), box-shadow .2s; }
button.card:hover, .lift:hover { border-color: rgba(110, 200, 255, .32); background: rgba(24, 44, 92, .6); transform: translateY(-2px); box-shadow: 0 16px 40px -22px rgba(46, 197, 255, .55); }
button.card:active, .pressable:active { transform: scale(0.985); }
.key-box { width: 52px; height: 52px; border-radius: 15px; background: var(--grad-soft); box-shadow: inset 0 0 0 1px rgba(140, 200, 255, .18); display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; }

.btn { height: 52px; border-radius: 16px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; font-size: 15px; white-space: nowrap; letter-spacing: -0.01em; transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, filter .2s; }
.btn.primary { background: var(--grad-btn); color: var(--on-accent); box-shadow: 0 10px 30px -12px rgba(76, 201, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .45); }
.btn.primary:hover { filter: brightness(1.07); box-shadow: 0 14px 36px -12px rgba(76, 201, 255, .95), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn.primary:active { transform: scale(.98); }
.btn.secondary { background: rgba(140, 180, 255, .07); border: 1px solid var(--line2); color: var(--text); font-size: 14.5px; }
.btn.secondary:hover { background: rgba(140, 180, 255, .12); border-color: rgba(110, 200, 255, .36); }
.btn.sm { height: 42px; font-size: 13.5px; border-radius: 13px; }
.btn.md { height: 48px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.45; }
.btn .ic { width: 19px; height: 19px; }

.pill { height: 40px; padding: 0 14px; border-radius: 12px; background: rgba(140, 180, 255, .06); border: 1px solid var(--line2); color: var(--soft); font-weight: 600; font-size: 13.5px; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; flex: none; transition: background .18s, border-color .18s, color .18s; }
.pill:hover { border-color: rgba(110, 200, 255, .36); color: var(--text); }
.pill.round { border-radius: 999px; }
.pill.sm { height: 36px; font-size: 13px; border-radius: 10px; padding: 0 12px; }
.pill.xs { height: 32px; font-size: 12px; padding: 0 10px; }
.pill.on { background: var(--text); border-color: var(--text); color: var(--bg0); }
.pill.on.amber, .pill.on.key { background: var(--grad-btn); border-color: transparent; color: var(--on-accent); box-shadow: 0 6px 18px -8px rgba(76, 201, 255, .8); }
.pill.key { font-family: var(--display); font-weight: 750; font-size: 15px; padding: 0 4px; }
.pill.monoc { font-family: var(--mono); }

.seg { display: flex; gap: 4px; padding: 4px; background: rgba(4, 9, 26, .5); border: 1px solid var(--line); border-radius: 14px; }
.seg button { flex: 1; height: 38px; border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--muted); transition: background .2s, color .2s; white-space: nowrap; padding: 0 10px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: linear-gradient(180deg, rgba(76, 201, 255, .26), rgba(76, 140, 255, .18)); color: var(--text); box-shadow: inset 0 0 0 1px rgba(110, 200, 255, .35); }

.sq { width: 42px; height: 42px; border-radius: 12px; background: rgba(140, 180, 255, .07); border: 1px solid var(--line2); font-size: 19px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; transition: background .18s, border-color .18s; }
.sq:hover { background: rgba(140, 180, 255, .13); border-color: rgba(110, 200, 255, .36); }
.circle-btn { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; transition: background .18s; }
button.circle-btn:hover { background-color: rgba(140, 180, 255, .1); }
.circle-btn .ic { width: 20px; height: 20px; }
.back { width: 42px; height: 42px; border-radius: 50%; background: var(--control); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.play { width: 68px; height: 68px; border-radius: 50%; background: var(--grad-btn); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 12px 32px -10px rgba(76, 201, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .5); transition: transform .15s, filter .2s; }
.play:hover { filter: brightness(1.08); transform: scale(1.03); }
.play .ic { width: 26px; height: 26px; margin-left: 3px; }
.pause-glyph { display: flex; gap: 6px; } .pause-glyph i { width: 5px; height: 22px; border-radius: 2px; background: var(--on-accent); display: block; }

.tag { display: inline-block; font-family: var(--mono); font-size: 9.5px; font-weight: 700; padding: 3px 7px; border-radius: 7px; border: 1px solid transparent; letter-spacing: 0.6px; }
.ic { width: 22px; height: 22px; flex: none; }

.detail-header { display: flex; align-items: center; gap: 14px; }
.detail-header .title { font-family: var(--display); font-weight: 800; font-size: clamp(28px, 3.4cqi, 42px); letter-spacing: -0.038em; line-height: 1.05; }
.detail-header .back { display: none; }

.field { width: 100%; background: rgba(4, 9, 26, .55); border: 1px solid var(--line2); border-radius: 12px; padding: 13px 14px; font-size: 15px; color: var(--text); outline: none; resize: vertical; transition: border-color .2s, box-shadow .2s; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(76, 201, 255, .14); }
.field::placeholder, .code::placeholder { color: var(--dim); }
label.lbl, .lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
.search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px; border-radius: 14px; background: rgba(4, 9, 26, .5); border: 1px solid var(--line2); transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(76, 201, 255, .14); }
.search input { flex: 1; background: none; border: 0; outline: none; font-size: 15px; min-width: 0; }
.search input::placeholder { color: var(--dim); }
.code { font-family: var(--mono); font-weight: 500; font-size: 14px; line-height: 1.6; background: rgba(3, 7, 20, .6); border: 1px solid var(--line); border-radius: 16px; padding: 14px; min-height: 360px; width: 100%; color: var(--text); outline: none; resize: vertical; }
.code:focus { border-color: rgba(76, 201, 255, .5); }

.switch { width: 50px; height: 30px; border-radius: 15px; background: var(--raised); position: relative; flex: none; transition: background .2s; box-shadow: inset 0 0 0 1px var(--line2); }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--soft); transition: transform .25s var(--ease), background .2s; }
.switch.on { background: var(--grad-btn); box-shadow: none; }
.switch.on::after { transform: translateX(20px); background: #fff; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(to right, #4CC9FF 0%, #5B8CFF var(--p, 50%), rgba(140, 180, 255, .16) var(--p, 50%)); }
input[type=range]::-moz-range-track { height: 5px; border-radius: 3px; background: rgba(140, 180, 255, .16); }
input[type=range]::-moz-range-progress { height: 5px; border-radius: 3px; background: linear-gradient(90deg, #4CC9FF, #5B8CFF); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; margin-top: -7.5px; box-shadow: 0 0 0 4px rgba(76, 201, 255, .35), 0 4px 10px rgba(0, 0, 0, .4); }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(76, 201, 255, .35); }

.divider { height: 1px; background: var(--line); }
.bar { height: 6px; border-radius: 3px; background: rgba(140, 180, 255, .14); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: 3px; box-shadow: 0 0 10px rgba(76, 201, 255, .5); transition: width .8s var(--ease); }

/* ---------- Dialogs, toasts, palette ---------- */
.scrim { position: fixed; inset: 0; background: rgba(2, 4, 12, 0.66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; animation: fade-in .18s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
.dialog { background: linear-gradient(180deg, #11214A, #0B1736); border: 1px solid var(--line2); border-radius: 24px; padding: 26px; width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 16px; max-height: 85dvh; overflow-y: auto; box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .9); animation: pop .22s var(--ease); }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog .actions button { padding: 10px 16px; font-weight: 700; border-radius: 12px; }
.dialog .actions button:hover { background: rgba(140, 180, 255, .1); }
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); background: linear-gradient(180deg, #15295A, #0F1E44); border: 1px solid var(--line2); color: var(--text); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; z-index: 60; max-width: min(90vw, 560px); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); animation: toast-in .25s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }
.palette { position: fixed; inset: 0; z-index: 70; background: rgba(2, 4, 12, .6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 20px 20px; animation: fade-in .15s ease-out; }
.palette.closing { animation: fade-out .15s ease-in both; }
.pal-box { width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column; border-radius: 20px; overflow: hidden; background: linear-gradient(180deg, rgba(18, 34, 76, .96), rgba(10, 20, 48, .97)); border: 1px solid var(--line2); box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .9), 0 0 0 1px rgba(110, 200, 255, .08); animation: pop .2s var(--ease); }
.pal-head { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 60px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-input { flex: 1; background: none; border: 0; outline: none; font-size: 17px; min-width: 0; }
.pal-input::-webkit-search-cancel-button { display: none; }
.pal-list { overflow-y: auto; padding: 6px 8px 10px; }
.pal-group { font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; color: var(--dim); padding: 12px 10px 6px; }
.pal-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; text-align: left; }
.pal-item.on { background: linear-gradient(90deg, rgba(46, 197, 255, .17), rgba(122, 92, 255, .08)); box-shadow: inset 0 0 0 1px rgba(110, 200, 255, .2); }
.pal-ic { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: rgba(140, 180, 255, .08); color: var(--accent); flex: none; }
.pal-ic .ic { width: 18px; height: 18px; }
.pal-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); }
.pal-foot b { font-family: var(--mono); color: var(--muted); }

/* ---------- Intro ---------- */
.intro { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; transition: opacity .6s, transform .6s var(--ease); cursor: pointer; }
.intro.out { opacity: 0; transform: scale(1.04); }
.intro canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.intro .mark { position: relative; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.intro .mark svg { width: 96px; height: 96px; animation: intro-scale .9s cubic-bezier(.4,0,.2,1) both; }
.intro .words { text-align: center; animation: intro-fade .7s .3s both; }
@keyframes intro-scale { from { transform: scale(.82); } }
@keyframes intro-fade { from { opacity: 0; } }

/* ---------- Song chart ---------- */
.chart-line { display: flex; flex-wrap: wrap; align-items: flex-end; padding: 6px 12px; border-radius: 14px; transition: background .25s; }
.chart-line.on { background: linear-gradient(90deg, rgba(46, 197, 255, .14), rgba(122, 92, 255, .06)); box-shadow: inset 3px 0 0 var(--accent); }
.seg-c { display: flex; flex-direction: column; }
.seg-c .ch { font-family: var(--mono); font-weight: 700; color: var(--accent); min-height: 1.2em; white-space: pre; cursor: pointer; }
.seg-c .ch:hover { color: #9FE6FF; }
.seg-c .ly { white-space: pre-wrap; font-weight: 500; }
.chart-line:not(.on).dimmed .ly { color: var(--dim); }
.chart-line.on .ly { font-weight: 650; }

/* ---------- Charts & progress visuals ---------- */
.chart svg text { font-family: var(--mono); font-weight: 500; }
.ring { position: relative; flex: none; }
.ring > svg { display: block; }
.ring .ring-arc { transition: stroke-dasharray 1.1s var(--ease); }
.ring .ring-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; text-align: center; }
.draw-in { stroke-dasharray: var(--len) var(--len); stroke-dashoffset: var(--len); animation: draw 1.4s var(--ease) .1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.grow-up { transform-box: fill-box; transform-origin: bottom; animation: grow-up .9s var(--ease) both; }
@keyframes grow-up { from { transform: scaleY(0); } }
.fade-cell { animation: fade-in .5s ease-out both; }

/* Stage track: the path's units as connected stages. */
.stages { position: relative; display: grid; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)); gap: 0; padding: 6px 0 2px; }
.stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 0 4px; cursor: pointer; background: none; }
.stage::before { content: ""; position: absolute; top: 22px; left: -50%; right: 50%; height: 3px; background: rgba(140, 180, 255, .16); z-index: 0; }
.stage:first-child::before { display: none; }
.stage.done::before, .stage.cur::before { background: linear-gradient(90deg, #2EE6C1, #4CC9FF); box-shadow: 0 0 10px rgba(76, 201, 255, .5); }
.stage .node { position: relative; z-index: 1; width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
  background: var(--surface-solid); border: 2px solid var(--line2); color: var(--muted); transition: transform .3s var(--ease), box-shadow .3s; }
.stage .node svg.ring-svg { position: absolute; inset: -6px; width: 58px; height: 58px; }
.stage:hover .node { transform: scale(1.06); }
.stage.done .node { background: linear-gradient(135deg, #2EE6C1, #4CC9FF); border-color: transparent; color: var(--on-accent); }
.stage.cur .node { background: var(--grad-btn); border-color: transparent; color: var(--on-accent); box-shadow: 0 0 0 6px rgba(76, 201, 255, .16), 0 0 30px rgba(76, 201, 255, .6); animation: beacon 2.4s ease-in-out infinite; }
.stage.sel .node { outline: 2px solid #fff; outline-offset: 3px; }
@keyframes beacon { 50% { box-shadow: 0 0 0 10px rgba(76, 201, 255, .06), 0 0 40px rgba(76, 201, 255, .75); } }
.stage .s-title { font-size: 12.5px; font-weight: 700; color: var(--soft); line-height: 1.25; }
.stage .s-sub { font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.stage.cur .s-title { color: var(--text); }
.stage.done .s-sub { color: var(--sage-text); }

/* Path steps: a winding trail of stepping stones. */
.trail { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px 0; }
.trail-step { position: relative; display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-radius: 18px; text-align: left; width: min(100%, 460px); transition: background .2s, transform .3s var(--ease); }
.trail-step:hover { background: rgba(140, 180, 255, .06); }
.trail-step .stone { width: 56px; height: 56px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px;
  background: var(--surface-solid); border: 2px solid var(--line2); color: var(--soft); transition: transform .3s var(--ease); }
.trail-step:hover .stone { transform: scale(1.06); }
.trail-step.done .stone { background: linear-gradient(135deg, #2EE6C1, #4CC9FF); border-color: transparent; color: var(--on-accent); }
.trail-step.cur .stone { width: 68px; height: 68px; font-size: 20px; background: var(--grad-btn); border-color: transparent; color: var(--on-accent); box-shadow: 0 0 0 7px rgba(76, 201, 255, .14), 0 0 36px rgba(76, 201, 255, .6); animation: beacon 2.4s ease-in-out infinite; }
.trail svg.trail-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }

/* Heat cells legend etc. */
.legend { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: block; }

/* Stat tiles */
.stat { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; padding: 16px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.stat .v { font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: -0.04em; line-height: 1.05; font-variant-numeric: tabular-nums; align-self: end; }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 500; grid-column: 2; align-self: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .ic-badge { grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; }
.stat .ic-badge .ic { width: 20px; height: 20px; }

/* Tool tiles */
.tile { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 150px; padding: 18px; border-radius: 22px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); transition: transform .25s var(--ease), border-color .25s, box-shadow .25s, background .25s; }
.tile::after { content: ""; position: absolute; inset: auto -30% -60% auto; width: 70%; height: 90%; border-radius: 50%; background: radial-gradient(circle, var(--tint, rgba(76, 201, 255, .25)), transparent 70%); opacity: .5; transition: opacity .3s, transform .4s var(--ease); pointer-events: none; }
.tile:hover { transform: translateY(-3px); border-color: rgba(110, 200, 255, .32); box-shadow: 0 20px 50px -24px rgba(46, 197, 255, .6); }
.tile:hover::after { opacity: 1; transform: scale(1.15); }
.tile .tile-ic { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: rgba(140, 180, 255, .08); box-shadow: inset 0 0 0 1px rgba(140, 200, 255, .14); color: var(--accent); }
.tile .tile-ic .ic { width: 22px; height: 22px; }
.tile .arrow { position: absolute; top: 18px; right: 18px; color: var(--dim); transition: transform .25s var(--ease), color .25s; }
.tile:hover .arrow { transform: translate(2px, -2px); color: var(--text); }
.tile .arrow .ic { width: 18px; height: 18px; }

/* Section heading row */
.section-head { display: flex; align-items: flex-end; gap: 12px; margin-top: 6px; }
.section-head .h2 { flex: 1; }
.link-btn { font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 0; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { color: var(--accent); }
.link-btn .ic { width: 16px; height: 16px; }

/* ---------- Misc ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.chip-chord { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; transition: border-color .2s, transform .2s var(--ease), background .2s; }
.chip-chord:hover { border-color: rgba(110, 200, 255, .35); transform: translateY(-2px); background: rgba(24, 44, 92, .6); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.stat-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; }
.stat-chip .ic { width: 15px; height: 15px; }
.quick { height: 54px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); padding: 0 16px; display: flex; align-items: center; gap: 12px; font-weight: 650; font-size: 14px; text-align: left; transition: border-color .2s, background .2s, transform .2s var(--ease); }
.quick:hover { border-color: rgba(110, 200, 255, .32); background: rgba(24, 44, 92, .6); transform: translateY(-1px); }
.quick .ic { width: 20px; height: 20px; color: var(--accent); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: left; width: 100%; transition: border-color .2s, background .2s; }
button.list-row:hover { border-color: rgba(110, 200, 255, .3); background: rgba(24, 44, 92, .55); }
.drag-ghost { box-shadow: 0 20px 50px rgba(0,0,0,.6), 0 0 0 1px rgba(110, 200, 255, .4); z-index: 5; position: relative; }
.viewer3d { position: relative; flex: 1; min-height: 0; touch-action: none; background: radial-gradient(circle at 50% 45%, #16285A 0%, rgba(6, 12, 34, .4) 70%); }
.viewer3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.kbd { font-family: var(--mono); font-size: 11px; }
.tiny-ic { width: 14px; height: 14px; }
@keyframes padPulse { 0%, 100% { transform: scale(0.92); } 50% { transform: scale(1.08); } }
@keyframes checkPop { 0% { transform: scale(0); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes ripple { from { transform: scale(0.55); opacity: 0.8; } to { transform: scale(1.25); opacity: 0; } }
@keyframes celebrate { 0% { opacity: 0; } 12% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes spark { from { transform: translate(0, 0) scale(1); opacity: 0.9; } to { transform: translate(var(--dx), var(--dy)) scale(0.6); opacity: 0; } }
.grid7 .pill, .grid6 .pill { padding: 0 2px; min-width: 0; }
.verse-text { font-family: var(--serif); font-weight: 400; font-style: italic; letter-spacing: -0.01em; line-height: 1.38; color: #EAF4FF; }
.lift { transition: transform .25s var(--ease), border-color .25s, box-shadow .25s, background .25s; }

/* ---------- Tablets & small laptops: icon rail ---------- */
@media (max-width: 1179px) {
  :root { --side-w: 84px; --pad-x: 28px; }
  .sidebar { padding: 16px 12px; align-items: center; gap: 16px; }
  .brand { padding: 4px; }
  .brand-words, .side-label, .side-head, .side-card-text, .side-path { display: none; }
  .side-group { align-items: center; gap: 4px; padding-top: 10px; border-top: 1px solid var(--line); }
  .side-group:first-of-type { border-top: 0; padding-top: 0; }
  .side-item { width: 52px; height: 48px; padding: 0; justify-content: center; }
  .side-item.on::before { left: -12px; }
  .side-item .side-ic .ic { width: 22px; height: 22px; }
  .side-card { padding: 6px; border-radius: 50%; }
  .top-search { width: clamp(180px, 34vw, 360px); }
}

/* ---------- Phones: bottom bar, no sidebar ---------- */
@media (max-width: 759px) {
  :root { --pad-x: 20px; }
  #app { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .topbar { display: none; }
  .scroll { padding: calc(20px + var(--safe-top)) 20px 28px; gap: 14px; }
  .t-title { font-size: 34px; }
  .detail-header .back { display: inline-flex; }
  .detail-header .title { font-size: 26px; }
  .dock { width: 100%; margin: 0; border-radius: 26px 26px 0 0; border-width: 1px 0 0; padding: 14px 18px calc(14px + var(--safe-bottom)); }
  .with-nav .dock { padding-bottom: 14px; }
  .nav { display: none; background: var(--nav); border-top: 1px solid var(--line); padding: 0 4px var(--safe-bottom); flex: none; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
  .with-nav .nav { display: flex; }
  .nav button { flex: 1; height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--dim); font-size: 10px; font-weight: 600; }
  .nav button .pill-ic { width: 46px; height: 28px; border-radius: 14px; display: flex; align-items: center; justify-content: center; transition: background .2s; }
  .nav button .ic { width: 21px; height: 21px; }
  .nav button.on { color: var(--text); font-weight: 700; }
  .nav button.on .pill-ic { background: linear-gradient(135deg, rgba(76, 201, 255, .28), rgba(122, 92, 255, .2)); color: #9FE6FF; }
  .toast { bottom: 96px; }
  .panel { padding: 18px; border-radius: 22px; }
  .panel.hero { padding: 22px; }
  .stages { grid-template-columns: repeat(var(--n, 8), 92px); overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
  .stages::-webkit-scrollbar { display: none; }
  .hscroll.edge { margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
  .panel.song-sheet { background: transparent; border: 0; box-shadow: none; padding: 4px 0 !important; }
  .chart-line { padding: 6px 4px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Dashboard grid ---------- */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.dash > * { grid-column: 1 / -1; min-width: 0; }
@container page (min-width: 720px) {
  .dash > .c4, .dash > .c5, .dash > .c6, .dash > .c7 { grid-column: span 6; }
}
@container page (min-width: 840px) {
  .dash > .c8 { grid-column: span 7; } .dash > .c4 { grid-column: span 5; }
}
@container page (min-width: 1020px) {
  .dash { gap: 20px; }
  .dash > .c4 { grid-column: span 4; } .dash > .c5 { grid-column: span 5; } .dash > .c6 { grid-column: span 6; }
  .dash > .c7 { grid-column: span 7; } .dash > .c8 { grid-column: span 8; }
}
.page-head { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.page-head > .grow { min-width: 240px; }
.page-head .search { width: min(380px, 100%); }
.trail-step { width: min(calc(100% - 64px), 380px); transform: translateX(calc(var(--off, 0) * .55px)); }
@container page (min-width: 900px) { .trail-step { transform: translateX(calc(var(--off, 0) * 1.9px)); } }
@media (min-width: 760px) { .dock.mobile-dock { display: none; } }

/* ---------- 3D viewer layout ---------- */
.anatomy .an-head { padding: calc(20px + var(--safe-top)) 20px 12px; }
.anatomy .an-view { flex: 1; min-height: 0; display: flex; }
.anatomy .an-side { padding: 12px 20px calc(12px + var(--safe-bottom)); max-height: 34dvh; overflow-y: auto; }
@media (min-width: 760px) {
  .screen.anatomy { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); grid-template-rows: auto minmax(0, 1fr); column-gap: 24px; padding: 28px var(--pad-x) 28px; }
  .anatomy .an-head { grid-column: 1 / -1; padding: 0 0 18px; flex-direction: row !important; align-items: flex-end; justify-content: space-between; }
  .anatomy .an-seg { width: 300px; }
  .anatomy .an-view { border-radius: 26px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
  .anatomy .an-side { padding: 0; max-height: none; overflow-y: auto; gap: 16px !important; }
}
.tiles6 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@container page (min-width: 560px) { .tiles6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container page (min-width: 1040px) { .tiles6 { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; } }
.pill.key { min-width: 40px; }
@media (min-width: 760px) { .code.editor { min-height: max(360px, calc(100dvh - 380px)); } }

/* Family-code sign-in */
.signin { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at 25% 20%, rgba(46,197,255,.18), transparent 55%), radial-gradient(circle at 80% 70%, rgba(122,92,255,.18), transparent 55%), #050B1C; }
.signin-card { width: 100%; max-width: 380px; padding: 32px 24px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(12px); }

/* Worship pad: Sanctus runs in one long-lived frame placed over .sanctus-stage */
.pad-screen { display: flex; flex-direction: column; gap: 12px; height: 100%; min-height: 0; padding: 16px; box-sizing: border-box; }
.sanctus-stage { flex: 1; min-height: 420px; border-radius: 20px; border: 1px solid var(--line); background: #070B18; }
.sanctus-host { position: fixed; display: none; z-index: 5; border-radius: 20px; overflow: hidden; }
.sanctus-host.shown { display: block; }
.sanctus-host iframe { width: 100%; height: 100%; border: 0; display: block; }

/* First-run welcome (uses the .signin backdrop) */
.signin { transition: opacity .4s; overflow-y: auto; }
.signin.out { opacity: 0; pointer-events: none; }
.welcome { gap: 18px; align-items: center; margin: auto; }
.welcome.in { animation: welcome-in .45s var(--ease) both; }
@keyframes welcome-in { from { opacity: 0; transform: translateY(10px); } }
.welcome-feature { display: flex; gap: 12px; align-items: center; text-align: left; }
.welcome-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); background: rgba(46, 197, 255, .1); border: 1px solid var(--line); }
.welcome-dots { display: flex; gap: 6px; }
.welcome-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--line2); transition: width .3s, background .3s; }
.welcome-dots i.on { width: 18px; background: var(--accent); }
.welcome-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.welcome-or::before, .welcome-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.linkish { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; padding: 6px 10px; cursor: pointer; }
.linkish:hover { color: var(--text); }
.signin:has(.welcome) { align-items: flex-start; }

/* Play along: worship pad + drums on one page, and the floating player elsewhere */
.playalong-stage { flex: none; height: clamp(380px, 58dvh, 680px); min-height: 0; }
.playalong-dock { gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pad-toggle { display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-radius: 16px; background: rgba(140, 180, 255, .06); border: 1px solid var(--line2); color: var(--soft); transition: background .2s, border-color .2s, color .2s; }
.pad-toggle .ic { width: 20px; height: 20px; }
.pad-toggle.on { background: rgba(122, 92, 255, .2); border-color: rgba(154, 133, 255, .7); color: var(--text); }
.pad-toggle.on .eq { color: #B9A8FF; }
.mini-player { display: none; }
.mini-player.shown { display: flex; align-items: center; gap: 8px; margin: 0 12px 10px; padding: 8px 8px 8px 14px; border-radius: 20px; z-index: 6;
  background: linear-gradient(90deg, rgba(122, 92, 255, .28), rgba(46, 197, 255, .18)), var(--surface2); border: 1px solid rgba(154, 133, 255, .45);
  box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .8), 0 0 24px -10px rgba(122, 92, 255, .8); backdrop-filter: blur(14px); animation: mini-in .35s var(--ease) both; }
@keyframes mini-in { from { opacity: 0; transform: translateY(12px); } }
.mini-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left; color: var(--text); padding: 4px 0; }
.mini-info .eq { color: #B9A8FF; flex: none; }
.mini-what { font-size: 12px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-btn { flex: none; width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); background: rgba(4, 9, 26, .35); border: 1px solid var(--line); }
.mini-btn .ic { width: 20px; height: 20px; }
.mini-btn.on { color: var(--text); background: rgba(122, 92, 255, .35); border-color: rgba(154, 133, 255, .6); }
.mini-btn.stop:hover { color: var(--coral); }
@media (min-width: 900px) { .mini-player.shown { align-self: center; width: min(560px, calc(100% - 48px)); margin-bottom: 16px; } }
