/* Wren — see DESIGN.md. Dark lab instrument, coach's voice.
   Semantic trio: jay blue = action/target, green = in tune, amber = adjust. */

:root {
  --base: #0A0D14;
  --panel: #121826;
  --panel-2: #0F1420;
  --line: #1E2740;
  --line-soft: #161d31;
  --jay: #4C6FFF;
  --jay-dim: #35406B;
  --intune: #35D0A5;
  --off: #E6B450;
  --text: #E8ECF4;
  --muted: #7A879F;
  --muted-2: #4C566E;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background:
    radial-gradient(1100px 540px at 60% -12%, #131b31 0%, transparent 60%),
    var(--base);
  color: var(--text);
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.mono { font-family: "JetBrains Mono", monospace; }

h1 { font-size: 27px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 14px; }
h3 { font-size: 16px; font-weight: 600; }

.eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.eyebrow b { color: var(--jay); font-weight: 600; }

.k {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.hint { color: var(--muted); font-size: 13px; max-width: 68ch; margin-top: 18px; }
.hint-inline { color: var(--muted); font-size: 13px; }

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: 208px 1fr;
  min-height: 100vh;
  min-height: 100dvh; /* Android Chrome: dodge the collapsing URL bar */
}

.side {
  background: var(--panel-2);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
}
.brand { margin-bottom: 2px; padding-left: 10px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 10px;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s, background 0.15s;
}
.nav button:hover { color: var(--text); background: var(--panel); }
.nav button[aria-current="page"] { color: var(--text); background: var(--jay-dim); }
.nav button:focus-visible { outline: 2px solid var(--jay); outline-offset: 2px; }
.nav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.side-foot {
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: 0.05em;
  padding-left: 10px;
}

.mic-toggle {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.mic-toggle:hover { border-color: var(--jay-dim); }
.mic-toggle:focus-visible { outline: 2px solid var(--jay); outline-offset: 2px; }
.mic-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--intune);
  box-shadow: 0 0 8px rgba(53, 208, 165, 0.7);
}
.mic-toggle.off { color: var(--muted); }
.mic-toggle.off .mic-dot { background: var(--muted-2); box-shadow: none; }

main {
  padding: 30px 34px 60px;
  max-width: 860px;
  width: 100%;
}
main:focus { outline: none; }

/* ---------- gate ---------- */
.gate {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 20, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  z-index: 40;
  text-align: center;
  padding: 24px;
}
.gate p { color: var(--muted); max-width: 46ch; font-size: 14px; }
.err { color: var(--off); font-family: "JetBrains Mono", monospace; font-size: 12px; min-height: 16px; max-width: 60ch; }

/* ---------- buttons ---------- */
.btn {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--jay-dim);
  border: 1px solid var(--jay);
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: #46528a; }
.btn:active { background: #2c3559; }
.btn:focus-visible { outline: 2px solid var(--jay); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--jay-dim); background: var(--panel); }
.btn.big { font-size: 15px; padding: 13px 24px; }
.btn.small { font-size: 13px; padding: 7px 14px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

.chip {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---------- readouts ---------- */
.readout {
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 18px;
  background: var(--panel-2);
}
.ro {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 16px;
}
.readout .ro + .ro { border-left: 1px solid var(--line-soft); }
.ro .mono, .ro span:not(.k) { font-family: "JetBrains Mono", monospace; font-size: 16px; color: var(--text); }
.ro.wide { flex: 1; min-width: 150px; }

/* ---------- tuner ---------- */
.note-row { display: flex; align-items: flex-end; justify-content: center; gap: 6px; min-height: 132px; }
.note {
  font-size: 104px;
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.02em;
  transition: color 0.12s ease, text-shadow 0.12s ease;
}
.note.locked { color: var(--intune); text-shadow: 0 0 40px rgba(53, 208, 165, 0.35); }
.note.idle { color: var(--muted-2); }
.note.holding { opacity: 0.55; } /* brief dropout: held, dimmed, not blanked */

/* which way home: flat wants up, sharp wants down */
.pitch-arrow {
  width: 34px;
  font-size: 26px;
  line-height: 1;
  color: var(--off);
  text-align: center;
  padding-bottom: 22px;
  opacity: 0;
  transition: opacity 0.15s;
}
.pitch-arrow.show { opacity: 1; }

.tuner-nudge {
  min-height: 20px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--text);
  max-width: 62ch;
}

/* target picker: the Match keyboard, shrunk to a picker */
.tuner-target { margin-top: 18px; }
.tuner-target .kbd-bar { margin-top: 10px; flex-wrap: wrap; }
.tuner-target .kbd-bar .push-right { margin-left: auto; }
.kbd.compact { height: 88px; margin-top: 8px; }
.octave { font-family: "JetBrains Mono", monospace; font-size: 30px; color: var(--muted); font-weight: 500; padding-bottom: 13px; min-width: 34px; /* balances the arrow on the left so the letter stays centered */ }

.cents-wrap { margin-top: 14px; }
.cents-scale { position: relative; height: 44px; }
.track { position: absolute; top: 50%; left: 0; right: 0; height: 2px; background: var(--line); transform: translateY(-50%); }
.lockline { position: absolute; top: 8px; bottom: 8px; left: 50%; width: 2px; background: var(--jay-dim); transform: translateX(-50%); }
.needle {
  position: absolute; top: 4px; bottom: 4px; width: 4px; border-radius: 3px;
  background: var(--off); left: 50%; transform: translateX(-50%);
  transition: left 0.06s linear, background 0.12s;
}
.needle.locked { background: var(--intune); box-shadow: 0 0 16px rgba(53, 208, 165, 0.6); }
.cents-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.cents-read { text-align: center; font-size: 13px; color: var(--muted); margin-top: 6px; min-height: 17px; }

canvas.trace, canvas.roll {
  display: block;
  width: 100%;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  margin-top: 20px;
}
canvas.trace { height: 150px; }
canvas.trace.ribbon { height: 190px; }
canvas.roll { height: 260px; }

/* segmented control (game switcher, practice tempo) */
.seg {
  display: inline-flex;
  gap: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  margin-top: 4px;
}
.seg button {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { color: var(--text); background: var(--jay-dim); }
.seg button:focus-visible { outline: 2px solid var(--jay); outline-offset: 2px; }
.tempo-seg { margin-top: 16px; }

/* ---------- warm up ---------- */
.wu-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.wu-head h2 { margin-bottom: 0; }
.wu-meta { display: flex; align-items: center; gap: 14px; }
/* bubble tracker: one bubble per rep, filling as the work happens */
.bubble-row { display: flex; gap: 8px; }
.bubble {
  position: relative;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line);
  overflow: hidden;
}
.bubble-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0%;
  background: var(--jay-dim);
  transition: height 0.12s linear;
}
.bubble.now { border-color: var(--jay); box-shadow: 0 0 10px rgba(76, 111, 255, 0.35); }
.bubble.good { border-color: var(--intune); }
.bubble.good .bubble-fill { background: var(--intune); }
.bubble.rough { border-color: var(--off); }
.bubble.rough .bubble-fill { background: var(--off); }

.step-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.step-chip {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.step-chip:hover { color: var(--text); border-color: var(--jay-dim); }
.step-chip:focus-visible { outline: 2px solid var(--jay); outline-offset: 2px; }
.step-chip.current { color: var(--text); border-color: var(--jay); }
.step-chip.done { color: var(--intune); }

.wu-instructions { margin-top: 18px; max-width: 62ch; font-size: 16px; line-height: 1.55; }
.wu-sub { margin-top: 10px; color: var(--muted); font-size: 13px; max-width: 62ch; }
.wu-statusrow { display: flex; align-items: baseline; gap: 16px; margin-top: 12px; min-height: 22px; flex-wrap: wrap; }
.wu-status { font-family: "JetBrains Mono", monospace; font-size: 14px; color: var(--muted); }
.wu-result { font-size: 14px; color: var(--intune); }
.wu-timer { font-family: "JetBrains Mono", monospace; font-size: 44px; margin-top: 22px; color: var(--text); }

.sum-list { list-style: none; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.sum-list li {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 10px 16px; background: var(--panel-2);
}
.sum-list li + li { border-top: 1px solid var(--line-soft); }
.sum-name { font-size: 14px; }
.sum-score { font-size: 13px; color: var(--muted); }
.coach-notes { margin-top: 18px; max-width: 62ch; display: flex; flex-direction: column; gap: 8px; }
.coach-notes p { color: var(--text); font-size: 15px; }
.coach-notes p:last-child { color: var(--muted); font-size: 13px; }

/* ---------- lessons ---------- */
.goal-seg { display: flex; flex-wrap: wrap; margin: 4px 0 2px; }

.warmup-nudge {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: var(--panel-2);
  border: 1px dashed var(--jay-dim);
  border-radius: 14px;
  padding: 16px 20px;
  margin-top: 16px;
}
.warmup-nudge p { color: var(--muted); font-size: 13px; max-width: 48ch; margin-top: 4px; }
.warmup-nudge .btn-row { margin-top: 0; }
.wn-title { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 15px; color: var(--text); }

.lesson-hero {
  background: linear-gradient(135deg, #16233c 0%, var(--panel) 70%);
  border: 1px solid var(--jay-dim);
  border-radius: 16px;
  padding: 22px 24px;
  margin-top: 16px;
}
.lesson-hero h2 { margin-bottom: 6px; }
.lh-blurb { color: var(--muted); font-size: 14px; max-width: 56ch; }
.lh-reason { color: var(--text); font-size: 14px; margin-top: 10px; max-width: 56ch; }

.lc-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.lc-min { color: var(--muted-2); font-size: 12px; }
.lc-note { color: var(--off); font-size: 12px; }
.done-chip { color: var(--intune); border-color: var(--jay-dim); }

.lesson-list { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
.lesson-list .k { margin-bottom: 2px; }
.lesson-card {
  display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.lesson-card:hover { border-color: var(--jay-dim); background: var(--panel); }
.lesson-card:focus-visible { outline: 2px solid var(--jay); outline-offset: 2px; }
.lc-title { font-family: "Space Grotesk", sans-serif; font-size: 15px; font-weight: 600; color: var(--text); }
.lc-blurb { font-size: 13px; color: var(--muted); max-width: 60ch; }

.coach-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  margin-top: 16px;
}
.coach-card .wu-instructions { margin-top: 0; }
.rest-card { text-align: center; }
.rest-count { font-family: "JetBrains Mono", monospace; font-size: 44px; color: var(--jay); margin-top: 10px; }

.lesson-banner { margin-top: 14px; background: linear-gradient(135deg, #101a33 0%, var(--panel) 70%); }

/* ---------- match ---------- */
.match-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-top: 6px; }
.match-target { font-size: 40px; font-weight: 600; }
.match-stats { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel-2); }
.match-stats .ro + .ro { border-left: 1px solid var(--line-soft); }

.kbd { position: relative; height: 132px; margin-top: 10px; user-select: none; }
.key {
  position: absolute; top: 0; height: 100%;
  border: 1px solid var(--line); border-radius: 0 0 6px 6px;
  background: #E4E7EF; cursor: pointer; padding: 0;
  transition: background 0.12s;
}
.key.white:hover { background: #cdd3e2; }
.key.black { height: 60%; background: #1a2133; border-color: #0a0d14; z-index: 2; border-radius: 0 0 5px 5px; }
.key.black:hover { background: #232c44; }
.key:focus-visible { outline: 2px solid var(--jay); outline-offset: -2px; z-index: 3; }
.key.target { background: var(--jay); border-color: var(--jay); }
.key.black.target { background: var(--jay); }
.key.sung:not(.target) { background: var(--intune); border-color: var(--intune); }
.key.root:not(.target) { background: #8fa2e8; border-color: var(--jay); }
.key.black.root:not(.target) { background: #46528a; }
.key.outside { opacity: 0.4; }
.key.edge {
  border-color: var(--intune);
  box-shadow: 0 0 12px rgba(53, 208, 165, 0.55);
  z-index: 1;
}
.key.black.edge { z-index: 2; }

.kbd-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}
.oct-label { font-size: 12px; color: var(--muted); min-width: 88px; text-align: center; }
.keylabel {
  position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  font-size: 9px; color: #3a4258; pointer-events: none;
}
.key.target .keylabel { color: #fff; }

.hold-bar { height: 9px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-top: 18px; }
.hold-fill { height: 100%; width: 0%; background: var(--intune); transition: width 0.08s linear; }
.match-status { font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--muted); margin-top: 10px; min-height: 18px; }

/* ---------- range ---------- */
.range-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 26px; }
.range-live { min-height: 96px; font-size: 88px; }
.range-captured { color: var(--muted); font-size: 13px; }
.range-result { display: flex; align-items: stretch; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.range-box {
  border: 1px solid var(--line); background: var(--panel-2);
  border-radius: 14px; padding: 18px 26px; text-align: center;
}
.range-note { font-size: 40px; font-weight: 600; margin-top: 6px; }
.range-mid { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; min-width: 180px; }
.range-type { font-size: 26px; font-weight: 600; }
.range-span { color: var(--muted); font-size: 13px; }
.history { margin-top: 26px; }

.type-bars { margin-top: 22px; display: flex; flex-direction: column; gap: 7px; }
.type-row { display: grid; grid-template-columns: 118px 1fr; gap: 12px; align-items: center; }
.type-name {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--muted-2);
  text-align: right;
}
.type-name.you { color: var(--intune); font-weight: 600; }
.type-track {
  position: relative;
  height: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
}
.type-bar {
  position: absolute;
  top: 1px; bottom: 1px;
  border-radius: 4px;
  background: var(--jay-dim);
}
.type-row.you .type-bar { background: var(--intune); }
.type-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted-2);
  margin-left: 130px;
  margin-top: 2px;
}

/* ---------- breath ---------- */
.meter { height: 9px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.meter-fill { height: 100%; width: 0%; background: var(--jay); transition: width 0.06s linear; }
.breath-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.breath-tool {
  border: 1px solid var(--line); background: var(--panel-2);
  border-radius: 14px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
}
.breath-times { display: flex; gap: 26px; }
.breath-time { font-size: 30px; }
.breath-tool.pacer { align-items: center; text-align: center; }
.pacer-stage { display: flex; align-items: center; justify-content: center; height: 118px; width: 100%; }
.pacer-ring {
  width: 104px; height: 104px;
  border-radius: 50%;
  border: 2px solid var(--jay);
  background: rgba(76, 111, 255, 0.08);
  will-change: transform;
}
.pacer-label { font-size: 13px; color: var(--text); min-height: 18px; }
.pacer-cycles { font-size: 11px; color: var(--muted-2); min-height: 14px; }

.ratio-row {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  margin-top: 18px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2);
}
.ratio-row .mono { font-size: 20px; }

/* ---------- home ---------- */
.home-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.home-tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 4px; }
.voice-chip {
  cursor: pointer;
  color: var(--text);
  border-color: var(--jay-dim);
  transition: border-color 0.15s, color 0.15s;
}
.voice-chip:hover { border-color: var(--jay); }
.voice-chip:focus-visible { outline: 2px solid var(--jay); outline-offset: 2px; }
.voice-chip.unset { color: var(--muted); border-style: dashed; }
.range-chip { color: var(--muted); }

.home-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.home-action {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.home-action:hover { border-color: var(--jay-dim); background: var(--panel); }
.home-action:focus-visible { outline: 2px solid var(--jay); outline-offset: 2px; }
.ha-name { font-family: "Space Grotesk", sans-serif; font-size: 14px; font-weight: 600; color: var(--text); }
.ha-sub { font-size: 12px; color: var(--muted-2); }

.home-streak { margin-top: 28px; }
.streak-wrap { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.streak-grid {
  display: grid;
  grid-template-rows: repeat(7, 13px);
  grid-auto-flow: column;
  grid-auto-columns: 13px;
  gap: 3px;
}
.sg-cell {
  width: 13px; height: 13px; border-radius: 3px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
}
.sg-cell.l1 { background: var(--jay-dim); border-color: var(--jay-dim); }
.sg-cell.l2 { background: #2c6f81; border-color: #2c6f81; }
.sg-cell.l3 { background: var(--intune); border-color: var(--intune); }
.sg-cell.today { border-color: var(--jay); }
.streak-stats { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); padding-bottom: 2px; }

.streak-line { color: var(--muted); margin-bottom: 14px; }
.coach-quote {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  max-width: 62ch;
  margin-bottom: 20px;
}
.setrow {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 26px;
}
.a4-select {
  font-size: 12px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
}
.a4-select:focus-visible { outline: 2px solid var(--jay); outline-offset: 2px; }
.btn.confirm { border-color: var(--off); color: var(--off); }
.routine-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(135deg, #1a2340 0%, var(--panel) 65%);
  border: 1px solid var(--jay-dim);
  border-radius: 16px;
  padding: 22px 24px;
}
.routine-banner p { color: var(--muted); font-size: 14px; max-width: 52ch; margin-top: 6px; }
.home-split { display: grid; grid-template-columns: 5fr 7fr; gap: 14px; margin-top: 14px; }
.home-voice, .home-recent { padding: 18px 4px; }
.voice-type { font-size: 24px; font-weight: 600; margin-top: 8px; }
.voice-range { color: var(--muted); font-size: 14px; margin: 2px 0 12px; }
.voice-cta { color: var(--muted); font-size: 14px; margin: 8px 0 12px; max-width: 40ch; }
.bests { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel-2); margin-top: 18px; }
.bests .ro + .ro { border-left: 1px solid var(--line-soft); }
.home-recent .sum-list { margin-top: 10px; }
.tip { border-top: 1px solid var(--line-soft); padding-top: 14px; margin-top: 26px; }

/* ---------- settings ---------- */
.set-block { margin-top: 26px; max-width: 62ch; }
.set-block .btn { margin-top: 12px; }
.set-note { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.text-input {
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  width: min(100%, 320px);
}
.text-input:focus-visible { outline: 2px solid var(--jay); outline-offset: 2px; }
.text-input::placeholder { color: var(--muted-2); }
.voice-seg { flex-wrap: wrap; }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 12px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); font-size: 14px; padding: 12px 18px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50; max-width: min(90vw, 480px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto;
    flex-direction: row; align-items: center; padding: 8px 10px;
    /* clear Android/iOS gesture bar */
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    border-right: none; border-top: 1px solid var(--line); z-index: 30;
  }
  .brand, .side-foot { display: none; }
  .mic-toggle { margin-top: 0; padding: 7px 10px; }
  .mic-toggle .mic-label { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; gap: 0; }
  .nav button { flex-direction: column; gap: 4px; font-size: 10px; padding: 7px 5px; }
  main { padding: 22px 18px calc(110px + env(safe-area-inset-bottom, 0px)); }
  .note { font-size: 76px; }
  .range-live { font-size: 64px; }
  .breath-grid, .home-split { grid-template-columns: 1fr; }
  .home-actions { grid-template-columns: 1fr 1fr; }
  canvas.roll { height: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  .needle, .note, .hold-fill, .meter-fill, #toast, .btn, .nav button, .seg button, .step-chip, .bubble-fill, .home-action, .voice-chip, .pitch-arrow, .lesson-card { transition: none; }
  .note.locked { text-shadow: none; }
  .needle.locked { box-shadow: none; }
  .key.edge { box-shadow: none; }
  .mic-dot { box-shadow: none; }
  .bubble.now { box-shadow: none; }
}
