:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --accent: #ffb64d;
  --accent-bright: #ffd17a;
  --signal: #7cc5d8;
  --panel: #14202b;
  --panel-raised: #192734;
  --line: rgba(142, 171, 192, 0.2);
  --text: #e6edf2;
  --muted: #8b9ba8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background-color: #0a1119;
  background-image:
    linear-gradient(rgba(108, 139, 160, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108, 139, 160, 0.035) 1px, transparent 1px),
    radial-gradient(ellipse 62% 48% at 50% 0%, rgba(51, 90, 119, 0.22), transparent 76%);
  background-size: 36px 36px, 36px 36px, auto;
}

button,
select,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.text-stone-50 { color: #f1f5f7; }
.text-stone-100 { color: #e6edf2; }
.text-stone-300 { color: #c2cdd5; }
.text-stone-500 { color: #8b9ba8; }
.text-stone-600 { color: #71818e; }

.brand-mark {
  color: var(--accent);
  border: 1px solid rgba(255, 182, 77, 0.38);
  border-radius: 6px;
  background: linear-gradient(145deg, #1c2a35, #101923);
  box-shadow: inset 0 0 0 3px rgba(255, 182, 77, 0.045);
}

.metronome-card {
  position: relative;
  overflow: hidden;
  border: 1px solid #354755;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(24, 37, 49, 0.98), rgba(17, 28, 39, 0.99));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34), inset 0 1px rgba(205, 224, 236, 0.08);
}

.metronome-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(124, 197, 216, 0.42), transparent);
  content: "";
}

.eyebrow {
  color: #8fa9b9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.14em;
}

.tempo-value {
  color: var(--accent-bright);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(3.5rem, 16vw, 6.5rem);
  font-weight: 600;
  letter-spacing: -0.075em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 22px rgba(255, 182, 77, 0.14);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  color: #b1c0ca;
  border: 1px solid #3a4b59;
  border-radius: 7px;
  background: linear-gradient(145deg, #1a2935, #111c26);
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.icon-button:hover:not(:disabled) {
  color: var(--accent-bright);
  border-color: rgba(255, 182, 77, 0.58);
  background: #202d37;
}

.icon-button:active:not(:disabled) {
  transform: scale(0.95);
}

.icon-button:focus-visible,
.step-button:focus-visible,
.tap-button:focus-visible,
.meter-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.icon-button:disabled,
.step-button:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.tempo-slider {
  height: 4px;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) 0 var(--slider-progress, 30%), rgba(159, 184, 201, 0.2) var(--slider-progress, 30%) 100%);
  cursor: pointer;
}

.tempo-slider::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  appearance: none;
  border: 3px solid #14202b;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 0 1px var(--accent), 0 0 10px rgba(255, 182, 77, 0.24);
}

.tempo-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 3px solid #14202b;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 0 1px var(--accent), 0 0 10px rgba(255, 182, 77, 0.24);
}

.tempo-slider:focus-visible {
  outline: 2px solid rgba(255, 182, 77, 0.8);
  outline-offset: 6px;
}

.tap-button {
  border: 1px solid #344653;
  border-radius: 5px;
  background: rgba(8, 15, 22, 0.5);
}

.tap-button:hover {
  border-color: rgba(255, 182, 77, 0.5);
}

.tap-button:active {
  color: var(--accent-bright);
  transform: scale(0.97);
}

.meter-stepper,
.meter-select {
  border: 1px solid #3a4b59;
  border-radius: 7px;
  background: linear-gradient(145deg, #1a2935, #111c26);
}

.step-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #a9bac5;
  border: 0;
  border-radius: 5px;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  transition: color 150ms ease, background 150ms ease;
}

.step-button:hover:not(:disabled) {
  color: var(--accent-bright);
  background: rgba(124, 197, 216, 0.08);
}

.meter-number {
  min-width: 46px;
  color: var(--text);
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 21px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.meter-select {
  min-width: 82px;
  appearance: none;
  color: var(--text);
  cursor: pointer;
}

.meter-select option {
  color: var(--text);
  background: #17232e;
}

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #91cba0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.13em;
}

.status-label::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8acb99;
  box-shadow: 0 0 8px rgba(138, 203, 153, 0.35);
  content: "";
}

.status-label.is-pending {
  color: var(--accent);
}

.status-label.is-pending::before {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255, 182, 77, 0.42);
}

.accent-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255, 182, 77, 0.4);
}

.beat-orb {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(124, 197, 216, 0.36);
  border-radius: 50%;
  background: rgba(124, 197, 216, 0.06);
  box-shadow: 0 0 0 7px rgba(124, 197, 216, 0.035), 0 0 0 14px rgba(124, 197, 216, 0.02);
  transform: scale(0.86);
}

.beat-orb.is-pulsing {
  animation: beat-pulse 180ms ease-out;
}

.beat-orb.is-accent {
  border-color: var(--accent-bright);
  background: rgba(255, 182, 77, 0.34);
  box-shadow: 0 0 22px rgba(255, 182, 77, 0.28), 0 0 0 8px rgba(255, 182, 77, 0.09), 0 0 0 16px rgba(255, 182, 77, 0.035);
}

.beat-number {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 23px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.beat-track {
  display: flex;
  min-height: 8px;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.beat-mark {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: rgba(148, 170, 185, 0.25);
  transition: background 90ms ease, box-shadow 90ms ease, transform 90ms ease;
}

.beat-mark.is-downbeat {
  background: rgba(255, 182, 77, 0.45);
}

.beat-mark.is-active {
  background: var(--signal);
  box-shadow: 0 0 10px rgba(124, 197, 216, 0.45);
  transform: scale(1.25);
}

.beat-mark.is-active.is-downbeat {
  background: var(--accent-bright);
  box-shadow: 0 0 12px rgba(255, 182, 77, 0.6);
}

.transport-button {
  min-height: 54px;
  color: #171b1f;
  border: 1px solid #ffc05b;
  background: linear-gradient(180deg, #ffc362, #efa43a);
  box-shadow: 0 5px 18px rgba(255, 174, 64, 0.13), inset 0 1px rgba(255, 255, 255, 0.26);
}

.transport-button:hover {
  background: linear-gradient(180deg, #ffd17a, #ffb64d);
  box-shadow: 0 6px 22px rgba(255, 174, 64, 0.2);
}

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

.transport-button.is-playing {
  color: #f5e9e8;
  border: 1px solid #8f4546;
  background: linear-gradient(180deg, #673438, #49272c);
  box-shadow: inset 0 1px rgba(255, 225, 220, 0.12);
}

.transport-button.is-playing:hover {
  background: linear-gradient(180deg, #794044, #562d33);
}

.tuner-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.13em;
}

.tuner-status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.tuner-status.is-listening {
  color: var(--signal);
}

.tuner-status.is-error {
  color: var(--accent);
}

.tuner-scale {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 182, 77, 0.55), rgba(124, 197, 216, 0.55), rgba(255, 182, 77, 0.55));
}

.tuner-center {
  position: absolute;
  top: -6px;
  left: 50%;
  width: 1px;
  height: 16px;
  background: var(--signal);
}

.tuner-marker {
  position: absolute;
  top: -5px;
  left: var(--marker-position, 50%);
  width: 14px;
  height: 14px;
  border: 2px solid #14202b;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 0 1px var(--accent);
  transform: translateX(-50%);
}

.key-hint {
  margin-left: 2px;
  padding: 3px 5px;
  color: #a8b7c1;
  border: 1px solid #3a4b59;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 8px;
  letter-spacing: 0.08em;
}

.tool-link {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  color: var(--text);
  border: 1px solid #354755;
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(24, 37, 49, 0.98), rgba(17, 28, 39, 0.99));
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease;
}

.tool-link:hover {
  border-color: rgba(255, 182, 77, 0.58);
  background: linear-gradient(145deg, #1a2935, #14202b);
}

.tool-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.tool-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--accent);
  border: 1px solid rgba(255, 182, 77, 0.3);
  border-radius: 7px;
  background: rgba(8, 15, 22, 0.45);
}

.tool-details {
  display: grid;
  min-width: 0;
  gap: 0.25rem;
}

.tool-name,
.tool-open {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 650;
  letter-spacing: 0.12em;
}

.tool-name {
  color: #e6edf2;
  font-size: 0.75rem;
}

.tool-description {
  color: var(--muted);
  font-size: 0.75rem;
}

.tool-open {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  color: #8fa9b9;
  font-size: 9px;
  transition: color 150ms ease;
}

.tool-link:hover .tool-open {
  color: var(--accent-bright);
}

@keyframes beat-pulse {
  0% { transform: scale(0.86); }
  45% { transform: scale(1.12); }
  100% { transform: scale(0.86); }
}

@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;
  }
}
