@font-face { font-family: "Plus Jakarta Sans"; src: url("../fonts/plus-jakarta-sans-latin.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("../fonts/plus-jakarta-sans-latin-ext.woff2") format("woff2"); font-weight: 200 800; font-display: swap; unicode-range: U+0100-024F, U+1E00-1EFF; }

/* Hablama tokens (docs/design/DESIGN_SYSTEM.md): lavender ground, violet action, gold for stars and sparks. */
:root {
  --bg: #F5F3FC; --card: #FFFFFF; --panel: #F7F3FF; --line: #E3DCF4;
  --ink: #24123D; --ink-2: #433661; --ink-3: #6E6488;
  --violet: #4F22D8; --violet-2: #6530F0; --violet-1: #EEE9FF; --violet-3: #DCD3FF;
  --gold: #F5C94E; --gold-1: #FFF4C9; --ok: #1F8A5B; --ok-1: #E3F5EC;
  --shadow: 0 6px 20px rgba(79, 34, 216, .08);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
main { max-width: 760px; margin: 0 auto; padding: calc(16px + var(--safe-t)) max(16px, env(safe-area-inset-right)) calc(var(--tabbar) + 32px + var(--safe-b)) max(16px, env(safe-area-inset-left)); outline: none; }
h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
h2 { font-size: 20px; letter-spacing: -.01em; margin: 0; }
h3 { font-size: 16px; margin: 0; }
p { margin: 0; }
.muted { color: var(--ink-3); }
.eyebrow { font: 700 12px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--violet); }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* top of each page */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.brand { display: flex; align-items: baseline; gap: 6px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand span { color: var(--violet); }
.chip-stat { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; }
.spark { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #FFE07A, var(--gold) 60%, #D9A21E); display: inline-block; }
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--violet); padding: 6px 0; }

/* level switch */
.levels { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.levels a { flex: none; padding: 8px 14px; border-radius: 14px; background: var(--violet-1); color: var(--ink-2); font-weight: 700; font-size: 14px; }
.levels a[aria-current="true"] { background: var(--violet); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 16px; box-shadow: var(--shadow); }
.next { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 14px; align-items: center; }
.cover { aspect-ratio: 1; border-radius: 18px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; text-align: center; padding: 6px; position: relative; overflow: hidden; }
.cover::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 75% 20%, rgba(255,255,255,.35), transparent 55%); }
.cover small { position: relative; z-index: 1; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 16px; font-weight: 700; border: 0; cursor: pointer; }
.btn.primary { background: linear-gradient(var(--violet-2), var(--violet)); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 6px 14px rgba(79,34,216,.22); }
.btn.secondary { background: var(--card); color: var(--violet); border: 1px solid var(--violet-3); }
.btn.ghost { background: var(--violet-1); color: var(--violet); }
.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn.full { width: 100%; }

/* units on the path */
.units { display: grid; gap: 12px; }
.unit { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.unit .num { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font-weight: 800; background: var(--violet-1); color: var(--violet); }
.unit.done .num { background: var(--gold-1); color: var(--ink); }
.unit h3 { line-height: 1.25; }
.unit .sub { font-size: 13px; color: var(--ink-3); }
.stars { color: var(--gold); letter-spacing: 1px; font-size: 14px; white-space: nowrap; }
.stars .off { color: var(--violet-3); }
.bar { height: 6px; border-radius: 6px; background: var(--violet-1); overflow: hidden; } .bar i { display: block; height: 100%; background: var(--violet); }

/* song lists */
.songs { display: grid; gap: 10px; }
.song-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 10px; }
.song-row .cover { border-radius: 12px; }
.song-row .t { font-weight: 700; }
.song-row .m { font-size: 13px; color: var(--ink-3); }
.soon { font: 700 11px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); background: var(--violet-1); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }

/* song page */
.hero { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; align-items: end; margin: 6px 0 18px; }
.hero .cover { border-radius: 24px; font-size: 15px; }
.hero h1 { font-size: 30px; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.action { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 14px; display: grid; gap: 4px; text-align: left; cursor: pointer; min-height: 96px; }
.action.main { grid-column: 1 / -1; background: linear-gradient(135deg, var(--violet-2), var(--violet)); color: #fff; border: 0; }
.action .ai { font-size: 22px; } .action b { font-size: 17px; } .action span { font-size: 13px; opacity: .8; }
.action[aria-disabled="true"] { opacity: .55; cursor: default; }
.note { font-size: 13px; color: var(--ink-3); background: var(--panel); border-radius: 14px; padding: 10px 12px; }

/* player */
.player-top { position: sticky; top: 0; z-index: 3; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); padding: calc(8px + var(--safe-t)) 0 8px; margin-top: calc(-16px - var(--safe-t)); }
.lyrics { display: grid; gap: 14px; padding: 8px 0 140px; }
.lyric { padding: 8px 12px; border-radius: 14px; transition: background .2s; cursor: pointer; }
.lyric .es { font-size: 21px; font-weight: 700; line-height: 1.35; color: var(--ink-3); }
.lyric .en { font-size: 14px; color: var(--ink-3); margin-top: 2px; }
.lyric.active { background: var(--card); box-shadow: var(--shadow); }
.lyric.active .es { color: var(--ink); }
.lyric.past .es { color: var(--ink-2); }
.hide-en .lyric .en { display: none; }
.w { cursor: pointer; border-radius: 6px; }
.w.on { color: var(--violet); }
.w.target { text-decoration: underline 2px var(--gold); text-underline-offset: 4px; }
.w.new { text-decoration: underline 2px dotted var(--violet); text-underline-offset: 4px; }
.controls { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + var(--safe-b)); z-index: 4; padding: 10px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.controls .inner { max-width: 760px; margin: 0 auto; display: grid; gap: 8px; }
.scrub { width: 100%; accent-color: var(--violet); }
.ctl { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.round { width: 56px; height: 56px; border-radius: 50%; border: 0; background: linear-gradient(var(--violet-2), var(--violet)); color: #fff; font-size: 22px; cursor: pointer; box-shadow: 0 6px 14px rgba(79,34,216,.25); }
.pill-btn { border: 1px solid var(--violet-3); background: var(--card); color: var(--violet); border-radius: 12px; padding: 8px 10px; font-weight: 700; font-size: 13px; cursor: pointer; min-width: 52px; }
.pill-btn[aria-pressed="true"] { background: var(--violet); color: #fff; border-color: var(--violet); }
.time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--ink-3); display: flex; justify-content: space-between; }

/* word sheet */
.sheet-back { position: fixed; inset: 0; background: rgba(36,18,61,.35); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--card); border-radius: 28px 28px 0 0; padding: 20px max(20px, env(safe-area-inset-right)) calc(20px + var(--safe-b)) max(20px, env(safe-area-inset-left)); max-width: 760px; margin: 0 auto; display: grid; gap: 12px; box-shadow: 0 -10px 40px rgba(36,18,61,.2); }
.sheet .word { font-size: 34px; font-weight: 800; letter-spacing: -.02em; color: var(--violet); }
.sheet .gloss { font-size: 20px; font-weight: 700; }
.sheet .line { background: var(--panel); border-radius: 14px; padding: 10px 12px; }
.sheet .line .en { color: var(--ink-3); font-size: 14px; }
.sheet .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* explore, words, me */
input[type="search"] { width: 100%; font: 16px var(--font); padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.artists { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.artist { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 12px; display: grid; gap: 6px; }
.artist .cover { border-radius: 14px; font-size: 16px; }
.artist b { font-size: 15px; } .artist span { font-size: 12px; color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.chips button[aria-pressed="true"] { background: var(--violet); color: #fff; border-color: var(--violet); }
.word-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.word-row b { color: var(--violet); font-size: 17px; }
.word-row .ln { font-size: 13px; color: var(--ink-3); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.stat b { display: block; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--ink-3); }
.empty { text-align: center; padding: 28px 16px; color: var(--ink-3); background: var(--card); border: 1px dashed var(--line); border-radius: 20px; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); }
.tabbar a { display: grid; place-items: center; align-content: center; gap: 2px; font-size: 12px; font-weight: 700; color: var(--ink-3); }
.tabbar .ti { font-size: 18px; line-height: 1; }
.tabbar a[aria-current="page"] { color: var(--violet); }
.toast { white-space: nowrap; position: fixed; left: 50%; bottom: calc(var(--tabbar) + 90px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 14px; font-weight: 600; z-index: 30; }
@media (min-width: 720px) { .actions { grid-template-columns: repeat(4, minmax(0, 1fr)); } .action.main { grid-column: span 2; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- the path: a winding trail ---------- */
.path-head { position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--bg) 85%, transparent); padding: calc(6px + var(--safe-t)) 0 10px; margin: calc(-6px - var(--safe-t)) 0 0; display: grid; gap: 10px; }
.level-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.trail { position: relative; margin-top: 6px; background:
  radial-gradient(ellipse 60% 40px at 15% 30%, rgba(255,255,255,.7), transparent 70%),
  radial-gradient(ellipse 50% 36px at 85% 62%, rgba(255,255,255,.6), transparent 70%),
  linear-gradient(180deg, #E4EEFF 0%, var(--bg) 35%, #EEE9FF 100%); border-radius: 32px; overflow: hidden; }
.trail-line { position: absolute; inset: 0; pointer-events: none; }
.trail-edge { fill: none; stroke: rgba(79, 34, 216, .10); stroke-width: 26; stroke-linecap: round; }
.trail-dash { fill: none; stroke: #FFFFFF; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 2 13; }
.signpost { position: absolute; left: 14px; right: 14px; z-index: 2; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 12px 16px; box-shadow: var(--shadow); display: grid; gap: 2px; }
.signpost h2 { font-size: 21px; line-height: 1.2; }
.sp-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-3); }
.sp-stars { font-weight: 800; color: var(--ink-2); white-space: nowrap; }
.stop { position: absolute; width: 76px; height: 76px; z-index: 2; }
.stone { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg, var(--a), var(--b));
  box-shadow: 0 7px 0 rgba(36,18,61,.18), 0 12px 22px rgba(79,34,216,.18), inset 0 2px 0 rgba(255,255,255,.45); transition: transform .15s; }
.stone::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 3px solid rgba(255,255,255,.55); }
.glyph { color: #fff; font-size: 28px; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,.25); position: relative; }
.stop:active .stone { transform: translateY(4px); }
.stop.starred .stone { box-shadow: 0 7px 0 rgba(36,18,61,.18), 0 0 0 5px var(--gold), inset 0 2px 0 rgba(255,255,255,.45); }
.stop.is-soon .stone { background: #DCD3FF; box-shadow: 0 6px 0 rgba(36,18,61,.10); }
.stop.is-soon .stone::before { border-color: rgba(255,255,255,.8); }
.stop.is-soon .glyph { color: var(--ink-3); text-shadow: none; }
.stop.current .stone { box-shadow: 0 7px 0 rgba(36,18,61,.18), 0 0 0 6px #fff, 0 0 0 10px var(--violet), 0 14px 26px rgba(79,34,216,.3), inset 0 2px 0 rgba(255,255,255,.45); animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.label { position: absolute; top: 12px; width: max-content; max-width: 150px; display: grid; line-height: 1.25; }
.label.r { left: 92px; } .label.l { right: 92px; text-align: right; }
.label b { font-size: 15px; } .label small { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.here { position: absolute; top: -22px; display: flex; flex-direction: column-reverse; align-items: center; gap: 0; pointer-events: none; }
.stop.current { z-index: 3; }
.here.l { right: 82px; } .here.r { left: 82px; }
.here img { width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(36,18,61,.25)); }
.bubble { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px 10px; font-weight: 800; font-size: 13px; color: var(--violet); white-space: nowrap; box-shadow: var(--shadow); }
.stop.current .label { top: 2px; }
.jump { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + 16px + var(--safe-b)); z-index: 6; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; font-weight: 800; color: var(--violet); box-shadow: 0 8px 24px rgba(36,18,61,.18); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .stop.current .stone { animation: none; } }

.label.b { top: 88px; left: 50%; transform: translateX(-50%); text-align: center; }
.stop.current .label.b { top: 90px; }
