:root {
  --bg: #0a0b17;
  --panel: #13142a;
  --panel-2: #1c1d38;
  --line: #2d2e52;
  --text: #eceaf6;
  --muted: #a19fc0;
  --accent: #f4f1ff;
  --left: #a78bfa;
  --right: #ff8f4f;
  --loop: #2fd9c0;
  --radius: 7px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

#toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.group.right { margin-left: auto; }

button, .btn, select {
  appearance: none;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
button:hover, .btn:hover, select:hover { border-color: #4a4b7a; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 600; }
button.on { background: #0f302c; border-color: var(--loop); color: var(--loop); }
select { max-width: 260px; text-overflow: ellipsis; }

#play { min-width: 40px; justify-content: center; }

.readout {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 118px;
}
.readout.dim { color: var(--muted); min-width: 0; }

.slider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.slider input { width: 110px; accent-color: var(--accent); }
.slider output { color: var(--text); font-variant-numeric: tabular-nums; min-width: 38px; }

.lbl { color: var(--muted); }
.lbl.hand-l::before, .lbl.hand-r::before {
  content: "";
  display: inline-block;
  width: 9px; height: 9px;
  margin-right: 5px;
  border-radius: 2px;
  vertical-align: -1px;
}
.lbl.hand-l::before { background: var(--left); }
.lbl.hand-r::before { background: var(--right); }

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.seg button {
  border: 0;
  border-radius: 0;
  height: 26px;
  padding: 0 9px;
  background: var(--panel-2);
  color: var(--muted);
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-checked="true"] { background: #36376a; color: var(--text); }

#connectBtn.connected { color: var(--loop); border-color: #1d6b60; }
.connect { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 320px;
  display: flex; flex-direction: column; gap: 6px; padding: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.menu[hidden] { display: none; }
.menu .menu-title { margin: 0 0 2px; color: var(--muted); font-size: 12px; }
.menu > button {
  display: grid; justify-items: start; gap: 2px; height: auto; padding: 8px 10px; white-space: normal; text-align: left;
}
.menu > button span { color: var(--muted); font-size: 12px; }
.menu > button.on { border-color: #2c9c8c; background: #0f302c; }
.menu > button:disabled { opacity: .55; cursor: default; }
.menu-live { display: grid; gap: 8px; padding: 8px 2px 2px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.menu-live[hidden] { display: none; }
.menu-live select { max-width: 220px; }
.menu-live .meter { height: 8px; border-radius: 4px; background: #07080f; border: 1px solid var(--line); overflow: hidden; }
.menu-live .meter div { height: 100%; width: 0; background: linear-gradient(90deg, #7d5fe8, #2fd9c0 60%, #ff8f4f); }
.menu-live .small { margin: 0; }
.menu-live .small b { color: #9be3ad; font-size: 15px; }
.menu-live .slider input { width: 140px; }

#stage {
  display: flex;
  min-height: 0;
}
#board {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#view.dragging { cursor: grabbing; }

#waitBadge, #toast {
  z-index: 2;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(14, 15, 32, .88);
  border: 1px solid var(--line);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
#waitBadge { top: 14px; color: var(--loop); border-color: #1d6b60; }
#waitBadge.score { color: #9be3ad; border-color: #3f7a4c; }
#toast { top: 54px; color: var(--text); }

#overview {
  height: 72px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
#mini { width: 100%; height: 100%; display: block; cursor: pointer; touch-action: none; }
#overview { position: relative; }
#score { width: 100%; height: 100%; display: none; cursor: pointer; }
body.score-on #overview { height: 196px; }
body.score-on #mini { display: none; }
body.score-on #score { display: block; }
#scoreToggle {
  position: absolute; right: 8px; bottom: 6px; height: 24px; padding: 0 8px; font-size: 12px; opacity: .85;
  background: rgba(19,20,42,.85);
}
#scoreToggle:hover { opacity: 1; }

dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  padding: 18px 20px;
  min-width: 320px;
}
dialog::backdrop { background: rgba(4, 4, 14, .6); }
dialog h2 { margin: 0 0 12px; font-size: 16px; }
dialog label { display: block; margin: 9px 0; }
dialog small { color: var(--muted); margin-left: 24px; }
dialog menu { display: flex; justify-content: flex-end; margin: 16px 0 0; padding: 0; }
dialog table { border-collapse: collapse; }
dialog td { padding: 4px 14px 4px 0; vertical-align: top; }
/* credits & licences */
.credits-link { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
button.link { height: auto; padding: 0; border: 0; background: none; color: #b8a3ff; text-decoration: underline; font-size: inherit; }
#credits { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
#creditsBody { font-size: 13px; }
#creditsBody h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--loop); }
#creditsBody .note { color: var(--muted); margin: 0 0 8px; }
#creditsBody td { padding: 3px 14px 3px 0; }
#creditsBody .what { color: var(--muted); white-space: nowrap; }
#creditsBody td:last-child { white-space: nowrap; padding-right: 0; }
#creditsBody a { color: #b8a3ff; }
/* song library */
#library { width: min(1180px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; }
#library form { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.lib-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.lib-head h2 { margin: 0; }
.lib-head input {
  flex: 1; max-width: 320px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); color: var(--text); font: inherit;
}
.lib-head button { margin-left: auto; }
#libraryList {
  overflow: auto;
  padding: 14px 18px 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  align-items: start;
}
#libraryList section { display: flex; flex-direction: column; gap: 6px; }
#libraryList section[hidden], .song-card[hidden] { display: none; }
#libraryList h3 {
  margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
}
#libraryList section[data-level="First steps"] h3 { color: #b8a3ff; }
#libraryList section[data-level="Game music"] h3 { color: #2fd9c0; }
#libraryList section[data-level="Film & TV music"] h3 { color: #ffb86b; }
#libraryList section[data-level^="My "] h3 { color: #ff8fb8; }
#libraryList section[data-level^="⌨"] h3 { color: #7ee2ff; }
.song-card { position: relative; }
.song-card .forget {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; padding: 0; line-height: 20px;
  border-radius: 50%; font-size: 12px; opacity: 0; color: var(--muted);
}
.song-card:hover .forget, .song-card:focus-within .forget { opacity: 1; }
/* opening a MIDI file */
#midiImport { width: min(640px, calc(100vw - 32px)); }
#midiImport input[type=text] {
  width: 100%; height: 30px; margin-top: 4px; padding: 0 10px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); color: var(--text); font: inherit;
}
#midiImport select { margin-left: 6px; }
.mi-help { color: var(--muted); font-size: 13px; margin: 10px 0 6px; }
#miParts { width: 100%; font-size: 13px; }
#miParts td { padding: 5px 10px 5px 0; vertical-align: middle; }
#miParts .drums { color: var(--muted); }
#miParts .seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
#miParts .seg button { border: 0; border-radius: 0; padding: 3px 9px; background: var(--panel-2); }
#miParts .seg button.on[data-h=R] { background: var(--right); color: #1d0c02; }
#miParts .seg button.on[data-h=L] { background: var(--left); color: #120a2a; }
#miParts .seg button.on[data-h=off] { background: var(--line); color: var(--text); }
#libraryList section[data-level="Easy"] h3 { color: #8fd05a; }
#libraryList section[data-level="Medium"] h3 { color: #e8c547; }
#libraryList section[data-level="Hard"] h3 { color: #f08a4b; }
#libraryList section[data-level="Very hard"] h3 { color: #f0605d; }
.song-card {
  display: grid; gap: 1px; justify-items: start;
  height: auto; padding: 7px 10px; text-align: left; white-space: normal;
}
.song-card .t { font-weight: 600; }
.song-card .c { color: var(--text); opacity: .85; font-size: 12px; }
.song-card .w { color: var(--muted); font-size: 11.5px; }
.song-card.current { border-color: var(--accent); background: #26274a; }

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--panel-2);
  font: 12px ui-monospace, monospace;
  text-align: center;
}

#errors {
  position: fixed;
  left: 12px; right: 12px; bottom: 72px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #3b1113;
  border: 1px solid #7a2a2e;
  color: #ffd7d9;
  font: 12px ui-monospace, monospace;
  white-space: pre-wrap;
  z-index: 10;
}

@media (max-width: 720px) {
  #toolbar { gap: 6px 10px; padding: 6px 8px; }
  .slider input { width: 80px; }
  .group.right { margin-left: 0; }
}

/* ---------- the beginner course */
button.learn { border-color: #5a47b0; color: #d6cbff; }
button.learn:hover { border-color: #7d68d8; }

#coach[hidden] { display: none; }
#coach {
  flex: 0 0 360px;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 16px 12px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  font-size: 14px; line-height: 1.45;
}
#coach header { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
#coach header span { flex: 1; }
#coach button.icon { height: 26px; padding: 0 8px; }
#coach h2 { margin: 0; font-size: 18px; line-height: 1.25; }
#coach h3 { margin: 0 0 6px; font-size: 15px; color: #ddd4ff; }
#coach p { margin: 0 0 8px; }
#coach .dots { display: flex; flex-wrap: wrap; gap: 5px; }
#coach .dot {
  width: 28px; height: 28px; padding: 0; justify-content: center; border-radius: 50%;
  font-size: 12px; color: var(--muted);
}
#coach .dot.done { background: #1f3b26; border-color: #3f7a4c; color: #9be3ad; }
#coach .dot.current { border-color: var(--loop); color: var(--text); box-shadow: 0 0 0 2px rgba(47,217,192,.25); }
#coach .step { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
#coach .task { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
#coach .meta { color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
#coach .status { margin: 0; }
#coach .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
#coach .chip {
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); font-weight: 600; font-size: 13px;
  color: var(--muted);
}
#coach .chip.now { border-color: var(--loop); color: var(--loop); }
#coach .chip.ok { border-color: #3f7a4c; color: #9be3ad; background: #1a2e20; }
#coach .complete { margin: 10px 0 0; color: #9be3ad; }
#coach .actions { display: flex; gap: 8px; }
#coach .actions button { flex: 1; justify-content: center; height: 36px; font-size: 14px; }
#coach .actions button.ready { background: #2b6d3d; border-color: #4aa564; color: #fff; font-weight: 600; }
#coach .actions button:disabled { opacity: .4; cursor: default; }
#coach footer.hear {
  margin-top: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  color: var(--muted); font-size: 12.5px; padding-top: 8px; border-top: 1px solid var(--line);
}
#coach footer .heard { color: #9be3ad; font-weight: 600; }
#coach button.link {
  height: auto; padding: 0; border: 0; background: none; color: #b8a3ff; text-decoration: underline; margin-left: auto;
}
#coach .setup { display: flex; flex-direction: column; gap: 8px; }
#coach .choice {
  display: grid; justify-items: start; gap: 2px; height: auto; padding: 9px 12px; text-align: left; white-space: normal;
}
#coach .choice span { color: var(--muted); font-size: 12.5px; }
#coach .choice.on { border-color: #4aa564; background: #1a2e20; }
#coach .micbox { padding: 4px 2px 6px; display: grid; gap: 8px; }
#coach .micbox select { max-width: 100%; }
#coach .meter { height: 8px; border-radius: 4px; background: #07080f; border: 1px solid var(--line); overflow: hidden; }
#coach .meter div { height: 100%; width: 0; background: linear-gradient(90deg, #7d5fe8, #2fd9c0 60%, #ff8f4f); }
#coach .small { font-size: 12.5px; color: var(--muted); margin: 0; }
#coach .small b { color: #9be3ad; font-size: 15px; }

/* ---------- the course home */
#course, #progress { width: min(1040px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; }
#course[open], #progress[open] { display: flex; flex-direction: column; }
#courseList, #progressBody { overflow: auto; padding: 12px 18px 20px; }
.home-top { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; margin-bottom: 10px; }
.home-top .lvl { display: flex; gap: 10px; align-items: center; }
.home-top small { color: var(--muted); }
.home-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.home-actions button { height: auto; min-height: 38px; font-size: 14px; }
.home-actions button.big { flex-direction: column; align-items: flex-start; padding: 6px 14px; font-size: 15px; }
.home-actions button.big small { font-weight: 400; opacity: .75; font-size: 12px; }
#courseList p.how { color: var(--muted); font-size: 13px; margin: 10px 0 4px; max-width: 760px; }
.week { margin-top: 14px; }
.week h3 { margin: 0; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: #b8a3ff; }
.week p { margin: 2px 0 8px; color: var(--muted); font-size: 12.5px; }
.daytiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.daytile {
  display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: start;
  height: auto; padding: 8px 9px; text-align: left; white-space: normal; border-radius: 10px;
}
.daytile .n {
  grid-row: 1 / 3; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); font-weight: 700; font-size: 12.5px;
}
.daytile .t { font-weight: 600; font-size: 13px; line-height: 1.25; }
.daytile .p { grid-column: 2; color: var(--muted); font-size: 11.5px; }
.daytile.current { border-color: var(--loop); box-shadow: 0 0 0 2px rgba(47,217,192,.2); }
.daytile.current .n { border-color: var(--loop); color: var(--loop); }
.daytile.started .n { border-color: #7d68d8; color: #b8a3ff; }
.daytile.done .n { background: #1f3b26; border-color: #3f7a4c; color: #9be3ad; }
.daytile.gold .n { background: #3b3212; border-color: #ffd24a; color: #ffd24a; }
#dayDetail {
  position: sticky; bottom: -20px; margin: 16px -18px -20px; padding: 14px 18px 18px;
  background: var(--panel-2); border-top: 1px solid var(--line); box-shadow: 0 -12px 30px rgba(0,0,0,.35);
  max-height: 55vh; overflow: auto;
}
#dayDetail[hidden] { display: none; }
#dayDetail .dd-head { display: flex; gap: 10px; align-items: flex-start; }
#dayDetail .dd-head > div { flex: 1; }
#dayDetail h3 { margin: 0; font-size: 17px; }
#dayDetail h4 { margin: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #b8a3ff; }
#dayDetail p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
#dayDetail .dd-actions { display: flex; gap: 8px; margin-top: 10px; }
#dayDetail ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
#dayDetail li { display: flex; gap: 10px; align-items: center; font-size: 13.5px; padding: 2px 0; }
#dayDetail li > span:nth-child(2) { flex: 1; }
#dayDetail li small { color: var(--muted); }
#dayDetail li .st { width: 42px; text-align: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#dayDetail li.ok .st { color: #9be3ad; font-weight: 700; }
#dayDetail li.rv { color: var(--muted); font-style: italic; }
#dayDetail li button { height: 24px; font-size: 12px; }

svg.ring .track { fill: none; stroke: var(--line); stroke-width: 6; }
svg.ring .fill { fill: none; stroke: var(--loop); stroke-width: 6; stroke-linecap: round; }
svg.ring .t1 { fill: var(--text); font-size: 15px; font-weight: 800; text-anchor: middle; }
svg.ring .t2 { fill: var(--muted); font-size: 8.5px; text-anchor: middle; }

@media (max-width: 900px) {
  #stage { flex-direction: column; }
  #coach { flex: 0 0 auto; max-height: 48%; border-left: 0; border-top: 1px solid var(--line); }
}

#coach .step.speaking { border-color: #7d68d8; box-shadow: 0 0 0 3px rgba(125,104,216,.2); }
#coach .bubble {
  position: relative; padding: 10px 12px; border-radius: 12px; background: #1f1c3d; border: 1px solid #4b3fa0;
  color: #efeaff; font-size: 14.5px;
}
#coach .bubble.speaking { border-color: #b8a3ff; box-shadow: 0 0 0 3px rgba(184,163,255,.16); }
#coach .complete { padding: 10px 12px; border-radius: 12px; background: #1a2e20; border: 1px solid #3f7a4c; color: #c9f2d3; }
#coach button.link.slower { align-self: center; margin: 0; font-size: 13px; }
#coach .voicepick { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
#coach .slider { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
#coach .slider input { flex: 1; }

/* ---------- results card */
.results {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 5;
  width: min(380px, calc(100% - 32px)); padding: 18px 20px; text-align: center;
  background: rgba(19,20,42,.97); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.results[hidden] { display: none; }
.results .stars { font-size: 40px; letter-spacing: 4px; color: #ffd24a; line-height: 1.1; }
.results .stars.s0 { color: #5f5f82; }
.results .points { font-size: 34px; font-weight: 800; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.results .best { color: #9be3ad; font-weight: 700; }
.results .prev { color: var(--muted); }
.results .grid { display: grid; gap: 5px; margin: 14px 0; text-align: left; font-size: 13.5px; }
.results .grid div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.results .grid span { color: var(--muted); }
.results .actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.song-card .stars, .lesson-card .stars { color: #ffd24a; font-size: 12px; letter-spacing: 1px; }
#coach .dot.star3 { background: #3b3212; border-color: #ffd24a; color: #ffd24a; }
.course-intro .streak { color: #ff9d5c; font-weight: 600; }

/* ---------- the coach: days, mastery, help */
#coach header .goal svg { width: 30px; height: 30px; display: block; }
#coach header .goal .t2 { display: none; }
#coach header .goal .t1 { font-size: 20px; }
#coach .dots { gap: 4px 8px; }
#coach .dots .sec { display: inline-flex; flex-wrap: wrap; gap: 3px; align-items: center; }
#coach .dots .sec i { font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); width: 100%; }
#coach .dot { width: 18px; height: 18px; font-size: 10px; }
#coach .step.won { border-color: #4aa564; box-shadow: 0 0 0 3px rgba(74,165,100,.25); }
#coach .meter-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
#coach .meter-row .need { color: #ffd24a; font-weight: 600; }
#coach .mastery { height: 8px; border-radius: 4px; background: #07080f; border: 1px solid var(--line); overflow: hidden; margin: 4px 0 2px; }
#coach .mastery i { display: block; height: 100%; background: linear-gradient(90deg, #7d5fe8, #2fd9c0); transition: width .4s; }
#coach .helping { margin: 6px 0 0; font-size: 12.5px; color: #ffd8a8; }
#coach .prompt { font-size: 40px; font-weight: 800; text-align: center; margin: 6px 0 10px; color: #fff; }
#coach .prompt small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
#coach .chip.bad { border-color: #7a2a2e; color: #ffb4b8; background: #3b1113; }
#coach .selfcheck { display: flex; gap: 6px; }
#coach .selfcheck button { flex: 1; justify-content: center; height: 36px; }
#coach .links { display: flex; gap: 14px; justify-content: center; }
#coach .links button.link { margin: 0; font-size: 12.5px; }
#coach .links button.link.offer { color: #ffd24a; font-weight: 700; }
#coach .actions.col { flex-direction: column; }
#coach .summary { text-align: center; display: grid; gap: 10px; }
#coach .summary .trophy { font-size: 46px; line-height: 1; }
#coach .summary h2 { font-size: 22px; }
#coach .summary .grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#coach .summary .grid div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 2px; display: grid; }
#coach .summary .grid b { font-size: 17px; }
#coach .summary .grid span { font-size: 11px; color: var(--muted); }
.lvlbar { display: grid; gap: 3px; font-size: 13px; }
.lvlbar .bar, .skill .bar { height: 10px; border-radius: 5px; background: #07080f; border: 1px solid var(--line); overflow: hidden; }
.lvlbar .bar i, .skill .bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff8f4f, #ffd24a); }
.lvlbar small { color: var(--muted); }
.newbadges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

/* ---------- your progress */
#progressBody h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #b8a3ff; }
#progressBody h3 small { text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 400; }
#progressBody .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
#progressBody .card { display: flex; gap: 12px; align-items: center; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; font-size: 13px; }
#progressBody .card span { color: var(--text); }
#progressBody .card small { color: var(--muted); }
#progressBody .card .big, .toast-card .big { font-size: 34px; line-height: 1; }
#progressBody .skills { display: grid; gap: 6px; }
.skill { display: grid; grid-template-columns: 170px 1fr 170px; gap: 10px; align-items: center; font-size: 13px; }
.skill .val { color: var(--muted); font-size: 12px; }
.skill .bar i { background: linear-gradient(90deg, #7d5fe8, #2fd9c0); }
#progressBody .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
svg.chart { width: 100%; height: 110px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
svg.chart rect { fill: #7d5fe8; }
svg.chart.line polyline { fill: none; stroke: #2fd9c0; stroke-width: 1; vector-effect: non-scaling-stroke; }
svg.chart.line circle { fill: #2fd9c0; }
svg.chart.line .target { stroke: #ffd24a; stroke-dasharray: 2 2; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .5; }
.coursemap { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; max-width: 560px; }
.coursemap .cell, .legend .cell { display: grid; place-items: center; height: 26px; border-radius: 6px; border: 1px solid var(--line);
  font-size: 11px; color: var(--muted); }
.cell.started { border-color: #7d68d8; color: #b8a3ff; }
.cell.done { background: #1f3b26; border-color: #3f7a4c; color: #9be3ad; }
.cell.gold { background: #3b3212; border-color: #ffd24a; color: #ffd24a; }
.legend { color: var(--muted); font-size: 12px; display: flex; gap: 8px; align-items: center; }
.legend .cell { display: inline-block; width: 16px; height: 14px; }
#progressBody .trouble { display: grid; gap: 6px; max-width: 720px; }
#progressBody .trouble .row { display: flex; gap: 10px; align-items: center; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; }
#progressBody .trouble .row > span { flex: 1; }
#progressBody .trouble small { color: var(--muted); }
#progressBody .muted { color: var(--muted); font-size: 13px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.badge { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); opacity: .55; filter: grayscale(1); }
.badge.got { opacity: 1; filter: none; color: var(--text); background: var(--panel-2); border-color: #5a47b0; }
.badge .icon { font-size: 20px; }
.goalpick { display: flex; gap: 6px; flex-wrap: wrap; }
.goalpick button.on { border-color: var(--loop); color: var(--loop); background: #0f302c; }
@media (max-width: 760px) {
  #progressBody .two { grid-template-columns: 1fr; }
  .skill { grid-template-columns: 120px 1fr; }
  .skill .val { grid-column: 2; }
}

/* ---------- celebrations */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
#toasts { position: fixed; left: 16px; top: 96px; z-index: 60; display: grid; gap: 8px; pointer-events: none; }
.toast-card {
  display: flex; gap: 12px; align-items: center; min-width: 240px; max-width: 340px; padding: 10px 14px; border-radius: 12px;
  background: rgba(28,29,56,.97); border: 1px solid #5a47b0; box-shadow: 0 12px 30px rgba(0,0,0,.45); font-size: 13px;
  animation: toastIn .35s ease-out; transition: opacity .5s, transform .5s;
}
.toast-card.out { opacity: 0; transform: translateX(-30px); }
.toast-card.level { border-color: #ffd24a; }
.toast-card.goal { border-color: var(--loop); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }

/* ---------- the welcome tour (welcome.js) ---------- */
#welcome {
  position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; min-width: 0; overflow: hidden;
}
#welcome::backdrop { background: transparent; }
.wl-screen {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: auto; padding: 24px 16px;
  background: radial-gradient(ellipse at 50% 0%, rgba(125, 95, 232, .22), transparent 60%), rgba(8, 9, 20, .94);
}
.wl-screen[hidden] { display: none; }
.wl-card {
  position: relative; width: min(720px, 100%); padding: 28px 30px 22px; font-size: 14.5px; line-height: 1.5;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}
.wl-card h1 { margin: 6px 0 4px; font-size: 30px; line-height: 1.15; letter-spacing: -.01em; }
.wl-card h2 { margin: 6px 0 4px; font-size: 22px; }
.wl-lead { margin: 0 0 16px; color: var(--muted); font-size: 15.5px; }
.wl-lead strong { color: var(--text); }
.wl-small { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.wl-card menu { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin: 22px 0 0; padding: 0; }
.wl-card menu button { height: 36px; padding: 0 16px; font-size: 14px; }
.wl-card menu button.link { height: auto; padding: 0; margin-right: auto; }

.wl-dots { display: flex; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.wl-dots li { flex: 1; padding-top: 7px; border-top: 3px solid var(--line); }
.wl-dots li.done { border-color: #5a47b0; }
.wl-dots li.on { border-color: var(--loop); color: var(--text); font-weight: 600; }

.wl-plan { margin: 0 0 18px; padding: 0; list-style: none; counter-reset: plan; display: grid; gap: 10px; }
.wl-plan li { counter-increment: plan; display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; }
.wl-plan li::before {
  content: counter(plan); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--loop); font-weight: 700; font-size: 13px;
}
.wl-voice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); }
.wl-voice span { margin-right: 4px; }

.wl-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.wl-choice, .wl-path {
  display: grid; grid-template-columns: 34px 1fr; column-gap: 8px; row-gap: 2px; align-content: start;
  height: auto; padding: 12px 14px; text-align: left; white-space: normal; border-radius: 10px; background: var(--panel-2);
}
.wl-choice .ic, .wl-path .ic { grid-row: span 3; font-size: 22px; line-height: 1.2; }
.wl-choice b, .wl-path b { font-size: 15px; }
.wl-choice span:not(.ic), .wl-path span:not(.ic) { color: var(--muted); font-size: 13px; line-height: 1.45; }
.wl-choice:hover:not([disabled]), .wl-path:hover { border-color: var(--loop); }
.wl-choice.on { border-color: var(--loop); background: #0f302c; }
.wl-choice[disabled] { opacity: .5; cursor: not-allowed; }

.wl-kb { display: block; width: min(420px, 100%); margin: 4px auto 14px; }
.wl-kb rect.w { fill: #f3ecde; stroke: #2d2e52; }
.wl-kb rect.b { fill: #1a1b33; stroke: #0a0b17; }
.wl-kb rect.target { fill: #bff5ec; stroke: var(--loop); stroke-width: 2; }
.wl-kb rect.lit { fill: var(--right); }
.wl-kb text { fill: var(--loop); font-size: 11px; font-weight: 600; }
.wl-kb text.key { fill: #5a47b0; font-size: 12px; font-weight: 800; }
.wl-choices .wl-choice:last-child:nth-child(odd) { grid-column: 1 / -1; }
.wl-lead kbd, .wl-tips kbd { font-size: 12px; }
.wl-live { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #0e0f22; }
.wl-live p { margin: 0; }
.wl-live-head { display: flex; gap: 10px; align-items: baseline; }
.wl-live label { display: flex; gap: 8px; align-items: center; }
.wl-live select { flex: 1; min-width: 0; }
.wl-live .meter { height: 8px; border-radius: 4px; background: #07080f; border: 1px solid var(--line); overflow: hidden; }
.wl-live .meter div { height: 100%; width: 0; background: linear-gradient(90deg, #7d5fe8, #2fd9c0 60%, #ff8f4f); }
.wl-live > button { justify-self: start; }
.wl-live #wlHeard { color: var(--right); font-size: 16px; }
.wl-ok { color: var(--loop); font-weight: 700; }
.wl-tips { margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: #2a2210; border: 1px solid #6b5520; }
.wl-tips ul { margin: 6px 0 0; padding-left: 18px; }
.wl-tips li { margin: 3px 0; }

.wl-paths { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 8px; }
.wl-path { padding: 16px; }
.wl-path b { font-size: 17px; }
.wl-path em { font-style: normal; color: var(--loop); font-size: 13px; font-weight: 600; margin-top: 6px; }
.wl-path:first-child { border-color: #5a47b0; }
.wl-goal { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 16px; color: var(--muted); }
.wl-goal span { margin-right: 6px; }

/* the look around: a spotlight on each part of the real screen, and what it's for */
.wl-spot {
  position: fixed; border: 2px solid var(--loop); border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 200vmax rgba(6, 7, 20, .72), 0 0 24px rgba(47, 217, 192, .35);
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease;
}
.wl-tip {
  position: fixed; padding: 14px 16px 12px; font-size: 14.5px; line-height: 1.5; background: var(--panel);
  border: 1px solid var(--loop); border-radius: 12px; box-shadow: 0 16px 50px rgba(0, 0, 0, .55);
}
.wl-tip p { margin: 0; }
.wl-tip menu { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin: 12px 0 0; padding: 0; }
.wl-tip .wl-count { margin-right: auto; color: var(--muted); font-size: 12px; }

/* the first screen: a few notes falling behind it */
.wl-rain { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.wl-screen:not(.wl-first) .wl-rain { display: none; }
.wl-rain i {
  position: absolute; top: -120px; width: 26px; height: 70px; border-radius: 13px; opacity: .16;
  background: var(--right); animation: wl-fall 9s linear infinite;
}
.wl-rain i:nth-child(even) { background: var(--left); height: 110px; }
.wl-rain i:nth-child(1) { left: 6%; animation-delay: -1s; }   .wl-rain i:nth-child(2) { left: 14%; animation-delay: -6s; }
.wl-rain i:nth-child(3) { left: 23%; animation-delay: -3s; }   .wl-rain i:nth-child(4) { left: 31%; animation-delay: -8s; }
.wl-rain i:nth-child(5) { left: 44%; animation-delay: -5s; }   .wl-rain i:nth-child(6) { left: 57%; animation-delay: -2s; }
.wl-rain i:nth-child(7) { left: 66%; animation-delay: -7s; }   .wl-rain i:nth-child(8) { left: 75%; animation-delay: -4s; }
.wl-rain i:nth-child(9) { left: 84%; animation-delay: -9s; }   .wl-rain i:nth-child(10) { left: 92%; animation-delay: -0.5s; }
@keyframes wl-fall { to { transform: translateY(calc(100vh + 240px)); } }
@media (prefers-reduced-motion: reduce) { .wl-rain { display: none; } .wl-spot { transition: none; } }

@media (max-width: 640px) {
  .wl-card { padding: 20px 18px 16px; }
  .wl-card h1 { font-size: 24px; }
  .wl-choices, .wl-paths { grid-template-columns: 1fr; }
  .wl-dots li { font-size: 0; }
}
