/* Design tokens ------------------------------------------------------------
   Every color in the app lives here and nowhere else. A light theme (or a
   prefers-color-scheme switch) only needs to redefine these values. */
:root {
  color-scheme: dark;

  /* Surfaces */
  --bg-page: #1c1c1e;
  --bg-raised: #26262a;
  --bg-raised-hover: #303035;

  /* Lines */
  --border: #3a3a40;
  --border-control: #4a4a52;

  /* Text */
  --text: #e8e8ea;
  --text-muted: #9c9ca3;

  /* Interaction */
  --accent: #4cc3a0;
  --text-on-accent: #1c1c1e;
  --focus: #ef9f27;

  /* Fretboard */
  --board-bg: #25221f;
  --board-string: #8e8e95;
  --board-fret: #55555c;
  --board-nut: #d0d0d4;
  --board-inlay: #45454b;
  --board-fretnum: var(--text-muted);
  --dot-scale: #13856a;
  --dot-root: #c24c26;
  /* Root color for small text on dark surfaces; --dot-root is too dark
     for AA at that size. */
  --root-text: #f07a52;
  --dot-label: #ffffff;
  --pointer: #ef9f27;

  /* Keyboard: lit white keys use --dot-root and --dot-scale; lit black keys
     a darker shade of each. */
  --kb-white: #dcdad4;
  --kb-black: #141416;
  --kb-edge: #55555c;
  --kb-black-tone: #0c5a48;
  --kb-black-root: #8a3419;
  --kb-octave: var(--text-muted);

  /* Grand staff: sheet music stays dark ink on light paper in every theme. */
  --staff-paper: #f4f1ea;
  --staff-ink: #141414;

  /* Tuner pedal */
  --tn-body: var(--dot-scale);
  --tn-body-shade: #0c5a48;
  --tn-body-edge: #2aa98a;
  --tn-body-label: #d9f3ea;
  --tn-window: #111113;
  --tn-bar-unlit: #2b2b30;
  --tn-out: #f0603f;
  --tn-in: #5fe3a1;
  --tn-jack: var(--border);
  --tn-dim: #5a5a62;
  --tn-label: #8a8a93;
  --tn-note: var(--text);
  --tn-name: var(--dot-label);
  --tn-light-on: #c9ffe9;
  --tn-light-off: #0a4d3e;
  --tn-switch-face-top: #e3e5e8;
  --tn-switch-face-bottom: #8d9197;
  --tn-switch-face-edge: #6f7379;
  --tn-switch-top: #c3c6cb;
  --tn-switch-top-edge: #8b8f95;

  /* Tip jar */
  --coin-edge: #9a5f08;
  --tooltip-bg: #f2f2f4;
  --tooltip-text: var(--text-on-accent);
  --tooltip-shadow: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

a {
  color: var(--accent);
}

button,
select {
  font: inherit;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border-control);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}

button:hover,
select:hover {
  background: var(--bg-raised-hover);
  border-color: var(--text-muted);
}

/* Windows renders the open dropdown list from the option colors. */
option {
  color: var(--text);
  background: var(--bg-raised);
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Header ------------------------------------------------------------------ */

.app-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.app-name {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* Shown only while Collaborate Mode sync is active. */
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.sync-status[hidden] {
  display: none;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.sync-status.is-live {
  color: var(--text);
}

.sync-status.is-live .sync-dot {
  background: var(--dot-scale);
}

.sync-status.is-reconnecting .sync-dot {
  background: var(--pointer);
}

/* Plain-browser only: what this is and where to get it. */
.welcome {
  margin: 12px 16px 0;
  color: var(--text-muted);
  font-size: 14px;
}

main {
  padding: 16px;
}

/* Segmented controls ------------------------------------------------------ */

/* The tool switcher and the chord Labels control: one row of buttons;
   neighbours overlap by a pixel so each shared edge is a single border. */
.tool-switcher {
  display: flex;
  padding: 12px 16px 0;
}

.ch-segmented {
  display: flex;
}

.tool-switcher button,
.ch-segmented button {
  border-radius: 0;
  white-space: nowrap;
}

.tool-switcher button + button,
.ch-segmented button + button {
  margin-left: -1px;
}

.tool-switcher button:first-child,
.ch-segmented button:first-child {
  border-radius: 6px 0 0 6px;
}

.tool-switcher button:last-child,
.ch-segmented button:last-child {
  border-radius: 0 6px 6px 0;
}

/* Shared pressed look for switcher, segmented and chord-type buttons. */
.tool-switcher button[aria-pressed="true"],
.ch-segmented button[aria-pressed="true"],
.ch-types button[aria-pressed="true"] {
  position: relative;
  z-index: 1;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  font-weight: 600;
}

/* Keeps the focus outline above the overlapping neighbour. */
.tool-switcher button:focus-visible,
.ch-segmented button:focus-visible {
  position: relative;
  z-index: 2;
}

/* A tool still working while hidden (the running metronome). */
.tool-switcher button.is-running::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--dot-root);
  vertical-align: middle;
}

/* Six tools need about 620px for one row at full padding. Between 540px and
   700px the buttons share the row: tighter padding, and a long label may
   wrap inside its button rather than overflow. */
@media (min-width: 540px) and (max-width: 699px) {
  .tool-switcher button {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 8px;
    white-space: normal;
  }
}

/* In the dock the switcher becomes a joined two-column block of equal
   buttons (three rows for six tools), and a long label may wrap inside its
   button rather than clip. With an odd number of tools the last one spans
   the bottom row. The block starts below 540px. */
@media (max-width: 539px) {
  .tool-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tool-switcher button {
    white-space: normal;
  }

  .tool-switcher button + button {
    margin-left: 0;
  }

  .tool-switcher button:nth-child(even) {
    margin-left: -1px;
  }

  .tool-switcher button:nth-child(n + 3) {
    margin-top: -1px;
  }

  .tool-switcher button:first-child {
    border-radius: 6px 0 0 0;
  }

  .tool-switcher button:nth-child(2) {
    border-radius: 0 6px 0 0;
  }

  .tool-switcher button:nth-last-child(2) {
    border-radius: 0 0 0 6px;
  }

  .tool-switcher button:last-child {
    border-radius: 0 0 6px 0;
  }

  .tool-switcher button:nth-last-child(2):nth-child(even) {
    border-radius: 0;
  }

  .tool-switcher button:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    border-radius: 0 0 6px 6px;
  }
}

/* Fretboard --------------------------------------------------------------- */

.fb-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.fb-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fb-field-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fb-field select {
  min-width: 72px;
  max-width: 200px;
}

.fb-toggle {
  align-self: flex-end;
  white-space: nowrap;
}

.fb-range {
  width: 140px;
  height: 34px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.fb-readout {
  align-self: flex-end;
  line-height: 34px;
  color: var(--text-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Both orientations are a fixed-size viewport onto the neck, so the SVG just
   fills its container width. The board owns every touch gesture (drag pans,
   tap rings), so the browser must not scroll or zoom from it. */
.fb-svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.fb-board.is-dragging .fb-svg {
  cursor: grabbing;
}

.fb-hint {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.fb-board-bg {
  fill: var(--board-bg);
}

.fb-string {
  stroke: var(--board-string);
  stroke-width: 1.5;
}

.fb-fret {
  stroke: var(--board-fret);
  stroke-width: 2;
}

.fb-nut {
  stroke: var(--board-nut);
  stroke-width: 6;
}

.fb-inlay {
  fill: var(--board-inlay);
}

.fb-fretnum {
  fill: var(--board-fretnum);
  font-size: 15px;
  font-weight: 600;
  text-anchor: middle;
}

/* Portrait runs the numbers down the left edge, so they centre on the fret
   rather than sitting on a baseline below the board. */
.fb-fretnum--side {
  dominant-baseline: central;
}

.fb-dot {
  fill: var(--dot-scale);
  pointer-events: none;
}

.fb-dot--root {
  fill: var(--dot-root);
}

.fb-label {
  fill: var(--dot-label);
  font-size: 14px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.fb-ring {
  fill: none;
  stroke: none;
  pointer-events: none;
}

.fb-ring.is-on {
  stroke: var(--pointer);
  stroke-width: 3;
}

/* Keeps the board's grab cursor; the target only carries the tooltip. A zero
   fill-opacity (rather than fill: none) keeps it hit-testable for hover. */
.fb-hit {
  fill-opacity: 0;
}

/* Circle of fifths -------------------------------------------------------- */

/* Fills a narrow dock but stops growing in a wide popout. */
.cof {
  max-width: 560px;
  margin: 0 auto;
}

.cof-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.cof-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.cof-svg {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-select: none;
}

/* Keyboard focus is drawn by .cof-focus-ring instead. */
.cof-seg {
  cursor: pointer;
  outline: none;
}

.cof-shape {
  fill: var(--bg-raised);
  stroke: var(--bg-page);
  stroke-width: 2;
}

.cof-seg:hover .cof-shape {
  fill: var(--bg-raised-hover);
}

.cof-seg.is-scale .cof-shape {
  fill: var(--dot-scale);
}

.cof-seg.is-tonic .cof-shape {
  fill: var(--dot-root);
}

.cof-name,
.cof-numeral,
.cof-sig,
.cof-center-name,
.cof-center-sig {
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.cof-name {
  fill: var(--text);
}

.cof-seg--major .cof-name {
  font-size: 17px;
  font-weight: 650;
}

.cof-seg--minor .cof-name {
  font-size: 14px;
  font-weight: 600;
}

.cof-seg--major .cof-name--long {
  font-size: 13px;
}

.cof-numeral {
  fill: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.cof-seg.is-scale .cof-name,
.cof-seg.is-scale .cof-numeral,
.cof-seg.is-tonic .cof-name,
.cof-seg.is-tonic .cof-numeral {
  fill: var(--dot-label);
}

.cof-seg.is-dim .cof-numeral {
  fill: var(--pointer);
}

.cof-dim-outline {
  fill: none;
  stroke: var(--pointer);
  stroke-width: 2.5;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

.cof-focus-ring {
  fill: none;
  stroke: none;
  pointer-events: none;
}

.cof-focus-ring.is-on {
  stroke: var(--focus);
  stroke-width: 3;
}

.cof-sig {
  fill: var(--text-muted);
  font-size: 10px;
}

.cof-center {
  fill: var(--bg-raised);
  stroke: var(--border);
  stroke-width: 1.5;
}

.cof-center-name {
  fill: var(--text);
  font-size: 15px;
  font-weight: 650;
}

.cof-center-sig {
  fill: var(--text-muted);
  font-size: 12px;
}

.cof-readout {
  margin-top: 12px;
}

.cof-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  margin: 0 0 6px;
}

.cof-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cof-chords {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0 0.9em;
}

/* Chords ------------------------------------------------------------------ */

/* Fills a narrow dock but stays centered in a wide popout. 800px fits two
   cards side by side (3 x 260 + gaps would need 804px), so a third wraps. */
.chords {
  max-width: 800px;
  margin: 0 auto;
}

.ch-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 10px;
}

.ch-type-field {
  margin-bottom: 14px;
}

.ch-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ch-types button {
  min-width: 44px;
  padding: 5px 10px;
  white-space: nowrap;
}

.ch-header {
  margin-bottom: 12px;
}

.ch-name {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
  line-height: 1.2;
}

.ch-meta {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* One full-width card per row in the ~320px dock; two or more side by side
   from 532px (2 x 260 + gap) up. min(100%, 260px) keeps a dock narrower
   than 260px from overflowing. The card's max-width stops a lone card from
   ballooning in a mid-width window; cards stay left-aligned with the
   controls and header above them. */
.ch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 12px;
}

.ch-card {
  max-width: 380px;
  padding: 8px 8px 4px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.ch-card-title {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.ch-svg {
  display: block;
  width: 100%;
  height: auto;
}

.ch-string,
.ch-fret {
  stroke: var(--board-string);
  stroke-width: 1.5;
}

.ch-nut {
  stroke: var(--board-nut);
  stroke-width: 6;
}

.ch-fretnum,
.ch-mark,
.ch-label,
.ch-open-label {
  dominant-baseline: central;
}

.ch-fretnum {
  fill: var(--text-muted);
  font-size: 13px;
  text-anchor: end;
}

.ch-mark {
  fill: var(--text-muted);
  font-size: 16px;
  text-anchor: middle;
}

.ch-open {
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.5;
}

.ch-dot {
  fill: var(--dot-scale);
}

.ch-dot--root {
  fill: var(--dot-root);
}

.ch-barre {
  fill: var(--dot-scale);
}

.ch-barre--under {
  fill-opacity: 0.35;
}

/* Same size and weight as the fretboard's dot labels. */
.ch-label {
  fill: var(--dot-label);
  font-size: 14px;
  font-weight: 650;
  text-anchor: middle;
}

.ch-open-label {
  fill: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-anchor: middle;
}

.ch-open-label--root {
  fill: var(--root-text);
}

/* Keyboard ---------------------------------------------------------------- */

/* Up to three octaves of 47px keys; stays centered in a wide popout. */
.kb {
  max-width: 1040px;
  margin: 0 auto;
}

/* Two groups that each wrap as a whole: the segmented pair, then the
   selects. They share one line when wide (about 570px and up); in the dock
   the pair takes the first line and the selects the second. */
.kb-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.kb-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kb-selects {
  display: flex;
  flex: 1 1 260px;
  gap: 8px;
  min-width: 0;
}

/* Key is as wide as its widest option ("C♯/D♭"); Type fills the rest of
   the line. */
.kb-key-select,
.kb-inversion-select,
.kb-clear {
  flex: none;
}

.kb-type-select {
  flex: 1 1 0;
  min-width: 0;
}

/* The scale or chord Type, and Inversion, are hidden by mode. */
.kb-controls [hidden] {
  display: none;
}

/* The SVG is a fixed-size window onto the keyboard and fills its container
   width. The board owns every touch gesture (drag pans, tap rings), so the
   browser must not scroll or zoom from it. */
.kb-svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.kb-board.is-dragging .kb-svg {
  cursor: grabbing;
}

/* Keyboard focus is drawn by .kb-focus-ring instead. */
.kb-key {
  outline: none;
}

/* A black key cut by the window's edge, at rest. */
.kb-key.is-cut {
  display: none;
}

.kb-key--white .kb-shape {
  fill: var(--kb-white);
  stroke: var(--kb-edge);
  stroke-width: 1;
}

.kb-key--black .kb-shape {
  fill: var(--kb-black);
  stroke: var(--kb-edge);
  stroke-width: 1;
}

.kb-key--white.is-tone .kb-shape {
  fill: var(--dot-scale);
}

.kb-key--white.is-root .kb-shape {
  fill: var(--dot-root);
}

.kb-key--black.is-tone .kb-shape {
  fill: var(--kb-black-tone);
}

.kb-key--black.is-root .kb-shape {
  fill: var(--kb-black-root);
}

/* Same weight and color as the fretboard's dot labels. */
.kb-label {
  fill: var(--dot-label);
  font-size: 14px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.kb-key--black .kb-label {
  font-size: 11px;
}

/* The Fretboard's pointer ring. */
.kb-ring {
  fill: none;
  stroke: none;
  pointer-events: none;
}

.kb-ring.is-on {
  stroke: var(--pointer);
  stroke-width: 3;
}

.kb-octave {
  fill: var(--kb-octave);
  font-size: 11px;
  text-anchor: middle;
  pointer-events: none;
}

.kb-focus-ring {
  fill: none;
  stroke: none;
  pointer-events: none;
}

.kb-focus-ring.is-on {
  stroke: var(--focus);
  stroke-width: 3;
}

/* Full width under the keyboard. The chevron points right when collapsed
   and down when open. */
.kb-staff-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  margin-top: 12px;
  text-align: left;
}

.kb-staff-toggle::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin: 0 12px 0 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.kb-staff-toggle[aria-expanded="true"]::before {
  transform: rotate(45deg);
}

.kb-staff {
  margin-top: 8px;
  padding: 8px;
  border-radius: 6px;
  background: var(--staff-paper);
}

.kb-staff[hidden] {
  display: none;
}

/* Centered; its width and height attributes cap a staff space at 12px, and
   it shrinks to fit a narrower panel. */
.st-svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.st-glyph {
  fill: var(--staff-ink);
}

.st-line {
  stroke: var(--staff-ink);
}

.kb-readout {
  margin-top: 12px;
}

.kb-name {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
  line-height: 1.2;
}

.kb-meta {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.kb-hint {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

/* Metronome --------------------------------------------------------------- */

/* Fills a narrow dock but stays compact in a wide popout. */
.metronome {
  max-width: 480px;
  margin: 0 auto;
}

.mt-tempo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mt-step {
  flex: none;
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 8px;
  font-size: 32px;
  line-height: 1;
}

.mt-bpm {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mt-bpm-value {
  font-size: 64px;
  font-weight: 650;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.mt-bpm-unit {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.mt-slider {
  display: block;
  width: 100%;
  height: 34px;
  margin: 12px 0 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.mt-transport {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.mt-start,
.mt-tap {
  padding: 14px 12px;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 650;
}

.mt-start {
  flex: 1;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
}

.mt-start:hover {
  background: var(--accent);
  border-color: var(--text);
}

.mt-start.is-running {
  background: var(--bg-raised);
  border-color: var(--accent);
  color: var(--text);
}

.mt-start.is-running:hover {
  background: var(--bg-raised-hover);
}

.mt-tap {
  flex: 0 0 96px;
}

.mt-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}

.mt-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 2px solid var(--border-control);
}

.mt-dot.is-on {
  background: var(--dot-scale);
  border-color: var(--dot-scale);
}

.mt-dot.is-on.is-accent {
  background: var(--dot-root);
  border-color: var(--dot-root);
}

.mt-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
}

.mt-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  white-space: nowrap;
  cursor: pointer;
}

.mt-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.mt-status {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* Tuner ------------------------------------------------------------------- */

/* A centered column like the metronome; the pedal stops growing at 300px. */
.tuner {
  max-width: 480px;
  margin: 0 auto;
}

.tn-pedal {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
}

.tn-jack {
  fill: var(--tn-jack);
}

.tn-body-shade,
.tn-screw {
  fill: var(--tn-body-shade);
}

.tn-body {
  fill: var(--tn-body);
  stroke: var(--tn-body-edge);
  stroke-width: 1.5;
}

.tn-screw-slot {
  stroke: var(--tn-body);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.tn-window {
  fill: var(--tn-window);
  stroke: var(--tn-light-off);
  stroke-width: 2;
}

.tn-pedal.is-in-tune .tn-window {
  stroke: var(--tn-in);
  stroke-width: 3;
}

.tn-bar {
  fill: var(--tn-bar-unlit);
}

.tn-bar.is-out {
  fill: var(--tn-out);
}

.tn-bar.is-in {
  fill: var(--tn-in);
}

.tn-side,
.tn-letter,
.tn-message,
.tn-brand,
.tn-name {
  text-anchor: middle;
}

.tn-side {
  fill: var(--tn-label);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
}

.tn-side--flat {
  text-anchor: start;
}

.tn-side--sharp {
  text-anchor: end;
}

.tn-pedal:not(.is-on) .tn-side {
  fill: var(--tn-dim);
}

.tn-side.is-active {
  fill: var(--tn-out);
}

.tn-letter {
  fill: var(--tn-note);
  font-size: 78px;
  font-weight: 700;
}

.tn-pedal.is-in-tune .tn-letter {
  fill: var(--tn-in);
}

.tn-message {
  fill: var(--tn-dim);
  font-size: 13px;
}

/* A microphone error must be readable, not dimmed. */
.tn-message.is-error {
  fill: var(--tn-note);
}

/* Inside Zoom, the browser handoff prompt reads like a label. */
.tn-message.is-handoff {
  fill: var(--tn-label);
}

.tn-brand {
  fill: var(--tn-body-label);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 3.5px;
}

.tn-name {
  fill: var(--tn-name);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 5px;
}

.tn-light {
  fill: var(--tn-light-off);
}

.tn-halo {
  display: none;
  fill: var(--tn-light-on);
  opacity: 0.22;
}

.tn-pedal.is-on .tn-light {
  fill: var(--tn-light-on);
}

.tn-pedal.is-on .tn-halo {
  display: inline;
}

/* Keyboard focus is drawn by .tn-switch-ring instead. */
.tn-switch {
  cursor: pointer;
  outline: none;
}

.tn-switch-base {
  fill: var(--tn-body-shade);
}

.tn-switch-face-top {
  stop-color: var(--tn-switch-face-top);
}

.tn-switch-face-bottom {
  stop-color: var(--tn-switch-face-bottom);
}

.tn-switch-cap {
  stroke: var(--tn-switch-face-edge);
  stroke-width: 1.5;
}

.tn-switch-top {
  fill: var(--tn-switch-top);
  stroke: var(--tn-switch-top-edge);
  stroke-width: 1.5;
}

.tn-switch-ring {
  fill: none;
  stroke: none;
  stroke-width: 3;
  pointer-events: none;
}

/* Shown on keyboard focus; engines without :focus-visible ignore the
   second rule and show it on any focus. */
.tn-switch:focus .tn-switch-ring {
  stroke: var(--focus);
}

.tn-switch:focus:not(:focus-visible) .tn-switch-ring {
  stroke: none;
}

/* Under the pedal while this browser tuner runs for the Zoom dock. */
.tn-link-note {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* Page column and tip line ------------------------------------------------ */

/* The app page is at least one viewport tall (dvh where supported, so mobile
   browser toolbars don't hide the bottom). The tip line's auto top margin
   takes all spare height, keeping it at the bottom of a short page; on a tall
   page it follows the content. It stays in normal flow and never overlaps. */
.app-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* The minimum gap to the content is main's 16px bottom padding plus this
   padding-top: about one line of body text. */
.tip-line {
  margin: auto 16px 16px;
  padding-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.tip-line a {
  color: inherit;
}

.tip-line a:hover {
  color: var(--text);
}

/* Anchors the tooltip over the link. */
.tip-jar {
  position: relative;
  display: inline-block;
}

/* Only the words are underlined, not the icon or the gap. */
.tip-jar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  text-decoration: none;
}

/* Accent green, overriding .tip-line a's inherited color; .tip-line a:hover
   is more specific, so hover still turns it --text. The icon outline follows
   through currentColor. */
.tip-line .tip-jar-link {
  color: var(--accent);
}

.tip-jar-label {
  text-decoration: underline;
}

.tip-jar-icon {
  flex: none;
}

.tip-jar-outline {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.tip-jar-coin {
  fill: var(--pointer);
  stroke: var(--coin-edge);
  stroke-width: 0.7;
}

/* Out of flow above the link, so showing it never moves the layout. Centered
   over the link, which is centered in the page, and never wider than the
   window less the footer's 16px margins, so it stays inside a narrow dock.
   Hidden with visibility, not display, so aria-describedby still reads it. */
.tip-jar-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  z-index: 10;
  width: max-content;
  max-width: 230px;
  max-width: min(230px, calc(100vw - 32px));
  padding: 7px 10px;
  border-radius: 5px;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  box-shadow: 0 2px 8px var(--tooltip-shadow);
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
  transform: translateX(-50%);
  visibility: hidden;
  pointer-events: none;
}

.tip-jar-link:hover + .tip-jar-tip,
.tip-jar-link:focus-visible + .tip-jar-tip {
  visibility: visible;
}

/* Post-install welcome page ----------------------------------------------- */

.installed {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 16px;
}

.installed h1 {
  margin: 0 0 12px;
  font-size: 24px;
}

.installed p {
  margin: 0 0 12px;
  color: var(--text-muted);
}
