/* Light by default; see below for dark. */
:root {
  color-scheme: light dark;
  --bg: #f6f6f4;
  --panel: #ffffff;
  --panel-2: #f0f0ed;
  --line: #e4e4e0;
  --line-strong: #d2d2cc;
  --text: #1c1c1a;
  --muted: #74746e;
  --accent: #e8890c;
  --accent-soft: #fdf0dc;
  --on-accent: #ffffff;
  --accent-2: #a85f00;
  --khali: #3b82c4;
  --khali-soft: #e3eef8;
  --danger: #d64545;
  --ok: #2f9e5b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .03);
  --topbar-bg: rgba(246, 246, 244, .82);
}
/* Dark: when the system asks for it (unless the theme button forces light),
   or when the theme button forces it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #111112;
    --panel: #1a1a1c;
    --panel-2: #242427;
    --line: #2b2b2f;
    --line-strong: #3a3a3f;
    --text: #ececea;
    --muted: #8f8f8a;
    --accent: #f59e2b;
    --accent-soft: #33240f;
    --on-accent: #1a1206;
    --accent-2: #ffc67a;
    --khali: #6aaee8;
    --khali-soft: #16293b;
    --danger: #ef6b6b;
    --ok: #5cc485;
    --shadow: none;
    --topbar-bg: rgba(17, 17, 18, .8);
  }
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #111112;
  --panel: #1a1a1c;
  --panel-2: #242427;
  --line: #2b2b2f;
  --line-strong: #3a3a3f;
  --text: #ececea;
  --muted: #8f8f8a;
  --accent: #f59e2b;
  --accent-soft: #33240f;
  --on-accent: #1a1206;
  --accent-2: #ffc67a;
  --khali: #6aaee8;
  --khali-soft: #16293b;
  --danger: #ef6b6b;
  --ok: #5cc485;
  --shadow: none;
  --topbar-bg: rgba(17, 17, 18, .8);
}
:root[data-theme=light] { color-scheme: light; }

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
}
h3 { margin: 0 0 12px; font-size: .95rem; font-weight: 600; letter-spacing: -.005em; }
code, kbd {
  background: var(--panel-2); padding: 1px 6px; border-radius: 5px; font-size: .85em;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}
kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ── Controls ── */
button, .button, select, input[type=text], input[type=number], textarea {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font: inherit;
  font-size: .9rem;
  min-height: 36px;
  transition: border-color .12s, background .12s, color .12s;
}
button, .button {
  cursor: pointer; user-select: none; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button:hover, .button:hover { background: var(--panel-2); }
button:disabled { opacity: .4; cursor: default; }
button:disabled:hover { background: var(--panel); }
button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.06); background: var(--accent); }
button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); background: transparent; }
button.icon {
  background: none; border: none; font-size: 1.2rem; color: var(--muted);
  padding: 0 6px; min-height: 0;
}
button.icon:hover { color: var(--accent); background: none; }
#favBtn { color: var(--accent); }

select {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238f8f8a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type=number] { width: 76px; }
input[type=text], textarea { min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { width: 100%; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .88rem; resize: vertical; line-height: 1.5; }
select:focus-visible, input:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0 6px 0 0; vertical-align: -3px; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 20px; background: transparent; cursor: pointer; margin: 0;
}
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line-strong); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-strong); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
input[type=range]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
input[type=range]:focus-visible { box-shadow: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }

.row { display: flex; align-items: center; gap: 6px; }
.row.wrap { flex-wrap: wrap; margin-top: 12px; gap: 8px; }

/* ── Top bar ── */
#topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 24px; background: var(--topbar-bg); border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  position: sticky; top: 0; z-index: 20;
}
#brand { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
#brand::before {
  content: ''; width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto;
  background: radial-gradient(circle, var(--bg) 0 3px, var(--accent) 3.5px);
}
#themeBtn {
  margin-left: auto; flex: 0 0 auto; width: 36px; height: 36px; padding: 0;
  border-radius: 50%; border-color: transparent; background: none; color: var(--muted);
}
#themeBtn:hover { background: var(--panel-2); color: var(--text); }
#themeBtn svg { width: 18px; height: 18px; }
#tabs { display: flex; gap: 2px; padding: 3px; background: var(--panel-2); border-radius: 11px; overflow-x: auto; }
.tab-btn {
  background: none; border: none; color: var(--muted); border-radius: 8px;
  padding: 5px 14px; min-height: 30px; white-space: nowrap;
}
.tab-btn:hover { background: none; color: var(--text); }
.tab-btn.active { color: var(--text); background: var(--panel); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

#banner {
  background: var(--accent-soft); color: var(--accent-2); padding: 10px 24px; font-size: .9rem;
  border-bottom: 1px solid var(--line);
}

/* ── Transport ── */
#transport {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px;
  max-width: 1720px; margin: 20px 24px 0; padding: 14px 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
#transport label {
  display: block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: 6px;
}
#transport label .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
#transport .tgroup input[type=range] { width: 150px; }
#transport .status { margin-left: auto; font-size: .88rem; text-align: right; line-height: 1.7; }
#transport .status b { font-weight: 600; font-variant-numeric: tabular-nums; }
#tempo { font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; padding: 7px 4px; -moz-appearance: textfield; }
#tempo::-webkit-inner-spin-button, #tempo::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* − / + pairs read as one stepper */
#tempoDown, #keyDown { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: -7px; }
#tempoUp, #keyUp { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -7px; }
#tempo, #key { border-radius: 0; position: relative; z-index: 1; }
#tempoDown, #tempoUp, #keyDown, #keyUp { width: 36px; padding: 0; font-size: 1.05rem; }
#tempoHalf { margin-left: 6px; }
.play {
  width: 56px; height: 56px; border-radius: 50%; font-size: 1.35rem; padding: 0;
  background: var(--accent); color: var(--on-accent); border: none;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform .1s, background .15s, box-shadow .15s;
}
.play:hover { background: var(--accent); transform: scale(1.04); }
.play:active { transform: scale(.97); }
.play.playing { background: var(--text); color: var(--bg); box-shadow: none; }
.play.playing:hover { background: var(--text); }
.play.pending { animation: pulse 0.8s infinite alternate; }
.play.loading { opacity: .6; }
@keyframes pulse { to { opacity: .55; } }

main { padding: 20px 24px 48px; max-width: 1768px; margin: 0 auto; }
@media (min-width: 1768px) { #transport { margin-left: auto; margin-right: auto; } }
.tab { display: none; }
.tab.active { display: block; }

.presets { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.presets label { color: var(--muted); font-size: .85rem; font-weight: 500; }
.presets select { min-width: 160px; }

/* ── Beat grid ── */
.beat-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.vibhag { display: flex; flex-direction: column; gap: 6px; }
.vibhag .mark { font-weight: 700; color: var(--accent); font-size: .85rem; padding-left: 2px; }
.vibhag .mark.khali { color: var(--khali); }
.vibhag .cells { display: flex; gap: 5px; }
.cell {
  min-width: 64px; padding: 10px 8px 11px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  transition: background .06s, color .06s, transform .06s;
}
.cell .num { font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cell .bol { font-weight: 600; white-space: nowrap; }
.cell.sam { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cell.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: translateY(-2px); }
.cell.on .num { color: var(--on-accent); opacity: .8; }
.cell.error { border-color: var(--danger); color: var(--danger); }
.beat-grid.small .cell { min-width: 48px; padding: 6px; font-size: .85rem; }

/* ── Channel cards ── */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card > select { width: 100%; margin-bottom: 10px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 0; flex: 1; }
.field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 10px 0; }
.field > label:first-child { flex: 0 0 auto; min-width: 112px; font-size: .86rem; color: var(--muted); }
.field > label:first-child:has(input[type=checkbox]) { color: var(--text); }
.field input[type=text], .field input[type=range], .field select { flex: 1; min-width: 120px; }
.field select { max-width: 100%; }
.card .sub { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 4px; }
.card p.small:empty { display: none; }
#manjeeraError { color: var(--danger); margin: 0; }
details { margin-top: 10px; }
details summary { cursor: pointer; color: var(--muted); font-size: .86rem; }
details summary:hover { color: var(--text); }

.switch { position: relative; width: 36px; height: 21px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute; inset: 0; background: var(--line-strong); border-radius: 21px; cursor: pointer; transition: .18s;
}
.switch span::before {
  content: ''; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px;
  background: white; border-radius: 50%; transition: .18s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(15px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.card.off { opacity: .55; }
.instruments .card.off { opacity: 1; }
.instruments .card.off h3 { color: var(--muted); }
.instruments .card.off .inst-body { opacity: .55; }

/* ── Player layout: rail · instruments · Taal · Sargam ── */
/* Each part is a .pane that the rail opens and closes. Sargam fills the
   body; while an instrument is open (.inst-open) it shrinks to its panel
   width. Flex sizes are transitioned, so opening and closing slide. */
.player-layout { display: flex; gap: 16px; align-items: flex-start; }
.player-layout > .card { margin: 0; }
.push-right { margin-left: auto; }
#card-taal { flex: 0 0 300px; min-width: 0; }
#sargamPanel {
  flex: 1 1 0; min-width: 0; position: sticky; top: 72px;
  max-height: calc(100vh - 92px); overflow-y: auto;
}
.inst-open #sargamPanel { flex: 0 0 370px; }
.instruments {
  flex: 1 1 0; min-width: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 10px 12px; align-items: start;
}

.pane {
  transition: flex-grow .35s ease, flex-basis .35s ease, margin-left .35s ease, opacity .25s ease,
              padding .35s ease, border-width .35s ease;
}
/* Closed: zero width (the negative margin cancels the gap), faded out. */
.pane:not(.open) {
  flex: 0 0 0 !important; margin-left: -16px; opacity: 0; overflow: hidden;
  padding-left: 0 !important; padding-right: 0 !important; border-left-width: 0; border-right-width: 0;
}
.pane:not(.open):not(.moving) { display: none; }
/* While sliding, contents keep a usable width and are clipped, not squashed. */
.pane.moving > * { min-width: 260px; }

.inst-rail {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  position: sticky; top: 72px;
}
.rail-sep { width: 24px; height: 1px; background: var(--line); margin: 4px 0; }
.inst-btn {
  position: relative; width: 44px; height: 44px; min-height: 0; padding: 0;
  border: none; border-radius: 10px; background: none; color: var(--muted);
}
.inst-btn svg { width: 24px; height: 24px; }
.inst-btn:hover { background: var(--panel-2); color: var(--text); }
.inst-btn.on { color: var(--text); }
.inst-btn.active, .inst-btn.active:hover { background: var(--accent-soft); color: var(--accent-2); }
/* Dot: that part is switched on. */
.inst-btn .dot {
  position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); opacity: 0; transform: scale(.4); transition: opacity .15s, transform .15s;
}
.inst-btn.on .dot { opacity: 1; transform: none; }

.instruments .card { margin: 0; min-width: 260px; display: none; padding: 14px 16px 16px; }
.instruments .card.open, .instruments .card.moving { display: block; }
.inst.open { animation: pane-in .35s ease; }
@keyframes pane-in { from { opacity: 0; transform: translateX(-14px); } }
.inst .card-head { margin: 0 0 12px; gap: 8px; }
.inst-body > select { width: 100%; margin-bottom: 10px; }
.pane-close { font-size: 1rem !important; flex: 0 0 auto; }
.inst #strumBtn { min-height: 28px; padding: 2px 9px; font-size: .8rem; flex: 0 0 auto; }
@media (prefers-reduced-motion: reduce) {
  .pane, .inst.open { transition: none; animation: none; }
}
.field[hidden] { display: none; }
#sargamPanel textarea { margin-bottom: 4px; }
/* Notation on top; the exercise picker, editor and settings below it. */
#sargamPanel .turn { margin-top: 0; }
.sargam-help { margin: 12px 0 0; }
.sargam-settings { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.sargam-settings > select { width: 100%; margin-bottom: 10px; }
#sargamError:empty, #sargamWarn:empty { display: none; }
.status-line.warn { color: var(--accent-2); }
#sargamEditor .hint { margin: 2px 0 6px; line-height: 1.55; }
#sargamEditor .row { margin: 6px 0 8px; flex-wrap: wrap; }
#sargamEditor .field input { flex: 1; min-width: 0; }
#sargamPanel .field > label:first-child { min-width: 92px; }
#sargamPanel .field select { flex: 1; min-width: 0; }
.turn {
  margin: 14px 0 10px; padding: 8px 12px; border-radius: var(--radius-sm); text-align: center;
  background: var(--panel-2); font-weight: 600; font-size: .88rem;
}
.turn.listen { background: var(--khali-soft); color: var(--khali); }
.turn.yours { background: var(--accent-soft); color: var(--accent-2); }
.sargam-lines { display: flex; flex-direction: column; gap: 6px; }
.s-line {
  display: flex; gap: 6px; align-items: flex-start; padding: 8px 6px; border-radius: 10px;
  border: 1px solid transparent; transition: background .15s;
}
.s-line.current { border-color: var(--line); background: var(--panel-2); }
.s-line .ln { flex: 0 0 18px; font-size: .72rem; color: var(--muted); padding-top: 8px; font-variant-numeric: tabular-nums; }
.s-line .vibs { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.s-vib { display: flex; gap: 3px; }
.s-beat {
  display: flex; gap: 1px; padding: 4px 3px 6px; min-width: 34px; justify-content: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px; position: relative;
}
.s-beat.sam::after { content: 'X'; position: absolute; top: -9px; left: 2px; font-size: .6rem; color: var(--accent); font-weight: 700; }
.sw {
  position: relative; display: inline-block; min-width: 1.15em; text-align: center;
  flex: 1 1 0; white-space: nowrap;
  font-weight: 600; font-size: .9rem; padding: 2px 1px; border-radius: 4px;
}
.sw.pad { color: var(--line-strong); }
.sw.held { color: var(--muted); }
.sw.rest { color: var(--muted); font-weight: 400; }
.sw.komal .nm {  text-underline-offset: 3px; } /* text-decoration: underline;*/
.sw.tivra .nm::before { content: ''; position: absolute; top: -1px; left: 50%; width: 1px; height: 5px; background: currentColor; }
.sw.taar::after, .sw.mandra::after {
  content: ''; position: absolute; left: 50%; width: 3px; height: 3px; margin-left: -1.5px;
  border-radius: 50%; background: currentColor;
}
.sw.taar::after { top: -2px; }
.sw.mandra::after { bottom: -3px; }
.sw.taar2::after { box-shadow: 4px 0 0 currentColor; margin-left: -3.5px; }
.sw.on { background: var(--accent); color: var(--on-accent); }
.sw.ok { box-shadow: inset 0 -3px 0 var(--ok); }
.sw.low { box-shadow: inset 0 -3px 0 var(--khali); }
.sw.high { box-shadow: inset 0 -3px 0 var(--danger); }
.sw.miss { box-shadow: inset 0 -3px 0 var(--muted); opacity: .7; }
.legend span { margin-right: 10px; white-space: nowrap; }
.legend i { display: inline-block; width: 10px; height: 3px; vertical-align: middle; margin-right: 4px; }

@media (max-width: 1180px) {
  #card-taal { flex-basis: 270px; }
  .inst-open #sargamPanel { flex-basis: 330px; }
}
@media (max-width: 1000px) {
  .player-layout { flex-direction: column; align-items: stretch; }
  /* Stacked: every block takes its natural height. (The desktop flex sizes
     would squash the sargam panel to a sliver that scrolls inside itself.) */
  .player-layout > *, #sargamPanel, .inst-open #sargamPanel, .instruments { flex: none; width: 100%; }
  #sargamPanel { position: static; max-height: none; overflow: visible; }
  .inst-rail { flex-direction: row; position: static; width: auto; align-self: flex-start; }
  .rail-sep { width: 1px; height: 24px; margin: 0 4px; }
  .instruments { margin: 0; grid-template-columns: 1fr; }
  .instruments .card { min-width: 0; }
  /* Stacked: closed panes simply disappear (no sideways slide). */
  .pane:not(.open) { display: none !important; }
}

/* ── Composer / Sequences ── */
.two-col { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; align-items: start; }
.two-col > .card, .two-col > div > .card:last-child { margin-bottom: 0; }
.two-col > div > .card + .card { margin-top: 16px; }
.status-line { margin: 8px 0; font-size: .86rem; min-height: 1.2em; }
.status-line.ok { color: var(--ok); }
.status-line.err { color: var(--danger); }
.pads { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.pads button { padding: 12px 4px; font-weight: 600; background: var(--panel-2); border-color: transparent; }
.pads button:hover { border-color: var(--line-strong); }
.pads button.flash { background: var(--accent); color: var(--on-accent); }
.list { list-style: none; margin: 0 0 12px; padding: 0; }
.list li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer;
}
.list li:hover { background: var(--panel-2); }
.list li.sel { background: var(--accent-soft); }
.list li .muted { font-size: .8rem; }
.list .empty { color: var(--muted); cursor: default; }
.list .empty:hover { background: none; }
.steps { width: 100%; border-collapse: collapse; margin: 10px 0; }
.steps th {
  text-align: left; font-size: .72rem; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; padding: 6px 4px; border-bottom: 1px solid var(--line);
}
.steps td { padding: 5px 4px; }
.steps td select { width: 100%; }
.steps tr.current td { background: var(--accent-soft); }
.steps tr.current td:first-child { border-radius: 8px 0 0 8px; }
.steps tr.current td:last-child { border-radius: 0 8px 8px 0; }

/* ── Tuner ── */
.tuner { max-width: 520px; margin: 0 auto; text-align: center; padding: 28px; }
.tuner .row { justify-content: center; flex-wrap: wrap; margin-top: 18px; gap: 8px; }
.tuner-note { font-size: 4rem; font-weight: 700; color: var(--accent); letter-spacing: -.02em; margin-top: 8px; }
.meter { position: relative; height: 28px; background: var(--panel-2); border-radius: 14px; margin: 16px 0 8px; overflow: hidden; }
.meter .zero { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--line-strong); }
#tNeedle { position: absolute; top: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); left: calc(50% - 10px); transition: left .08s; }
#tNeedle.good { background: var(--ok); }

/* ── Settings ── */
#tab-settings { max-width: 720px; margin: 0 auto; }
#tab-settings .card .field > label:first-child { min-width: 140px; }

@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; }
  #topbar { gap: 12px; padding: 8px 12px; }
  #brand { font-size: .95rem; }
  #transport { margin: 12px 12px 0; padding: 14px; gap: 14px 18px; }
  #transport .status { margin-left: 0; text-align: left; }
  main { padding: 14px 12px 40px; }
  .cell { min-width: 52px; }
}
@media (max-width: 560px) {
  #brand { display: none; }
  #tabs { flex: 1; }
  .tab-btn { padding: 5px 10px; flex: 1; }
  #transport { gap: 12px; }
  #transport .tgroup { flex: 1 1 100%; }
  #transport .tgroup input[type=range] { width: 100%; }
  #transport .row { flex-wrap: wrap; row-gap: 8px; }
  #tempo { flex: 1; min-width: 56px; }
  .play { width: 52px; height: 52px; }
  #transport > .play { flex: 0 0 auto; order: -2; }
  #transport .status { flex: 1 1 0; order: -1; text-align: right; }
  .cell { min-width: 0; flex: 1; }
  .vibhag { flex: 1 1 100%; }
  .beat-grid { gap: 10px; }
  .field > label:first-child { min-width: 96px; }
}
