html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

audio {
  display: none;
}

/* ---------- Tempo Trainer theme ---------- */

:root {
  /* Brand palette - the five real colors, used directly everywhere below */
  --dust-grey: #dad7cdff;
  --dry-sage: #a3b18aff;
  --fern: #588157ff;
  --hunter-green: #3a5a40ff;
  --pine-teal: #344e41ff;

  /* The only non-literal value: dust-grey text at reduced contrast against
     the fern card, for secondary/muted labels (still legible, just quieter
     than the primary dust-grey headings). Everything else below references
     the five palette colors directly, not a derived scale. */
  --text-muted: color-mix(in srgb, var(--dust-grey) 78%, var(--fern) 22%);

  /* Shared with the BPM tick math in Index.cshtml, which needs this exact
     value to line up ticks with where the thumb's center actually lands. */
  --thumb-size: 1.75rem;
}

* ,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--dust-grey);
  background: var(--dry-sage);
  -webkit-tap-highlight-color: transparent;
}

main {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 1.5rem calc(1.25rem + env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) calc(1.25rem + env(safe-area-inset-left));
}

.tempo-page {
  width: 100%;
  display: flex;
  justify-content: center;
}

.tempo-card {
  width: 100%;
  max-width: 24rem;
  background: var(--fern);
  border: 1px solid var(--hunter-green);
  border-radius: 1.75rem;
  padding: clamp(1.75rem, 6vw, 2.75rem) clamp(1.5rem, 6vw, 2.25rem);
  box-shadow: 0 1.5rem 3rem -1.5rem rgba(52, 78, 65, 0.6);
  text-align: center;
}

.tempo-eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tempo-title {
  margin: 0.25rem 0 0;
  font-size: clamp(2rem, 8vw, 2.5rem);
  font-weight: 700;
  color: var(--dust-grey);
}

.tempo-visual {
  position: relative;
  margin: 1.5rem auto 0.5rem;
  width: 100%;
  max-width: 13rem;
}

.swing-arc {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.3s ease;
}

.swing-track {
  fill: none;
  stroke: var(--dry-sage);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 1 10;
}

.swing-mark {
  stroke: var(--dust-grey);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.7;
}

.swing-trail {
  fill: var(--dust-grey);
}

.swing-arm {
  stroke: var(--dry-sage);
  stroke-width: 2;
  stroke-linecap: round;
}

.swing-ball {
  fill: var(--dust-grey);
  stroke: var(--pine-teal);
  stroke-width: 2;
}

.swing-dot {
  fill: var(--dust-grey);
  stroke: var(--pine-teal);
  stroke-width: 2;
  filter: drop-shadow(0 0.2rem 0.35rem rgba(52, 78, 65, 0.5));
}

.swing-arc.is-flipped {
  transform: scaleX(-1);
}

.flip-btn {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--pine-teal);
  background: var(--dust-grey);
  border: 2px solid var(--dry-sage);
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.flip-btn:active {
  transform: scale(0.92);
}

.flip-btn.is-flipped {
  background: var(--hunter-green);
  border-color: var(--pine-teal);
  color: var(--dust-grey);
}

@media (hover: hover) {
  .flip-btn:not(.is-flipped):hover {
    background: var(--dry-sage);
  }

  .flip-btn.is-flipped:hover {
    background: var(--pine-teal);
  }
}

.bpm-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.25rem 0 1rem;
}

.bpm-value {
  font-size: clamp(3rem, 15vw, 4rem);
  font-weight: 700;
  line-height: 1;
  color: var(--dust-grey);
  font-variant-numeric: tabular-nums;
}

.bpm-label {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.bpm-slider-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0 2.25rem;
}

.bpm-slider-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.bpm-ticks {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 0;
  pointer-events: none;
}

.bpm-tick {
  position: absolute;
  top: 0;
  width: 0.25rem;
  height: 0.25rem;
  border-radius: 50%;
  background: var(--pine-teal);
  opacity: 0.45;
  transform: translate(-50%, -50%);
}

.bpm-step {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--dry-sage);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.15s ease, transform 0.1s ease;
}

.bpm-step:active {
  transform: scale(0.88);
}

@media (hover: hover) {
  .bpm-step:hover {
    color: var(--dust-grey);
  }
}

.bpm-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--dry-sage);
  margin: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.bpm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--thumb-size);
  height: var(--thumb-size);
  margin-top: calc((0.5rem - var(--thumb-size)) / 2);
  border-radius: 50%;
  background: var(--hunter-green);
  border: 3px solid var(--dust-grey);
  box-shadow: 0 0.25rem 0.5rem rgba(52, 78, 65, 0.4);
}

.bpm-slider::-moz-range-track {
  height: 0.5rem;
  border-radius: 999px;
  background: var(--dry-sage);
}

.bpm-slider::-moz-range-thumb {
  width: var(--thumb-size);
  height: var(--thumb-size);
  border-radius: 50%;
  background: var(--hunter-green);
  border: 3px solid var(--dust-grey);
  box-shadow: 0 0.25rem 0.5rem rgba(52, 78, 65, 0.4);
}

.bpm-slider:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(218, 215, 205, 0.4);
}

/* A quiet ring around the thumb - just enough to notice you're sitting
   exactly on a common BPM (116/128/144/162) rather than one beat off it. */
.bpm-slider.is-common::-webkit-slider-thumb {
  box-shadow: 0 0.25rem 0.5rem rgba(52, 78, 65, 0.4), 0 0 0 4px rgba(218, 215, 205, 0.6);
}

.bpm-slider.is-common::-moz-range-thumb {
  box-shadow: 0 0.25rem 0.5rem rgba(52, 78, 65, 0.4), 0 0 0 4px rgba(218, 215, 205, 0.6);
}

.tempo-buttons {
  display: flex;
  gap: 0.75rem;
}

.tempo-btn {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--pine-teal);
  background: var(--dust-grey);
  border: 2px solid var(--dry-sage);
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.tempo-btn:active {
  transform: scale(0.96);
}

.tempo-btn.is-active {
  background: var(--pine-teal);
  border-color: var(--pine-teal);
  color: var(--dust-grey);
  box-shadow: 0 0.5rem 1rem -0.5rem rgba(52, 78, 65, 0.8);
}

@media (hover: hover) {
  .tempo-btn:not(.is-active):hover {
    background: var(--dry-sage);
    border-color: var(--hunter-green);
  }

  .tempo-btn.is-active:hover {
    background: var(--hunter-green);
    border-color: var(--hunter-green);
  }
}

.tempo-hint {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
