:root {
  --bg: #0a0912; --bg-2: rgba(255,255,255,.04); --panel: rgba(22,19,38,.62); --panel-2: rgba(255,255,255,.05); --panel-3: rgba(255,255,255,.08);
  --line: rgba(255,255,255,.07); --line-2: rgba(255,255,255,.12);
  --purple: #9146ff; --purple-d: #772ce8; --purple-dd: #5c16c5; --lav: #bf94ff;
  --text: #efeff1; --muted: #adadb8; --dim: #6e6e7a;
  --green: #00f593; --pink: #ff5cad; --amber: #ffb84d; --red: #ff5a5a;
  --r: 24px; --grad: linear-gradient(135deg, #9146ff 0%, #6d5bff 55%, #c86bff 100%); --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 500 15px/1.45 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }

/* ambient background */
.bg-glow { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-glow i { position: absolute; border-radius: 50%; filter: blur(110px); opacity: .45; animation: drift 22s ease-in-out infinite alternate; }
.bg-glow i:nth-child(1) { width: 620px; height: 620px; background: #5c16c5; top: -260px; left: -160px; }
.bg-glow i:nth-child(2) { width: 520px; height: 520px; background: #4f46e5; bottom: -300px; right: -120px; opacity: .22; animation-duration: 28s; }
.bg-glow i:nth-child(3) { width: 380px; height: 380px; background: #ff5cad; top: 40%; left: 55%; opacity: .07; animation-duration: 34s; }
@keyframes drift { to { transform: translate(80px, 60px) scale(1.15); } }

.bg-waves { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: .9; }
/* header */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: rgba(10,9,18,.55); backdrop-filter: blur(22px) saturate(140%); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 38px; height: 38px; border-radius: 12px; background: var(--grad); display: flex; align-items: center; justify-content: center; gap: 3px; box-shadow: 0 6px 24px -6px var(--purple); }
.logo span { width: 3px; border-radius: 3px; background: #fff; animation: eq 1.1s ease-in-out infinite; }
.logo span:nth-child(1) { height: 8px; animation-delay: -.2s } .logo span:nth-child(2) { height: 16px; animation-delay: -.5s }
.logo span:nth-child(3) { height: 22px; } .logo span:nth-child(4) { height: 14px; animation-delay: -.7s } .logo span:nth-child(5) { height: 7px; animation-delay: -.35s }
@keyframes eq { 50% { transform: scaleY(.45); } }
.brand-txt b { display: block; font-weight: 900; font-size: 19px; letter-spacing: .04em; line-height: 1; }
.brand-txt em { font-style: normal; color: var(--lav); }
.brand-txt small { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }

.tabs { display: flex; gap: 4px; margin: 0 auto; background: var(--bg-2); padding: 5px; border-radius: 99px; border: 1px solid var(--line); }
.tabs button { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 0; background: none; border-radius: 99px; color: var(--muted); font-weight: 600; font-size: 14px; transition: .2s; position: relative; }
.tabs button svg { width: 17px; height: 17px; }
.tabs button:hover { color: var(--text); background: var(--panel-2); }
.tabs button.active { color: #fff; background: var(--grad); box-shadow: 0 4px 18px -4px rgba(145,70,255,.8); }
.soon { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; background: rgba(255,92,173,.18); color: var(--pink); padding: 2px 6px; border-radius: 5px; font-weight: 700; }
.tabs button.active .soon { background: rgba(255,255,255,.2); color: #fff; }

.top-right { display: flex; align-items: center; gap: 12px; }
.mic-pill { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--bg-2); font-size: 13px; font-weight: 600; color: var(--muted); }
.mic-pill .live { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.mic-pill.on { color: var(--text); }
.mic-pill.on .live { background: var(--green); box-shadow: 0 0 0 0 rgba(0,245,147,.6); animation: live 1.6s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 8px rgba(0,245,147,0); } 100% { box-shadow: 0 0 0 0 rgba(0,245,147,0); } }
.meter { display: flex; gap: 2px; align-items: flex-end; height: 14px; }
.meter i { width: 3px; height: 100%; border-radius: 2px; background: var(--line-2); transition: background .08s; }
.meter i.on { background: var(--green); } .meter i.on:nth-child(n+7) { background: var(--amber); } .meter i.on:nth-child(n+9) { background: var(--red); }

/* seg controls */
.seg { display: inline-flex; flex-wrap: nowrap; gap: 3px; background: rgba(0,0,0,.25); padding: 4px; border-radius: 14px; border: 1px solid var(--line); }
.seg.wrap { flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; transition: .15s; white-space: nowrap; }
.seg button small { opacity: .6; font-family: var(--mono); font-size: 11px; margin-left: 2px; }
.seg button:hover { color: var(--text); background: var(--panel-3); }
.seg button.active { background: var(--grad); color: #fff; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.seg.mini button { padding: 5px 10px; font-size: 12px; }

/* layout */
main { position: relative; z-index: 1; max-width: 1480px; margin: 0 auto; padding: 22px 24px 48px; }
.view { display: none; animation: fadein .35s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } }
.card { background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0) 35%), var(--panel); backdrop-filter: blur(24px) saturate(130%); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 30px 60px -35px rgba(0,0,0,.9); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; font-weight: 700; }
.legend { color: var(--dim); font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.lg-f0 { background: var(--green); box-shadow: 0 0 6px var(--green); margin-left: 8px; } .lg-ref { background: var(--lav); box-shadow: 0 0 6px var(--purple); height: 8px !important; border-radius: 3px; } .lg-h { background: var(--pink); margin-left: 8px; }

.train-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; }
.side { display: flex; flex-direction: column; gap: 18px; }
.bottom-grid { display: grid; grid-template-columns: minmax(0, 1fr) 520px; gap: 18px; margin-top: 18px; }

/* stage */
.stage { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.stage-top { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.progress { color: var(--muted); font-size: 13px; font-weight: 500; }
.actions { margin-left: auto; display: flex; gap: 8px; }
.phase { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; background: var(--panel-3); color: var(--muted); }
.phase .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.phase[data-p="listen"] { background: rgba(145,70,255,.18); color: var(--lav); }
.phase[data-p="listen"] .dot { animation: blink .5s infinite alternate; }
.phase[data-p="sing"] { background: rgba(255,92,173,.15); color: var(--pink); }
.phase[data-p="sing"] .dot { animation: live2 1.2s infinite; }
.phase[data-p="success"] { background: rgba(0,245,147,.15); color: var(--green); }
@keyframes blink { to { opacity: .25; } }
@keyframes live2 { 50% { transform: scale(1.6); opacity: .5; } }

.graph-wrap { position: relative; height: 430px; background: radial-gradient(ellipse at 80% 50%, rgba(145,70,255,.12), transparent 60%), rgba(8,7,16,.55); }
.graph-wrap.tall { height: 470px; }
.graph-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.overlay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.9); opacity: 0; pointer-events: none; transition: .3s cubic-bezier(.2,.9,.3,1.2); display: grid; place-items: center; }
.overlay.show { opacity: 1; transform: translate(-60%, -50%) scale(1); }
.ov-ring { position: absolute; width: 190px; height: 190px; border-radius: 50%; border: 2px solid rgba(191,148,255,.4); animation: ring 1.1s ease-out infinite; }
.ov-ring::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid rgba(191,148,255,.25); animation: ring 1.1s .45s ease-out infinite; }
@keyframes ring { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
.ov-txt { text-align: center; background: rgba(14,14,16,.8); backdrop-filter: blur(10px); border: 1px solid rgba(191,148,255,.35); padding: 18px 28px; border-radius: 20px; box-shadow: 0 0 60px -10px var(--purple); }
.ov-txt small { display: block; color: var(--lav); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; font-size: 11px; }
.ov-txt b { display: block; font-size: 52px; font-weight: 900; line-height: 1.05; letter-spacing: -0.03em; }
.ov-txt span { font-family: var(--mono); color: var(--muted); font-size: 14px; }
.floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float { position: absolute; right: 26%; font-weight: 900; font-size: 30px; color: var(--green); text-shadow: 0 0 20px rgba(0,245,147,.7); animation: floatup 1.2s ease-out forwards; }
.float small { display: block; font-size: 13px; color: #fff; text-align: center; letter-spacing: .1em; text-transform: uppercase; }
@keyframes floatup { from { transform: translateY(0) scale(.6); opacity: 0; } 20% { transform: translateY(-10px) scale(1.1); opacity: 1; } to { transform: translateY(-80px) scale(1); opacity: 0; } }

.kbd-wrap { padding: 12px 14px 14px; border-top: 1px solid var(--line); overflow-x: auto; }
.kbd { position: relative; height: 92px; min-width: 760px; user-select: none; touch-action: none; }
.key { position: absolute; top: 0; border-radius: 0 0 7px 7px; transition: background .12s, box-shadow .12s, transform .08s; }
.key.white { height: 100%; background: linear-gradient(180deg, #e9e6f2, #fff); border: 1px solid #0e0e10; z-index: 1; }
.key.black { height: 60%; background: linear-gradient(180deg, #2a2a31, #0e0e10); border: 1px solid #000; z-index: 2; border-radius: 0 0 5px 5px; }
.key:hover { filter: brightness(.93); }
.key.down { transform: translateY(2px); }
.kl { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font: 700 10px var(--mono); color: #6e6e7a; }
.key.inrange.white { background: linear-gradient(180deg, #d9fbe9, #f1fff7); }
.key.inrange.black { background: linear-gradient(180deg, #1f4d3a, #0b2a1d); }
.key.target.white { background: linear-gradient(180deg, #c7a6ff, #9146ff); }
.key.target.black { background: linear-gradient(180deg, #a970ff, #5c16c5); }
.key.target { box-shadow: 0 0 22px rgba(145,70,255,.9); z-index: 3; }
.key.target .kl { color: #fff; }
.key.voice::after { content: ""; position: absolute; left: 50%; bottom: 22px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 14px var(--pink); }
.key.voice.ok::after { background: var(--green); box-shadow: 0 0 14px var(--green); }
.key.black.voice::after { bottom: 10px; }

/* note cards */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.note-card { padding: 16px; position: relative; overflow: hidden; }
.note-card.target { border-color: rgba(145,70,255,.45); background: linear-gradient(160deg, rgba(145,70,255,.22), rgba(145,70,255,.02) 60%), var(--panel); }
.nc-label { display: flex; align-items: center; gap: 7px; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--muted); }
.nc-label i { width: 8px; height: 8px; border-radius: 2px; background: var(--purple); }
.voice .nc-label i, .big-readout .nc-label i { background: var(--pink); border-radius: 50%; }
.nc-note { font-size: 46px; font-weight: 900; letter-spacing: -0.04em; line-height: 1.1; margin-top: 6px; white-space: nowrap; }
.nc-note sup { font-size: 20px; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.nc-hz { font: 600 15px var(--mono); color: var(--lav); }
.voice .nc-hz { color: var(--pink); }
.voice.ok { border-color: rgba(0,245,147,.5); }
.voice.ok .nc-hz { color: var(--green); }
.nc-alt { font: 500 12px var(--mono); color: var(--dim); margin-top: 2px; }

.hint-card { text-align: center; }
.gauge { max-width: 270px; margin: 0 auto; }
.gauge-svg { width: 100%; display: block; overflow: visible; }
.g-track { stroke: var(--panel-3); stroke-width: 16; }
.g-arc { stroke-width: 6; opacity: .55; }
.g-ok { stroke: var(--green); stroke-width: 16; opacity: .9; }
.g-ok-glow { stroke: var(--green); stroke-width: 16; opacity: 0; transition: opacity .2s; }
.gauge.in .g-ok-glow { opacity: .9; }
.g-ticks line { stroke: var(--dim); stroke-width: 1.5; }
.g-lbl { fill: var(--dim); font: 600 10px var(--mono); stroke: none; text-transform: uppercase; }
.g-needle { transform-origin: 100px 100px; transform-box: view-box; }
.g-needle path { fill: #fff; stroke: none; filter: drop-shadow(0 0 6px rgba(255,255,255,.6)); }
.g-needle circle { fill: var(--purple); stroke: #fff; stroke-width: 2; }
.gauge.idle .g-needle { opacity: .3; }
.gauge.in .g-needle path { fill: var(--green); filter: drop-shadow(0 0 8px var(--green)); }

.hint { display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 18px; border-radius: 14px; font-weight: 800; font-size: 20px; background: var(--panel-3); color: var(--muted); transition: .2s; }
.h-ico { width: 24px; height: 24px; display: none; }
.hint[data-s="up"], .hint[data-s="down"] { background: rgba(255,92,173,.14); color: var(--pink); }
.hint[data-s="ok"] { background: rgba(0,245,147,.14); color: var(--green); box-shadow: 0 0 30px -8px rgba(0,245,147,.6); }
.hint[data-s="up"] .h-ico, .hint[data-s="down"] .h-ico, .hint[data-s="ok"] .h-ico { display: block; background: currentColor; -webkit-mask: var(--ico) center/contain no-repeat; mask: var(--ico) center/contain no-repeat; }
.hint[data-s="up"] { --ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M12 20V4M5 11l7-7 7 7'/></svg>"); }
.hint[data-s="down"] { --ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M12 4v16M5 13l7 7 7-7'/></svg>"); }
.hint[data-s="ok"] { --ico: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M4 12l5 5L20 6'/></svg>"); }
.hint[data-s="up"] .h-ico, .hint[data-s="down"] .h-ico { animation: nudge .7s ease-in-out infinite; }
.hint[data-s="down"] .h-ico { animation-direction: reverse; }
@keyframes nudge { 50% { transform: translateY(-4px); } }
.hint-sub { color: var(--muted); font-size: 13px; margin-top: 10px; min-height: 38px; }
.hint-sub b { font-family: var(--mono); color: var(--text); }

.stats-card { display: flex; gap: 18px; align-items: center; }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.r-bg { stroke: var(--panel-3); stroke-width: 9; }
.r-fg { stroke: var(--green); stroke-width: 9; transition: stroke-dashoffset .08s linear; filter: drop-shadow(0 0 6px rgba(0,245,147,.6)); }
.r-txt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.r-txt b { font: 800 22px var(--mono); }
.r-txt span { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); font-weight: 700; }
.ring.full .r-txt b { color: var(--green); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; flex: 1; }
.stats small { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 700; }
.stats b { font: 800 22px var(--mono); }
.stats .wide { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.stats .wide b { font-size: 16px; color: var(--amber); }
#sStreak.hot { color: var(--amber); text-shadow: 0 0 14px rgba(255,184,77,.6); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 99px; padding: 10px 18px; font-weight: 700; font-size: 14px; transition: .15s; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 22px -8px var(--purple); }
.btn.primary svg { fill: currentColor; }
.btn.primary:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn.primary.stop { background: var(--panel-3); box-shadow: none; border-color: var(--line-2); }
.btn.primary:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.ghost { background: var(--panel-2); border-color: var(--line-2); color: var(--text); }
.btn.ghost:hover { background: var(--panel-3); }
.btn.big { padding: 14px 28px; font-size: 16px; border-radius: 12px; }

/* settings */
.spec { width: 100%; height: 230px; display: block; }
.settings .set-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-top: 1px solid var(--line); }
.settings .set-row:first-of-type { border-top: 0; }
.set-row > label { width: 84px; flex: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.toggles { flex-direction: column; align-items: flex-start !important; gap: 10px !important; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.switch small { color: var(--dim); font-weight: 500; }
.switch input { display: none; }
.sw { width: 36px; height: 20px; border-radius: 99px; background: var(--panel-3); border: 1px solid var(--line-2); position: relative; transition: .2s; flex: none; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked + .sw { background: var(--purple); border-color: var(--purple); }
.switch input:checked + .sw::after { left: 18px; background: #fff; }
input[type=range] { flex: 1; accent-color: var(--purple); }
.range-val { font: 600 12px var(--mono); color: var(--muted); width: 52px; text-align: right; }

/* free */
.big-readout { text-align: center; }
.big-readout .nc-label { justify-content: center; }
.br-note { font-size: 88px; font-weight: 900; letter-spacing: -0.05em; line-height: 1; margin: 10px 0 4px; transition: color .2s, text-shadow .2s; }
.br-note sup { font-size: 32px; color: var(--muted); letter-spacing: 0; }
.br-note.ok { color: var(--green); text-shadow: 0 0 40px rgba(0,245,147,.45); }
.br-hz { font: 500 16px var(--mono); color: var(--muted); }
.br-hz b { font-size: 30px; color: var(--pink); font-weight: 700; }
.scope { width: 100%; height: 110px; display: block; }
.spec-card.solo { margin-top: 18px; }
.learn { margin-top: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.learn b { color: var(--lav); }
.learn p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* range */
.range-hero { display: flex; align-items: center; gap: 30px; justify-content: space-between; background: linear-gradient(120deg, rgba(145,70,255,.25), rgba(145,70,255,0) 55%), var(--panel); }
.range-hero h2 { font-size: 28px; font-weight: 900; }
.range-hero p { color: var(--muted); max-width: 720px; margin: 6px 0 0; }
.range-hero p b { color: var(--text); }
.range-live { text-align: center; min-width: 150px; }
.range-live small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); font-weight: 700; }
.range-live b { display: block; font-size: 46px; font-weight: 900; line-height: 1.1; }
.range-live span { font: 600 14px var(--mono); color: var(--pink); }
.range-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr) 260px; gap: 18px; margin-top: 18px; }
.rgraph .graph-wrap { height: 100%; min-height: 300px; }
.rcard { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; justify-content: center; }
.rc-note { font-size: 56px; font-weight: 900; letter-spacing: -0.04em; line-height: 1.1; margin-top: 8px; }
.rc-hz { font: 600 14px var(--mono); color: var(--lav); margin-bottom: 10px; }
.rc-bar { width: 100%; height: 6px; border-radius: 6px; background: var(--panel-3); overflow: hidden; margin-top: 14px; }
.rc-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--purple), var(--pink)); }
.rcard.measuring { border-color: var(--purple); box-shadow: 0 0 40px -12px var(--purple); }
.rcard.measuring .rc-note { color: var(--lav); }
.range-result { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.range-result h3 { font-size: 22px; font-weight: 900; }
.range-result h3 em { font-style: normal; color: var(--green); }
.range-result p { margin: 4px 0 0; color: var(--muted); }
#view-range > .card:last-child { margin-top: 18px; padding: 0; }
#view-range .kbd-wrap { border-top: 0; }

/* songs */
.songs-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 34px; overflow: hidden; background: radial-gradient(circle at 90% 10%, rgba(255,92,173,.15), transparent 50%), linear-gradient(140deg, rgba(145,70,255,.25), transparent 60%), var(--panel); }
.badge { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; background: rgba(255,92,173,.16); color: var(--pink); padding: 5px 10px; border-radius: 7px; }
.songs-hero h2 { font-size: 40px; font-weight: 900; margin-top: 12px; }
.songs-hero p { color: var(--muted); max-width: 520px; }
.songs-hero ul { padding: 0; list-style: none; margin: 18px 0; display: grid; gap: 8px; }
.songs-hero li { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.songs-hero li::before { content: ""; width: 18px; height: 18px; border-radius: 6px; background: rgba(0,245,147,.15) url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300f593' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12l5 5L20 7'/></svg>") center/12px no-repeat; }
.song-pick { display: inline-flex; align-items: center; gap: 14px; padding: 10px 18px 10px 10px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line-2); }
.song-pick .cover { width: 48px; height: 48px; border-radius: 10px; background: conic-gradient(from 200deg, #ff5cad, #9146ff, #5c16c5, #ff5cad); animation: spin 8s linear infinite; position: relative; }
.song-pick .cover::after { content: ""; position: absolute; inset: 18px; border-radius: 50%; background: var(--bg); }
@keyframes spin { to { transform: rotate(360deg); } }
.song-pick b { display: block; } .song-pick small { color: var(--dim); }
.sh-demo { position: relative; border-radius: 16px; background: #111114; border: 1px solid var(--line); overflow: hidden; min-height: 320px; }
.lane { position: absolute; inset: 20px 0 70px; animation: lane 9s linear infinite; }
.lane i { position: absolute; left: calc(var(--x) * 6px + 40%); top: calc(var(--y) * 1%); width: calc(var(--w) * 6px); height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--purple), var(--lav)); box-shadow: 0 0 16px -2px var(--purple); }
@keyframes lane { to { transform: translateX(-1000px); } }
.lane-now { position: absolute; left: 40%; top: 0; bottom: 60px; width: 2px; background: linear-gradient(transparent, var(--lav), transparent); }
.lane-now::after { content: ""; position: absolute; top: 45%; left: -8px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px var(--green), 0 0 30px var(--green); animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-40px); } }
.lyric { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; font-size: 22px; font-weight: 800; color: var(--dim); letter-spacing: .1em; }
.lyric .on { color: #fff; text-shadow: 0 0 18px var(--purple); }

/* gate */
.gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(8,8,10,.72); backdrop-filter: blur(14px); transition: opacity .4s; padding: 16px; }
.gate.hide { opacity: 0; pointer-events: none; }
.gate-card { width: min(460px, 100%); text-align: center; padding: 40px 34px 26px; border-radius: 26px; background: linear-gradient(180deg, rgba(145,70,255,.18), rgba(145,70,255,0) 50%), var(--panel); border: 1px solid rgba(145,70,255,.35); box-shadow: 0 40px 120px -30px rgba(145,70,255,.6); }
.gate-mic { position: relative; width: 96px; height: 96px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--purple), var(--purple-dd)); box-shadow: 0 10px 40px -8px var(--purple); }
.gate-mic svg { width: 40px; height: 40px; color: #fff; position: relative; }
.gate-mic i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--lav); animation: ring 2.2s ease-out infinite; }
.gate-mic i:nth-child(2) { animation-delay: .7s; } .gate-mic i:nth-child(3) { animation-delay: 1.4s; }
.gate h1 { font-size: 30px; font-weight: 900; }
.gate p { color: var(--muted); margin: 10px 0 24px; }
.gate-tip { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; color: var(--dim); font-size: 13px; }
.gate-tip svg { width: 16px; height: 16px; flex: none; }
.link { border: 0; background: none; color: var(--lav); font-weight: 600; font-size: 13px; margin-top: 14px; text-decoration: underline; text-underline-offset: 3px; }
.gate .err { color: var(--red); font-size: 13px; margin-top: 12px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; z-index: 60; padding: 12px 18px; border-radius: 12px; background: var(--panel-3); border: 1px solid var(--line-2); font-weight: 600; font-size: 14px; transition: .3s; pointer-events: none; box-shadow: 0 20px 40px -10px #000; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* responsive */
@media (max-width: 1180px) {
  .train-grid, .bottom-grid { grid-template-columns: 1fr; }
  .side { display: grid; grid-template-columns: 1fr 1fr; }
  .side .duo { grid-column: 1 / -1; }
  .range-grid { grid-template-columns: 1fr 1fr; }
  .rgraph { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 760px) {
  .top { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .tabs button { padding: 8px 10px; font-size: 13px; }
  .top-right .seg { display: none; }
  .top-right { margin-left: auto; }
  main { padding: 16px; }
  .side { display: flex; }
  .graph-wrap, .graph-wrap.tall { height: 340px; }
  .actions .btn span { display: none; }
  .actions .btn.primary span { display: inline; }
  .stats-card { flex-direction: column; }
  .learn, .songs-hero, .range-grid { grid-template-columns: 1fr; }
  .range-hero, .range-result { flex-direction: column; align-items: flex-start; }
  .songs-hero { padding: 22px; }
  .set-row { flex-wrap: wrap; }
  .br-note { font-size: 64px; }
}

/* ================= song mode ================= */
.song-grid { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.song-side { display: grid; gap: 18px; position: sticky; top: 84px; }
.song-main { display: grid; gap: 18px; min-width: 0; }
.sg-list { display: grid; gap: 6px; max-height: 340px; overflow: auto; margin: 0 -6px 12px; padding: 0 6px; }
.sg-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; border: 1px solid transparent; cursor: pointer; transition: .15s; position: relative; }
.sg-item:hover { background: var(--panel-2); }
.sg-item.active { background: linear-gradient(135deg, rgba(145,70,255,.22), rgba(109,91,255,.08)); border-color: rgba(191,148,255,.35); }
.sg-meta { min-width: 0; flex: 1; display: grid; }
.sg-meta b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-meta small { color: var(--muted); font-size: 12px; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.tags i { font-style: normal; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--panel-3); color: var(--dim); }
.tags i.ok { background: rgba(0,245,147,.12); color: var(--green); }
.sg-item .del { opacity: 0; border: 0; background: none; color: var(--muted); font-size: 18px; width: 26px; height: 26px; border-radius: 8px; }
.sg-item:hover .del { opacity: 1; } .sg-item .del:hover { background: rgba(255,90,90,.15); color: var(--red); }
.cover.sm { width: 42px; height: 42px; flex: none; border-radius: 12px; background: conic-gradient(from 200deg, #ff5cad, #9146ff, #5c16c5, #ff5cad); position: relative; display: flex; align-items: center; justify-content: center; gap: 3px; overflow: hidden; }
.cover.sm.bi { background: conic-gradient(from 120deg, #00c2ff, #6d5bff, #00f593, #00c2ff); }
.cover.sm i { width: 3px; height: 40%; border-radius: 2px; background: rgba(255,255,255,.85); }
.sg-item.active .cover.sm i { animation: sgeq 1s ease-in-out infinite; } .cover.sm i:nth-child(2) { animation-delay: -.3s !important; } .cover.sm i:nth-child(3) { animation-delay: -.6s !important; }
@keyframes sgeq { 50% { height: 75%; } }
.sg-new { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sg-new button { grid-column: span 2; }
input:not([type]), .sg-new input, textarea { background: rgba(0,0,0,.3); border: 1px solid var(--line-2); border-radius: 12px; color: var(--text); padding: 9px 12px; font: inherit; font-size: 13px; outline: none; min-width: 0; }
input:not([type]):focus, textarea:focus { border-color: var(--lav); box-shadow: 0 0 0 3px rgba(145,70,255,.2); }
.files { display: grid; gap: 10px; }
.files .card-head { margin-bottom: 2px; }
.files .bi-note { display: none; }
.files.builtin .bi-note { display: block; color: var(--green); }
.files.builtin .file-btn { opacity: .4; pointer-events: none; }
.file-btn { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; border: 1px dashed var(--line-2); cursor: pointer; transition: .15s; }
.file-btn:hover { border-color: var(--lav); background: rgba(145,70,255,.08); }
.file-btn input { display: none; }
.file-btn > span:last-child { display: grid; min-width: 0; }
.file-btn b { font-size: 13px; } .file-btn em { font-style: normal; color: var(--dim); font-weight: 500; font-size: 11px; }
.file-btn small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-ico { width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--panel-3); font-size: 16px; }
.an-bar { height: 4px; border-radius: 4px; background: var(--panel-3); overflow: hidden; display: none; }
.an-bar.on { display: block; } .an-bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }
.tiny { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.5; }

.song-stage .stage-top { gap: 18px; }
.sg-title { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.sg-title b { display: block; font-size: 17px; font-weight: 800; }
.sg-title small { color: var(--muted); font-size: 13px; }
.sg-score { text-align: right; display: grid; }
.sg-score small { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.sg-score b { font-family: var(--mono); font-size: 22px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.song-lane { height: 400px; }
.song-lane.drag { outline: 2px dashed var(--lav); outline-offset: -10px; }
.sg-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; color: var(--muted); background: rgba(8,7,16,.6); }
.sg-empty b { color: var(--text); font-size: 18px; }
.se-ico { font-size: 40px; width: 80px; height: 80px; display: grid; place-items: center; border-radius: 50%; background: rgba(145,70,255,.15); color: var(--lav); margin-bottom: 6px; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.08); box-shadow: 0 0 40px rgba(145,70,255,.4); } }
.sg-sync { position: absolute; left: 50%; top: 16px; transform: translate(-50%, -20px); opacity: 0; pointer-events: none; transition: .25s; background: rgba(14,12,26,.92); border: 1px solid rgba(255,92,173,.4); border-radius: 18px; padding: 12px 18px; display: grid; gap: 4px; text-align: center; max-width: 90%; }
.sg-sync.show { opacity: 1; transform: translate(-50%, 0); }
.sg-sync small { color: var(--pink); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.sg-sync span { color: var(--muted); font-size: 12px; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--panel-3); border: 1px solid var(--line-2); color: var(--text); }

.lyrics { padding: 18px 20px 14px; text-align: center; display: grid; gap: 4px; border-top: 1px solid var(--line); background: linear-gradient(180deg, rgba(145,70,255,.06), transparent); }
.ly-prev, .ly-next { color: var(--dim); font-size: 14px; min-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ly-cur { --p: 0%; font-size: 26px; font-weight: 800; letter-spacing: -.01em; min-height: 36px; background: linear-gradient(90deg, #fff 0, #e5d4ff var(--p), rgba(173,173,184,.45) var(--p)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ly-cur.pop { animation: lypop .35s ease-out; }
@keyframes lypop { from { transform: translateY(8px) scale(.97); opacity: .3; } }
.transport { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.transport input[type=range]#sgSeek { flex: 1; min-width: 140px; }
.play { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 26px -8px var(--purple); transition: .15s; flex: none; }
.play svg { width: 20px; height: 20px; fill: #fff; stroke: none; }
.play:hover { transform: scale(1.06); } .play.on { box-shadow: 0 0 0 6px rgba(145,70,255,.18), 0 8px 26px -8px var(--purple); }
.btn.icon { width: 38px; height: 38px; padding: 0; }
.btn.chip { padding: 6px 12px; font-size: 12px; }
.btn.chip.active { background: rgba(0,245,147,.14); border-color: rgba(0,245,147,.4); color: var(--green); }
.seg.mix.off { opacity: .45; }
.seg.mix button.active { background: linear-gradient(135deg, #00c2ff, #6d5bff); }
.time { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 36px; text-align: center; }
.vol { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.vol svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.vol input { width: 80px; }
.transport input[type=range] { accent-color: var(--purple); }
.ly-edit textarea { width: 100%; min-height: 150px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
.ly-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.hp-tip { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; padding: 0 6px; }
.hp-tip svg { width: 18px; height: 18px; fill: none; stroke: var(--lav); stroke-width: 2; flex: none; }
@media (max-width: 900px) { .song-grid { grid-template-columns: 1fr; } .song-side { position: static; } .song-lane { height: 320px; } .ly-cur { font-size: 20px; } }

/* ================= phone ================= */
.tp-more { display: contents; }
html { -webkit-tap-highlight-color: transparent; }
button, .file-btn, .sg-item, input[type=range] { touch-action: manipulation; }
.sync-btns { display: flex; gap: 8px; justify-content: center; margin-top: 6px; pointer-events: auto; }
.sg-sync.show { pointer-events: auto; }
@media (hover: none) { .kb-only { display: none; } .sg-item .del { opacity: .7; } }
@media (max-width: 760px) {
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .top { padding: calc(8px + env(safe-area-inset-top)) 14px 8px; flex-wrap: nowrap; }
  .brand-txt small { display: none; }
  .logo { width: 34px; height: 34px; }
  /* bottom tab bar */
  .tabs { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); margin: 0; z-index: 30; width: auto; order: 0;
    display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px; border-radius: 22px; background: rgba(16,13,30,.86); backdrop-filter: blur(22px) saturate(150%); border-color: var(--line-2); box-shadow: 0 20px 40px -12px rgba(0,0,0,.8); overflow: visible; }
  .tabs button { flex-direction: column; gap: 3px; padding: 8px 2px; font-size: 11px; border-radius: 16px; white-space: nowrap; }
  .tabs button svg { width: 21px; height: 21px; }
  .tabs button .badge { display: none; }
  .mic-pill { padding: 7px 12px; font-size: 12px; }
  main { padding: 12px 12px 8px; }
  .card { padding: 16px; border-radius: 20px; }
  .graph-wrap, .graph-wrap.tall { height: 46vh; min-height: 300px; }
  input:not([type]), textarea, .sg-new input { font-size: 16px; }
  /* songs: player first, library after */
  .song-grid { display: flex; flex-direction: column; }
  .song-main { order: 1; width: 100%; }
  .song-side { order: 2; width: 100%; }
  .song-stage .stage-top { padding: 12px 14px; gap: 12px; }
  .sg-title b { font-size: 15px; } .sg-score b { font-size: 18px; }
  .song-lane { height: 44vh; min-height: 280px; }
  .lyrics { padding: 12px 12px 10px; }
  .ly-cur { font-size: 19px; min-height: 28px; }
  .ly-prev, .ly-next { font-size: 12px; }
  .top { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(10,9,18,.92); }
  .transport { display: grid; grid-template-columns: auto auto auto minmax(0, 1fr) auto; gap: 8px 10px; padding: 10px 12px 12px; }
  .transport input[type=range]#sgSeek { min-width: 0; width: 100%; }
  .transport > .seg.mix { grid-column: 1 / -1; display: flex; }
  .transport > .seg.mix button { flex: 1; }
  .tp-more { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
  .tp-more > * { flex: none; }
  .tp-more .vol { display: none; }
  .seg.mini button { padding: 7px 9px; }
  .sg-list { display: flex; overflow-x: auto; max-height: none; gap: 8px; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .sg-item { flex: 0 0 78%; scroll-snap-align: start; background: var(--panel-2); }
  .sg-sync { width: calc(100% - 24px); }
  .hp-tip { font-size: 12px; }
}
@media (max-width: 380px) { .tabs button { font-size: 10px; } .transport > .chip { font-size: 11px; } }
