:root {
  --ink: #162438;
  --ink-soft: #3b4f69;
  --muted: #6b7b90;
  --line: #e2e8f2;
  --line-strong: #cdd7e6;
  --surface: #ffffff;
  --surface-soft: #f7f9fd;
  --paper: #fffdf8;
  --paper-alt: #faf6ec;
  --blue: #2563eb;
  --blue-deep: #1d4ed8;
  --blue-soft: #e8f0fe;
  --amber: #c97a16;
  --amber-soft: #fef3dc;
  --violet: #7357d6;
  --violet-soft: #eeeafd;
  --emerald: #0f9d68;
  --emerald-soft: #ddf7ec;
  --rose: #e11d48;
  --shadow-sm: 0 2px 6px rgba(22, 36, 56, 0.05);
  --shadow-md: 0 12px 32px rgba(22, 36, 56, 0.07);
  --radius-lg: 20px;
  --radius-md: 13px;
  --radius-sm: 9px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.07), transparent 36%),
    radial-gradient(circle at 88% 8%, rgba(201, 122, 22, 0.07), transparent 34%),
    linear-gradient(180deg, #edf3fb 0%, #f6f8fc 48%, #eef2f8 100%);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font: inherit;
}

.app {
  width: min(1240px, calc(100% - 28px));
  margin: 18px auto 38px;
}

/* Focus mode for iPad / Piano stand */
body.focus-mode .hero,
body.focus-mode .note-box,
body.focus-mode .footer {
  display: none;
}

body.focus-mode .app {
  width: min(1400px, calc(100% - 20px));
  margin-top: 10px;
  margin-bottom: 16px;
}

body.focus-mode .score-scroll {
  max-height: 52vh;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 850;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(145deg, #1d314d, #111e30);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: 0 6px 16px rgba(17, 30, 48, 0.22);
}

.brand-title {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 700;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.library-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 4px 6px 4px 10px;
  box-shadow: var(--shadow-sm);
}

.library-picker label {
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
  white-space: nowrap;
}

.library-picker select {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
  font-size: 13px;
  padding: 4px 4px;
  outline: none;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #d5dfec;
  border-radius: 11px;
  padding: 8px 13px;
  background: #fff;
  color: #2f425c;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  border-color: #a8bbd8;
  background: #f9fbff;
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn.primary {
  background: linear-gradient(180deg, #3272f6, #2159d6);
  border-color: #2159d6;
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #3b7bff, #1d51c8);
  border-color: #1d51c8;
}

.btn.active-toggle {
  background: var(--blue-soft);
  border-color: #93b8fb;
  color: var(--blue-deep);
}

.btn.emerald-toggle {
  background: var(--emerald-soft);
  border-color: #6ee7b7;
  color: #066f48;
}

.btn.sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 9px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.mode-select {
  border: 1px solid #d5dfec;
  border-radius: 10px;
  padding: 7px 10px;
  background: #fff;
  color: #354963;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.mode-select:focus {
  border-color: var(--blue);
}

/* Hero */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 4px 2px 16px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #5e789c;
  font-weight: 850;
  margin-bottom: 5px;
}

.hero h1 {
  margin: 0 0 5px;
  font-size: clamp(22px, 3.2vw, 32px);
  letter-spacing: -0.03em;
  line-height: 1.18;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #dde5f0;
  border-radius: 999px;
  padding: 6px 11px;
  color: #4f627b;
  font-weight: 700;
  font-size: 11.5px;
  white-space: nowrap;
}

.chip.midi-connected {
  background: var(--emerald-soft);
  border-color: #86efac;
  color: #066f48;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.chip.midi-connected .chip-dot {
  background: var(--emerald);
  box-shadow: 0 0 0 3px rgba(15, 157, 104, 0.2);
}

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 15px;
  box-shadow: var(--shadow-md);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 13px 18px;
  border-bottom: 1px solid #edf1f6;
  background: linear-gradient(180deg, #ffffff, #fafcff);
}

.section-title {
  font-size: 15px;
  font-weight: 850;
  display: flex;
  align-items: center;
  gap: 9px;
}

.num {
  width: 25px;
  height: 25px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 900;
}

.tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

/* Segmented control for Practice Mode */
.segmented {
  display: inline-flex;
  background: #edf2f9;
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}

.seg-btn {
  border: 0;
  background: transparent;
  color: #4f627b;
  font-size: 12px;
  font-weight: 750;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.15s;
}

.seg-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(22, 36, 56, 0.1);
}

.seg-btn.follow.active {
  color: #066f48;
  background: #fff;
}

/* Loop controls */
.loop-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px 5px;
}

.loop-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--blue-deep);
  padding: 0 5px;
  font-variant-numeric: tabular-nums;
}

/* Sheet Music Panel */
.score-wrap {
  position: relative;
  background: linear-gradient(180deg, var(--paper), var(--paper-alt));
}

.score-scroll {
  max-height: 460px;
  overflow: auto;
  padding: 12px 14px 16px;
  scrollbar-color: #cbd5e1 transparent;
}

.score-svg {
  width: 100%;
  height: auto;
  display: block;
  min-width: 780px;
  user-select: none;
}

.score-hit {
  cursor: pointer;
  transition: fill-opacity 0.12s ease;
}

.score-hit:hover {
  fill: #2563eb;
  fill-opacity: 0.1;
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 253, 248, 0.78);
  backdrop-filter: blur(3px);
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.countdown-overlay.show {
  opacity: 1;
}

.countdown-num {
  font-size: 64px;
  font-weight: 900;
  color: var(--blue);
  line-height: 1;
  text-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
}

.countdown-label {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink-soft);
}

.score-foot {
  padding: 9px 18px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: #708094;
  font-size: 11.5px;
  border-top: 1px solid #f0ece1;
  background: #fffefb;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

/* Scrubbable progress bar */
.progress-track {
  padding: 6px 18px 14px;
  background: #fff;
  cursor: pointer;
}

.progress {
  position: relative;
  height: 8px;
  background: #e9eff7;
  border-radius: 999px;
  overflow: visible;
}

.progress-loop {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(37, 99, 235, 0.2);
  border-radius: 999px;
  pointer-events: none;
}

.progress-fill {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  transition: width 0.12s linear;
}

.progress-fill::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--blue);
  transform: translateY(-50%);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

/* Practice area */
.practice {
  padding: 16px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Step HUD */
.step-hud {
  border: 1px solid #e2eaf4;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8faff, #f4f8ff);
  padding: 13px;
  display: grid;
  grid-template-columns: 1.05fr 1.15fr 1.15fr 0.95fr;
  gap: 10px;
  align-items: stretch;
}

.hud-box {
  background: #fff;
  border: 1px solid #e5ecf5;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud-box.intro {
  background: transparent;
  border: 0;
  padding: 4px 6px;
}

.hud-box.right {
  border-left: 4px solid var(--blue);
}

.hud-box.left {
  border-left: 4px solid var(--amber);
}

.hud-box.next {
  background: #fbfcfe;
  border-style: dashed;
  border-color: #cfdbe9;
}

.step-kicker {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: #70839e;
  font-weight: 850;
}

.step-number-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0 6px;
}

.step-number {
  font-size: 26px;
  font-weight: 900;
  color: #1f4178;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.follow-streak {
  font-size: 11px;
  font-weight: 800;
  color: var(--emerald);
  background: var(--emerald-soft);
  padding: 2px 7px;
  border-radius: 999px;
}

.duration-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  background: #fff;
  border: 1px solid #dce5f2;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  color: #42556e;
  font-weight: 800;
}

.hand-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  font-weight: 850;
  color: var(--ink-soft);
}

.hand-head small {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 700;
}

.pitches-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
  min-height: 28px;
  align-items: center;
}

.pitch-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: -0.01em;
  background: #f1f5fb;
  color: var(--ink);
  border: 1px solid #dbe5f2;
}

.hud-box.right .pitch-tag {
  background: var(--blue-soft);
  color: #1b4bb8;
  border-color: #c3d8fd;
}

.hud-box.left .pitch-tag {
  background: var(--amber-soft);
  color: #96570c;
  border-color: #f6d39c;
}

.pitch-tag.matched {
  background: var(--emerald-soft) !important;
  color: #056b46 !important;
  border-color: #6ee7b7 !important;
}

.pitch-tag small {
  font-size: 11px;
  opacity: 0.78;
  font-weight: 700;
}

.empty-hand {
  font-size: 13px;
  color: #9aa6b5;
  font-weight: 650;
}

.hand-foot {
  font-size: 10.5px;
  color: #7c8a9d;
  margin-top: 6px;
}

.next-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  margin-top: 5px;
}

.next-line span {
  color: var(--muted);
  font-weight: 700;
}

.next-line strong {
  color: var(--ink);
  font-weight: 800;
  text-align: right;
}

/* Keyboard toolbar & Piano */
.keyboard-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.keyboard-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.keyboard-bar-left b {
  font-size: 13.5px;
}

.keyboard-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.vol-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 9px;
  font-size: 12px;
}

.vol-wrap input {
  width: 72px;
  accent-color: var(--blue);
  cursor: pointer;
}

.icon-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 2px 3px;
  font-size: 14px;
  line-height: 1;
}

.keyboard-frame {
  background: linear-gradient(180deg, #1b283b, #26364d 10px, #162233 10px, #162233);
  border-radius: 14px;
  padding: 12px 10px 10px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35), 0 8px 20px rgba(22, 36, 56, 0.14);
}

.keyboard-viewport {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-color: #64748b #1e293b;
  -webkit-overflow-scrolling: touch;
}

.keyboard {
  position: relative;
  display: flex;
  width: 100%;
  height: 186px;
  user-select: none;
  touch-action: manipulation;
}

.white-key {
  position: relative;
  flex: 1 1 0;
  min-width: 34px;
  height: 180px;
  border: 1px solid #bfc9d8;
  border-top: 0;
  border-right: 0;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafd 78%, #e9eff7 100%);
  box-shadow: inset 0 -4px 0 rgba(164, 179, 200, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8px;
  gap: 2px;
  cursor: pointer;
  transition: background 0.08s ease, transform 0.06s ease, box-shadow 0.08s ease;
}

.white-key:first-child {
  border-radius: 4px 0 8px 8px;
}

.white-key:last-of-type {
  border-right: 1px solid #bfc9d8;
  border-radius: 0 4px 8px 8px;
}

.white-key:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f1f6ff 80%, #e1ebfa 100%);
}

.white-key.pressed {
  transform: translateY(2px);
  box-shadow: inset 0 -1px 0 rgba(140, 158, 184, 0.5), inset 0 2px 5px rgba(22, 36, 56, 0.12);
}

.white-key.active-right {
  background: linear-gradient(180deg, #eaf2ff 0%, #cfe1ff 75%, #b6d1ff 100%);
  border-color: #4f86eb;
  box-shadow: inset 0 -4px 0 rgba(37, 99, 235, 0.35);
}

.white-key.active-left {
  background: linear-gradient(180deg, #fff6e5 0%, #ffe2b3 75%, #ffd28a 100%);
  border-color: #d68b24;
  box-shadow: inset 0 -4px 0 rgba(201, 122, 22, 0.35);
}

.white-key.active-both {
  background: linear-gradient(180deg, #f0edff 0%, #ddd5ff 75%, #cbc0ff 100%);
  border-color: #7e63dc;
  box-shadow: inset 0 -4px 0 rgba(115, 87, 214, 0.35);
}

.white-key.hit-correct {
  background: linear-gradient(180deg, #e2fbf0 0%, #a7f3d0 75%, #6ee7b7 100%) !important;
  border-color: var(--emerald) !important;
  box-shadow: inset 0 -3px 0 rgba(15, 157, 104, 0.4) !important;
}

.white-key.hit-wrong {
  background: linear-gradient(180deg, #ffe4e6 0%, #fecdd3 80%, #fda4af 100%) !important;
}

.key-main-label {
  font-size: 10.5px;
  font-weight: 850;
  color: #607086;
  line-height: 1;
}

.key-sub-label {
  font-size: 9.5px;
  font-weight: 700;
  color: #8b99ac;
  line-height: 1;
}

.white-key.active-right .key-main-label { color: #1b4bb8; }
.white-key.active-left .key-main-label { color: #8c4f0a; }
.white-key.active-both .key-main-label { color: #4e37a3; }

.middle-c-dot {
  position: absolute;
  bottom: 34px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e11d48;
  opacity: 0.78;
}

.next-dot {
  position: absolute;
  bottom: 44px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.next-dot.right { background: #60a5fa; }
.next-dot.left { background: #f59e0b; }
.next-dot.both { background: #a78bfa; }

.black-key {
  position: absolute;
  top: 0;
  height: 112px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, #27364c 0%, #162131 65%, #0e1622 100%);
  z-index: 4;
  box-shadow: 0 5px 7px rgba(8, 14, 24, 0.45), inset 0 -3px 2px rgba(255, 255, 255, 0.14);
  border: 1px solid #09101a;
  border-top: 0;
  transform: translateX(-50%);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 7px;
  transition: background 0.08s ease, height 0.06s ease;
}

.black-key:hover {
  background: linear-gradient(180deg, #334663 0%, #1d2b40 70%, #131e2e 100%);
}

.black-key.pressed {
  height: 109px;
  box-shadow: 0 2px 3px rgba(8, 14, 24, 0.5);
}

.black-key .key-main-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 9px;
}

.black-key.active-right {
  background: linear-gradient(180deg, #4b8bf5 0%, #1d57c9 85%, #1644a3 100%);
  border-color: #133b8f;
}

.black-key.active-left {
  background: linear-gradient(180deg, #efa73f 0%, #b56912 85%, #8f500a 100%);
  border-color: #7d4508;
}

.black-key.active-both {
  background: linear-gradient(180deg, #9886f0 0%, #5c46bf 85%, #47349e 100%);
  border-color: #3a2985;
}

.black-key.hit-correct {
  background: linear-gradient(180deg, #34d399 0%, #059669 85%, #047857 100%) !important;
  border-color: #065f46 !important;
}

.black-key.hit-wrong {
  background: linear-gradient(180deg, #fb7185 0%, #e11d48 85%) !important;
}

.black-key .next-dot {
  bottom: 24px;
}

.key-badge {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  border-radius: 999px;
  min-width: 22px;
  padding: 2px 5px;
  text-align: center;
  background: #fff;
  color: #1e4280;
  font-size: 10px;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(15, 29, 48, 0.3);
  pointer-events: none;
}

.white-key.active-left .key-badge,
.black-key.active-left .key-badge {
  color: #92520b;
}

.white-key.active-both .key-badge,
.black-key.active-both .key-badge {
  color: #553ea8;
}

.white-key.hit-correct .key-badge,
.black-key.hit-correct .key-badge {
  color: #047857;
}

.black-key .key-badge {
  top: 8px;
  font-size: 9px;
  padding: 2px 4px;
}

.key-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.legend-items {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.legend {
  font-size: 11px;
  color: #5b6d84;
  background: #fff;
  border: 1px solid #e4eaf3;
  border-radius: 8px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend .right { background: var(--blue); }
.legend .left { background: var(--amber); }
.legend .both { background: var(--violet); }
.legend .hit { background: var(--emerald); }
.legend .midc { background: var(--rose); }

/* Transport Row */
.transport-row {
  padding: 13px 18px 15px;
  border-top: 1px solid #edf1f6;
  background: #fbfcfe;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.transport {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.tempo-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.speed-pills {
  display: inline-flex;
  background: #edf2f9;
  padding: 2px;
  border-radius: 9px;
  gap: 2px;
}

.speed-pill {
  border: 0;
  background: transparent;
  color: #53657d;
  font-size: 11.5px;
  font-weight: 750;
  padding: 4px 8px;
  border-radius: 7px;
  cursor: pointer;
}

.speed-pill.active {
  background: #fff;
  color: var(--blue-deep);
  box-shadow: 0 1px 4px rgba(22, 36, 56, 0.1);
}

.tempo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.tempo input {
  width: 112px;
  accent-color: var(--blue);
  cursor: pointer;
}

.tempo strong {
  min-width: 30px;
  text-align: right;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.step-count {
  font-size: 12px;
  color: #6b7c93;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

/* Note Box & Footer */
.note-box {
  padding: 12px 18px 14px;
  border-top: 1px solid #edf1f6;
  background: #f9fbfe;
  color: #64748b;
  font-size: 11.5px;
  line-height: 1.7;
}

.note-box b {
  color: #334660;
}

.note-box code {
  background: #edf2f8;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 11px;
  color: #29446b;
}

.footer {
  text-align: center;
  color: #8c99aa;
  font-size: 11px;
  line-height: 1.65;
  padding: 4px 6px;
}

.file-input, .hidden {
  display: none !important;
}

/* Drag-and-drop overlay */
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 36, 56, 0.52);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.drop-overlay.show {
  opacity: 1;
}

.drop-card {
  background: #fff;
  border: 2px dashed var(--blue);
  border-radius: 22px;
  padding: 34px 48px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(15, 29, 48, 0.25);
}

.drop-card h3 {
  margin: 0 0 8px;
  font-size: 19px;
}

.drop-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* Help Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 29, 48, 0.48);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}

.modal {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(15, 29, 48, 0.26);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid #edf1f6;
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  padding: 16px 18px 20px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-soft);
  max-height: 72vh;
  overflow: auto;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 6px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  background: #17263b;
  color: #fff;
  padding: 10px 16px;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 650;
  box-shadow: 0 10px 28px rgba(15, 29, 48, 0.3);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
  max-width: calc(100% - 28px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 960px) {
  .step-hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app {
    width: calc(100% - 16px);
    margin: 12px auto 26px;
  }

  .panel-head,
  .practice,
  .transport-row {
    padding-left: 13px;
    padding-right: 13px;
  }

  .score-scroll {
    max-height: 360px;
    padding: 8px 6px 12px;
  }

  .keyboard {
    height: 162px;
  }

  .white-key {
    height: 156px;
    min-width: 31px;
  }

  .black-key {
    height: 96px;
  }

  .shortcut-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .step-hud {
    grid-template-columns: 1fr;
  }

  .actions .btn {
    font-size: 12px;
    padding: 7px 10px;
  }

  .tempo input {
    width: 84px;
  }
}
