/* ============ Token tema ============ */
:root {
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 14px;
  --tap: 44px;
  --topbar-h: 52px;
  --rh: #34d399;   /* tangan kanan */
  --lh: #60a5fa;   /* tangan kiri */
  --hit: #ffc53d;  /* tuts aktif */
}
body[data-theme='warm'] {
  --bg: #fbf5ec; --surface: #ffffff; --surface-2: #f4e9d9; --text: #2d2118; --muted: #7a6656;
  --accent: #d9602a; --accent-ink: #ffffff; --border: #ead9c3; --ok: #2f9e5b; --err: #c2413b;
}
body[data-theme='dark'] {
  --bg: #0e1016; --surface: #171a23; --surface-2: #222634; --text: #eef1f7; --muted: #9aa3b5;
  --accent: #ffb020; --accent-ink: #1a1200; --border: #2c3140; --ok: #4ade80; --err: #f87171;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100dvh;
  transition: background .25s ease, color .25s ease;
}
a { color: var(--accent); }
h1, h2 { line-height: 1.2; margin: 0 0 .5em; }
main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* ============ Topbar ============ */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(8px);
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand::before { content: '🎹 '; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 8px 12px; border-radius: 999px; color: var(--muted); text-decoration: none;
  font-weight: 600; font-size: .92rem; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current] { color: var(--accent-ink); background: var(--accent); }

/* ============ Tombol & kontrol ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); min-width: var(--tap); padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: 600 .95rem var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .4; cursor: default; }
.btn:focus-visible, .seg button:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.lg { min-height: 52px; padding: 0 22px; font-size: 1.05rem; }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: .85rem; }
.btn.icon { padding: 0; font-size: 1.1rem; }
.btn.ghost { background: transparent; }
.btn.toggle[aria-pressed='true'] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.seg button {
  min-height: calc(var(--tap) - 8px); padding: 0 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font: 600 .9rem var(--font); cursor: pointer; white-space: nowrap;
}
.seg button[aria-checked='true'] { background: var(--accent); color: var(--accent-ink); }

select {
  min-height: var(--tap); padding: 0 10px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 600 .95rem var(--font);
}
.field { display: inline-flex; align-items: center; gap: 6px; }
.volume input { width: 96px; accent-color: var(--accent); }
.group { display: inline-flex; gap: 4px; }
.chip {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  font-size: .85rem; font-weight: 600; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }

/* ============ Halaman terang (beranda, kursus, dll.) ============ */
.page { max-width: 1040px; margin: 0 auto; padding: 28px 16px 48px; }
.hero { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: center; margin-bottom: 36px; }
.hero h1 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 52ch; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.progress-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 6px 24px rgba(120, 80, 40, .08);
}
.pc-label { color: var(--muted); font-weight: 600; }
.pc-value { font-size: 2.4rem; font-weight: 800; }
.bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 8px 0; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.pc-note { font-size: .9rem; color: var(--muted); }

.stages { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.stages li {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.stages .num {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 700;
}
.stages li.done .num { background: var(--ok); color: #fff; }
.st-title { flex: 1; font-weight: 600; }
.st-state { font-size: .85rem; color: var(--muted); }
.stages li.done .st-state { color: var(--ok); font-weight: 700; }

.ph-card {
  max-width: 560px; margin: 40px auto; padding: 28px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.ph-badge {
  display: inline-block; padding: 4px 12px; border-radius: 99px; margin-bottom: 12px;
  background: var(--surface-2); color: var(--accent); font-weight: 700; font-size: .85rem;
}

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
}

/* ============ Halaman piano (gelap) ============ */
.piano-page {
  height: calc(100dvh - var(--topbar-h));
  display: flex; flex-direction: column; gap: 10px; padding: 10px 12px 12px;
}
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.now-playing {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 16px; border-radius: var(--radius);
  background: radial-gradient(120% 140% at 0% 0%, #1d2231 0%, var(--surface) 60%);
  border: 1px solid var(--border); overflow: hidden;
}
.np-name { font-size: clamp(2rem, 7vh, 4rem); font-weight: 800; color: var(--hit); line-height: 1; }
.np-sub { display: flex; gap: 14px; align-items: baseline; font-size: 1.15rem; color: var(--muted); margin-top: 6px; }
.angka-glyph { position: relative; display: inline-block; font-weight: 800; color: var(--text); font-size: 1.4rem; padding: 6px 2px; }
.angka-glyph .d { position: absolute; left: 0; right: 0; text-align: center; font-size: .7rem; line-height: 1; letter-spacing: -1px; }
.angka-glyph .d.up { top: 0; }
.angka-glyph .d.down { bottom: 0; }
.np-side { max-width: 460px; display: grid; gap: 8px; justify-items: end; text-align: right; }
.kbd-help { font-size: .82rem; color: var(--muted); }
.load-status { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--muted); }
.load-status.ok { color: var(--ok); }
.load-status.err { color: var(--err); }
.spinner {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.rotate-hint {
  display: none; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-size: .9rem;
}
@media (orientation: portrait) and (max-width: 760px) {
  .rotate-hint { display: flex; }
}

/* Peta mini 88 tuts */
.minimap-wrap { position: relative; height: 22px; cursor: pointer; touch-action: none; flex: none; }
.minimap.kb { position: absolute; inset: 0; border-radius: 4px; overflow: hidden; opacity: .75; }
.minimap .key { pointer-events: none; padding: 0 !important; box-shadow: none !important; }
.minimap .key.white { border-radius: 0; border-width: 0 1px 0 0; }
.minimap .key.black { border-radius: 0; }
.minimap .key span { display: none; }
.minimap-window {
  position: absolute; top: -2px; bottom: -2px; border: 2px solid var(--accent); border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 18%, transparent); pointer-events: none; transition: left .15s, width .15s;
}

/* Keyboard */
.keyboard-wrap { flex: none; height: clamp(150px, 42vh, 340px); }
.keyboard { height: 100%; }

.kb { position: relative; user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none; }
.kb .key { position: absolute; top: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.kb .key.white {
  bottom: 0; z-index: 1; padding-bottom: 8px;
  background: linear-gradient(180deg, #f3f3f3 0%, #ffffff 70%, #e9e9e9 100%);
  border: 1px solid #9ca3af; border-top: 0; border-radius: 0 0 7px 7px;
  box-shadow: inset 0 -6px 0 #d7d7d7; color: #374151;
}
.kb .key.black {
  height: 62%; z-index: 2; padding-bottom: 6px;
  background: linear-gradient(180deg, #2a2d34 0%, #111317 85%, #262a31 100%);
  border: 1px solid #000; border-top: 0; border-radius: 0 0 5px 5px;
  box-shadow: inset 0 -5px 0 #3a3f4a, 0 3px 4px rgba(0, 0, 0, .45); color: #e5e7eb;
}
.kb .key.white.active {
  background: linear-gradient(180deg, #ffe9a6 0%, var(--hit) 100%);
  box-shadow: inset 0 -2px 0 #d49b10, 0 0 22px color-mix(in srgb, var(--hit) 70%, transparent);
}
.kb .key.black.active {
  background: linear-gradient(180deg, #ffcf5a 0%, #e59a00 100%);
  box-shadow: inset 0 -2px 0 #9a6400, 0 0 18px color-mix(in srgb, var(--hit) 80%, transparent);
  color: #1a1200;
}
/* Sorotan tutorial (tahap pemutar) */
.kb .key.marked[data-hand='R'] { background: linear-gradient(180deg, #a7f3d0, var(--rh)); color: #052e1c; }
.kb .key.marked[data-hand='L'] { background: linear-gradient(180deg, #bfdbfe, var(--lh)); color: #0b1f3d; }
.kb .key .finger:empty { display: none; }
.kb .key .finger {
  width: min(calc(var(--wk) * .8), 30px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .75); color: #fff; font-weight: 800; font-size: min(calc(var(--wk) * .45), 16px); margin-bottom: 6px;
}

.kb .lbl {
  display: flex; flex-direction: column; align-items: center; line-height: 1;
  font-weight: 700; font-size: clamp(8px, calc(var(--wk) * .36), 17px); pointer-events: none;
}
.kb .key.black .lbl { font-size: clamp(7px, calc(var(--wk) * .27), 13px); }
.kb .dots { font-size: .7em; letter-spacing: -1px; height: .7em; line-height: .7em; }
.kb .dots:empty { height: 0; }
.kb .hint {
  font-size: clamp(8px, calc(var(--wk) * .28), 12px); font-weight: 700; margin-top: 4px; pointer-events: none;
  color: #9ca3af; font-family: ui-monospace, Consolas, monospace;
}
.kb .key.black .hint { color: #8b93a5; }
.kb .hint:empty { display: none; }
.kb .key.middle-c::after {
  content: ''; position: absolute; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.kb.compact .key.black .lbl,
.kb.compact .key.black .hint { display: none; }
.kb.tiny .lbl, .kb.tiny .hint { display: none; }

/* Layar HP landscape: hemat ruang vertikal */
@media (max-height: 500px) {
  :root { --topbar-h: 40px; --tap: 38px; }
  .topbar { padding: 0 10px; }
  .nav a { padding: 5px 10px; font-size: .85rem; }
  .piano-page { gap: 6px; padding: 6px 8px 8px; }
  .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: none; }
  .toolbar > * { flex: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .now-playing { padding: 4px 12px; min-height: 40px; }
  .np-main { display: flex; align-items: center; gap: 14px; }
  .np-name { font-size: 1.6rem; }
  .np-sub { margin-top: 0; font-size: .95rem; align-items: center; }
  .angka-glyph { font-size: 1.15rem; }
  .kbd-help { display: none; }
  .minimap-wrap { height: 14px; }
  .keyboard-wrap { height: 52vh; }
}
@media (max-width: 640px) {
  .kbd-help { display: none; }
  .volume input { width: 70px; }
}

/* ============ Daftar lagu (sementara) ============ */
.song-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 16px; }
.song-card {
  display: grid; gap: 6px; padding: 16px; border-radius: var(--radius); text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); transition: transform .12s, border-color .12s;
}
.song-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.sc-title { font-weight: 800; font-size: 1.08rem; }
.sc-meta { color: var(--muted); font-size: .9rem; }
.sc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 2px 10px; border-radius: 99px; background: var(--surface-2); font-size: .8rem; font-weight: 600; color: var(--muted); }
.tag.best { color: var(--ok); }

/* ============ Pemutar ============ */
.player-page {
  position: relative; height: calc(100dvh - var(--topbar-h));
  display: flex; flex-direction: column; gap: 6px; padding: 8px 12px 10px;
}
.pl-loading { margin: auto; display: flex; gap: 10px; align-items: center; color: var(--muted); }
.pl-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: none; }
.pl-bar > * { flex: none; }
.pl-title { display: grid; line-height: 1.2; min-width: 0; max-width: 240px; margin-right: 4px; }
.pl-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-title span { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-btn { width: 52px; font-size: 1.2rem; }
.speed input { width: 90px; accent-color: var(--accent); }
.speed b { min-width: 3.2em; font-size: .9rem; }
.loop-range { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); }
.loop-range select { min-height: 36px; }
.loop-range[hidden] { display: none; }
.pl-seek { display: flex; align-items: center; gap: 12px; flex: none; font-size: .85rem; color: var(--muted); font-weight: 600; }
.pl-seek input { flex: 1; accent-color: var(--accent); }
.pl-seek [data-measure] { min-width: 88px; }
.pl-seek .live { min-width: 150px; text-align: right; }

.sheet-scroll {
  flex: none; height: clamp(90px, 22vh, 200px); overflow-x: auto; overflow-y: hidden;
  background: #fbf7ef; border-radius: 10px; scrollbar-width: thin;
}
.sheet-host { height: 100%; }
.sheet-host svg { display: block; }
.sheet-msg { height: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; color: #6b5a4a; font-size: .9rem; }
.no-sheet .sheet-scroll { display: none; }

.stage {
  position: relative; flex: 1; min-height: 60px; border-radius: 10px 10px 0 0; overflow: hidden;
  background: linear-gradient(180deg, #0b0d13 0%, #141824 100%);
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage-msg {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: min(90%, 520px);
  text-align: center; color: var(--text); font-weight: 600; pointer-events: none;
  padding: 8px 14px; border-radius: 12px; background: rgba(14, 16, 22, .82); border: 1px solid var(--border);
}
.stage-msg:empty { display: none; }
.pl-kb { height: clamp(110px, 28vh, 240px); margin-top: -6px; }

.kb .key.wrong { background: linear-gradient(180deg, #fecaca, #ef4444) !important; }
.kb .key.marked.active { filter: brightness(1.25) saturate(1.2); box-shadow: 0 0 22px rgba(255, 255, 255, .5); }

.result {
  position: absolute; inset: 0; z-index: 10; display: grid; place-items: center;
  background: rgba(8, 10, 15, .72); backdrop-filter: blur(4px);
}
.result[hidden] { display: none; }
.result-card {
  width: min(92%, 420px); padding: 22px; border-radius: 18px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.r-label { color: var(--muted); font-weight: 700; }
.r-score { font-size: 3.6rem; font-weight: 800; color: var(--accent); line-height: 1.1; }
.r-best { color: var(--ok); font-weight: 800; }
.r-sub { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.r-stats { display: flex; justify-content: center; gap: 24px; margin: 14px 0 6px; }
.r-stats div { display: grid; }
.r-stats b { font-size: 1.5rem; }
.r-stats span { font-size: .8rem; color: var(--muted); }
.r-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

@media (max-height: 500px) {
  body[data-route='pemutar'] .topbar { display: none; }
  body[data-route='pemutar'] .player-page { height: 100dvh; }
  .player-page { gap: 4px; padding: 4px 8px 6px; }
  .pl-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .pl-bar::-webkit-scrollbar { display: none; }
  .pl-title { max-width: 150px; }
  .pl-title span { display: none; }
  .play-btn { width: 44px; }
  .pl-seek { font-size: .75rem; gap: 8px; }
  .pl-seek [data-measure] { min-width: 70px; }
  .pl-seek .live { min-width: 110px; }
  .sheet-scroll { height: 22vh; }
  .pl-kb { height: 30vh; }
  .r-score { font-size: 2.6rem; }
  .result-card { padding: 14px; }
  .r-actions { margin-top: 8px; }
}

/* ============ Perpustakaan lagu ============ */
.library { max-width: 1180px; }
.lib-head p { max-width: 70ch; }
.lib-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); margin: 18px 0 14px; }
.lib-tabs::-webkit-scrollbar { display: none; }
.lib-tabs button {
  min-height: var(--tap); padding: 0 14px; border: 0; border-bottom: 3px solid transparent; background: none;
  color: var(--muted); font: 700 .95rem var(--font); cursor: pointer; white-space: nowrap;
}
.lib-tabs button[aria-selected='true'] { color: var(--accent); border-bottom-color: var(--accent); }
.lib-tabs .count { font-weight: 600; font-size: .78rem; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); margin-left: 4px; }
.lib-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.lib-filters .search { flex: 1 1 240px; }
.lib-filters input[type='search'] {
  width: 100%; min-height: var(--tap); padding: 0 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: 500 1rem var(--font);
}
.lib-filters input[type='search']:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: .92rem; color: var(--muted); min-height: var(--tap); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.lib-count { color: var(--muted); font-size: .9rem; margin: 12px 0 8px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.lib-empty { grid-column: 1 / -1; padding: 40px 16px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.lib-card {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 2px 10px rgba(120, 80, 40, .05);
}
.lib-card h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.lc-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; align-items: center; min-height: 22px; }
.badge.rec { white-space: nowrap; }
.lc-no { font-size: .78rem; font-weight: 700; color: var(--muted); }
.badge.rec { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #fff3d6; color: #9a5b00; }
.lc-by { font-size: .88rem; color: var(--muted); }
.lc-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 6px; }
.tag.lvl-pemula { background: #dcf5e6; color: #1d7a45; }
.tag.lvl-menengah { background: #fff0cc; color: #8a5a00; }
.tag.lvl-mahir { background: #fde0dc; color: #a83a2c; }
.tag.lic-pending { background: #eee6f7; color: #6a4a8c; }
.tag.lic-user_private { background: #e3ecfa; color: #2f5a9a; }
.lc-play, .lc-locked { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; }
.lc-play .btn { flex: 1 1 auto; }
.lc-best { font-size: .75rem; font-weight: 800; opacity: .85; }
.soon { font-size: .82rem; font-weight: 700; color: var(--muted); padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.lc-note { margin: 4px 0 0; font-size: .78rem; color: var(--muted); }
.kel-C { background: linear-gradient(180deg, var(--surface), #faf6fd); }

/* Segmen berupa tautan (pilihan versi di pemutar) */
.seg .seg-link {
  display: inline-flex; align-items: center; min-height: calc(var(--tap) - 8px); padding: 0 12px; border-radius: 9px;
  color: var(--muted); font: 600 .9rem var(--font); text-decoration: none; white-space: nowrap;
}
.seg .seg-link[aria-checked='true'] { background: var(--accent); color: var(--accent-ink); }
.info-card { text-align: left; max-height: 90%; overflow: auto; }
.info-card h2 { margin: 0; }
.info-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: .9rem; margin: 14px 0 0; }
.info-card dt { color: var(--muted); font-weight: 700; }
.info-card dd { margin: 0; }
.info-card .r-actions { justify-content: flex-end; }

/* ============ Tambah lagu ============ */
.add { max-width: 900px; }
.add-form { display: grid; gap: 18px; margin-top: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-block { display: grid; gap: 6px; font-weight: 700; font-size: .92rem; }
.field-block input, .field-block select, .type-opts .num {
  min-height: var(--tap); padding: 0 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: 500 1rem var(--font);
}
.type-opts .num { width: 84px; }
.field-block input:focus-visible, .not-text:focus-visible, .type-opts .num:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.req { color: var(--err); }
.attach { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; }
.attach legend { font-weight: 700; font-size: .92rem; margin-bottom: 8px; }
.attach-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tile {
  position: relative; display: grid; justify-items: center; align-content: start; gap: 4px; text-align: center;
  padding: 16px 10px; min-height: 120px; border-radius: var(--radius); cursor: pointer;
  background: var(--surface); border: 2px solid var(--border); color: var(--text); font: inherit;
}
.tile:hover { border-color: var(--accent); }
.tile:focus-within, .tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile.on { border-color: var(--accent); background: #fff4ea; }
.tile-ico { font-size: 1.9rem; line-height: 1.2; }
.tile b { font-size: 1rem; }
.tile span:last-child { font-size: .8rem; color: var(--muted); }
.attach-list { display: grid; gap: 6px; }
.att-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); font-size: .9rem;
}
.att-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-note { font-size: .8rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.att-note.ok { color: var(--ok); }
.att-note.err { color: var(--err); }
.type-panel { display: grid; gap: 10px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.type-opts { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.type-opts .field { font-weight: 700; font-size: .9rem; }
.not-text {
  width: 100%; min-height: 150px; resize: vertical; padding: 12px; border-radius: 12px; border: 1px solid var(--border);
  background: #fffdf9; color: var(--text); font: 500 1.05rem/1.7 ui-monospace, Consolas, 'Courier New', monospace;
}
.parse-status .ps-head { margin: 0; font-weight: 700; }
.ps-head.ok { color: var(--ok); }
.ps-head.err, .ps-list .err { color: var(--err); }
.ps-list { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: .9rem; }
.ps-list .warn { color: #9a6200; }
.snip { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text); font-size: .85rem; }
.snip mark { background: #ffd2cc; color: #8a1c10; border-radius: 3px; padding: 0 2px; }
.linklike { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.help { font-size: .9rem; }
.help summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.help ul { padding-left: 18px; display: grid; gap: 4px; }
.help code, .rv-note code { background: var(--surface-2); padding: 0 5px; border-radius: 5px; }
.form-errors ul { margin: 0; padding: 12px 14px 12px 30px; border-radius: 12px; background: #fdecea; color: #8a1c10; font-weight: 600; display: grid; gap: 4px; }
.form-actions { display: flex; justify-content: flex-end; }

.add-processing { display: grid; place-items: center; min-height: calc(100dvh - var(--topbar-h) - 40px); }
.proc-card { width: min(100%, 460px); text-align: center; padding: 28px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); }
.proc-keys { display: flex; justify-content: center; gap: 3px; height: 56px; margin-bottom: 14px; }
.proc-keys span { width: 22px; border-radius: 0 0 5px 5px; background: #fff; border: 1px solid #c9bba8; animation: keypress 1.4s ease-in-out infinite; }
.proc-keys span:nth-child(2) { animation-delay: .15s; } .proc-keys span:nth-child(3) { animation-delay: .3s; }
.proc-keys span:nth-child(4) { animation-delay: .45s; } .proc-keys span:nth-child(5) { animation-delay: .6s; }
.proc-keys span:nth-child(6) { animation-delay: .75s; } .proc-keys span:nth-child(7) { animation-delay: .9s; }
@keyframes keypress { 0%, 60%, 100% { background: #fff; transform: none; } 30% { background: var(--accent); transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .proc-keys span { animation: none; } }
.bar.big { height: 14px; }
.bar span { transition: width .35s ease; }

.add-review { max-width: 1180px; }
.rv-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.rv-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.rv-warn ul { margin: 12px 0 0; padding: 10px 14px 10px 30px; border-radius: 12px; background: #fff6e0; color: #6d4800; display: grid; gap: 4px; font-size: .92rem; }
.rv-warn .err { color: #8a1c10; font-weight: 700; }
.rv-grid { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 14px; margin-top: 14px; }
.rv-card { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.rv-card h2 { font-size: 1.1rem; }
.rv-card h3 { font-size: 1rem; margin: 16px 0 8px; }
.rv-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.rv-settings { display: grid; gap: 10px; }
.rv-tracks { width: 100%; border-collapse: collapse; font-size: .85rem; }
.rv-tracks th, .rv-tracks td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rv-tracks select { min-height: 36px; font-size: .85rem; width: 100%; }
.rv-note { font-size: .85rem; color: var(--muted); margin-bottom: 0; }
.rv-prev-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rv-sheet { height: 190px; border: 1px solid var(--border); }
.small { font-size: .82rem; }

@media (max-width: 760px) {
  .field-row, .rv-grid { grid-template-columns: 1fr; }
  .attach-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-height: 500px) {
  .tile { min-height: 92px; padding: 10px 8px; }
  .tile-ico { font-size: 1.5rem; }
}

/* ============ Luruskan halaman (foto) ============ */
.add-crop { max-width: 1000px; }
.crop-head h1 span { font-size: 1rem; font-weight: 600; }
.crop-stage { display: grid; place-items: center; min-height: 260px; margin-top: 10px; background: #2b2520; border-radius: var(--radius); padding: 10px; }
.crop-canvas { max-width: 100%; touch-action: none; cursor: crosshair; border-radius: 6px; }
.crop-loading { color: #eee; display: flex; gap: 8px; align-items: center; }
.crop-quality { margin-top: 10px; font-weight: 700; font-size: .92rem; }
.crop-quality.q-ok { color: var(--ok); }
.crop-quality.q-warn { color: #9a6200; }
.crop-quality.q-bad { color: var(--err); }
.crop-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.spacer { flex: 1; }

/* ============ Editor koreksi ============ */
.rv-edit { margin-top: 14px; }
.rv-edit > summary { cursor: pointer; list-style: none; display: grid; gap: 2px; }
.rv-edit > summary::-webkit-details-marker { display: none; }
.rv-edit > summary h2 { margin: 0; display: inline; }
.rv-edit > summary h2::after { content: ' ▾'; color: var(--muted); font-size: .9rem; }
.rv-edit:not([open]) > summary h2::after { content: ' ▸'; }
.editor-host { margin-top: 12px; }
.ed { display: grid; gap: 12px; outline: none; }
.ed:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
.ed.with-img { grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.1fr); align-items: start; }
.ed-img { display: grid; gap: 8px; min-width: 0; }
.ed-img-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ed-img-view { max-height: 62vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.ed-img-view img { display: block; max-width: none; }
.ed-main { display: grid; gap: 10px; min-width: 0; }
.ed-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ed-m { font-weight: 600; }
.ed-lane { display: grid; grid-template-columns: 76px 1fr; gap: 8px; align-items: stretch; }
.ed-lane-label { font-size: .78rem; font-weight: 800; padding: 8px 6px; border-radius: 10px; display: grid; place-items: center; text-align: center; }
.ed-R .ed-lane-label { background: #dcf5e6; color: #1d7a45; }
.ed-L .ed-lane-label { background: #dce9fb; color: #2458a0; }
.ed-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; min-height: 76px; align-items: flex-end; }
.ed-col { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.ed-beat { font-size: .7rem; color: var(--muted); text-align: center; white-space: nowrap; }
.ed-chip {
  display: grid; grid-template-columns: auto auto; gap: 0 6px; align-items: center; min-width: 64px; min-height: var(--tap);
  padding: 6px 8px; border-radius: 10px; border: 2px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; cursor: pointer; text-align: left;
}
.ed-chip b { font-size: .95rem; }
.ed-chip small { color: var(--muted); font-size: .72rem; grid-column: 1; }
.ed-chip .ed-dur { grid-column: 2; grid-row: 1; font-size: 1.05rem; text-align: right; }
.ed-chip .ed-fing { grid-column: 2; grid-row: 2; justify-self: end; min-width: 20px; height: 20px; border-radius: 50%; background: #333; color: #fff; font-size: .75rem; font-weight: 800; display: grid; place-items: center; }
.ed-chip .ed-fing.man { background: var(--accent); }
.ed-R .ed-chip { border-color: #b8e8cb; }
.ed-L .ed-chip { border-color: #bcd3f4; }
.ed-chip.sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.ed-empty { color: var(--muted); font-size: .85rem; padding: 12px; }
.ed-panel { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.ed-hint { font-size: .9rem; color: var(--muted); }
.ed-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ed-k { font-size: .82rem; font-weight: 800; color: var(--muted); min-width: 52px; }
.ed-pitch { min-width: 92px; text-align: center; font-size: 1.1rem; }
.ed-panel select { min-height: 36px; }
.ed-panel .seg button.on { background: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--err); }
@media (max-width: 860px) { .ed.with-img { grid-template-columns: 1fr; } .ed-img-view { max-height: 40vh; } }

/* ============ Kursus ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.center { text-align: center; }
.course-head { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; margin-bottom: 20px; }
.course-head .progress-card { display: grid; gap: 6px; }
.pass { color: var(--ok); font-weight: 800; }
.fail { color: #9a6200; font-weight: 700; }
.lessons { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.lessons a {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
}
.lessons a:hover { border-color: var(--accent); }
.lessons .num { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; }
.lessons li.done .num { background: var(--ok); color: #fff; }
.l-body { flex: 1; display: grid; gap: 2px; }
.l-body .muted { font-size: .88rem; }
.l-state { font-size: .85rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.lessons li.done .l-state { color: var(--ok); }
.lesson { max-width: 920px; display: grid; gap: 14px; }
.lesson h1 { margin: 0; }
.crumbs { font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--accent); }
.done-badge { font-size: .9rem; padding: 3px 10px; border-radius: 99px; background: #dcf5e6; color: #1d7a45; vertical-align: middle; }
.lesson-body { display: grid; gap: 12px; }
.lesson-sec p:first-child { margin-top: 0; }
.lesson-sec h3, .lesson-ex h2 { margin-top: 0; }
.tips { padding-left: 20px; display: grid; gap: 6px; }
.t-map { border-collapse: collapse; margin: 8px 0; font-size: .95rem; }
.t-map th, .t-map td { border: 1px solid var(--border); padding: 6px 10px; text-align: center; }
.t-map th { background: var(--surface-2); text-align: left; }
.demo-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.demo-head h3 { margin: 0; }
.demo-cap { margin: 6px 0 10px; }
.demo-kb { height: 150px; }
.demo-kb .keyboard { height: 100%; }
.staff-box { min-height: 110px; overflow-x: auto; }
.mini-staff { width: 100%; }
.mini-staff svg { display: block; margin: 0 auto; }
.hand-wrap { display: grid; place-items: center; }
.hands { width: min(100%, 420px); }
.hands .palm { fill: #f3d2b3; stroke: #c99d78; stroke-width: 2; }
.hands .finger { fill: #f6dcc2; stroke: #c99d78; stroke-width: 2; }
.hands .finger.on { fill: #ffc98f; stroke: var(--accent); stroke-width: 3; }
.hands .num { fill: #fff; stroke: #c99d78; stroke-width: 1.5; }
.hands .num.on { fill: var(--accent); stroke: var(--accent); }
.hands .num-t { font: 800 13px var(--font); fill: #3a2a1c; }
.hands .num.on + .num-t { fill: #fff; }
.hands .hand-label { font: 700 14px var(--font); fill: #7a5a3c; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ============ Latihan interaktif ============ */
.ex { display: grid; gap: 12px; }
.ex-top { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: .9rem; }
.ex-top .bar { flex: 1; margin: 0; }
.ex-score { color: var(--ok); white-space: nowrap; }
.ex-prompt { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 8px; min-height: 90px; }
.ex-text { font-size: 1.15rem; }
.big-q { font-size: 2.4rem; color: var(--accent); display: inline-block; min-width: 1.5em; }
.ex-visual:empty { display: none; }
.ex-visual.staff { min-height: 110px; width: 100%; max-width: 560px; }
.ex-extra { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
.ex-feedback { min-height: 1.6em; text-align: center; font-weight: 700; }
.ex-feedback.ok { color: var(--ok); }
.ex-feedback.bad { color: var(--err); }
.ex-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.ex-choices .choice.right { background: #dcf5e6; border-color: var(--ok); color: #1d7a45; }
.ex-choices .choice.wrong { background: #fde0dc; border-color: var(--err); color: #8a1c10; }
.ex-kb { height: 170px; }
.ex-kb .keyboard { height: 100%; }
.ex.no-kb .ex-kb { opacity: .35; pointer-events: none; height: 90px; }
.seq-dots { display: flex; gap: 6px; }
.seq-dots span { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--border); }
.seq-dots span.ok { background: var(--ok); border-color: var(--ok); }
.seq-dots span.bad { border-color: var(--err); }
.ex-result { text-align: center; display: grid; gap: 4px; justify-items: center; padding: 10px; }
.ex-result p { margin: 2px 0; }
.stars { font-size: 2.4rem; color: #f5a623; letter-spacing: 4px; }
.angka-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.angka-big { display: inline-grid; grid-template-rows: 14px auto 14px; justify-items: center; font-weight: 800; }
.angka-big .n { font-size: 2.6rem; line-height: 1; }
.angka-big .d { font-size: 1rem; line-height: 14px; letter-spacing: -1px; }

/* ============ Latihan: tebak nada ============ */
.practice { max-width: 980px; display: grid; gap: 14px; }
.practice-setup { display: grid; gap: 16px; }
.ps-row { display: grid; gap: 8px; }
.ps-k { font-weight: 800; font-size: .9rem; color: var(--muted); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.mode-btn {
  display: grid; gap: 4px; text-align: left; padding: 12px; border-radius: 12px; min-height: var(--tap);
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.mode-btn span { font-size: .8rem; color: var(--muted); }
.mode-btn[aria-pressed='true'] { border-color: var(--accent); background: #fff4ea; }
.ps-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.practice-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.practice-bar h1 { margin: 0; font-size: 1.4rem; }
.practice-bar h1 span { font-size: 1rem; }

@media (max-width: 760px) { .course-head { grid-template-columns: 1fr; } }
@media (max-height: 500px) {
  .ex-kb { height: 130px; }
  .ex-prompt { min-height: 60px; padding: 2px; }
  .big-q { font-size: 1.8rem; }
  .demo-kb { height: 120px; }
}

/* ============ Profil & progres ============ */
.profile { max-width: 1100px; display: grid; gap: 14px; }
.pf-head { display: flex; gap: 16px; align-items: center; }
.pf-avatar { flex: none; width: 76px; height: 76px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface-2); font-size: 2.3rem; cursor: pointer; }
.pf-avatar:hover { border-color: var(--accent); }
.pf-id { flex: 1; min-width: 0; display: grid; gap: 8px; }
.pf-name { font: 800 1.5rem var(--font); border: 0; border-bottom: 2px dashed var(--border); background: transparent; color: var(--text); padding: 2px 0; width: min(100%, 420px); }
.pf-name:focus-visible { outline: none; border-bottom-color: var(--accent); }
.pf-account { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pf-cloud summary { cursor: pointer; font-size: .85rem; color: var(--accent); font-weight: 700; }
.pf-login { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-login input { min-height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 .9rem var(--font); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 2px; }
.tile-stat b { font-size: 1.7rem; line-height: 1.1; }
.tile-stat span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.pf-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 1.6fr; gap: 14px; align-items: start; }
.profile h2 { font-size: 1.15rem; margin: 0 0 10px; }
.profile h3 { font-size: 1rem; margin: 16px 0 8px; }
.pf-lessons, .pf-list, .pf-timeline { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.pf-lessons a { display: flex; gap: 10px; align-items: center; padding: 6px 4px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .92rem; }
.pf-lessons a:hover { background: var(--surface-2); }
.pf-lessons .num { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: .78rem; font-weight: 800; }
.pf-lessons li.done .num { background: var(--ok); color: #fff; }
.grow { flex: 1; min-width: 0; display: grid; }
.table-wrap { overflow-x: auto; }
.pf-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.pf-table th { text-align: left; font-size: .78rem; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--border); }
.pf-table td { padding: 7px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.pf-list li, .pf-timeline li { display: flex; gap: 10px; align-items: center; padding: 6px 2px; border-bottom: 1px solid var(--border); font-size: .92rem; }
.pf-timeline li:last-child, .pf-list li:last-child { border-bottom: 0; }
.tl-ico { font-size: 1.2rem; }
.tl-score { font-weight: 800; min-width: 3.2em; text-align: right; }
.tl-date { min-width: 96px; text-align: right; }
.pf-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-msg { min-height: 1.4em; font-weight: 700; margin: 8px 0 0; }
@media (max-width: 760px) { .pf-grid { grid-template-columns: 1fr; } .tl-date { display: none; } }
.pf-account .chip { max-width: none; }
