:root {
  --ink: #2b2d42;
  --paper: #ffffff;
  --berry: #ef476f;
  --sun: #ffd166;
  --leaf: #06a77d;
  --mint: #06d6a0;
  --sea: #118ab2;
  --plum: #7b5cd6;
  --orange: #ff9f1c;
  --shadow: 0 6px 0 rgba(30, 32, 60, .18);
  --soft: 0 10px 30px rgba(30, 32, 60, .16);
  --r: 24px;
  /* land theme (overridden per land below) */
  --sky1: #7cc8f2; --sky2: #dff4ff;
  --hill1: #9bdc8a; --hill2: #6fc66b; --hill3: #4fae58;
  --accent: #06a77d; --on-sky: #2b2d42;
}
body[data-land="1"] { --sky1: #6fd3cf; --sky2: #e2fbf6; --hill1: #8fdcc6; --hill2: #55bfae; --hill3: #2f9e95; --accent: #118ab2; }
body[data-land="2"] { --sky1: #9edba6; --sky2: #eef9e2; --hill1: #6fbf73; --hill2: #3f9b57; --hill3: #2a7a45; --accent: #2d8a4e; }
body[data-land="3"] { --sky1: #ffc98a; --sky2: #fff1d6; --hill1: #f3b562; --hill2: #d99a3d; --hill3: #b4c25a; --accent: #e07a1f; }
body[data-land="4"] { --sky1: #a9b8ff; --sky2: #eef0ff; --hill1: #c3c9ee; --hill2: #8f97d6; --hill3: #6a6fb8; --accent: #6a5acd; }
body[data-land="5"] { --sky1: #1b2452; --sky2: #5a4a9c; --hill1: #3b3f7a; --hill2: #2c2f63; --hill3: #1f2149; --accent: #f29e00; --on-sky: #ffffff; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--sky2);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; padding: 0; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
.ico { width: 1.25em; height: 1.25em; vertical-align: -0.24em; flex: none; }

/* ---------- scenery ---------- */
.scenery { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: linear-gradient(180deg, var(--sky1), var(--sky2) 70%); transition: background .6s; }
.sun { position: absolute; top: 6%; right: 9%; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, #fff7c2 0 35%, #ffe07a 60%, rgba(255, 224, 122, 0) 72%); }
body[data-land="5"] .sun { background: radial-gradient(circle, #fffbe8 0 42%, rgba(255, 251, 232, .25) 60%, transparent 72%); }
.cloud { position: absolute; width: 180px; height: 54px; border-radius: 50px; background: rgba(255, 255, 255, .85); animation: drift 70s linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: inherit; border-radius: 50%; }
.cloud::before { width: 76px; height: 76px; left: 26px; top: -34px; }
.cloud::after { width: 58px; height: 58px; right: 30px; top: -22px; }
.c1 { top: 9%; left: -20%; }
.c2 { top: 24%; left: -20%; transform: scale(.7); animation-duration: 95s; animation-delay: -40s; opacity: .8; }
.c3 { top: 15%; left: -20%; transform: scale(1.2); animation-duration: 120s; animation-delay: -85s; opacity: .7; }
body[data-land="5"] .cloud { opacity: .12; }
.twinkles { position: absolute; inset: 0; opacity: 0; transition: opacity .6s; }
body[data-land="5"] .twinkles { opacity: 1; }
.twinkles i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #fff; animation: twinkle 3s ease-in-out infinite; }
.hills { position: absolute; left: 0; bottom: 0; width: 100%; height: 42%; }
.hill { transition: fill .6s; }
.h1 { fill: var(--hill1); } .h2 { fill: var(--hill2); } .h3 { fill: var(--hill3); }

/* clip: slide-in and press animations must never poke past the window and flash a scrollbar
   (that briefly narrows the page and makes everything jump); real long pages still scroll */
#app { position: relative; z-index: 1; min-height: 100%; display: flex; justify-content: center; overflow: hidden; overflow: clip; }
.screen {
  width: 100%; max-width: 1040px; min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  animation: screenIn .28s ease-out;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 62px; padding: 10px 26px; border-radius: 999px;
  background: var(--leaf); color: #fff; font-size: 21px; font-weight: 800;
  box-shadow: var(--shadow); transition: transform .08s, box-shadow .08s;
}
.btn.alt { background: var(--plum); }
.btn.alt2 { background: var(--orange); }
.btn.ghost { background: var(--paper); color: var(--ink); }
.btn.stop, .btn.danger { background: var(--berry); }
.btn.small { min-height: 48px; font-size: 17px; padding: 6px 18px; }
.btn.giant { min-height: 92px; padding: 14px 64px; font-size: 38px; background: var(--berry); animation: breathe 2.2s ease-in-out infinite; }
.btn:disabled { opacity: .45; }
.ibtn {
  width: 58px; height: 58px; border-radius: 50%; background: var(--paper); font-size: 26px; font-weight: 900;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow); flex: none;
}
.btn:active, .ibtn:active, .inst:active, .node:active, .chip:active, .song:active, .seg button:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(30, 32, 60, .18); }
.row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--paper); border-radius: 999px; padding: 8px 16px; font-weight: 800; box-shadow: var(--shadow); }
.pill .ico { color: #f6a800; }

.topbar { width: 100%; display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 12px; }
.topbar h2 { margin: 0; font-size: clamp(22px, 3.2vw, 32px); text-align: center; color: var(--on-sky); }
.topbar-right { min-width: 58px; display: flex; justify-content: flex-end; }
.tag { margin: 0; font-size: clamp(17px, 2.3vw, 22px); text-align: center; color: var(--on-sky); opacity: .9; font-weight: 600; }

.stars { display: inline-flex; gap: 2px; }
.star { color: rgba(43, 45, 66, .16); font-size: 22px; display: inline-flex; }
.star.on { color: #f6a800; }
.dots { display: flex; gap: 7px; align-items: center; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, .75); }
.dots i.done { background: var(--mint); }
.dots i.cur { background: var(--sun); box-shadow: 0 0 0 3px #fff; }

.buddy { flex: none; }
.buddy-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.buddy .eyes { animation: blink 4.5s infinite; transform-box: fill-box; transform-origin: center; }
.buddy.bounce { animation: bounce .28s ease-out; }
.talk { width: 100%; display: flex; align-items: center; gap: 14px; }
.talk .buddy { width: 96px; height: 96px; }
.bubble {
  position: relative; flex: 1; background: var(--paper); border-radius: 22px; padding: 14px 20px;
  font-size: clamp(18px, 2.4vw, 23px); font-weight: 700; line-height: 1.35; box-shadow: var(--soft);
}
.bubble::before { content: ""; position: absolute; left: -12px; top: 50%; margin-top: -11px; border: 11px solid transparent; border-right-color: var(--paper); border-left: 0; }
.status { min-height: 30px; font-size: clamp(18px, 2.4vw, 22px); font-weight: 800; text-align: center; color: var(--on-sky); }
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 50; max-width: 90vw;
  background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 18px; font-size: 18px; font-weight: 700;
  animation: toastIn 3.2s forwards; text-align: center;
}

/* ---------- notation ---------- */
svg.notation { display: block; color: var(--ink); overflow: visible; }
.notation .lab { font-size: 17px; font-weight: 800; fill: var(--sea); font-family: inherit; }
.notation .lab.sm { font-size: 13px; }
.notation .tick { fill: #cfd5e3; }
.notation .tick.down { fill: #8d96ad; }
.notation .barline { stroke: var(--ink); stroke-width: 2.2; opacity: .3; }
.notation .barline.thick { stroke-width: 5; opacity: .6; }
.notation .tail { fill: rgba(43, 45, 66, .1); }
.notation .tailfill { fill: var(--mint); }
.notation .n { transition: color .1s, opacity .15s; }
.notation .n.auto { color: var(--plum); }
.notation .n.lit { color: var(--berry); }
.notation .n.auto.lit { color: #b28cff; }
.notation .n.rest.lit { color: #9aa3b8; }
.notation .n.j-perfect { color: var(--leaf); }
.notation .n.j-good { color: #e09400; }
.notation .n.j-miss { color: var(--berry); opacity: .45; }
.notation .n.ghost { opacity: 0; }
.notation .n.short .tail { fill: rgba(239, 71, 111, .2); }

/* ---------- home ---------- */
.home { justify-content: center; gap: 18px; position: relative; }
.corner { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 18px; }
.logo { margin: 0; font-size: clamp(46px, 9vw, 92px); line-height: .95; text-align: center; letter-spacing: -1px; }
.logo span { display: inline-block; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink); }
.logo span:first-child { color: var(--sun); animation: wobble 3s ease-in-out infinite; }
.logo span:last-child { color: var(--mint); animation: wobble 3s ease-in-out -1.5s infinite; }
.inst-pick { display: flex; gap: 20px; }
.inst {
  width: clamp(140px, 24vw, 210px); padding: 14px 10px 12px; border-radius: 30px; background: rgba(255, 255, 255, .6);
  display: flex; flex-direction: column; align-items: center; box-shadow: var(--shadow); border: 5px solid transparent;
  transition: transform .15s, background .15s;
}
.inst .buddy-svg { height: clamp(96px, 16vw, 140px); width: auto; }
.inst b { font-size: 26px; }
.inst small { font-size: 17px; opacity: .75; font-weight: 700; }
.inst.on { background: var(--paper); border-color: var(--plum); transform: scale(1.06); }
.inst.on .buddy-svg { animation: bob 1.4s ease-in-out infinite; }
.total-stars { font-weight: 800; font-size: 19px; color: var(--ink); background: rgba(255, 255, 255, .7); padding: 8px 18px; border-radius: 999px; }
.total-stars .ico { color: #f6a800; }

/* ---------- map ---------- */
.map { gap: 18px; padding-bottom: 60px; }
.land { width: 100%; background: rgba(255, 255, 255, .88); border-radius: 30px; padding: 16px 18px 20px; box-shadow: var(--soft); border-top: 10px solid var(--accent); }
.land[data-land="0"] { --accent: #06a77d; } .land[data-land="1"] { --accent: #118ab2; } .land[data-land="2"] { --accent: #2d8a4e; }
.land[data-land="3"] { --accent: #e07a1f; } .land[data-land="4"] { --accent: #6a5acd; } .land[data-land="5"] { --accent: #35307a; }
.land.closed { opacity: .62; }
.land-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.land-num { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 28px; font-weight: 900; display: flex; align-items: center; justify-content: center; flex: none; }
.land-title { flex: 1; }
.land-title h3 { margin: 0; font-size: clamp(22px, 3vw, 30px); }
.land-title p { margin: 2px 0 0; font-size: 17px; opacity: .75; font-weight: 700; }
.land-cells { display: flex; gap: 6px; }
.mini-cell { display: inline-flex; flex-direction: column; align-items: center; background: #f3f5fb; border-radius: 14px; padding: 4px 6px; }
.mini-cell svg { height: 54px; width: auto; }
.mini-cell small { font-size: 13px; font-weight: 800; color: var(--sea); margin-top: -4px; }
.trail { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; position: relative; }
.trail::before { content: ""; position: absolute; left: 10%; right: 10%; top: 38px; border-top: 6px dotted rgba(43, 45, 66, .2); }
.node { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 2px; }
.node-disc {
  width: 76px; height: 76px; border-radius: 50%; background: var(--paper); border: 6px solid var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 36px; box-shadow: var(--shadow); transition: transform .1s;
}
.node:nth-child(even) .node-disc { margin-top: 0; }
.node.done .node-disc { background: var(--accent); }
.node.locked .node-disc { border-color: #c6ccda; color: #aab1c2; background: #eef0f6; box-shadow: none; font-size: 28px; }
.node.next .node-disc { animation: pulse 1.3s ease-in-out infinite; }
.node-name { font-size: 15px; font-weight: 800; text-align: center; line-height: 1.15; min-height: 34px; display: flex; align-items: center; }
.node.locked .node-name { opacity: .5; }
.node .star { font-size: 17px; }

/* ---------- intro ---------- */
.intro-card, .result-card, .panel {
  width: 100%; background: var(--paper); border-radius: 32px; padding: 24px 22px 28px; box-shadow: var(--soft);
  display: flex; flex-direction: column; align-items: center; gap: 14px; margin: auto 0;
}
.intro-ico { font-size: 64px; line-height: 1; }
.intro-card h3 { margin: 0; font-size: clamp(26px, 4vw, 38px); text-align: center; }
.intro-card .bubble { background: #f3f5fb; box-shadow: none; }
.intro-card .bubble::before { border-right-color: #f3f5fb; }
.intro-cells { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ---------- play (highway) ---------- */
.play {
  width: 100%; max-width: 1200px; height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 10px; position: relative;
}
.hud { display: grid; grid-template-columns: 58px 1fr 96px; gap: 14px; align-items: center; }
.hud-title { font-size: 18px; font-weight: 800; color: var(--on-sky); text-align: center; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { position: relative; height: 22px; background: rgba(255, 255, 255, .75); border-radius: 999px; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .12); }
.meter-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--sun), var(--orange)); transition: width .25s; }
.meter i { position: absolute; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; display: flex; align-items: center; justify-content: center; font-size: 30px; color: #c9cedb; transition: transform .2s, color .2s; filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .9)); }
.meter i.on { color: #f6a800; transform: scale(1.3) rotate(-8deg); }
.combo { background: var(--paper); border-radius: 18px; text-align: center; padding: 4px 6px; box-shadow: var(--shadow); line-height: 1; transition: transform .15s, background .15s; }
.combo b { display: block; font-size: 28px; }
.combo span { font-size: 12px; font-weight: 700; opacity: .7; }
.combo.hot { background: var(--sun); transform: scale(1.08); }
.banner { height: 56px; display: flex; align-items: center; justify-content: center; }
.banner span { background: var(--paper); border-radius: 999px; padding: 8px 28px; font-size: clamp(22px, 3.4vw, 30px); font-weight: 900; box-shadow: var(--shadow); display: inline-block; }
.banner.big span { font-size: 40px; min-width: 76px; text-align: center; background: var(--sun); padding: 2px 22px; }
.banner span.bounce { animation: bounce .25s ease-out; }
.lane { position: relative; height: clamp(170px, 31vh, 290px); background: var(--paper); border-radius: 26px; overflow: hidden; box-shadow: var(--soft); flex: none; }
.strip { position: absolute; left: 0; top: 0; height: 100%; will-change: transform; }
.strip svg { position: relative; display: block; }
.band { position: absolute; top: 0; bottom: 0; border-left: 3px solid rgba(43, 45, 66, .12); }
.band.listen { background: rgba(123, 92, 214, .12); }
.band.play { background: rgba(255, 209, 102, .2); }
.band.memory { background: repeating-linear-gradient(135deg, rgba(255, 209, 102, .3) 0 14px, rgba(255, 209, 102, .14) 14px 28px); }
.band span { position: absolute; left: 10px; top: 6px; font-size: 14px; font-weight: 800; opacity: .6; white-space: nowrap; }
.nowline { position: absolute; top: 8px; bottom: 8px; width: 6px; margin-left: -3px; border-radius: 3px; background: var(--berry); opacity: .5; }
.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pops { position: absolute; inset: 0; pointer-events: none; }
.pop { position: absolute; top: 6px; transform: translateX(-50%); font-size: 22px; font-weight: 900; white-space: nowrap; animation: popUp .7s ease-out forwards; text-shadow: 0 2px 0 #fff, 0 -2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff; }
.p-perfect { color: var(--leaf); } .p-good { color: #d98200; }
.pad-row { flex: 1; min-height: 150px; display: flex; gap: 14px; align-items: stretch; }
.pad-row .buddy { width: clamp(84px, 15vw, 170px); display: flex; align-items: flex-end; }
.play[data-phase="listen"] .buddy { animation: bob .6s ease-in-out infinite; }

.pad {
  position: relative; flex: 1; border-radius: 30px; overflow: hidden; touch-action: none;
  box-shadow: 0 10px 0 rgba(20, 22, 45, .35); transition: transform .05s, box-shadow .05s, filter .2s, opacity .2s;
}
.pad.down { transform: translateY(7px); box-shadow: 0 3px 0 rgba(20, 22, 45, .35); }
.pad-piano { background: #3d4266; }
.pad-cello { background: linear-gradient(180deg, #dd8a3a, #b96520); }
.pad.small { width: 100%; flex: none; height: clamp(120px, 20vh, 190px); margin-top: auto; }
.play[data-phase="listen"] .pad, .play[data-phase="wait"] .pad { filter: saturate(.35); opacity: .7; }
.pad-word { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; color: #fff; font-size: clamp(14px, 2vw, 18px); font-weight: 800; letter-spacing: .5px; opacity: .92; pointer-events: none; }
.pad-art { position: absolute; pointer-events: none; }
.keys { inset: 16px 16px 42px; display: flex; gap: 5px; }
.keys i { flex: 1; background: linear-gradient(180deg, #fff 80%, #dfe3ee); border-radius: 0 0 14px 14px; }
.keys b { position: absolute; top: 0; width: 8.5%; height: 58%; margin-left: -4.25%; background: #23253b; border-radius: 0 0 9px 9px; }
.pad.down .keys i { background: linear-gradient(180deg, #fff3c4 80%, #ffd166); }
.strings { inset: 22px 0 46px; display: flex; flex-direction: column; justify-content: space-evenly; }
.strings i { height: 5px; background: linear-gradient(180deg, #fff8e8, #cbb892); box-shadow: 0 2px 2px rgba(0, 0, 0, .25); }
.strings i:nth-child(1) { height: 3px; } .strings i:nth-child(2) { height: 4px; } .strings i:nth-child(4) { height: 7px; }
.bow { position: absolute; left: 12%; top: -12%; width: 16px; height: 124%; transform: rotate(8deg) translateX(0); }
.bow-stick { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; border-radius: 3px; background: #6b3d14; }
.bow-hair { position: absolute; left: 9px; top: 3%; bottom: 3%; width: 5px; background: #fffdf5; border-radius: 2px; }
.bow-frog { position: absolute; left: 0; bottom: 1%; width: 16px; height: 12%; border-radius: 4px; background: #23253b; }
.pad.down .bow { animation: bowing 2.4s ease-in-out infinite alternate; }
.pad.down .strings i { animation: shiver .08s linear infinite; }

.sheet-overlay { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: rgba(27, 36, 82, .45); backdrop-filter: blur(4px); border-radius: 0; }
.sheet { background: var(--paper); border-radius: 30px; padding: 24px 30px 30px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; box-shadow: var(--soft); min-width: 300px; }
.sheet h3 { margin: 0 0 4px; font-size: 32px; text-align: center; }

/* ---------- result ---------- */
.result { justify-content: center; }
.result-card { margin: 0; padding-top: 14px; }
.buddy.big { width: 130px; height: 130px; }
.buddy.happy { animation: bob .7s ease-in-out infinite; }
.big-stars .star { font-size: clamp(64px, 12vw, 104px); }
.star.pop-in { animation: starPop .5s cubic-bezier(.2, 1.8, .4, 1); }
.result-card h2 { margin: 0; font-size: clamp(30px, 5vw, 46px); text-align: center; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.stat { min-width: 104px; padding: 8px 12px; border-radius: 18px; background: #f3f5fb; text-align: center; font-size: 15px; font-weight: 700; }
.stat b { display: block; font-size: 30px; }
.s-perfect b { color: var(--leaf); } .s-good b { color: #e09400; } .s-miss b { color: var(--berry); } .s-combo b { color: var(--plum); }
.tip, .detail { margin: 0; font-size: 19px; font-weight: 600; text-align: center; opacity: .85; max-width: 620px; }
.unlock { margin: 0; font-size: 22px; font-weight: 800; background: var(--sun); padding: 10px 20px; border-radius: 999px; text-align: center; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall 3s linear forwards; }

/* ---------- lesson / ear / composer ---------- */
.card { background: var(--paper); border-radius: var(--r); box-shadow: var(--soft); }
.notation-card { width: 100%; padding: 12px 16px; display: flex; justify-content: center; overflow: hidden; }
.notation-card svg { width: 100%; max-width: 860px; height: auto; max-height: 30vh; }
.facts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.fact { display: flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .9); border-radius: 18px; padding: 4px 16px 4px 6px; box-shadow: var(--shadow); }
.fact svg { height: 62px; width: auto; }
.fact b { display: block; font-size: 22px; color: var(--sea); }
.fact small { font-size: 15px; font-weight: 700; opacity: .75; }

.beat-dots { display: flex; gap: 12px; }
.beat-dots i { width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, .85); box-shadow: inset 0 0 0 3px rgba(43, 45, 66, .12); transition: transform .06s; }
.beat-dots i.on { background: var(--berry); transform: scale(1.35); }
.beat-dots i.count { background: var(--plum); transform: scale(1.2); }
.beat-dots.big i { width: 44px; height: 44px; }

.measures { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.measure-wrap { width: 100%; display: flex; align-items: stretch; gap: 8px; }
.timesig { display: flex; flex-direction: column; justify-content: center; font-size: 40px; line-height: .92; font-weight: 900; padding: 0 4px; color: var(--on-sky); width: 34px; flex: none; }
.measure { flex: 1; display: flex; min-height: 120px; padding: 7px; background: var(--paper); border-radius: var(--r); box-shadow: var(--soft); border-right: 9px double var(--ink); min-width: 0; }
.blk, .slot { margin: 3px; border-radius: 14px; min-width: 0; }
.blk { background: #dff5ee; display: flex; flex-direction: column; align-items: center; justify-content: center; animation: popIn .22s cubic-bezier(.2, 1.6, .4, 1); overflow: hidden; }
.blk svg { height: 76px; width: auto; max-width: 100%; }
.blk small { font-size: 14px; font-weight: 800; color: var(--sea); margin-top: -6px; }
.blk.ok { background: #bff0dc; box-shadow: inset 0 0 0 4px var(--mint); }
.blk.bad { background: #fde0e6; box-shadow: inset 0 0 0 4px var(--berry); animation: shake .35s; }
.blk.now { background: var(--sun); }
.slot { border: 3px dashed #bcc3d3; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip { display: flex; flex-direction: column; align-items: center; min-width: 98px; padding: 6px 10px 8px; background: var(--paper); border-radius: 18px; box-shadow: var(--shadow); }
.chip svg { height: 64px; width: auto; }
.chip b { font-size: 17px; color: var(--sea); margin-top: -4px; }
.chip small { font-size: 13px; font-weight: 700; opacity: .7; }
.chip.shake { animation: shake .35s; }
.tempo { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .8); border-radius: 999px; padding: 4px; font-weight: 700; }
.tempo .ibtn { width: 50px; height: 50px; box-shadow: none; background: #e9ecf5; }
.tempo b { font-size: 22px; }

.compose .measure { min-height: 96px; }
.compose .blk svg { height: 60px; }
.compose { gap: 12px; }

/* ---------- what is rhythm? (beat grid) ---------- */
.basics { gap: 10px; }
.basics .beatbox { height: 46px; }
.basics .beats.tall .beatbox { height: 96px; }
.grid-host, .pulse { width: 100%; }
.bgrid { position: relative; width: 100%; background: var(--paper); border-radius: var(--r); box-shadow: var(--soft); padding: 12px 16px 14px; }
.cap { font-size: 15px; font-weight: 800; opacity: .65; margin: 6px 0 4px; }
.cap:first-child { margin-top: 0; }
.brow { display: grid; grid-template-columns: repeat(var(--n), 1fr); }
.beatbox { height: 54px; margin: 0 3px; border-radius: 14px; background: #eef0f7; display: flex; align-items: center; justify-content: center; font-size: 26px; transition: transform .07s, background .07s; }
.beats.tall .beatbox { height: 96px; font-size: 44px; }
.beatbox.on { background: var(--sun); transform: scale(1.06); }
.beatbox:first-child.on { background: var(--orange); }
.rwrap { position: relative; }
.rcell { margin: 0 3px; padding: 10px 8px 6px; border-radius: 14px; background: #e8f6fb; display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 0; }
.rcell:not(:disabled):active { transform: scale(.97); }
.rbars { display: flex; gap: 5px; height: 30px; }
.rbar { border-radius: 9px; background: var(--sea); min-width: 0; transition: transform .06s, background .06s; }
.rbar.quiet { background: none; border: 3px dashed #b5bdcf; }
.rbar.on { background: var(--berry); transform: scaleY(1.25); }
.rword { font-size: clamp(14px, 2vw, 19px); font-weight: 800; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link { position: absolute; top: 25px; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: var(--paper); box-shadow: 0 3px 0 rgba(30, 32, 60, .2), 0 0 0 3px #dfe3ef; font-size: 21px; z-index: 2; opacity: .85; }
.link.on { background: var(--sun); opacity: 1; box-shadow: 0 3px 0 rgba(30, 32, 60, .2), 0 0 0 3px var(--orange); }
.hush { margin-top: 6px; }
.shh { margin: 0 auto; width: 50px; height: 50px; border-radius: 50%; background: #eef0f7; font-size: 24px; filter: grayscale(1); opacity: .7; }
.shh.on { background: var(--sun); filter: none; opacity: 1; }
.brow.notes { display: block; }
.brow.notes svg { width: 100%; height: auto; }
.playhead { position: absolute; top: 8px; bottom: 8px; width: 5px; margin-left: -2px; border-radius: 3px; background: var(--berry); opacity: 0; pointer-events: none; z-index: 3; }
.pulse { display: flex; align-items: center; gap: 16px; }
.pulse .bgrid { flex: 1; }
.heart { font-size: clamp(56px, 10vw, 96px); line-height: 1; width: 1.3em; text-align: center; flex: none; }
.streak { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 800; color: var(--on-sky); min-height: 30px; flex-wrap: wrap; justify-content: center; }
.streak-dots { display: flex; gap: 7px; }
.streak-dots i { width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .8); box-shadow: inset 0 0 0 3px rgba(43, 45, 66, .12); }
.streak-dots i.on { background: var(--mint); }
.btn.toggle { background: var(--paper); color: var(--ink); opacity: .6; }
.btn.toggle.on { background: var(--sea); color: #fff; opacity: 1; }
.basics .nav { margin-top: auto; }
.basics .pad.small { margin-top: 0; }
.key-card { width: 100%; background: var(--paper); border-radius: var(--r); box-shadow: var(--soft); padding: 6px 14px; }
.key-row { width: 100%; display: grid; grid-template-columns: 340px 110px 1fr auto; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 2px solid #eef0f6; text-align: left; border-radius: 12px; }
.key-row:last-child { border-bottom: 0; }
.key-row.on { background: #fff6d8; }
.key-row.on .rbar:not(.quiet) { background: var(--berry); }
.key-bars .rbars { height: 26px; }
.key-bars { display: block; max-width: 100%; }
.key-note svg { height: 62px; width: auto; }
.key-text b { display: block; font-size: 22px; color: var(--sea); }
.key-text small { font-size: 14px; font-weight: 700; opacity: .7; }
.key-word { font-size: 18px; font-weight: 800; white-space: nowrap; }
.start-card { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: rgba(255, 255, 255, .92); border-radius: 26px; box-shadow: var(--soft); text-align: left; border: 4px solid transparent; }
.start-card.next { border-color: var(--sun); }
.start-card.next .node-disc { animation: pulse 1.3s ease-in-out infinite; }
.start-card .node-disc { --accent: var(--plum); width: 64px; height: 64px; font-size: 30px; flex: none; }
.start-text { flex: 1; }
.start-text b { display: block; font-size: clamp(20px, 2.8vw, 26px); }
.start-text small { font-size: 16px; font-weight: 700; opacity: .7; }
.notation-card { position: relative; }
.sweep { position: absolute; left: 0; top: 10px; bottom: 10px; width: 5px; margin-left: -2px; border-radius: 3px; background: var(--berry); opacity: 0; pointer-events: none; }
.notation .zebra { fill: rgba(43, 45, 66, .045); }
.notation .dbar { fill: currentColor; opacity: .32; }
.notation .dbar.quiet { fill: none; stroke: currentColor; stroke-width: 2; stroke-dasharray: 5 4; opacity: .3; }
.notation .n.lit .dbar, .notation .n.j-perfect .dbar, .notation .n.j-good .dbar { opacity: .75; }
@media (max-width: 760px) {
  .key-row { grid-template-columns: 1fr 90px; }
  .key-word { display: none; }
}

/* ---------- songbook ---------- */
.song-list { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.song { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--paper); border-radius: 22px; box-shadow: var(--shadow); text-align: left; }
.song-ico { width: 56px; height: 56px; border-radius: 50%; background: #f1ecff; display: flex; align-items: center; justify-content: center; font-size: 28px; flex: none; color: #aab1c2; }
.song-text { flex: 1; min-width: 0; }
.song-text b { display: block; font-size: 20px; }
.song-text small { font-size: 15px; font-weight: 700; opacity: .7; }
.song.locked { opacity: .6; box-shadow: none; }

/* ---------- settings ---------- */
.panel { align-items: stretch; gap: 0; padding: 8px 22px; margin: 0; }
.set { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 2px solid #eef0f6; flex-wrap: wrap; }
.set:last-child { border-bottom: 0; }
.set > div:first-child { flex: 1; min-width: 200px; }
.set b { font-size: 19px; }
.set small { display: block; font-size: 15px; opacity: .7; font-weight: 600; margin-top: 2px; }
.seg { display: inline-flex; background: #e9ecf5; border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { min-height: 48px; padding: 6px 18px; border-radius: 999px; font-weight: 800; font-size: 17px; }
.seg button.on { background: var(--plum); color: #fff; }
.sliders { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: min(100%, 420px); }
.slider { display: grid; grid-template-columns: 130px 1fr 56px; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.slider em { font-style: normal; text-align: right; opacity: .7; }
.slider input { -webkit-appearance: none; appearance: none; height: 44px; background: transparent; margin: 0; touch-action: pan-y; }
.slider input::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: #dfe3ef; }
.slider input::-moz-range-track { height: 12px; border-radius: 6px; background: #dfe3ef; }
.slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; margin-top: -11px; border-radius: 50%; background: var(--plum); border: 4px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.slider input::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--plum); border: 4px solid #fff; }
.sliders .btn { align-self: flex-end; }
.mic-test { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.mic-bar { width: 180px; height: 18px; border-radius: 9px; background: #e9ecf5; overflow: hidden; }
.mic-bar i { display: block; height: 100%; width: 0; background: var(--mint); }
.settings .pill { box-shadow: none; background: #e9ecf5; }

/* ---------- animations ---------- */
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes drift { to { transform: translateX(160vw); } }
@keyframes twinkle { 50% { opacity: .2; transform: scale(.6); } }
@keyframes breathe { 50% { transform: scale(1.05); } }
@keyframes wobble { 50% { transform: rotate(-3deg) translateY(-4px); } }
@keyframes bob { 50% { transform: translateY(-7px) rotate(-3deg); } }
@keyframes bounce { 40% { transform: scale(1.14) translateY(-6px); } }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes pulse { 50% { transform: scale(1.14); box-shadow: 0 0 0 10px rgba(255, 209, 102, .55); } }
@keyframes popUp { 0% { opacity: 0; transform: translate(-50%, 14px) scale(.6); } 25% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -18px) scale(1); } }
@keyframes popIn { from { transform: scale(.4); opacity: 0; } }
@keyframes starPop { from { transform: scale(0) rotate(-90deg); } }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@keyframes toastIn { 0% { opacity: 0; transform: translate(-50%, 20px); } 8%, 88% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } }
@keyframes bowing { from { transform: rotate(8deg) translateX(0); } to { transform: rotate(8deg) translateX(min(60vw, 560px)); } }
@keyframes shiver { 50% { transform: translateY(1px); } }

@media (max-width: 640px) {
  .trail { grid-template-columns: repeat(3, 1fr); row-gap: 14px; }
  .trail::before { display: none; }
  .land-cells { display: none; }
  .btn.giant { padding: 12px 40px; font-size: 30px; min-height: 76px; }
  .talk .buddy { width: 68px; height: 68px; }
  .hud { grid-template-columns: 58px 1fr 76px; }
}
@media (max-height: 560px) {
  .banner { height: 44px; }
  .lane { height: 140px; }
  .hud-title { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cloud, .logo span, .btn.giant, .inst.on .buddy-svg { animation: none; }
}
