:root {
  color-scheme: light;
  --paper: #eee7dc;
  --paper-light: #faf6ef;
  --paper-deep: #ded3c2;
  --ink: #1c1d19;
  --ink-soft: #3d3c35;
  --muted: #756f64;
  --line: rgba(28, 29, 25, 0.14);
  --line-strong: rgba(28, 29, 25, 0.28);
  --accent: #df542d;
  --accent-dark: #b93b1b;
  --accent-soft: #f7c7b5;
  --signal: #b8c94c;
  --panel: rgba(250, 246, 239, 0.78);
  --panel-solid: #f9f4eb;
  --shadow: 0 28px 80px rgba(61, 45, 29, 0.12);
  --shadow-soft: 0 12px 32px rgba(61, 45, 29, 0.09);
  --display-font: "Bodoni 72", "Didot", "Songti SC", "Times New Roman", serif;
  --ui-font: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif;
  --condensed-font: "Avenir Next Condensed", "DIN Condensed", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(255, 255, 255, 0.92), transparent 27rem),
    radial-gradient(circle at 92% 14%, rgba(223, 84, 45, 0.11), transparent 25rem),
    linear-gradient(135deg, #f2ede5 0%, var(--paper) 52%, #e8dfd2 100%);
  font-family: var(--ui-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -3;
  content: "";
  pointer-events: none;
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(28, 29, 25, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 29, 25, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 86%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(223, 84, 45, 0.32);
  outline-offset: 3px;
}

.ambient-shape {
  position: fixed;
  z-index: -2;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(1px);
}

.ambient-shape--one {
  top: 10rem;
  left: -12rem;
  width: 28rem;
  height: 28rem;
  border: 1px solid rgba(28, 29, 25, 0.08);
  box-shadow:
    0 0 0 4rem rgba(255, 255, 255, 0.11),
    0 0 0 8rem rgba(28, 29, 25, 0.02);
}

.ambient-shape--two {
  right: -8rem;
  bottom: -8rem;
  width: 24rem;
  height: 24rem;
  background: rgba(184, 201, 76, 0.11);
  filter: blur(28px);
}

.app-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper-light);
  font-family: var(--display-font);
  font-size: 25px;
  line-height: 1;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-kicker,
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-family: var(--condensed-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.3;
}

.brand-title {
  font-family: var(--condensed-font);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(250, 246, 239, 0.62);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  backdrop-filter: blur(14px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 4px rgba(184, 201, 76, 0.14);
  transition:
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

body.is-playing .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(223, 84, 45, 0.14);
  animation: status-pulse 1s steps(2, end) infinite;
}

.tempo-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(340px, 1.1fr);
  gap: clamp(28px, 5vw, 70px);
  min-height: 600px;
  padding: clamp(28px, 4.5vw, 58px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 34px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.52), transparent 46%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.tempo-stage::before {
  position: absolute;
  top: -1px;
  right: 42px;
  width: 130px;
  height: 4px;
  content: "";
  background: var(--accent);
}

.tempo-stage::after {
  position: absolute;
  right: -90px;
  bottom: -110px;
  width: 300px;
  height: 300px;
  border: 1px solid rgba(28, 29, 25, 0.07);
  border-radius: 50%;
  content: "";
  box-shadow:
    0 0 0 34px rgba(28, 29, 25, 0.025),
    0 0 0 68px rgba(28, 29, 25, 0.018);
  pointer-events: none;
}

.tempo-visual,
.tempo-controls {
  position: relative;
  z-index: 1;
}

.tempo-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stage-label {
  display: flex;
  width: min(100%, 390px);
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  color: var(--muted);
  font-family: var(--condensed-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tempo-orbit {
  position: relative;
  display: grid;
  width: min(100%, 390px);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.78) 0 42%, transparent 42.5%),
    radial-gradient(circle at 40% 32%, rgba(255, 255, 255, 0.76), transparent 44%),
    rgba(238, 231, 220, 0.68);
  box-shadow:
    inset 0 0 0 12px rgba(250, 246, 239, 0.52),
    inset 0 0 0 13px rgba(28, 29, 25, 0.045),
    0 22px 45px rgba(61, 45, 29, 0.12);
  transition:
    transform 100ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.tempo-orbit::before,
.tempo-orbit::after {
  position: absolute;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.tempo-orbit::before {
  inset: 17%;
  border: 1px dashed rgba(28, 29, 25, 0.14);
}

.tempo-orbit::after {
  inset: 29%;
  background: rgba(250, 246, 239, 0.52);
  box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.55);
}

.tempo-orbit.is-pulsing {
  border-color: rgba(223, 84, 45, 0.52);
  transform: scale(1.012);
  box-shadow:
    inset 0 0 0 12px rgba(250, 246, 239, 0.52),
    inset 0 0 0 13px rgba(223, 84, 45, 0.12),
    0 24px 50px rgba(61, 45, 29, 0.14);
}

.beat-dot {
  --beat-color: var(--accent);
  --beat-halo: rgba(223, 84, 45, 0.12);
  position: absolute;
  z-index: 2;
  width: 18px;
  height: 18px;
  border: 5px solid var(--paper-light);
  border-radius: 50%;
  background: var(--paper-deep);
  box-shadow: 0 0 0 1px var(--line-strong);
  transform: translate(-50%, -50%);
  transition:
    transform 110ms ease,
    background 110ms ease,
    box-shadow 110ms ease;
}

.beat-dot[data-level="heavy"] {
  --beat-color: var(--accent);
  --beat-halo: rgba(223, 84, 45, 0.13);
}

.beat-dot[data-level="secondary"] {
  --beat-color: #c58a25;
  --beat-halo: rgba(197, 138, 37, 0.14);
}

.beat-dot[data-level="light"] {
  --beat-color: #87905c;
  --beat-halo: rgba(135, 144, 92, 0.14);
}

.beat-dot.is-active {
  background: var(--beat-color);
  box-shadow:
    0 0 0 1px var(--beat-color),
    0 0 0 8px var(--beat-halo),
    0 0 28px var(--beat-halo);
  transform: translate(-50%, -50%) scale(1.28);
}

.tempo-readout {
  position: relative;
  z-index: 3;
  display: grid;
  width: 58%;
  justify-items: center;
}

.tempo-readout-label {
  margin-bottom: -2px;
  color: var(--muted);
  font-family: var(--condensed-font);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
}

.tempo-display {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--display-font);
  font-size: clamp(78px, 9vw, 122px);
  font-variant-numeric: lining-nums tabular-nums;
  font-weight: 400;
  line-height: 0.98;
  text-align: center;
  cursor: text;
}

.tempo-name {
  margin-top: 8px;
  color: var(--muted);
  font-family: var(--condensed-font);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
}

.beat-caption {
  min-height: 22px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

body.is-playing .beat-caption {
  color: var(--accent-dark);
}

.tempo-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: clamp(0px, 2vw, 20px);
}

.compact-slowdown {
  margin-bottom: 22px;
}

.compact-slowdown-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.compact-slowdown-meta > span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.03em;
}

.compact-slowdown-meta strong {
  color: var(--ink);
  font-family: var(--condensed-font);
  font-size: 13px;
}

.controls-heading h1 {
  max-width: 480px;
  margin: 10px 0 32px;
  font-family: var(--display-font);
  font-size: clamp(32px, 4vw, 51px);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.time-signature-control {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(250, 246, 239, 0.48);
}

.time-signature-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--display-font);
  font-size: 25px;
  line-height: 1;
}

.time-signature-picker select {
  min-width: 58px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper-light);
  color: var(--ink);
  font-family: var(--display-font);
  font-size: 23px;
  text-align: center;
  cursor: pointer;
}

.time-signature-control p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.bpm-stepper {
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  gap: 12px;
  align-items: center;
  margin-bottom: 25px;
}

.step-button {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(250, 246, 239, 0.72);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.step-button:hover {
  border-color: var(--ink);
  background: var(--paper-light);
  transform: translateY(-2px);
}

.step-button:active {
  transform: translateY(0) scale(0.96);
}

.stepper-copy {
  display: grid;
  justify-items: center;
  gap: 5px;
  text-align: center;
}

.stepper-copy > label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.stepper-input-shell {
  display: inline-flex;
  min-width: 112px;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px 3px;
  border: 1px solid transparent;
  border-bottom-color: var(--line-strong);
  border-radius: 10px;
  background: rgba(250, 246, 239, 0.54);
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.stepper-input-shell:focus-within {
  border-color: var(--accent);
  background: var(--paper-light);
  box-shadow: 0 0 0 3px rgba(223, 84, 45, 0.12);
}

.bpm-number-input {
  width: 3.4ch;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--condensed-font);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  letter-spacing: 0.05em;
  caret-color: var(--accent);
  appearance: textfield;
}

.bpm-number-input::-webkit-inner-spin-button,
.bpm-number-input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.stepper-input-shell > span {
  color: var(--muted);
  font-family: var(--condensed-font);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.range-wrap {
  margin-bottom: 30px;
}

.tempo-range {
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
}

.tempo-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--accent) var(--range-progress, 31.4%), transparent 0),
    var(--line);
}

.tempo-range::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--line);
}

.tempo-range::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.tempo-range::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -9px;
  border: 5px solid var(--paper-light);
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent-dark),
    0 4px 10px rgba(61, 45, 29, 0.22);
  appearance: none;
}

.tempo-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 5px solid var(--paper-light);
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent-dark),
    0 4px 10px rgba(61, 45, 29, 0.22);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--condensed-font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.transport-button {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 68px;
  align-items: center;
  justify-content: center;
  gap: 15px;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 18px;
  background: var(--ink);
  color: var(--paper-light);
  font-family: var(--condensed-font);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(28, 29, 25, 0.19);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.transport-button::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.13) 48%, transparent 76%);
  transform: translateX(-110%);
  transition: transform 500ms ease;
}

.transport-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(28, 29, 25, 0.24);
}

.transport-button:hover::before {
  transform: translateX(110%);
}

.transport-button:active {
  transform: translateY(0) scale(0.99);
}

body.is-playing .transport-button {
  border-color: var(--accent-dark);
  background: var(--accent);
  box-shadow: 0 16px 32px rgba(185, 59, 27, 0.25);
}

.transport-icon {
  position: relative;
  z-index: 1;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid currentColor;
  transition: all 160ms ease;
}

body.is-playing .transport-icon {
  width: 13px;
  height: 16px;
  border: 0;
  border-right: 4px solid currentColor;
  border-left: 4px solid currentColor;
}

.transport-button > span:last-child {
  position: relative;
  z-index: 1;
}

.shortcut-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

kbd {
  display: inline-grid;
  min-width: 46px;
  min-height: 24px;
  padding: 0 7px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: rgba(250, 246, 239, 0.8);
  color: var(--ink-soft);
  font-family: var(--condensed-font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.control-deck {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: start;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.sound-panel,
.history-panel {
  min-height: 250px;
  padding: 28px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 5px 0 0;
  font-family: var(--display-font);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.section-note,
.practice-description {
  max-width: 220px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: right;
}

.practice-description strong {
  color: var(--ink);
  font-family: var(--condensed-font);
  font-size: 14px;
}

.sound-sliders {
  display: grid;
  gap: 17px;
}

.sound-slider-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 7px 12px;
}

.sound-slider-copy {
  display: grid;
  gap: 2px;
}

.sound-slider-copy strong {
  font-size: 12px;
}

.sound-slider-copy small {
  color: var(--muted);
  font-size: 10px;
}

.sound-slider-value {
  color: var(--muted);
  font-family: var(--condensed-font);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.sound-slider {
  grid-column: 1 / -1;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
}

.sound-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--accent) var(--sound-progress, 50%), transparent 0),
    var(--line);
}

.sound-slider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--line);
}

.sound-slider::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.sound-slider::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: 4px solid var(--paper-light);
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent-dark),
    0 3px 8px rgba(61, 45, 29, 0.18);
  appearance: none;
}

.sound-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 4px solid var(--paper-light);
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent-dark),
    0 3px 8px rgba(61, 45, 29, 0.18);
}

.text-button {
  padding: 5px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.text-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.text-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.history-list {
  display: flex;
  min-height: 92px;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 9px;
}

.history-chip {
  display: inline-flex;
  min-width: 72px;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.42);
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.history-chip:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.75);
  transform: translateY(-2px);
}

.history-chip strong {
  font-family: var(--display-font);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.history-chip small {
  color: var(--muted);
  font-family: var(--condensed-font);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.empty-history {
  max-width: 210px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.practice-panel {
  margin-top: 18px;
  padding: 30px 28px 28px;
}

.beat-pattern-panel {
  margin-top: 18px;
  padding: 30px 28px 28px;
}

.section-heading--pattern {
  align-items: flex-end;
  margin-bottom: 18px;
}

.beat-pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.beat-control {
  display: grid;
  min-width: 0;
  gap: 15px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.34);
}

.beat-control-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.beat-control-heading span {
  color: var(--muted);
  font-family: var(--condensed-font);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.beat-control-heading strong {
  font-size: 12px;
  font-weight: 700;
}

.accent-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.accent-button {
  min-width: 0;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(250, 246, 239, 0.68);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.accent-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  transform: translateY(-1px);
}

.accent-button.is-active[data-level="heavy"] {
  border-color: var(--accent-dark);
  background: var(--accent);
  color: var(--paper-light);
}

.accent-button.is-active[data-level="secondary"] {
  border-color: #a66f17;
  background: #c58a25;
  color: #fffaf1;
}

.accent-button.is-active[data-level="light"] {
  border-color: #687044;
  background: #87905c;
  color: #fffaf1;
}

.section-heading--practice {
  align-items: flex-end;
  margin-bottom: 18px;
}

.ratio-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.ratio-grid.ratio-grid--compact {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  overflow: visible;
}

.ratio-grid--compact .ratio-button {
  gap: 6px;
  padding: 9px 7px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.28);
  text-align: center;
}

.ratio-grid--compact .ratio-button:hover {
  transform: translateY(-1px);
}

.ratio-grid--compact .ratio-label {
  font-size: 9px;
  letter-spacing: 0.04em;
}

.ratio-grid--compact .ratio-value {
  justify-content: center;
  gap: 2px;
}

.ratio-grid--compact .ratio-value strong {
  font-size: 22px;
  line-height: 1;
}

.ratio-grid--compact .ratio-value small {
  display: none;
}

.ratio-grid.ratio-grid--compact .ratio-button:last-child {
  grid-column: auto;
}

.ratio-button {
  display: grid;
  min-width: 0;
  gap: 18px;
  padding: 17px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.34);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.ratio-button:hover {
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(61, 45, 29, 0.09);
}

.ratio-button:active {
  transform: translateY(0) scale(0.98);
}

.ratio-button.is-flashing {
  border-color: var(--accent);
  background: rgba(247, 199, 181, 0.48);
}

.ratio-label {
  color: var(--muted);
  font-family: var(--condensed-font);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.ratio-value {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.ratio-value strong {
  font-family: var(--display-font);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.ratio-value small {
  color: var(--muted);
  font-family: var(--condensed-font);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 4px 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.app-footer p {
  margin: 0;
}

.noscript-message {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  margin: 0;
  padding: 14px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper-light);
  font-size: 13px;
}

@keyframes status-pulse {
  0%,
  48% {
    transform: scale(1);
  }

  50%,
  100% {
    transform: scale(0.72);
  }
}

@media (max-width: 900px) {
  .tempo-stage {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .tempo-controls {
    width: min(100%, 560px);
    margin: 0 auto;
    padding-right: 0;
  }

  .controls-heading {
    text-align: center;
  }

  .controls-heading h1 {
    margin-right: auto;
    margin-left: auto;
  }

  .control-deck {
    grid-template-columns: 1fr;
  }

  .beat-pattern-grid {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    padding-bottom: 6px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .ratio-grid {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    padding-bottom: 6px;
    overflow-x: auto;
    scrollbar-width: thin;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 24px, 1120px);
    padding-top: 16px;
  }

  .topbar {
    margin-bottom: 14px;
  }

  .brand-kicker {
    display: none;
  }

  .brand-title {
    font-size: 18px;
  }

  .status-pill {
    min-height: 34px;
    padding: 0 11px;
    font-size: 11px;
  }

  .tempo-stage {
    min-height: auto;
    padding: 25px 18px 28px;
    border-radius: 26px;
  }

  .tempo-orbit {
    width: min(100%, 330px);
  }

  .tempo-display {
    font-size: clamp(68px, 23vw, 96px);
  }

  .controls-heading h1 {
    margin-bottom: 25px;
    font-size: 34px;
  }

  .time-signature-control {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 8px;
    margin-bottom: 20px;
  }

  .time-signature-picker {
    justify-content: center;
  }

  .time-signature-control p {
    text-align: center;
  }

  .bpm-stepper {
    grid-template-columns: 48px 1fr 48px;
    gap: 9px;
  }

  .step-button {
    width: 48px;
    height: 48px;
  }

  .sound-panel,
  .history-panel {
    min-height: auto;
    padding: 23px 18px;
  }

  .section-note {
    display: none;
  }

  .practice-panel {
    padding: 25px 18px 20px;
  }

  .beat-pattern-panel {
    padding: 25px 18px 20px;
  }

  .section-heading--practice {
    align-items: flex-start;
  }

  .section-heading--pattern {
    align-items: flex-start;
  }

  .practice-description {
    max-width: 125px;
  }

  .beat-pattern-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .ratio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .ratio-button:last-child {
    grid-column: span 2;
  }

  .ratio-grid.ratio-grid--compact {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  .ratio-grid--compact .ratio-button {
    padding: 8px 2px 7px;
    border-radius: 8px;
  }

  .ratio-grid--compact .ratio-label {
    font-size: 8px;
  }

  .ratio-grid--compact .ratio-value strong {
    font-size: 18px;
  }

  .compact-slowdown-meta {
    gap: 8px;
  }

  .app-footer {
    display: grid;
    gap: 6px;
  }
}

@media (max-width: 420px) {
  .brand-mark {
    width: 39px;
    height: 39px;
    font-size: 22px;
  }

  .tempo-stage {
    padding-right: 14px;
    padding-left: 14px;
  }

  .stage-label {
    padding: 0 6px;
  }

  .tempo-orbit {
    width: min(100%, 300px);
  }

  .section-heading--practice {
    display: grid;
  }

  .section-heading--pattern {
    display: grid;
  }

  .practice-description {
    max-width: none;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
