:root {
  --bg: #0f0f0f;
  --panel: #1c1c1c;
  --panel-2: #232323;
  --border: #2a2a2a;
  --gold: #e8a04d;
  --gold-dim: #d98b3c;
  --text: #ededed;
  --muted: #8a8a8a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 50% -10%, #1a1712 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Source Sans 3", sans-serif;
  min-height: 100%;
}

#app {
  max-width: 620px;
  margin: 0 auto;
  padding: 16px 18px 40px;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.clef-glyph {
  color: var(--gold);
  font-size: 40px;
  line-height: 1;
  font-family: "Playfair Display", serif;
  text-shadow: 0 0 16px rgba(232,160,77,0.35);
}
.brand-name {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.3px;
}
.menu-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.menu-btn:hover { border-color: var(--gold); }

/* Menu drawer */
.menu-drawer {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
  font-size: 15px;
  line-height: 1.6;
}
.menu-drawer ul { margin: 8px 0 12px; padding-left: 18px; color: var(--muted); }
.menu-drawer kbd {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; font-size: 12px;
}
.hidden { display: none; }

/* Context chip */
.chip {
  display: inline-block;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* Staff card */
.staff-card {
  position: relative;
  background: linear-gradient(180deg, #1a1a1a, #151515);
  border: 1px solid var(--border);
  border-radius: 18px;
  height: 360px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.03);
}
#canvas { width: 100%; height: 100%; display: block; }
.staff-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 16px 20px;
  pointer-events: none;
}
.note-name {
  font-family: "Playfair Display", serif;
  font-size: 34px;
  font-weight: 600;
  color: var(--text);
}
.status { color: var(--muted); font-size: 14px; }
.timer-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: rgba(255,255,255,0.05);
}
.timer-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transition: width .1s linear;
  box-shadow: 0 0 10px rgba(232,160,77,0.6);
}

/* Controls */
.controls { margin-top: 20px; }
.primary-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.btn {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 15px 24px;
  border-radius: 13px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform .08s, background .2s, border-color .2s, box-shadow .2s;
  flex: 1 1 auto;
  min-width: 100px;
}
.btn:active { transform: translateY(1px); }
.btn-gold {
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  color: #201400;
  border: none;
  box-shadow: 0 6px 20px rgba(232,160,77,0.3);
}
.btn-gold.playing {
  background: linear-gradient(180deg, #2a2a2a, #202020);
  color: var(--gold);
  border: 1px solid var(--gold);
  box-shadow: 0 0 18px rgba(232,160,77,0.25);
}
.btn-dark { background: var(--panel); color: var(--text); }
.btn-dark:hover { border-color: var(--gold); }

.secondary-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}
.btn.small { flex: 0 0 auto; padding: 12px 20px; font-size: 15px; }
.btn.small.flash { border-color: var(--gold); background: var(--panel-2); }
.hint { color: var(--muted); font-size: 14px; }

/* Panel */
.panel {
  margin-top: 20px;
  background: linear-gradient(180deg, #1c1c1c, #181818);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 20px;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.panel-label {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .3px;
}
.bpm-readout {
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-size: 30px;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(232,160,77,0.3);
}
.clef-label { margin: 22px 0 12px; }

/* Slider */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #3a3a3a;
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid #1c1c1c;
  box-shadow: 0 0 10px rgba(232,160,77,0.6);
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid #1c1c1c;
  box-shadow: 0 0 10px rgba(232,160,77,0.6);
  cursor: pointer;
}

/* Clef toggle */
.clef-toggle { display: flex; gap: 12px; }
.toggle {
  flex: 1;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 15px 10px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: all .2s;
}
.toggle.active {
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  color: #201400;
  border: none;
  box-shadow: 0 4px 16px rgba(232,160,77,0.3);
}

/* Footer */
.footer {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}
.footer a { color: var(--gold); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

@media (max-width: 420px) {
  .brand-name { font-size: 26px; }
  .staff-card { height: 300px; }
  .btn { font-size: 15px; padding: 14px 16px; }
}