/* ─── PianoQuest ───────────────────────────────────────────────────────────────
   WordPress compatibility: styles are scoped under #app / #loading-screen so
   they don't conflict with WordPress themes, jQuery plugins, or admin bar.
   For a standalone page deploy: html/body styles ensure full-screen layout.
   For WordPress iframe embed: the iframe provides natural isolation.
   For WordPress inline embed: the #app isolation class prevents conflicts.
   ───────────────────────────────────────────────────────────────────────────── */

/* Scoped reset — only affects elements inside the app */
#app *, #loading-screen *,
#app *::before, #loading-screen *::before,
#app *::after,  #loading-screen *::after {
  box-sizing: border-box;
}
/* Standalone page: full screen. On WordPress, html/body can coexist.
   Anti-shift: lock html+body to viewport, no scroll in any direction ever. */
html {
  overflow: hidden !important;
  width: 100vw; max-width: 100vw;
  height: 100%; margin: 0; padding: 0;
  overscroll-behavior: none;              /* prevent pull-to-refresh & rubber-band */
}
html:not(.wp-toolbar) body {
  overflow: hidden !important;
  width: 100vw; max-width: 100vw;
  height: 100%; margin: 0; padding: 0;
  position: fixed; top: 0; left: 0;       /* position:fixed = absolute layout lock */
  overscroll-behavior: none;
}
#app, #loading-screen { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }
body.pianoquest-page { height: 100%; overflow: hidden !important; max-width: 100vw; background: #0d0f1a; color: #e8eaf0; position: fixed; top: 0; left: 0; }
/* WordPress admin bar compensation */
.wp-toolbar #app { height: calc(100vh - 32px); margin-top: 32px; }
@media screen and (max-width: 782px) { .wp-toolbar #app { height: calc(100vh - 46px); margin-top: 46px; } }

:root {
  --bg: #0d0f1a;
  --bg2: #151829;
  --bg3: #1e2235;
  --accent: #00d4ff;
  --accent2: #7c3aed;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --rh: #00d4ff;
  --lh: #a855f7;
  --nav-h: 56px;
  --radius: 12px;
}

.hidden { display: none !important; }

/* ─── Loading Screen ─── */
#loading-screen {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.loading-content { text-align: center; }
.loading-logo { font-size: 5rem; animation: pulse 1.5s ease-in-out infinite; }
.loading-title { font-size: 2.5rem; font-weight: 800; color: var(--accent); margin: .5rem 0 1.5rem; letter-spacing: -1px; }
.loading-bar-wrap { width: 280px; height: 8px; background: var(--bg3); border-radius: 99px; overflow: hidden; margin: 0 auto 1rem; }
.loading-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; width: 0%; transition: width .4s ease; }
.loading-msg { color: #a8b2c4; font-size: .9rem; }

/* ─── App shell ─── */
#app { height: 100vh; width: 100vw; max-width: 100vw; display: flex; flex-direction: column; overflow: hidden; position: relative; overscroll-behavior: none; }

/* ─── Navbar ─── */
#navbar {
  height: var(--nav-h); min-height: var(--nav-h);
  background: var(--bg2); border-bottom: 1px solid #ffffff12;
  display: flex; align-items: center; padding: 0 1rem; gap: 1rem; z-index: 100;
  flex-shrink: 0;
}
.nav-logo { font-weight: 800; font-size: 1.1rem; color: var(--accent); white-space: nowrap; }
.nav-tabs { display: flex; gap: .25rem; flex: 1; justify-content: center; }
.nav-tab {
  display: flex; align-items: center; gap: .35rem; padding: .45rem .8rem;
  background: none; border: none; border-radius: 8px; color: #a8b2c4;
  cursor: pointer; font-size: .85rem; transition: all .15s;
}
.nav-tab:hover { background: var(--bg3); color: #ccd0da; }
.nav-tab.active { background: var(--bg3); color: var(--accent); }
.nav-tab .ti { font-size: 1.1rem; }
.nav-right { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
.streak-badge, .xp-badge, .hearts-badge, .midi-badge {
  background: var(--bg3); border-radius: 20px; padding: .25rem .7rem;
  font-size: .82rem; font-weight: 700; white-space: nowrap;
}
.midi-badge { color: #a8b2c4; cursor: pointer; transition: color .3s; }
.midi-badge.connected { color: var(--green); }
.midi-badge.connected::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  margin-right: 4px;
  animation: midi-pulse 1.5s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes midi-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(.7); }
}
.nav-settings-btn {
  background: none; border: none; color: #9ca3af; font-size: 1.2rem;
  cursor: pointer; padding: .2rem .4rem; border-radius: 8px; transition: all .15s;
}
.nav-settings-btn:hover { background: var(--bg3); color: var(--accent); }

/* ─── Settings panel ─── */
.settings-panel {
  position: fixed; top: 0; right: 0; width: 320px; height: 100vh;
  background: #11131f; border-left: 1px solid #ffffff12;
  z-index: 2000; display: flex; flex-direction: column;
  box-shadow: -8px 0 32px #00000060; transform: translateX(0);
  transition: transform .25s ease;
}
.settings-panel.hidden { transform: translateX(100%); display: flex !important; }
.settings-backdrop {
  position: fixed; inset: 0; background: #00000050; z-index: 1999;
}
.settings-backdrop.hidden { display: none !important; }
.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem; border-bottom: 1px solid #ffffff10;
  flex-shrink: 0;
}
.settings-header h3 { font-size: 1rem; font-weight: 700; }
.settings-close {
  background: none; border: none; color: #9ca3af; font-size: 1.2rem;
  cursor: pointer; line-height: 1; padding: .25rem;
}
.settings-body { overflow-y: auto; flex: 1; padding: .5rem 0 2rem; }
.setting-section {
  padding: .6rem 1.25rem .2rem; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .1em; color: #9ca3af; font-weight: 700; margin-top: .5rem;
}
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem 1.25rem; gap: .75rem;
}
.setting-row label { font-size: .85rem; color: #d1d5db; flex-shrink: 0; }
.setting-val { font-size: .85rem; color: #9ca3af; }
.setting-control { display: flex; align-items: center; gap: .5rem; }
.setting-slider {
  -webkit-appearance: none; appearance: none;
  width: 130px; height: 4px; background: var(--bg3);
  border-radius: 99px; outline: none; cursor: pointer;
}
.setting-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
}
.setting-select {
  background: var(--bg3); border: 1px solid #ffffff15; border-radius: 8px;
  color: #d1d5db; font-size: .82rem; padding: .3rem .6rem; cursor: pointer;
}
.setting-toggle {
  background: var(--bg3); border: 1px solid #ffffff15; border-radius: 20px;
  color: #9ca3af; font-size: .75rem; font-weight: 700; padding: .25rem .75rem;
  cursor: pointer; transition: all .2s; min-width: 44px;
}
.setting-toggle[data-on="true"] {
  background: #00d4ff20; border-color: var(--accent); color: var(--accent);
}
.setting-danger-btn {
  width: 100%; background: #ef444418; border: 1px solid #ef4444;
  color: #ef4444; border-radius: 8px; padding: .5rem; font-size: .85rem;
  cursor: pointer; transition: all .15s;
}
.setting-danger-btn:hover { background: #ef444430; }

/* ─── Listen mode button ─── */
.ctrl-listen { background: var(--bg3); border: 1px solid #facc1530; color: #facc15; font-size: 1rem; }
.ctrl-listen.listening { background: #facc1520; border-color: #facc15; animation: pulse 1s ease-in-out infinite; }

/* ─── Chord strip ─── */
.chord-strip {
  display: flex; align-items: center; gap: .6rem; padding: .3rem 1rem;
  background: var(--bg2); border-top: 1px solid #ffffff08; flex-shrink: 0;
  min-height: 32px;
}
.chord-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: #9ca3af; }
.chord-name {
  font-size: .9rem; font-weight: 700; color: var(--accent);
  transition: all .2s; letter-spacing: .02em;
}

/* ─── Views ─── */
.view { display: none; flex: 1; overflow-y: auto; overflow-x: hidden; }
.view.active { display: flex; flex-direction: column; }

/* ─── HOME ─── */
.home-wrap { padding: 2rem; max-width: 900px; margin: 0 auto; width: 100%; }
.home-hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: .4rem; }
.home-sub { color: #a8b2c4; margin-bottom: 2rem; }

/* ─── Intro Card ─── */
.intro-card {
  background: linear-gradient(135deg, rgba(0,212,255,0.1), rgba(124,58,237,0.08));
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  line-height: 1.65;
}
.intro-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
}
.intro-icon { font-size: 1.6rem; }
.intro-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #111;
  flex: 1;
  margin: 0;
}
.intro-dismiss {
  background: none;
  border: 1px solid #ffffff15;
  border-radius: 6px;
  color: #666;
  font-size: 1.1rem;
  width: 28px; height: 28px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.intro-dismiss:hover { color: #333; border-color: #00000030; }
.intro-subtitle {
  font-size: .95rem;
  font-weight: 700;
  color: #222;
  margin: 0 0 .75rem;
}
.intro-card p {
  font-size: .88rem;
  color: #333;
  margin: 0 0 .6rem;
}
.intro-card p:last-child { margin-bottom: 0; }
.intro-card strong { color: #111; }

.home-row { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 1rem; margin-bottom: 2rem; }

/* Cards */
.card { background: var(--bg2); border: 1px solid #ffffff0f; border-radius: var(--radius); padding: 1.25rem; }

.goal-card { display: flex; justify-content: space-between; align-items: center; }
.goal-title { font-weight: 700; font-size: 1rem; margin-bottom: .25rem; color: #e8eaf0; }
.goal-desc { color: #a8b2c4; font-size: .85rem; margin-bottom: .75rem; }
.goal-bar-wrap { width: 100%; height: 6px; background: var(--bg3); border-radius: 99px; overflow: hidden; margin-bottom: .5rem; }
.goal-bar-fill { height: 100%; background: var(--green); border-radius: 99px; width: 0%; transition: width .5s ease; }
.goal-count { font-size: .8rem; color: #a8b2c4; }
.goal-ring { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.goal-ring svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--bg3); stroke-width: 5; }
.ring-fg { fill: none; stroke: var(--green); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.goal-ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; color: var(--green); }

.continue-card { display: flex; flex-direction: column; gap: .5rem; }
.continue-badge { font-size: .7rem; font-weight: 800; letter-spacing: .1em; color: var(--accent); }
.continue-card h3 { font-size: 1.2rem; font-weight: 700; color: #e8eaf0; }
.continue-meta { display: flex; gap: .5rem; margin-bottom: .25rem; }
.tag { font-size: .72rem; font-weight: 700; padding: .2rem .6rem; border-radius: 99px; }
.tag-level { background: #1e3a5f; color: #60a5fa; }
.tag-xp { background: #2d1f00; color: var(--yellow); }

.streak-card { text-align: center; }
.streak-flame { font-size: 2.5rem; }
.streak-num { font-size: 3rem; font-weight: 900; color: #f97316; line-height: 1; }
.streak-label { color: #a8b2c4; font-size: .85rem; margin-bottom: .75rem; }
/* Streak calendar — 14 dots in 2 rows of 7 */
.streak-calendar {
  display: flex; flex-wrap: wrap; gap: 4px; justify-content: center;
  margin-top: .75rem; width: 120px; margin-left: auto; margin-right: auto;
}
.streak-day { width: 13px; height: 13px; border-radius: 3px; background: var(--bg3); flex-shrink: 0; }
.streak-day.done { background: linear-gradient(135deg, #f97316, #fb923c); box-shadow: 0 0 4px #f9731688; }
.streak-day.today { outline: 2px solid #f97316; outline-offset: 1px; }

/* Home stats row */
.home-stats-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-chip {
  background: var(--bg2); border: 1px solid #ffffff0f; border-radius: 20px;
  padding: .35rem .85rem; display: flex; align-items: center; gap: .4rem;
  font-size: .85rem; font-weight: 700;
}
.stat-chip small { font-weight: 400; color: #9ca3af; font-size: .72rem; }
.stat-icon { font-size: .9rem; }
.stat-level { background: linear-gradient(135deg,#7c3aed22,#00d4ff22); border-color: var(--accent); color: var(--accent); }

/* Featured song card */
.featured-song-card {
  background: linear-gradient(135deg, var(--bg2) 0%, #1e1a35 100%);
  border: 1px solid #ffffff12; border-radius: var(--radius);
  padding: 1.25rem; display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.5rem; transition: border-color .2s;
}
.featured-song-card:hover { border-color: var(--accent); }
.fs-emoji { font-size: 2.8rem; flex-shrink: 0; }
.fs-info { flex: 1; min-width: 0; }
.fs-title { font-size: 1.1rem; font-weight: 800; margin-bottom: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #e8eaf0; }
.fs-composer { color: #a8b2c4; font-size: .82rem; margin-bottom: .4rem; }
.fs-tags { display: flex; gap: .4rem; flex-wrap: wrap; }
.fs-actions { display: flex; gap: .5rem; flex-shrink: 0; flex-direction: column; }
.fs-listen { font-size: .82rem; padding: .4rem .8rem; }
.fs-play   { font-size: .82rem; padding: .4rem .8rem; }
.btn-outline {
  background: none; border: 1px solid var(--accent); color: var(--accent);
  border-radius: 8px; padding: .45rem 1rem; cursor: pointer; font-weight: 600;
  font-size: .85rem; transition: all .15s;
}
.btn-outline:hover { background: var(--accent); color: #000; }
.link-btn {
  background: none; border: none; color: var(--accent); font-size: .82rem;
  cursor: pointer; text-decoration: underline; padding: 0;
}
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.section-header h2 { font-size: 1rem; font-weight: 700; color: #e8eaf0; }

/* Module path */
.section-header { margin-bottom: 1rem; }
.section-header h2 { font-size: 1.2rem; font-weight: 700; color: #e8eaf0; }
.module-path { display: flex; flex-direction: column; gap: .75rem; padding-bottom: 2rem; }
.mp-module { background: var(--bg2); border: 1px solid #ffffff0f; border-radius: var(--radius); overflow: hidden; }
.mp-header { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; cursor: pointer; }
.mp-header:hover { background: var(--bg3); }
.mp-icon { font-size: 1.5rem; }
.mp-info { flex: 1; }
.mp-name { font-weight: 700; font-size: .95rem; color: #e8eaf0; }
.mp-prog { font-size: .8rem; color: #a8b2c4; margin-top: .15rem; }
.mp-lock { color: #9ca3af; }
.mp-lessons { display: none; padding: .5rem 1rem 1rem; border-top: 1px solid #ffffff08; }
.mp-module.open .mp-lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; }
.lsn-card {
  background: var(--bg3); border-radius: 8px; padding: .75rem 1rem;
  display: flex; align-items: center; gap: .75rem; cursor: pointer;
  transition: all .15s; border: 1px solid transparent;
}
.lsn-card:hover { border-color: var(--accent); }
.lsn-card.done { border-color: var(--green); }
.lsn-card.locked { opacity: .55; cursor: pointer; }
.lsn-card.locked:hover { border-color: #f59e0b88; }
.song-card.locked { opacity: .7; position: relative; }
.song-card.locked:hover { border-color: #f59e0b88; }
.song-lock-badge {
  position: absolute; top: .6rem; right: .6rem;
  background: #0d0f1acc; border-radius: 6px; padding: 2px 6px; font-size: 13px;
}
.lsn-status { font-size: 1.1rem; }
.lsn-info { flex: 1; }
.lsn-title { font-size: .85rem; font-weight: 600; color: #e8eaf0; }
.lsn-mod-title { font-weight: 700; color: #111; }
.lsn-xp { font-size: .72rem; color: var(--yellow); }

/* ─── LESSONS PAGE ─── */
.lessons-wrap { padding: 2rem; max-width: 900px; margin: 0 auto; width: 100%; }
#lessons-modules { display: flex; flex-direction: column; gap: 1rem; padding-bottom: 2rem; }
.page-header { margin-bottom: 1.5rem; }
.page-header h2 { font-size: 1.6rem; font-weight: 800; color: #111; }
.page-header p { color: #444; margin-top: .25rem; }

/* ─── VIDEOS PAGE ─── */
.videos-wrap { padding: 2rem; max-width: 960px; margin: 0 auto; width: 100%; }
.vid-category { margin-bottom: 2rem; }
.vid-cat-header {
  display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem;
}
.vid-cat-icon { font-size: 1.5rem; }
.vid-cat-name { font-weight: 700; font-size: 1.05rem; color: #111; }
.vid-cat-desc { font-size: .8rem; color: #444; }
.vid-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem;
}
.vid-card {
  background: var(--bg2); border: 1px solid #ffffff0a; border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform .15s, border-color .2s;
}
.vid-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.vid-thumb {
  width: 100%; aspect-ratio: 16/9; background-size: cover; background-position: center;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.vid-play-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: #fff; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.vid-card:hover .vid-play-icon { opacity: 1; }
.vid-done-badge {
  position: absolute; top: 8px; right: 8px; font-size: 1.1rem;
}
.vid-info { padding: .75rem; }
.vid-title { font-weight: 600; font-size: .88rem; color: #e8eaf0; margin-bottom: .25rem; }
.vid-chords { font-size: .78rem; color: var(--accent); margin-bottom: .25rem; }
.vid-meta { font-size: .75rem; color: #a8b2c4; }
.vid-card.done { opacity: 0.7; }
.vid-card.done:hover { opacity: 1; }

@media (max-width: 600px) {
  .vid-grid { grid-template-columns: 1fr; }
  .videos-wrap { padding: 1rem; }
}

/* ─── SONGS PAGE ─── */
.songs-wrap { padding: 2rem; max-width: 1000px; margin: 0 auto; width: 100%; }
.genre-filter { display: flex; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.gf-btn { background: var(--bg3); border: 1px solid #ffffff10; border-radius: 99px; color: #a8b2c4; padding: .35rem 1rem; cursor: pointer; font-size: .85rem; transition: all .15s; }
.gf-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }
.songs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; padding-bottom: 2rem; }
.song-card {
  background: var(--bg2); border: 1px solid #ffffff0f; border-radius: var(--radius); padding: 1.25rem;
  display: flex; flex-direction: column; gap: .5rem; cursor: pointer; transition: all .2s;
}
.song-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.song-cover { font-size: 3rem; text-align: center; padding: 1rem 0; background: var(--bg3); border-radius: 8px; }
.song-title { font-weight: 700; font-size: 1rem; color: #e8eaf0; }
.song-composer { color: #a8b2c4; font-size: .82rem; }
.song-tags { display: flex; gap: .4rem; flex-wrap: wrap; }
.song-diff { font-size: .72rem; font-weight: 700; padding: .2rem .6rem; border-radius: 99px; }
.diff-1 { background: #052e16; color: #4ade80; }
.diff-2 { background: #1c1f05; color: #a3e635; }
.diff-3 { background: #2d1b00; color: #fb923c; }
.diff-4 { background: #2d0a00; color: #f87171; }
.song-dur { font-size: .72rem; color: #9ca3af; }
.song-stars { color: var(--yellow); font-size: .85rem; }

/* ─── PRACTICE PAGE ─── */
.practice-wrap { padding: 2rem; max-width: 900px; margin: 0 auto; width: 100%; }
.practice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.pcard {
  background: var(--bg2); border: 1px solid #ffffff0f; border-radius: var(--radius); padding: 1.5rem;
  display: flex; flex-direction: column; align-items: center; gap: .75rem; text-align: center; cursor: pointer; transition: all .2s;
}
.pcard:hover { border-color: var(--accent2); transform: translateY(-2px); }
.pcard.pcard-active { border-color: var(--accent); box-shadow: 0 0 12px rgba(0,212,255,.2); }
.pcard-icon { font-size: 2.5rem; }
.pcard h3 { font-weight: 700; color: #e8eaf0; }
.pcard p { color: #a8b2c4; font-size: .83rem; }

#practice-subpanel { background: var(--bg2); border-radius: var(--radius); padding: 1.5rem; margin-top: 1rem; }
#practice-subpanel h3 { color: #e8eaf0; font-weight: 700; }

/* ─── PROGRESS PAGE ─── */
.progress-wrap { padding: 2rem; max-width: 900px; margin: 0 auto; width: 100%; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
.scard { background: var(--bg2); border-radius: var(--radius); padding: 1.25rem; text-align: center; }
.sval { font-size: 2rem; font-weight: 900; color: var(--accent); }
.slbl { font-size: .8rem; color: #a8b2c4; margin-top: .25rem; }
.level-section { background: var(--bg2); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 2rem; }
.level-section h3 { margin-bottom: .75rem; font-size: 1rem; color: #e8eaf0; }
.lv-bar-wrap { height: 10px; background: var(--bg3); border-radius: 99px; overflow: hidden; margin-bottom: .5rem; }
.lv-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; transition: width .6s ease; }
.lv-xp-label { font-size: .8rem; color: #a8b2c4; }
.achieve-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; padding-bottom: 2rem; }
.ach-card { background: var(--bg2); border-radius: var(--radius); padding: 1rem; text-align: center; }
.ach-card.locked { opacity: .35; filter: grayscale(1); }
.ach-icon { font-size: 2rem; }
.ach-name { font-weight: 700; font-size: .85rem; margin-top: .5rem; color: #e8eaf0; }
.ach-desc { font-size: .75rem; color: #a8b2c4; margin-top: .2rem; }

/* ─── PLAYER VIEW ─── */
#view-player { overflow: hidden; overscroll-behavior: none; touch-action: none; }
.player-wrap { height: calc(100vh - var(--nav-h)); display: flex; flex-direction: column; }

.player-header {
  display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem;
  background: var(--bg2); border-bottom: 1px solid #ffffff10; flex-shrink: 0; min-height: 48px;
}
.btn-back { background: none; border: 1px solid #ffffff20; color: #ccd0da; border-radius: 8px; padding: .3rem .8rem; cursor: pointer; font-size: .85rem; }
.btn-back:hover { background: var(--bg3); }
.ph-title { flex: 1; min-width: 0; }
.ph-title > span { display: block; }
#ph-name { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-sub { font-size: .75rem; color: #a8b2c4; }
.ph-right { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.ph-hearts { font-size: .9rem; }
.ph-score { font-size: .82rem; }
.ph-acc { font-size: .9rem; font-weight: 700; color: var(--green); }

/* ─── Tutorial button (player header) ─── */
.btn-tutorial {
  background: linear-gradient(135deg, #ff0000, #cc0000);
  border: none; color: #fff; border-radius: 8px;
  padding: .3rem .8rem; cursor: pointer; font-size: .82rem;
  font-weight: 600; white-space: nowrap; flex-shrink: 0;
  display: flex; align-items: center; gap: .3rem;
  transition: opacity .15s, transform .1s;
}
.btn-tutorial:hover { opacity: .85; transform: scale(1.03); }
.btn-tutorial.hidden { display: none !important; }

/* ─── YouTube tutorial modal ─── */
.yt-card {
  max-width: 760px; padding: 1.25rem 1.5rem 1.5rem;
  display: flex; flex-direction: column; gap: .75rem;
}
.yt-header {
  display: flex; align-items: center; justify-content: space-between;
}
.yt-header h3 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.yt-player-wrap {
  position: relative; width: 100%; padding-bottom: 56.25%; /* 16:9 */
  height: 0; border-radius: 10px; overflow: hidden; background: #000;
}
.yt-player-wrap iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  border: none;
}
.yt-hint {
  font-size: .8rem; color: #a8b2c4; text-align: center; margin: 0;
}

/* ─── Video lesson full-screen view ─── */
.vl-wrap {
  display: flex; flex-direction: column; height: 100%; padding: .75rem 1rem;
  max-width: 1000px; margin: 0 auto; width: 100%;
}
.vl-header {
  display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; flex-shrink: 0;
}
.vl-header h2 { font-size: 1rem; font-weight: 700; margin: 0; color: #e8eaf0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vl-player {
  position: relative; width: 100%; padding-bottom: 56.25%; /* 16:9 */
  border-radius: 12px; overflow: hidden; background: #000; flex-shrink: 0;
}
.vl-player iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;
}
.vl-chords {
  display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center;
  padding: .75rem 0; flex-shrink: 0;
}
.vl-chords.hidden { display: none; }
.vl-chord {
  background: var(--bg3); border: 1px solid #ffffff15; border-radius: 8px;
  padding: .4rem .9rem; font-size: .95rem; font-weight: 700; color: var(--accent);
  letter-spacing: .02em;
}
.vl-desc {
  font-size: .85rem; color: #8892a4; text-align: center; margin: .5rem 0 0;
}

/* Waterfall */
.waterfall-wrap {
  flex: 1; min-height: 0; position: relative; background: #080a12; overflow: hidden;
}
#waterfall-canvas { width: 100%; height: 100%; display: block; will-change: transform; }
.wf-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #00000088; z-index: 5;
}
.wf-countdown { font-size: 8rem; font-weight: 900; color: #fff; animation: countPop .8s ease; }

/* View-mode tab bar */
.view-tabs {
  display: flex; align-items: center; gap: .3rem; padding: .3rem .75rem;
  background: var(--bg2); border-bottom: 1px solid #ffffff10; flex-shrink: 0;
}
.view-tab {
  background: var(--bg3); border: 1px solid #ffffff15; border-radius: 8px;
  color: #9ca3af; font-size: .78rem; font-weight: 600; padding: .25rem .7rem;
  cursor: pointer; transition: all .15s;
}
.view-tab.active { color: var(--accent); border-color: var(--accent); background: #00d4ff18; }
.guided-label { font-size: .8rem; color: var(--yellow); font-weight: 600; }

/* Full score wrap */
.score-wrap {
  flex: 0 0 auto; min-height: 190px; max-height: 230px; background: #f9f7ef;
  overflow-x: auto; overflow-y: hidden; border-top: 1px solid #ccc;
}
.score-wrap canvas { display: block; }

/* Guided exercise panel */
.guided-wrap {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1rem;
  background: var(--bg); padding: 1.5rem;
}
.guided-notes {
  display: flex; gap: .35rem; flex-wrap: wrap; justify-content: center;
  max-width: 760px;
}
.gn-bubble {
  width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: .78rem; font-weight: 700;
  border: 2px solid #ffffff20; background: var(--bg3); color: #9ca3af;
  transition: all .2s; flex-shrink: 0;
}
.gn-bubble.done   { background: #22c55e22; border-color: #22c55e; color: #22c55e; }
.gn-bubble.active { background: #00d4ff22; border-color: var(--accent); color: var(--accent);
                    transform: scale(1.2); box-shadow: 0 0 12px var(--accent); }
.gn-bubble.lh.active { background: #a855f722; border-color: var(--lh); color: var(--lh);
                        box-shadow: 0 0 12px var(--lh); }
.guided-status { font-size: .9rem; color: #a8b2c4; text-align: center; }

/* Sheet music (old small strip — kept for legacy, hidden by default) */
.sheet-wrap {
  height: 110px; min-height: 110px; flex-shrink: 0;
  background: #f8f8f0; border-top: 2px solid #000; position: relative; overflow: hidden;
  display: none; /* replaced by score-wrap */
}
#sheet-canvas { width: 100%; height: 100%; display: block; }
.sheet-label { position: absolute; top: 4px; left: 8px; font-size: .65rem; color: #666; pointer-events: none; }

/* Controls bar */
.ctrl-bar {
  display: flex; align-items: center; gap: .5rem; padding: .4rem .75rem;
  background: var(--bg2); border-top: 1px solid #ffffff10; flex-shrink: 0; min-height: 44px; flex-wrap: wrap;
}
.ctrl-btn {
  background: var(--bg3); border: none; border-radius: 8px; color: #ccd0da;
  font-size: 1.1rem; width: 36px; height: 36px; cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.ctrl-btn:hover { background: #2a2f44; }
.ctrl-play { background: var(--accent); color: #000; font-size: .9rem; width: 40px; height: 40px; }
.ctrl-play:hover { background: #00b8da; }
.ctrl-play.playing { background: var(--red); }
.tempo-badge { font-size: .8rem; font-weight: 700; color: var(--yellow); background: var(--bg3); padding: .2rem .6rem; border-radius: 6px; flex-shrink: 0; }
.ctrl-sep { width: 1px; height: 24px; background: #ffffff15; margin: 0 .25rem; flex-shrink: 0; }
.toggle-btn {
  background: var(--bg3); border: 1px solid #ffffff15; border-radius: 8px;
  color: #9ca3af; font-size: .9rem; width: 32px; height: 32px; cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.toggle-btn.active { color: var(--accent); border-color: var(--accent); }
#tog-practice { width: auto; padding: 0 .6rem; font-size: .72rem; font-weight: 700; }
#tog-practice.active { color: #a855f7; border-color: #a855f7; background: #a855f71a; }
#tog-mute.muted { color: #ef4444; border-color: #ef4444; background: #ef444418; }
.song-prog-wrap { display: flex; align-items: center; gap: .5rem; flex: 1; min-width: 120px; }
.song-prog-bar { flex: 1; height: 6px; background: var(--bg3); border-radius: 99px; overflow: visible; position: relative; cursor: pointer; }
.song-prog-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .1s linear; }
.song-time { font-size: .75rem; color: #a8b2c4; white-space: nowrap; }

/* Piano keyboard */
.kb-wrap { flex-shrink: 0; background: #1a1a2e; border-top: 2px solid #000; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.kb-wrap::-webkit-scrollbar { display: none; }
#keyboard-canvas { display: block; will-change: transform; touch-action: pan-x; user-select: none; -webkit-user-select: none; }

/* Keyboard toolbar */
.kb-toolbar {
  display: flex; align-items: center; gap: .5rem; padding: .25rem .75rem;
  background: #12142066; border-bottom: 1px solid #ffffff0a; flex-wrap: wrap;
}
.kb-hint { font-size: .72rem; color: #9ca3af; flex: 1; }
.kb-hint kbd {
  background: #2a2d3e; border: 1px solid #3a3d4e; border-radius: 4px;
  padding: 1px 5px; font-size: .7rem; font-family: monospace; color: #cbd5e1;
}
.kb-map-btn {
  font-size: .75rem; padding: .25rem .6rem; background: #1e2235;
  border: 1px solid #2a2d3e; border-radius: 6px; color: #a8b2c4; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.kb-map-btn:hover, .kb-map-btn.active { background: #22d3ee22; border-color: #22d3ee; color: #22d3ee; }
.kb-octave {
  font-size: .72rem; font-family: monospace; color: #22d3ee;
  background: #22d3ee15; border-radius: 4px; padding: 2px 6px;
  border: 1px solid #22d3ee33;
}

/* AI Panel */
.ai-panel {
  display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem;
  background: var(--bg2); border-top: 1px solid #ffffff10; flex-shrink: 0; min-height: 54px;
}
.ai-avatar { font-size: 1.5rem; flex-shrink: 0; }
.ai-content { flex: 1; min-width: 0; }
.ai-content p { font-size: .82rem; color: #ccd0da; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-up { font-size: .78rem; color: var(--accent); font-weight: 600; white-space: nowrap; flex-shrink: 0; }

/* ─── OVERLAYS ─── */
.overlay { position: fixed; inset: 0; background: #00000099; display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(4px); }
.ov-card { background: var(--bg2); border: 1px solid #ffffff15; border-radius: 1.5rem; padding: 2.5rem; width: min(460px, 90vw); text-align: center; }
.ov-anim { font-size: 4rem; animation: bounce 1s ease; }
.ov-card h2 { font-size: 1.8rem; font-weight: 800; margin: .75rem 0; }
.ov-stats { display: flex; justify-content: center; gap: 2rem; margin: 1.5rem 0; }
.ov-stat {}
.ov-val { font-size: 2rem; font-weight: 900; color: var(--accent); }
.ov-lbl { font-size: .8rem; color: #a8b2c4; }
.star-row { font-size: 2rem; margin-bottom: 1rem; }
.ov-feedback { color: #a8b2c4; font-size: .9rem; margin-bottom: 1.5rem; line-height: 1.5; }
.ov-buttons { display: flex; gap: 1rem; justify-content: center; }

/* XP pop */
.xp-pop {
  position: fixed; bottom: 30%; left: 50%; transform: translateX(-50%);
  background: var(--yellow); color: #000; font-size: 1.4rem; font-weight: 900;
  padding: .4rem 1.2rem; border-radius: 99px; z-index: 2000; animation: xpFly 1.2s ease forwards;
}

/* ─── Buttons ─── */
.btn-primary { background: var(--accent); color: #000; border: none; border-radius: 10px; padding: .65rem 1.4rem; font-weight: 700; font-size: .9rem; cursor: pointer; transition: all .15s; }
.btn-primary:hover { background: #00b8da; }
.btn-secondary { background: var(--bg3); color: #ccd0da; border: 1px solid #ffffff20; border-radius: 10px; padding: .6rem 1.2rem; font-weight: 600; font-size: .88rem; cursor: pointer; transition: all .15s; }
.btn-secondary:hover { background: #2a2f44; }
.pcard-btn { margin-top: auto; }

/* ─── Note flash ─── */
.note-correct { animation: flashGreen .3s ease; }
.note-wrong   { animation: flashRed .3s ease; }

/* ─── Keyboard note label ─── */
.key-label { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: .55rem; color: #666; pointer-events: none; }

/* ─── Animations ─── */
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }
@keyframes bounce { 0%{transform:scale(.5);opacity:0} 60%{transform:scale(1.2)} 100%{transform:scale(1);opacity:1} }
@keyframes xpFly { 0%{opacity:1;transform:translateX(-50%) translateY(0)} 100%{opacity:0;transform:translateX(-50%) translateY(-80px)} }
@keyframes countPop { 0%{transform:scale(2);opacity:0} 100%{transform:scale(1);opacity:1} }
@keyframes flashGreen { 0%,100%{background:none} 50%{background:#22c55e44} }
@keyframes flashRed   { 0%,100%{background:none} 50%{background:#ef444444} }
@keyframes levelUp { 0%{opacity:0;transform:scale(.6)} 60%{transform:scale(1.15)} 100%{opacity:1;transform:scale(1)} }

/* ─── Scrollbars ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2f44; border-radius: 99px; }

/* ─── Nav upgrade/avatar buttons ─── */
.nav-upgrade-btn {
  background: linear-gradient(135deg,var(--accent2),var(--accent));
  border: none; border-radius: 20px; color: #fff; font-size: .78rem;
  font-weight: 700; padding: .3rem .85rem; cursor: pointer; white-space: nowrap;
  transition: opacity .15s;
}
.nav-upgrade-btn:hover { opacity: .85; }
.nav-avatar-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent2); border: 2px solid #ffffff20;
  color: #fff; font-size: .75rem; font-weight: 800;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: border-color .15s;
}
.nav-avatar-btn:hover { border-color: var(--accent); }

/* ─── Modal backdrop ─── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 3000; padding: 1rem;
}
.modal-card {
  background: #181b2e; border: 1px solid #ffffff18; border-radius: 16px;
  padding: 2rem; position: relative; width: 100%; max-width: 420px;
  max-height: 90vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; color: #9ca3af; font-size: 1.1rem;
  cursor: pointer; padding: .3rem; border-radius: 6px; line-height: 1;
}
.modal-close:hover { color: var(--accent); }

/* ─── Auth modal ─── */
.auth-logo { font-size: 2.5rem; text-align: center; margin-bottom: .5rem; }
.auth-card h2 { text-align: center; font-size: 1.3rem; margin-bottom: .25rem; }
.auth-sub { text-align: center; color: #a8b2c4; font-size: .85rem; margin-bottom: 1.25rem; }
.auth-tabs { display: flex; background: var(--bg3); border-radius: 10px; padding: 3px; margin-bottom: 1.25rem; }
.auth-tab {
  flex: 1; background: none; border: none; color: #a8b2c4;
  font-size: .85rem; font-weight: 600; padding: .45rem; border-radius: 8px; cursor: pointer;
  transition: all .2s;
}
.auth-tab.active { background: var(--bg2); color: #e8eaf0; }
.auth-input {
  display: block; width: 100%; background: var(--bg3); border: 1px solid #ffffff18;
  border-radius: 10px; color: #e8eaf0; font-size: .9rem; padding: .75rem 1rem;
  margin-bottom: .75rem; outline: none; transition: border-color .2s;
}
.auth-input:focus { border-color: var(--accent); }
.auth-error { color: var(--red); font-size: .82rem; margin-bottom: .75rem; padding: .5rem .75rem; background: #ef444415; border-radius: 8px; }
.auth-submit { width: 100%; margin-top: .25rem; }
.auth-guest-btn {
  display: block; width: 100%; margin-top: 1rem; background: none;
  border: none; color: #a8b2c4; font-size: .82rem; cursor: pointer; text-decoration: underline;
}

/* ─── Profile modal ─── */
.profile-card { text-align: center; }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%; background: var(--accent2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 800; color: #fff; margin: 0 auto 1rem;
}
.profile-name { font-size: 1.2rem; font-weight: 700; }
.profile-email { color: #a8b2c4; font-size: .82rem; margin-bottom: .5rem; }
.profile-plan-badge {
  display: inline-block; padding: .2rem .75rem; border-radius: 99px;
  font-size: .75rem; font-weight: 700; background: #1e3a5f; color: #60a5fa; margin-bottom: 1rem;
}
.profile-stats { display: flex; gap: 1rem; justify-content: center; margin-bottom: 1.25rem; }
.ps-item { text-align: center; }
.ps-val { font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.ps-lbl { font-size: .72rem; color: #a8b2c4; }
.profile-upgrade { width: 100%; margin-bottom: .5rem; }
.profile-sub-info { font-size: .8rem; color: #a8b2c4; margin-bottom: .5rem; }

/* ─── Upgrade modal ─── */
.upgrade-card { max-width: 520px; }
.upgrade-card h2 { text-align: center; margin-bottom: .25rem; }
.upgrade-sub { text-align: center; color: #a8b2c4; font-size: .85rem; margin-bottom: 1.5rem; }
.billing-toggle {
  display: flex; background: var(--bg3); border-radius: 10px;
  padding: 3px; margin: 0 auto 1.5rem; width: fit-content;
}
.billing-opt {
  background: none; border: none; color: #a8b2c4; font-size: .82rem;
  font-weight: 600; padding: .4rem 1rem; border-radius: 8px; cursor: pointer; transition: all .2s;
}
.billing-opt.active { background: var(--bg2); color: #e8eaf0; }
.billing-save { color: var(--green); font-size: .72rem; font-weight: 700; margin-left: .25rem; }
.plan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.plan-card {
  background: var(--bg3); border: 1px solid #ffffff18; border-radius: 14px;
  padding: 1.25rem; display: flex; flex-direction: column; gap: .5rem;
}
.plan-card.featured { border-color: var(--accent); background: #00d4ff0d; }
.plan-badge { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.plan-name { font-size: 1.1rem; font-weight: 800; }
.plan-price { font-size: 1.6rem; font-weight: 900; color: var(--accent); }
.plan-price span { font-size: .8rem; font-weight: 500; color: #a8b2c4; }
.plan-features { list-style: none; font-size: .8rem; color: #d1d5db; display: flex; flex-direction: column; gap: .35rem; margin: .25rem 0; }
.plan-features li::before { content: '✓ '; color: var(--green); font-weight: 700; }
.plan-cta { margin-top: auto; width: 100%; }

/* ─── Sight-Reading Trainer ─── */
.pcard-sightread { border-color: rgba(0,212,255,.18); }
.pcard-sightread:hover { border-color: var(--accent); }

.sightread-card { max-width: 480px; width: 92%; padding: 2rem; }
.sr-header { text-align: center; margin-bottom: 1.5rem; }
.sr-icon { font-size: 2.5rem; margin-bottom: .25rem; }
.sr-header h2 { font-size: 1.25rem; font-weight: 800; margin: .25rem 0; }
.sr-desc { color: #a8b2c4; font-size: .85rem; margin: 0; }

.sr-options { display: flex; flex-direction: column; gap: 1.25rem; margin-bottom: 1.5rem; }
.sr-option-group { display: flex; flex-direction: column; gap: .4rem; }
.sr-label { font-size: .78rem; font-weight: 600; color: #a8b2c4; text-transform: uppercase; letter-spacing: .04em; }

.sr-btn-group {
  display: flex; gap: .5rem; flex-wrap: wrap;
}
.sr-opt {
  background: var(--bg3); border: 1px solid #ffffff12; border-radius: 8px;
  color: #a0a8be; font-size: .82rem; font-weight: 600; padding: .45rem .9rem;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.sr-opt:hover { border-color: var(--accent); color: #e8eaf0; }
.sr-opt.active {
  background: rgba(0,212,255,.12); border-color: var(--accent); color: var(--accent);
}
.sr-hint {
  font-size: .76rem; color: #9ca3af; font-style: italic; min-height: 1.1em;
}
.sr-generate-btn {
  width: 100%; font-size: 1rem; padding: .7rem 1rem; font-weight: 700;
}

/* ─── Lock toast ─── */
.lock-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #181b2e; border: 1px solid var(--accent2); border-radius: 12px;
  padding: .75rem 1.25rem; display: flex; align-items: center; gap: .75rem;
  z-index: 4000; opacity: 0; transition: all .3s; pointer-events: none; white-space: nowrap;
}
.lock-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.lock-toast-icon { font-size: 1.2rem; }
.lock-toast-text { font-size: .85rem; font-weight: 600; }
.lock-toast-btn {
  background: var(--accent2); border: none; color: #fff; border-radius: 8px;
  font-size: .78rem; font-weight: 700; padding: .3rem .7rem; cursor: pointer;
}

/* ─── Responsive tweaks ─── */
@media (max-width: 700px) {
  .home-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .nav-tab .tl { display: none; }
  .nav-logo { display: none; }
  .ph-hearts { display: none; }

  /* Player controls – simplified on mobile */
  .ctrl-bar {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap; padding: .4rem .5rem; gap: .4rem;
    scrollbar-width: none;
  }
  .ctrl-bar::-webkit-scrollbar { display: none; }
  .ctrl-btn, .toggle-btn { min-width: 44px; min-height: 44px; font-size: 1rem; }
  .ctrl-play { min-width: 52px; min-height: 52px; font-size: 1.1rem; }
  .song-prog-wrap { min-width: 80px; }
  .song-time { font-size: .7rem; }

  /* Hide non-essential controls during play on mobile */
  .hand-toggle, .view-tabs { display: none; }
  .tempo-wrap { order: 10; } /* push to end */

  /* Player header compact */
  .player-header { padding: .4rem .6rem; gap: .4rem; min-height: 40px; }
  .ph-name { font-size: .9rem; }
  .ph-stats { gap: .4rem; font-size: .78rem; }

  /* Keyboard gets more vertical space on mobile */
  .kb-wrap { flex-shrink: 0; min-height: 120px; }

  /* Nav stats hidden on mobile */
  .midi-badge, .xp-badge { display: none; }

  /* Home wrap padding */
  .home-wrap { padding: 1rem; }
  .home-hero h1 { font-size: 1.4rem; }

  /* Score wrap scrollable */
  .score-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; min-height: 160px; max-height: 180px; }

  /* Modals full-width on mobile */
  .modal-card { padding: 1.25rem; border-radius: 12px; }
  .plan-cards { grid-template-columns: 1fr; }

  /* Guided notes wrap */
  .guided-notes { flex-wrap: wrap; padding: .5rem; gap: .35rem; }
  .gn-bubble { padding: .55rem .7rem; font-size: .85rem; }

  /* Settings panel full screen on mobile */
  .settings-panel { width: 100%; }

  /* Bottom nav for mobile */
  #navbar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    height: auto; padding: .25rem .5rem;
    border-top: 1px solid #ffffff10; border-bottom: none;
    z-index: 50; flex-direction: row; justify-content: center;
  }
  #navbar .nav-right { display: none; }
  .nav-tabs { width: 100%; justify-content: space-around; gap: 0; }
  .nav-tab { flex-direction: column; gap: .15rem; padding: .35rem .3rem; font-size: .65rem; }
  .nav-tab .ti { font-size: 1.25rem; }

  /* Adjust app layout for bottom nav */
  #app { padding-bottom: 60px; padding-top: 0; }
  .player-wrap { height: 100vh; } /* navbar hidden in player on mobile */
  .view { padding-top: 0; }

  /* Waterfall gets more space */
  .waterfall-wrap { flex: 1; min-height: 0; }

  /* Combo display - larger on mobile */
  .combo-display { font-size: 1.2rem; }
  .timing-flash { font-size: 1.6rem; }
}

@media (max-width: 480px) {
  .nav-tab { padding: .3rem .2rem; }
  .ctrl-btn { padding: .45rem; min-width: 44px; min-height: 44px; }
  .streak-badge { font-size: .75rem; padding: .2rem .5rem; }
  .home-row > *:nth-child(3) { display: none; }
  .ph-sub { display: none; }

  /* Even bigger play button on small phones */
  .ctrl-play { min-width: 56px; min-height: 56px; font-size: 1.2rem; border-radius: 50%; }

  /* Simplified player header */
  .player-header { padding: .3rem .5rem; }
  .btn-back { font-size: .8rem; padding: .3rem .5rem; }
  .btn-tutorial { font-size: .8rem; }

  /* Loop buttons hidden on tiny screens */
  .loop-btn-group { display: none; }

  /* Keyboard bigger on phones — minimum 140px height */
  .kb-wrap { min-height: 140px; }
}

/* ─── 1. Tempo slider ─── */
.tempo-wrap {
  display: flex; align-items: center; gap: .35rem; flex-shrink: 0;
}
.tempo-label { font-size: .9rem; line-height: 1; }
.tempo-slider {
  -webkit-appearance: none; appearance: none;
  width: 90px; height: 4px; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--val, 50%), var(--bg3) var(--val, 50%));
  outline: none; cursor: pointer; flex-shrink: 0;
}
.tempo-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
  box-shadow: 0 0 4px var(--accent);
}
.tempo-slider::-moz-range-thumb {
  width: 14px; height: 14px; border: none; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}

/* ─── 2. Hand isolation 3-way toggle ─── */
.hand-toggle {
  display: flex; align-items: center; border-radius: 8px;
  overflow: hidden; border: 1px solid #ffffff15; flex-shrink: 0;
}
.ht-btn {
  background: var(--bg3); border: none; color: #a8b2c4;
  padding: .3rem .55rem; font-size: .72rem; font-weight: 700;
  cursor: pointer; transition: background .15s, color .15s; white-space: nowrap;
}
.ht-btn + .ht-btn { border-left: 1px solid #ffffff15; }
.ht-btn.active { background: var(--accent2); color: #fff; }
.ht-btn:hover:not(.active) { background: var(--bg2); color: #e8eaf0; }

/* ─── 3. A–B Loop ─── */
.loop-btn-group {
  display: flex; align-items: center; gap: .3rem; flex-shrink: 0;
}
.loop-btn {
  background: var(--bg3); border: 1px solid #ffffff15; border-radius: 6px;
  color: #a8b2c4; font-size: .78rem; font-weight: 700;
  padding: .25rem .5rem; cursor: pointer; transition: background .15s, color .15s;
  white-space: nowrap;
}
.loop-btn:hover { background: #ffffff10; color: #e8eaf0; }
.loop-btn.active { background: #f97316; color: #fff; border-color: #f97316; }
.loop-clear.active, .loop-clear:not(.hidden) { display: inline-block; background: #ef444420; color: var(--red); border-color: var(--red); }
/* Markers inside the progress bar */
.loop-marker {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 3px; height: 14px; border-radius: 2px; pointer-events: none;
}
.loop-marker-a { background: #f97316; }
.loop-marker-b { background: #f97316; }
.loop-region {
  position: absolute; top: 0; height: 100%;
  background: rgba(249,115,22,.25); pointer-events: none; border-radius: 99px;
}

/* ─── 4. Tier + Level badges ─── */
.tier-badge {
  background: linear-gradient(135deg, #7c3aed, #00d4ff);
  border-radius: 20px; padding: .25rem .7rem;
  font-size: .78rem; font-weight: 800; white-space: nowrap; color: #fff;
  letter-spacing: .02em;
}
.level-badge {
  background: var(--bg3); border-radius: 20px; padding: .25rem .7rem;
  font-size: .82rem; font-weight: 700; white-space: nowrap; color: var(--yellow);
}

/* Reward toast (XP + streak + level-up notification) */
.reward-toast {
  position: fixed; bottom: 5.5rem; right: 1.5rem; z-index: 9000;
  background: linear-gradient(135deg, #1e2235ee, #151829ee);
  border: 1px solid #ffffff18; border-radius: 12px;
  padding: .75rem 1.25rem; font-size: .9rem; font-weight: 700;
  color: #e8eaf0; line-height: 1.7; text-align: right;
  box-shadow: 0 8px 32px #0009; pointer-events: none;
  backdrop-filter: blur(8px);
}
.reward-toast.toast-enter { animation: toastIn .35s cubic-bezier(.175,.885,.32,1.275) forwards; }
.reward-toast.toast-exit  { animation: toastOut .35s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateY(24px) scale(.95); } to { opacity:1; transform: none; } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform: translateY(12px); } }

/* ─── 5. Song search + favourites ─── */
.song-search-wrap {
  padding: 0 0 .75rem 0;
}
.song-search {
  width: 100%; max-width: 480px;
  background: var(--bg3); border: 1px solid #ffffff18;
  border-radius: 10px; color: #e8eaf0;
  padding: .6rem 1rem; font-size: .95rem;
  outline: none; transition: border-color .2s;
}
.song-search:focus { border-color: var(--accent); }
.song-search::placeholder { color: #9ca3af; }
/* Cancel button on search input (Chrome) */
.song-search::-webkit-search-cancel-button { cursor: pointer; }

/* Favourite heart button on song cards */
.fav-btn {
  position: absolute; top: .6rem; right: .6rem;
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: .25rem;
  border-radius: 50%; transition: transform .15s, background .15s;
  z-index: 2;
}
.fav-btn:hover  { transform: scale(1.25); background: #ffffff10; }
.fav-btn.fav-on { animation: heartPop .25s ease; }
@keyframes heartPop { 0%,100% { transform: scale(1); } 50% { transform: scale(1.4); } }

/* song-card needs position:relative for the absolute fav-btn */
.song-card { position: relative; }

/* Fade-out for removed cards */
@keyframes fadeOut { to { opacity:0; transform: scale(.9); } }

/* ─── PRACTICE INSIGHTS / STATS PAGE ─── */
.stats-wrap {
  padding: 2rem; max-width: 900px; margin: 0 auto; width: 100%;
  overflow-y: auto; height: calc(100vh - var(--nav-h));
}
.insights-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem;
}
.ins-card {
  background: var(--bg2); border-radius: var(--radius); padding: 1.25rem; text-align: center;
  border: 1px solid #ffffff08;
}
.ins-icon { font-size: 1.6rem; margin-bottom: .35rem; }
.ins-val { font-size: 1.8rem; font-weight: 900; color: var(--accent); }
.ins-lbl { font-size: .78rem; color: #8892a4; margin-top: .2rem; }

.ins-section {
  background: var(--bg2); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem;
  border: 1px solid #ffffff08;
}
.ins-section h3 { margin: 0 0 1rem; font-size: 1rem; color: #ccd0da; }

/* Level & XP row */
.ins-level-row { display: flex; align-items: center; gap: .75rem; }
.ins-level-badge {
  background: var(--bg3); border-radius: 8px; padding: .3rem .7rem;
  font-weight: 800; font-size: .9rem; color: var(--accent); white-space: nowrap;
}
.ins-xp-bar-wrap {
  flex: 1; height: 10px; background: var(--bg3); border-radius: 99px; overflow: hidden;
}
.ins-xp-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px; transition: width .6s ease; width: 0%;
}
.ins-xp-label { font-size: .8rem; color: #8892a4; white-space: nowrap; }

/* Weekly practice chart — pure CSS bars */
.ins-chart {
  display: flex; align-items: flex-end; gap: .5rem; height: 140px; padding-top: .5rem;
}
.ins-chart-col {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem; height: 100%;
  justify-content: flex-end;
}
.ins-chart-bar {
  width: 100%; min-height: 4px; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  transition: height .4s ease;
}
.ins-chart-bar.empty { background: var(--bg3); min-height: 4px; }
.ins-chart-val { font-size: .7rem; color: #8892a4; }
.ins-chart-day { font-size: .72rem; color: #8892a4; font-weight: 600; }

/* Most played songs list */
.ins-top-songs {
  list-style: none; padding: 0; margin: 0; counter-reset: song-rank;
}
.ins-top-songs li {
  display: flex; align-items: center; gap: .75rem; padding: .6rem 0;
  border-bottom: 1px solid #ffffff08; font-size: .9rem; color: #ccd0da;
}
.ins-top-songs li:last-child { border-bottom: none; }
.ins-top-songs li::before {
  counter-increment: song-rank; content: counter(song-rank);
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg3); color: var(--accent); font-weight: 800; font-size: .8rem;
  flex-shrink: 0;
}
.ins-song-name { flex: 1; }
.ins-song-count { color: #8892a4; font-size: .8rem; }
.ins-empty { color: #8892a4; font-size: .85rem; padding: .5rem 0; }
.ins-empty::before { display: none; }

/* Accuracy over time — session rows */
.ins-acc-list { display: flex; flex-direction: column; gap: .5rem; }
.ins-acc-row {
  display: flex; align-items: center; gap: .75rem; font-size: .85rem;
}
.ins-acc-date { color: #8892a4; width: 80px; flex-shrink: 0; }
.ins-acc-bar-wrap {
  flex: 1; height: 8px; background: var(--bg3); border-radius: 99px; overflow: hidden;
}
.ins-acc-bar {
  height: 100%; border-radius: 99px; transition: width .4s ease;
}
.ins-acc-bar.high   { background: var(--green); }
.ins-acc-bar.medium { background: var(--yellow); }
.ins-acc-bar.low    { background: var(--red); }
.ins-acc-pct { width: 40px; text-align: right; font-weight: 700; color: #ccd0da; }

/* Hide tier/level on very small screens */
@media (max-width: 640px) {
  .tier-badge { display: none; }
  .level-badge { display: none; }
  .insights-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .tempo-slider { width: 60px; }
  .loop-btn-group { display: none; } /* too narrow — accessible via restart */
  .insights-cards { grid-template-columns: 1fr; }
}

/* ─── Smart Practice ─── */
.sp-section { margin-top: 2rem; }
.sp-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}
.sp-card {
  background: var(--bg2);
  border: 1px solid #ffffff0f;
  border-radius: var(--radius);
  padding: 1.25rem;
}
.sp-card-title {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .75rem;
  color: #e8eaf0;
}
.sp-card-desc {
  font-size: .82rem;
  color: #8892a4;
  margin-bottom: 1rem;
}
.sp-empty {
  font-size: .82rem;
  color: #4b5563;
  padding: .5rem 0;
}

/* Weakness bars */
.sp-weak-list { display: flex; flex-direction: column; gap: .5rem; }
.sp-weak-group { margin-bottom: .75rem; }
.sp-weak-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6b7280;
  font-weight: 700;
  margin-bottom: .4rem;
}
.sp-weak-item {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sp-weak-name {
  font-size: .82rem;
  font-weight: 600;
  color: #d1d5db;
  min-width: 70px;
  flex-shrink: 0;
}
.sp-weak-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg3);
  border-radius: 99px;
  overflow: hidden;
}
.sp-weak-bar {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}
.sp-weak-pct {
  font-size: .75rem;
  font-weight: 700;
  color: #8892a4;
  min-width: 36px;
  text-align: right;
}

/* Drill controls */
.sp-drill-controls { display: flex; flex-direction: column; gap: .75rem; }
.sp-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6b7280;
  font-weight: 700;
}
.sp-diff-select { display: flex; gap: .4rem; }
.sp-diff-btn {
  background: var(--bg3);
  border: 1px solid #ffffff15;
  border-radius: 8px;
  color: #8892a4;
  font-size: .8rem;
  font-weight: 600;
  padding: .35rem .8rem;
  cursor: pointer;
  transition: all .15s;
  flex: 1;
  text-align: center;
}
.sp-diff-btn:hover { background: #2a2f44; color: #ccd0da; }
.sp-diff-btn.active {
  background: #00d4ff20;
  border-color: var(--accent);
  color: var(--accent);
}
.sp-generate-btn { margin-top: .5rem; width: 100%; }

/* Progress stats */
.sp-progress-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.sp-prog-stat { text-align: center; }
.sp-prog-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: #e8eaf0;
}
.sp-prog-label {
  font-size: .7rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: .15rem;
}

/* Responsive */
@media (max-width: 768px) {
  .sp-layout { grid-template-columns: 1fr; }
}
@media (min-width: 769px) and (max-width: 1024px) {
  .sp-layout { grid-template-columns: 1fr 1fr; }
  .sp-progress-card { grid-column: span 2; }
}

/* ─── Recording Studio ─── */
.rec-studio {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ffffff10;
}

.rec-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.rec-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .75rem 1.25rem;
  border: 2px solid #ffffff15;
  border-radius: var(--radius);
  background: var(--bg3);
  color: #e8eaf0;
  cursor: pointer;
  transition: all .2s;
  font-size: .85rem;
  min-width: 70px;
}
.rec-btn:hover:not(:disabled) { background: #2a2e45; border-color: #ffffff25; transform: translateY(-1px); }
.rec-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rec-btn-icon { font-size: 1.5rem; line-height: 1; }
.rec-btn-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #8892a4; }

/* Record button — big red */
.rec-btn-record { border-color: #ef444440; }
.rec-btn-record .rec-btn-icon { color: #ef4444; }
.rec-btn-record:hover:not(:disabled) { background: #ef444420; border-color: #ef444480; }
.rec-btn-record.rec-active {
  background: #ef444430;
  border-color: #ef4444;
  animation: rec-pulse 1.2s ease-in-out infinite;
}
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

/* Stop button */
.rec-btn-stop .rec-btn-icon { color: #f59e0b; }
.rec-btn-stop:hover:not(:disabled) { background: #f59e0b20; border-color: #f59e0b80; }

/* Play button */
.rec-btn-play .rec-btn-icon { color: var(--green); }
.rec-btn-play:hover:not(:disabled) { background: #22c55e20; border-color: #22c55e80; }

/* Timer */
.rec-timer {
  font-family: 'Courier New', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 80px;
  text-align: center;
  padding: 0 .5rem;
}

/* BPM input */
.rec-bpm-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
}
.rec-bpm-label {
  font-size: .8rem;
  color: #8892a4;
  font-weight: 600;
}
.rec-bpm-input {
  width: 70px;
  padding: .4rem .6rem;
  background: var(--bg3);
  border: 1px solid #ffffff20;
  border-radius: 6px;
  color: #e8eaf0;
  font-size: .9rem;
  text-align: center;
}
.rec-bpm-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Recording indicator */
.rec-indicator {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: #ef4444;
  font-size: .9rem;
  font-weight: 600;
  padding: .5rem 0;
}
.rec-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  animation: rec-dot-blink 1s ease-in-out infinite;
}
@keyframes rec-dot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* Post-recording panel */
.rec-post {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  border: 1px solid #ffffff10;
}
.rec-post-info {
  font-size: .9rem;
  color: #8892a4;
  margin-bottom: .75rem;
}
.rec-post-info span {
  color: var(--accent);
  font-weight: 600;
}
.rec-post-actions {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
}
.rec-save-input {
  flex: 1;
  min-width: 150px;
  padding: .5rem .75rem;
  background: var(--bg2);
  border: 1px solid #ffffff15;
  border-radius: 8px;
  color: #e8eaf0;
  font-size: .85rem;
}
.rec-save-input:focus { outline: none; border-color: var(--accent); }
.rec-save-btn, .rec-export-btn, .rec-clear-btn {
  white-space: nowrap;
  font-size: .82rem;
  padding: .5rem 1rem;
}

/* Recordings list */
.rec-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  margin-bottom: .75rem;
}
.rec-list-header h3 {
  font-size: 1rem;
  margin: 0;
}
.rec-list-count {
  font-size: .8rem;
  color: #8892a4;
}
.rec-list-empty {
  text-align: center;
  color: #555b70;
  padding: 2rem;
  font-size: .9rem;
}
.rec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  background: var(--bg3);
  border-radius: 8px;
  margin-bottom: .5rem;
  border: 1px solid #ffffff08;
  transition: border-color .2s;
}
.rec-item:hover { border-color: #ffffff18; }
.rec-item-info { flex: 1; min-width: 0; }
.rec-item-title {
  font-weight: 600;
  font-size: .9rem;
  color: #e8eaf0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rec-item-meta {
  font-size: .75rem;
  color: #8892a4;
  margin-top: .15rem;
}
.rec-item-actions {
  display: flex;
  gap: .5rem;
  flex-shrink: 0;
  margin-left: .75rem;
}
.rec-item-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #ffffff15;
  background: var(--bg2);
  color: #e8eaf0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  transition: all .15s;
}
.rec-item-btn:hover { background: #2a2e45; border-color: #ffffff25; }
.rec-item-play:hover { color: var(--green); border-color: #22c55e60; }
.rec-item-delete:hover { color: var(--red); border-color: #ef444460; }

@media (max-width: 640px) {
  .rec-controls { gap: .5rem; }
  .rec-btn { padding: .5rem .75rem; min-width: 56px; }
  .rec-btn-icon { font-size: 1.2rem; }
  .rec-timer { font-size: 1.2rem; }
  .rec-post-actions { flex-direction: column; }
  .rec-save-input { min-width: 100%; }
  .rec-bpm-wrap { margin-left: 0; }
}

/* ─── Skill Assessment ──────────────────────────────────────────────── */
#assessment-container {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0a0e27 0%, #1a1040 50%, #0a0e27 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}
#assessment-container.hidden { display: none; }

.assess-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 1rem;
  padding: 2rem;
  max-width: 540px;
  width: 100%;
  animation: fadeUp .4s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.assess-progress {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.assess-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #00d4ff, #7dff7d);
  border-radius: 2px;
  transition: width .4s ease;
}

.assess-stage {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #00d4ff;
  margin-bottom: .5rem;
}

.assess-question {
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.assess-options {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.assess-option {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: .6rem;
  padding: .9rem 1.2rem;
  color: #e8eaf0;
  font-size: .95rem;
  text-align: left;
  cursor: pointer;
  transition: all .2s;
}
.assess-option:hover {
  background: rgba(0,212,255,0.15);
  border-color: #00d4ff;
  color: #fff;
}

.assess-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.assess-back {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: #aab;
  padding: .5rem 1rem;
  border-radius: .4rem;
  cursor: pointer;
  font-size: .85rem;
}
.assess-back:hover { color: #fff; border-color: rgba(255,255,255,0.4); }

.assess-count {
  color: #667;
  font-size: .8rem;
}

/* Result screen */
.assess-result h2 {
  color: #fff;
  text-align: center;
  margin-bottom: 1rem;
}
.assess-result h3 {
  color: #7dff7d;
  margin: 1.5rem 0 .75rem;
  font-size: 1rem;
}

.assess-level-badge {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  padding: .75rem;
  border-radius: .6rem;
  background: linear-gradient(135deg, rgba(0,212,255,0.2), rgba(125,255,125,0.2));
  border: 1px solid rgba(0,212,255,0.3);
  color: #00d4ff;
  margin-bottom: 1rem;
}

.assess-desc {
  color: #aab;
  text-align: center;
  line-height: 1.5;
}

.assess-path {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.assess-path-item {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .6rem;
  background: rgba(255,255,255,0.04);
  border-radius: .5rem;
}
.assess-path-num {
  min-width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,212,255,0.2);
  color: #00d4ff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.assess-path-item strong { color: #e8eaf0; font-size: .9rem; }
.assess-path-item p { color: #889; font-size: .8rem; margin: .2rem 0 0; }

.assess-start-btn {
  width: 100%;
  margin-top: 1.5rem;
  padding: .9rem;
  font-size: 1.1rem;
  border-radius: .6rem;
  background: linear-gradient(135deg, #00d4ff, #0088cc);
  border: none;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s;
}
.assess-start-btn:hover { transform: scale(1.02); }

/* Cloud sync indicator */
.sync-indicator {
  font-size: .7rem;
  color: #667;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.sync-indicator.synced { color: #7dff7d; }
.sync-indicator.syncing { color: #00d4ff; }

/* ─── Assessment: Level Picker ──────────────────────────────────────── */
.assess-levels { display:flex; flex-direction:column; gap:.6rem; }
.assess-level-btn {
  display:flex; gap:.75rem; align-items:center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: .6rem;
  padding: .8rem 1rem;
  color: #e8eaf0;
  text-align:left;
  cursor:pointer;
  transition: all .2s;
}
.assess-level-btn:hover { background: rgba(0,212,255,0.12); border-color: #00d4ff; }
.assess-level-btn.suggested { border-color: rgba(0,212,255,0.5); background: rgba(0,212,255,0.08); }
.assess-level-icon { font-size:1.6rem; }
.assess-level-btn strong { display:block; font-size:.95rem; }
.assess-level-btn p { color:#889; font-size:.8rem; margin:.2rem 0 0; }
.assess-rec {
  font-size:.65rem; text-transform:uppercase; letter-spacing:.08em;
  background:rgba(0,212,255,0.2); color:#00d4ff;
  padding:.15rem .4rem; border-radius:.25rem; margin-left:.4rem;
}
.assess-skip {
  background:none; border:none; color:#667; font-size:.85rem; cursor:pointer;
}
.assess-skip:hover { color:#aab; }

/* ─── Assessment: Play Test ─────────────────────────────────────────── */
.play-test-notes {
  display:flex; justify-content:center; gap:.6rem;
  margin-bottom:1.2rem;
}
.play-test-note {
  width:50px; height:50px;
  display:flex; align-items:center; justify-content:center;
  border-radius:50%;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.15);
  transition: all .3s;
}
.play-test-note.active {
  border-color: #00d4ff;
  background: rgba(0,212,255,0.15);
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(0,212,255,0.3);
}
.play-test-note.done {
  border-color: #7dff7d;
  background: rgba(125,255,125,0.15);
}
.play-test-note.done .play-test-key::after { content: ' ✓'; color:#7dff7d; }
.play-test-key { font-weight:700; font-size:1rem; color:#e8eaf0; }
.play-test-status {
  text-align:center; color:#aab; font-size:.9rem; margin-bottom:1.2rem; min-height:1.4em;
}

/* Mini keyboard for play test */
.play-test-keyboard {
  display:flex; justify-content:center; gap:2px;
  margin: 0 auto 1rem; max-width:400px;
  position:relative; height:100px;
}
.pt-key {
  display:flex; align-items:flex-end; justify-content:center;
  padding-bottom:6px;
  cursor:pointer;
  border-radius: 0 0 4px 4px;
  transition: all .15s;
  user-select:none;
}
.pt-white {
  width:36px; height:100px;
  background: linear-gradient(180deg, #e8e8e8 0%, #fff 30%);
  border: 1px solid #999;
  color:#333; font-size:.7rem;
  z-index:1;
}
.pt-white:hover { background: #ddf8ff; }
.pt-white:active { background: #b0e8ff; }
.pt-black {
  width:24px; height:65px;
  background: linear-gradient(180deg, #222 0%, #444 100%);
  border: 1px solid #111;
  color:#aaa; font-size:.6rem;
  margin: 0 -12px;
  z-index:2;
}
.pt-black:hover { background: #335; }
.pt-black:active { background: #446; }
.pt-target {
  box-shadow: 0 0 15px rgba(0,212,255,0.6);
}
.pt-white.pt-target { background: linear-gradient(180deg, #b0e8ff 0%, #ddf8ff 30%) !important; border-color:#00d4ff; }
.pt-black.pt-target { background: linear-gradient(180deg, #003355 0%, #005588 100%) !important; border-color:#00d4ff; }

/* ─── Combo System ──────────────────────────────────────────────────── */
.combo-display {
  position:absolute; top:4px; right:12px;
  display:flex; align-items:center; gap:.4rem;
  pointer-events:none; z-index:10;
}
.combo-count {
  font-size:1.4rem; font-weight:800;
  color:#f59e0b;
  text-shadow: 0 0 10px rgba(245,158,11,0.5);
  transition: all .15s;
}
.combo-count.x2 { color:#f59e0b; }
.combo-count.x3 { color:#fb923c; }
.combo-count.x4 { color:#ef4444; font-size:1.6rem; }
.combo-count.x5 { color:#ec4899; font-size:1.8rem; text-shadow: 0 0 15px rgba(236,72,153,0.6); }
.combo-label { font-size:.7rem; color:#889; text-transform:uppercase; letter-spacing:.05em; }
.combo-mult { font-size:.85rem; font-weight:700; color:#f59e0b; }

/* ─── Timing Indicator ──────────────────────────────────────────────── */
.timing-flash {
  position:fixed; top:50%; left:50%; transform:translate(-50%,-50%);
  font-size:1rem; font-weight:700;
  pointer-events:none; z-index:100;
  opacity:0; transition: opacity .15s;
}
.timing-flash.show { opacity:1; }
.timing-flash.early { color:#f59e0b; }
.timing-flash.late  { color:#ef4444; }
.timing-flash.perfect { color:#7dff7d; }

/* Timing heatmap in completion overlay */
.timing-heatmap {
  display:flex; gap:1px; height:24px; margin:.75rem 0;
  border-radius:4px; overflow:hidden;
}
.timing-bar {
  flex:1; min-width:2px;
  transition: background .2s;
}

/* ─── Unlock Badges ─────────────────────────────────────────────────── */
.unlock-toast {
  position:fixed; top:80px; left:50%; transform:translateX(-50%);
  background: linear-gradient(135deg, rgba(125,255,125,0.15), rgba(0,212,255,0.15));
  border: 1px solid rgba(125,255,125,0.3);
  border-radius: .6rem;
  padding: .6rem 1.2rem;
  color: #7dff7d;
  font-weight:600;
  z-index:200;
  animation: slideDown .4s ease, fadeOut .4s ease 2.5s forwards;
  pointer-events:none;
}
@keyframes slideDown {
  from { opacity:0; transform:translateX(-50%) translateY(-20px); }
  to   { opacity:1; transform:translateX(-50%) translateY(0); }
}
@keyframes fadeOut {
  to { opacity:0; transform:translateX(-50%) translateY(-10px); }
}

/* ─── Weakness Summary in Completion Overlay ─── */
.ov-weakness {
  margin: .5rem 0; display: flex; flex-direction: column; gap: .35rem;
}
.ov-weak-msg {
  font-size: .82rem; padding: .4rem .75rem; border-radius: 8px;
  background: #ffffff08; color: #a8b2c4; text-align: center;
}
.ov-weak-high { background: #ef444418; color: #fca5a5; border: 1px solid #ef444430; }
.ov-weak-med  { background: #f59e0b15; color: #fcd34d; border: 1px solid #f59e0b25; }
.ov-drill-suggest {
  margin: .5rem 0; text-align: center;
}
.ov-drill-btn {
  display: inline-block; padding: .5rem 1.2rem; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 700; font-size: .85rem;
  border: none; cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.ov-drill-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,212,255,0.3); }
.ov-drill-reason {
  font-size: .72rem; color: #6b7280; margin-top: .3rem;
}

/* ─── Guided Chord Stack ─── */
.gn-chord-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .6rem .8rem;
  background: var(--bg3);
  border: 2px solid #ffffff15;
  border-radius: var(--radius);
  min-width: 56px;
  transition: border-color .2s, background .2s;
}
.gn-chord-stack.active {
  border-color: var(--accent);
  background: rgba(0,212,255,0.08);
}
.gn-chord-stack.done {
  border-color: var(--green);
  background: rgba(34,197,94,0.08);
}
.gn-stack-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #8892a4;
  margin-bottom: .15rem;
}
.gn-stack-note {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg2);
  border: 1px solid #ffffff18;
  font-size: .82rem;
  font-weight: 700;
  color: #ccd0da;
  transition: all .2s;
}
.gn-stack-note.hit {
  background: rgba(34,197,94,0.25);
  border-color: var(--green);
  color: #7dff7d;
}
