.metronome-page {
  max-width: 860px;
  margin: 0 auto;
}

.metronome-heading {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 34px 0 30px;
}

.metronome-heading h1 {
  margin: 0 0 5px;
}

.metronome-heading p {
  margin: 0;
  color: rgba(var(--color-black-rgb), 0.66);
}

.metronome-heading-icon {
  display: grid;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  background: #f2e7d7;
  color: #6d4226;
  font-size: 1.55rem;
}

.metronome-shell {
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 1px solid #8b5a35;
  border-radius: 18px;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.07), transparent 25%, rgba(79, 38, 14, 0.08) 55%, transparent 78%),
    linear-gradient(135deg, #c98d51 0%, #a96837 48%, #8b512d 100%);
  box-shadow: 0 18px 45px rgba(66, 35, 16, 0.18);
}

.metronome-shell::before {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(3deg, transparent 0 15px, rgba(66, 31, 11, 0.07) 16px, transparent 18px 31px);
  content: "";
  pointer-events: none;
}

.metronome-display,
.metronome-beats,
.metronome-controls {
  position: relative;
}

.metronome-display {
  padding: 34px 24px 26px;
  color: #fffaf1;
  text-align: center;
  text-shadow: 0 2px 4px rgba(45, 21, 8, 0.28);
}

.metronome-tempo-number {
  font-family: var(--font-secondary);
  font-size: clamp(4rem, 13vw, 6.8rem);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.metronome-tempo-unit {
  margin-top: 9px;
  font-family: var(--font-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.metronome-tempo-name {
  margin-top: 7px;
  color: #ffe2b8;
  font-family: var(--font-primary);
  font-size: 1.3rem;
  font-style: italic;
}

.metronome-beats {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: clamp(7px, 2vw, 13px);
  padding: 0 18px 28px;
}

.beat-indicator {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 249, 237, 0.78);
  border-radius: 50%;
  background: rgba(71, 31, 10, 0.22);
  transition: transform 90ms ease, background-color 90ms ease, box-shadow 90ms ease;
}

.beat-indicator.is-accented {
  width: 17px;
  height: 17px;
  border-color: #ffe0a5;
}

.beat-indicator.is-current {
  transform: scale(1.35);
  background: #fff5dc;
  box-shadow: 0 0 0 5px rgba(255, 231, 183, 0.22), 0 0 18px rgba(255, 237, 196, 0.68);
}

.metronome-controls {
  padding: clamp(24px, 5vw, 42px);
  border-radius: 18px 18px 15px 15px;
  background: #fffdf8;
  box-shadow: 0 -9px 30px rgba(60, 27, 9, 0.16);
}

.metronome-controls label,
.metronome-controls legend {
  color: #342219;
  font-family: var(--font-secondary);
  font-weight: 600;
}

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.tempo-number-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #76533d;
  font-family: var(--font-secondary);
  font-size: 0.8rem;
  font-weight: 600;
}

.tempo-number-wrap .form-control {
  width: 84px;
  min-height: 42px;
  border-color: #b8997c;
  text-align: center;
}

.form-range::-webkit-slider-thumb {
  background: #8c4d27;
}

.form-range::-moz-range-thumb {
  background: #8c4d27;
}

.form-range::-webkit-slider-runnable-track {
  background: #dec7ae;
}

.form-range::-moz-range-track {
  background: #dec7ae;
}

.range-limits {
  display: flex;
  justify-content: space-between;
  margin-top: -3px;
  color: #806c5e;
  font-family: var(--font-secondary);
  font-size: 0.78rem;
}

.control-help {
  margin: 6px 0 0;
  color: #6e625a;
  font-size: 0.95rem;
}

.meter-control,
.accent-control,
.volume-control {
  margin-top: 28px;
}

.meter-control label,
.volume-control label {
  display: block;
  margin-bottom: 8px;
}

.meter-control .form-select {
  min-height: 48px;
  border-color: #b8997c;
  background-color: #fff;
}

.accent-control {
  padding: 0;
  border: 0;
}

.accent-control legend {
  margin: 0;
  font-size: 1rem;
}

.accent-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
  gap: 10px;
  margin-top: 13px;
}

.accent-choice {
  position: relative;
}

.accent-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.accent-choice label {
  display: grid;
  min-height: 48px;
  place-items: center;
  margin: 0;
  border: 1px solid #b8997c;
  border-radius: 9px;
  background: #fff;
  color: #68442e;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.accent-choice input:checked + label {
  border-color: #7b431f;
  background: #8c4d27;
  color: #fff;
  box-shadow: inset 0 -2px 0 rgba(47, 20, 5, 0.25);
}

.accent-choice input:focus-visible + label {
  outline: 3px solid rgba(var(--color-primary-rgb), 0.45);
  outline-offset: 3px;
}

.accent-choice label:hover {
  transform: translateY(-1px);
}

.volume-control label span {
  color: #76533d;
  font-weight: 400;
}

.metronome-toggle {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 32px;
  border: 0;
  border-radius: 12px;
  background: #70401f;
  color: #fff;
  font-family: var(--font-secondary);
  font-size: 1.05rem;
  font-weight: 600;
  box-shadow: 0 7px 17px rgba(70, 33, 12, 0.2);
  transition: background-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.metronome-toggle:hover {
  transform: translateY(-1px);
  background: #8c4d27;
  box-shadow: 0 9px 21px rgba(70, 33, 12, 0.24);
}

.metronome-toggle:focus-visible {
  outline: 3px solid rgba(var(--color-primary-rgb), 0.45);
  outline-offset: 3px;
}

.metronome-toggle.is-playing {
  background: #3d2a20;
}

.toggle-icon {
  font-size: 1.35rem;
}

.keyboard-help {
  margin: 15px 0 0;
  color: #76685f;
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 575.98px) {
  .metronome-heading {
    align-items: flex-start;
  }

  .metronome-heading-icon {
    flex-basis: 48px;
    width: 48px;
    height: 48px;
  }

  .metronome-controls {
    padding: 24px 19px 28px;
  }

  .control-label-row {
    align-items: flex-start;
  }

  .accent-buttons {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .beat-indicator,
  .accent-choice label,
  .metronome-toggle {
    transition: none;
  }
}
