:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #6a6a6a;
  --light: #f3f3f3;
  --line: #d7d7d7;
  --ring: #000000;
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  min-height: 100%;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.mobile-unsupported {
  position: fixed;
  inset: 0;
  background: #fff;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
}

.mobile-unsupported:not([hidden]) {
  display: flex;
}

.mobile-unsupported-box {
  width: 100%;
  max-width: 320px;
  border: 2px solid #000;
  border-radius: 14px;
  padding: 20px 18px;
  text-align: center;
  background: #fff;
}

.mobile-unsupported-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
}

.mobile-unsupported-text {
  font-size: 15px;
  line-height: 1.45;
}

.device-shell {
  width: min(100%, 344px);
  max-width: 344px;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  border: 2px solid #1f1f1f;
  border-radius: 30px;
  padding: 7px;
  background: #fff;
  box-shadow: none;
  overflow: hidden;
}

button {
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  box-shadow: none;
}

button:focus,
button:focus-visible,
button:active {
  outline: none;
  box-shadow: none;
}

.app {
  width: 100%;
  max-width: 310px;
  min-height: min(627px, calc(100vh - 38px));
  min-height: min(627px, calc(100dvh - 38px));
  margin: 0 auto;
  position: relative;
  padding: 124px 18px 34px;
  overflow: hidden;
  background: var(--bg);
  border-radius: 22px;
}

.timer-box {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 140px;
  height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid #000;
  border-radius: 10px;
  background: #fff;
  color: #000;
  cursor: pointer;
  outline: none;
  box-shadow: none;
  touch-action: none;
}

.timer-box:focus,
.timer-box:active {
  outline: none;
  box-shadow: none;
}

.timer-display {
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: 0.02em;
  pointer-events: none;
}

.prefs-row {
  position: absolute;
  top: 132px;
  left: 28px;
  right: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--fg);
  padding: 0;
  cursor: pointer;
  line-height: 1;
  touch-action: manipulation;
}

.sound-btn {
  width: 42.35px;
  height: 50.75px;
  font-size: 35px;
  transform-origin: center;
}

.tap-btn {
  width: 42.35px;
  height: 60.2px;
  font-size: 32px;
}

.reset-btn {
  width: 42.35px;
  height: 60.2px;
  font-size: 42px;
}

.tempo-stage {
  position: relative;
  width: 154px;
  height: 154px;
  margin: 162px auto 0;
  cursor: pointer;
  touch-action: none;
}

.progress-ring {
  position: absolute;
  inset: 0;
  width: 154px;
  height: 154px;
  transform: rotate(-90deg);
  pointer-events: none;
}

.ring-track,
.ring-progress {
  fill: none;
  stroke-width: 6;
}

.ring-track {
  stroke: transparent;
}

.ring-progress {
  stroke: var(--ring);
  stroke-linecap: round;
  stroke-dasharray: 578.05;
  stroke-dashoffset: 0;
}

.tempo-button {
  position: absolute;
  left: 42px;
  top: 42px;
  width: 70px;
  height: 70px;
  border: 0;
  background: transparent;
  z-index: 2;
  border-radius: 13px;
  cursor: pointer;
  touch-action: manipulation;
}

.tempo-stage:hover .tempo-button {
  background: rgba(0, 0, 0, 0.03);
}

.tempo-field {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  text-align: center;
  font-size: 42px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  user-select: none;
  pointer-events: none;
  z-index: 3;
}

.stepper-row {
  margin: 84px auto 0;
  width: 64px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.stepper-btn {
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  color: var(--fg);
  border-radius: 0;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  touch-action: manipulation;
}

.beat-stack {
  width: fit-content;
  max-width: 152px;
  min-width: 69px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  position: relative;
  left: -4px;
}

.primary-row {
  margin-top: 10px;
}

.secondary-row {
  margin-top: 5px;
  max-width: 152px;
}

.beat-btn {
  border: 0;
  background: transparent;
  color: #0a66ff;
  padding: 0;
  width: 17px;
  height: 22px;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
  position: relative;
}

.beat-btn.current::after {
  content: '';
  position: absolute;
  left: 5px;
  right: -1px;
  bottom: -2px;
  height: 1.5px;
  background: #000;
  border-radius: 999px;
}

.bottom-tools {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--fg);
  border-radius: 999px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
}

.play-hint {
  display: none;
}

.app.is-playing .play-hint {
  color: var(--fg);
}

.app.is-playing .tempo-field {
  font-weight: 500;
}

.volume-control {
  display: inline-flex;
  align-items: center;
}

.volume-control input[type='range'] {
  width: 72px;
  accent-color: #000;
}

@media (max-width: 414px) {
  .app {
    padding-left: 14px;
    padding-right: 14px;
  }

  .prefs-row {
    left: 24px;
    right: 24px;
  }
}
