:root {
  color-scheme: dark;
  --bg: #121417;
  --panel: #1b1f24;
  --ink: #f7f5ef;
  --muted: #aeb6bf;
  --line: rgba(255, 255, 255, 0.1);
  --soft: #222831;
  --accent: #d89020;
  --accent-deep: #b66f14;
  --tint: rgba(216, 144, 32, 0.18);
  --display: #1b2027;
  --on: #4cd137;
  --on-bg: rgba(76, 209, 55, 0.18);
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23aeb6bf' stroke-width='1.6'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E");
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  display: flex;
  flex-direction: column;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
button,
select,
input {
  font: inherit;
  color: inherit;
}
button,
select,
input[type='range'],
input[type='checkbox'] {
  cursor: pointer;
  touch-action: manipulation;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: none;
  background: transparent;
  font-weight: 560;
}
button:active {
  transform: translateY(1px);
}
button:focus-visible,
html:not(.pointer-input) select:focus-visible,
select:is(:open),
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.sprite,
[hidden] {
  display: none !important;
}
.small-button,
.round {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #2a3038, #20252b);
  border-radius: 8px;
  min-height: 42px;
}
.icon-button {
  min-height: 42px;
  width: 42px;
  -webkit-tap-highlight-color: transparent;
}
.icon-button:active {
  transform: none;
}
.icon-button:focus-visible {
  outline: none;
}
.icon-button:focus-visible .icon {
  stroke-width: 3;
}
.small-button {
  padding: 0 15px;
  font-size: 0.875rem;
}
.small-button .icon {
  width: 17px;
}
.instrument-tabs {
  display: flex;
  gap: 3px;
  padding: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.instrument-tabs button {
  height: 35px;
  padding: 0;
  padding-inline: 19px 25px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}
.instrument-tabs .icon {
  width: 17px;
  height: 17px;
}
.instrument-tabs button[aria-pressed='true'] {
  color: #ffffff;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
main {
  width: min(100% - 64px, 1000px);
  margin: 0 auto;
  padding-top: calc(clamp(30px, 5.8vh, 60px) + env(safe-area-inset-top));
}
.legal-footer {
  width: min(100% - 64px, 1000px);
  margin: auto auto 0;
  padding: 16px 0 max(10px, env(safe-area-inset-bottom));
}
.legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
}
.legal-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  color: #c3c7cc;
  font-size: 0.8125rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-footer a[aria-current='page'] {
  color: var(--ink);
}
.legal-footer a:focus-visible,
.legal-content a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.legal-content,
.legal-page .legal-footer {
  max-width: 760px;
}
.legal-content {
  line-height: 1.65;
  overflow-wrap: break-word;
}
.legal-content header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.legal-content h2 {
  margin: 26px 0 8px;
  font-size: 1.125rem;
}
.legal-content p,
.legal-content address {
  margin: 0 0 12px;
  color: var(--muted);
}
.legal-content address {
  font-style: normal;
}
.legal-content a {
  color: var(--ink);
  text-underline-offset: 3px;
}
.legal-back {
  display: inline-block;
  margin-bottom: 18px;
  font-size: 0.875rem;
}
.title-row,
.heading,
.screen-bottom,
.controlbar,
.ref-card,
.ref-controls,
.card-label,
.quickfields,
.dialog-head,
.row {
  display: flex;
  align-items: center;
}
.title-row,
.screen-bottom,
.controlbar,
.ref-card,
.dialog-head,
.row {
  justify-content: space-between;
}
.title-row {
  margin-bottom: 28px;
  gap: 12px;
}
.heading {
  gap: 16px;
  min-width: 0;
  flex-wrap: wrap;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: clamp(2rem, 3.6vw, 2.9rem);
  line-height: 1.14;
  letter-spacing: -0.056em;
  font-weight: 610;
}
h2 {
  font-size: 1.1rem;
  font-weight: 610;
  letter-spacing: -0.035em;
}
.instrument,
.ref-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.instrument {
  overflow: hidden;
}
.screen {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  background-color: var(--display);
  padding: 22px 26px 18px;
}
#screen::before,
.metro-screen::before {
  content: '';
  min-height: 26px;
}
.cent {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 540;
}
#dial {
  display: block;
  width: min(91%, 760px);
  margin: 8px auto 0;
  overflow: visible;
  color: var(--muted);
}
#dial text {
  font:
    13px ui-monospace,
    Menlo,
    monospace;
  fill: currentColor;
}
#dial .center-label {
  fill: var(--accent);
  font-weight: 700;
}
.dial-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 3;
}
.dial-tick {
  stroke: currentColor;
  stroke-width: 1;
}
.dial-major {
  stroke-width: 1.6;
}
.center-mark {
  fill: var(--accent);
}
.needle {
  fill: var(--accent);
  transition: transform 85ms linear;
}
.tuned .needle,
.tuned .center-mark {
  fill: var(--on);
}
.readout {
  text-align: center;
  margin: 0 auto 2px;
}
.big-note {
  font-size: clamp(5rem, 8.5vw, 7.7rem);
  font-weight: 520;
  letter-spacing: 0.015em;
  line-height: 1.02;
  font-variant-numeric: tabular-nums;
}
.big-note sub {
  font-size: 0.36em;
  vertical-align: baseline;
  letter-spacing: -0.06em;
  margin-left: 4px;
}
.frequency,
.cent,
.meter,
.tempo-slider,
.beats {
  font-variant-numeric: tabular-nums;
}
.frequency {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 0.93rem;
  letter-spacing: -0.035em;
  margin-top: 9px;
  color: var(--muted);
}
.tuned .big-note,
.tuned .cent {
  color: var(--on);
}
.held .readout,
.held .cent,
.held .needle,
.held .center-mark {
  opacity: 0.4;
}
.screen-bottom {
  min-height: 28px;
}
.levels,
.meter {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}
.levels {
  gap: 8px;
}
.levels .icon {
  width: 16px;
}
.meter i {
  width: 3px;
  height: 11px;
  border-radius: 2px;
  background: var(--line);
}
.meter i.lit {
  background: var(--accent);
}
.cent {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 9px;
  background: var(--panel);
  font-family: ui-monospace, Menlo, monospace;
}
.controlbar {
  padding: 20px 26px;
  border-top: 1px solid var(--line);
  gap: 18px;
}
.quickfields,
.ref-controls {
  gap: 22px;
}
label {
  font-size: 0.79rem;
  font-weight: 550;
  color: var(--muted);
}
.quickfields label,
.ref-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
select {
  appearance: none;
  background: #111519 var(--chevron) no-repeat right 10px center;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 38px;
  font-size: 0.91rem;
  font-weight: 560;
  color: var(--ink);
}
.quickfields select {
  border-color: transparent;
  background-color: transparent;
  padding-left: 0;
  min-height: 27px;
}
.primary {
  border-radius: 8px;
  background: linear-gradient(135deg, #e6a32b, var(--accent-deep));
  color: white;
  padding: 0 21px;
  min-height: 47px;
  font-size: 0.93rem;
}
.ref-card {
  padding: 18px 25px;
  margin-top: 17px;
  min-height: 89px;
}
.card-label {
  gap: 13px;
}
.tile {
  background: var(--tint);
  color: var(--accent);
  border-radius: 11px;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
}
.ref-controls {
  gap: 13px;
}
.ref-controls label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.ref-controls select {
  min-width: 64px;
}
.round {
  border-radius: 50%;
  height: 42px;
  width: 42px;
}
.ref-controls .round {
  color: var(--accent);
  background: var(--tint);
  border-color: transparent;
}
.round .icon {
  width: 16px;
}
.shortcut {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 22px;
}
.shortcut .icon {
  width: 16px;
}
kbd {
  font: inherit;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
}
.tempo-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin: 17px 0 11px;
}
.bpm-label {
  display: grid;
  text-align: center;
  gap: 0;
  font-size: 0.8rem;
  letter-spacing: 0.09em;
}
.bpm-label input {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 520;
  line-height: 1;
  letter-spacing: -0.07em;
  font-size: clamp(5rem, 8vw, 7rem);
  text-align: center;
  width: 2.15em;
  padding: 0;
}
.tempo-slider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(320px, 90%);
  margin: 8px auto 13px;
  font:
    12px ui-monospace,
    monospace;
  color: var(--muted);
}
input[type='range'] {
  accent-color: var(--accent);
  width: 100%;
  height: 26px;
  min-width: 0;
}
.beats,
.accents {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
}
.beats {
  margin: 4px auto 3px;
  max-width: 580px;
}
.beat,
.accents button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.8rem;
}
.beat.accent,
.accents button[aria-pressed='true'] {
  background: var(--tint);
  border-color: var(--accent);
  color: var(--accent);
}
.beat.current {
  background: var(--accent);
  color: #121417;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--tint);
}
.tap {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}
.tap .icon {
  width: 22px;
  height: 22px;
}
.tap.flash {
  background: var(--tint);
  color: var(--accent);
}
dialog {
  width: min(440px, calc(100% - 26px));
  max-height: 85dvh;
  overflow: auto;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 0;
  box-shadow: 0 20px 90px #0003;
}
dialog::backdrop {
  background: rgba(18, 20, 23, 0.62);
}
.dialog-inner {
  padding: 21px;
}
.dialog-head {
  margin-bottom: 10px;
}
.dialog-head h2 {
  font-size: 1.4rem;
}
.row,
.stack,
fieldset {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
  min-height: 56px;
  gap: 12px;
  padding: 10px 0;
  color: var(--ink);
  font-size: 0.91rem;
}
.stack {
  display: grid;
  grid-template-columns: 1fr auto;
}
.stack input {
  grid-column: 1/-1;
}
.stack output {
  color: var(--muted);
}
input[type='number'] {
  width: 72px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: var(--panel);
  color: var(--ink);
}
input[type='checkbox'] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}
fieldset {
  padding-top: 4px;
}
legend {
  font-size: 0.91rem;
  font-weight: 550;
  padding: 9px 0;
}
.accents {
  justify-content: flex-start;
}
.accents button {
  width: 39px;
  height: 39px;
}
.dialog-inner .primary {
  margin-top: 10px;
  width: 100%;
}
#reset-settings {
  width: 100%;
  margin-top: 12px;
}
#notice {
  margin-top: 10px;
  background: var(--panel);
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
}
@media (max-width: 650px) {
  .instrument-tabs button {
    flex: 1;
    height: 37px;
    padding-inline: 8px 16px;
  }
  main {
    width: auto;
    margin: 0 max(14px, env(safe-area-inset-right)) 0
      max(14px, env(safe-area-inset-left));
    padding-top: calc(23px + env(safe-area-inset-top));
  }
  .legal-footer {
    width: auto;
    margin-right: max(14px, env(safe-area-inset-right));
    margin-left: max(14px, env(safe-area-inset-left));
  }
  .title-row {
    margin-bottom: 20px;
  }
  .heading {
    gap: 9px;
  }
  .small-button.settings {
    flex-shrink: 0;
    width: 42px;
    padding: 0;
  }
  .settings span {
    display: none;
  }
  .screen {
    padding: 16px 14px 12px;
  }
  #dial {
    width: 100%;
    margin: 14px auto 0;
    min-height: 70px;
  }
  .big-note {
    font-size: 5.4rem;
  }
  .readout {
    margin-top: 0;
  }
  .frequency {
    font-size: 0.81rem;
  }
  .screen-bottom {
    margin-top: 8px;
  }
  .controlbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 13px 16px 15px;
  }
  .quickfields {
    justify-content: space-between;
    width: 100%;
    gap: 8px;
  }
  .quickfields select {
    min-height: 37px;
  }
  .controlbar .primary {
    width: 100%;
  }
  .ref-card {
    padding: 14px;
    min-height: 68px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .tile {
    width: 33px;
    height: 33px;
    border-radius: 8px;
  }
  .tile .icon {
    width: 17px;
  }
  .card-label {
    gap: 8px;
  }
  h2 {
    font-size: 1rem;
  }
  .ref-controls {
    gap: 7px;
  }
  .ref-controls label {
    font-size: 0.71rem;
    gap: 3px;
    flex-direction: column;
    align-items: flex-start;
  }
  .ref-controls select {
    min-width: 51px;
    min-height: 36px;
    padding-left: 7px;
    padding-right: 22px;
    background-position: right 6px center;
  }
  .ref-controls .round {
    align-self: flex-end;
    width: 38px;
    height: 38px;
    min-height: 38px;
  }
  .shortcut {
    display: none;
  }
  .tempo-controls {
    gap: 16px;
  }
  .ref-card {
    margin-top: 12px;
  }
  .tempo-slider {
    margin-bottom: 12px;
  }
}
@media (max-width: 355px) {
  .title-row {
    column-gap: 8px;
  }
  .instrument-tabs button {
    gap: 5px;
    padding-inline: 5px 12px;
  }
  .ref-controls {
    gap: 4px;
  }
  .ref-card {
    padding: 11px;
  }
  .card-label .tile {
    display: none;
  }
}
@media (max-height: 600px) and (orientation: landscape) {
  main {
    padding-top: calc(12px + env(safe-area-inset-top));
  }
  h1 {
    font-size: 1.9rem;
  }
  .title-row {
    margin-bottom: 12px;
  }
  .screen {
    padding: 9px 18px;
  }
  .screen #dial {
    width: 48%;
    margin: 5px 0;
    align-self: flex-start;
    min-height: 60px;
  }
  .screen .readout {
    position: absolute;
    right: 12%;
    top: 23%;
  }
  .big-note {
    font-size: 3.4rem;
  }
  .frequency {
    margin-top: 2px;
  }
  .screen-bottom {
    margin: 0;
  }
  .controlbar,
  .ref-card {
    padding: 9px 17px;
    min-height: 58px;
  }
  .controlbar {
    flex-wrap: nowrap;
  }
  .quickfields {
    width: auto;
  }
  .controlbar .primary {
    width: auto;
  }
  .ref-card {
    margin-top: 8px;
  }
  .shortcut {
    display: none;
  }
  .tempo-controls {
    margin: 0;
  }
  .bpm-label input {
    font-size: 3.7rem;
  }
  .tempo-slider {
    margin: 2px auto;
  }
  .beats {
    margin: 0 auto;
  }
}
@media (pointer: coarse) {
  button,
  select {
    min-height: 44px;
  }
  .shortcut {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
@media (max-width: 650px) {
  #dial text {
    font-size: 24px;
  }
  #dial text.intermediate {
    display: none;
  }
  #dial .dial-tick {
    stroke-width: 1.6;
  }
  #dial .dial-major {
    stroke-width: 2.4;
  }
  .quickfields select,
  .ref-controls select,
  dialog select,
  dialog input[type='number'] {
    font-size: 16px;
  }
}
