:root {
  color-scheme: dark;
  --metro-bg: #090911;
  --metro-panel: rgba(25, 22, 37, .94);
  --metro-panel-2: rgba(12, 13, 22, .96);
  --metro-line: rgba(194, 159, 255, .22);
  --metro-line-strong: rgba(209, 184, 255, .48);
  --metro-text: #fff;
  --metro-muted: rgba(255, 255, 255, .64);
  --metro-soft: rgba(255, 255, 255, .08);
  --metro-accent: #b98cff;
  --metro-hot: #f8d37a;
  --metro-good: #76f0ad;
}

* { box-sizing: border-box; }

body.metronome-page {
  min-height: 100vh;
  color: var(--metro-text);
  background:
    radial-gradient(circle at 12% 8%, rgba(125, 71, 227, .28), transparent 34%),
    radial-gradient(circle at 88% 16%, rgba(58, 144, 255, .16), transparent 35%),
    linear-gradient(180deg, #090911 0%, #111020 54%, #090911 100%);
}

.metro-main {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 160px);
  margin: 0 auto;
  padding: 126px 0 72px;
}

.metro-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  margin-bottom: 18px;
}

.metro-kicker {
  margin: 0;
  color: #c9adff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.metro-hero h1 {
  margin: 8px 0 12px;
  font-size: clamp(42px, 8vw, 78px);
  line-height: .95;
}

.metro-hero p:last-child {
  max-width: 760px;
  margin: 0;
  color: var(--metro-muted);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.55;
}

.metro-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.primary-action,
.secondary-action,
.quick-tempos button,
.bpm-row button {
  min-height: 42px;
  border: 1px solid rgba(213, 188, 255, .26);
  border-radius: 999px;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.primary-action {
  padding: 0 28px;
  background: linear-gradient(145deg, rgba(151, 95, 255, .98), rgba(80, 44, 145, .98));
  box-shadow: 0 16px 40px rgba(84, 42, 160, .34);
}

.secondary-action,
.quick-tempos button,
.bpm-row button {
  padding: 0 18px;
  background: rgba(255, 255, 255, .07);
}

.primary-action:hover,
.secondary-action:hover,
.quick-tempos button:hover,
.bpm-row button:hover,
.primary-action:focus-visible,
.secondary-action:focus-visible,
.quick-tempos button:focus-visible,
.bpm-row button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--metro-line-strong);
  outline: none;
}

.metro-status-card {
  display: flex;
  gap: 13px;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid var(--metro-line);
  border-radius: 20px;
  background: linear-gradient(150deg, rgba(27, 23, 40, .9), rgba(12, 13, 22, .9));
  box-shadow: 0 18px 55px rgba(0, 0, 0, .26);
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, .42);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .06);
}

.status-dot.running {
  background: var(--metro-good);
  box-shadow: 0 0 0 6px rgba(118, 240, 173, .1), 0 0 20px rgba(118, 240, 173, .55);
}

.metro-status-card strong,
.metro-status-card span { display: block; }
.metro-status-card span { color: var(--metro-muted); font-size: 13px; }

.metro-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.metro-panel,
.metro-stage {
  border: 1px solid var(--metro-line);
  border-radius: 24px;
  background: linear-gradient(150deg, var(--metro-panel), var(--metro-panel-2));
  box-shadow: 0 24px 75px rgba(0, 0, 0, .34);
}

.metro-panel {
  padding: 20px;
}

.panel-section + .panel-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.panel-section h2 {
  margin: 0 0 14px;
  font-size: 15px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #e3d5ff;
}

.panel-section label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 8px;
  color: rgba(255, 255, 255, .84);
  font-size: 13px;
  font-weight: 800;
}

.panel-section output,
.privacy-note p {
  color: var(--metro-muted);
}

.panel-section input[type="range"] {
  width: 100%;
  accent-color: var(--metro-accent);
}

.panel-section select,
.bpm-row input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(213, 188, 255, .22);
  border-radius: 14px;
  background: rgba(0, 0, 0, .26);
  color: #fff;
  font: inherit;
  font-weight: 800;
}

.panel-section select { padding: 0 12px; }

.bpm-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
}

.bpm-row button {
  width: 48px;
  padding: 0;
  border-radius: 14px;
  font-size: 22px;
}

.bpm-row input {
  text-align: center;
  font-size: 34px;
  letter-spacing: -.05em;
}

.quick-tempos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.quick-tempos button {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 13px;
}

.check-row {
  justify-content: flex-start !important;
  align-items: center;
  cursor: pointer;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--metro-accent);
}

.privacy-note p {
  margin: 0;
  line-height: 1.55;
  font-size: 13px;
}

.metro-stage {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  min-height: 640px;
  overflow: hidden;
  padding: clamp(22px, 4vw, 48px);
}

.metro-stage::before {
  content: "";
  position: absolute;
  inset: -30%;
  background:
    radial-gradient(circle at 50% 45%, rgba(185, 140, 255, .25), transparent 24%),
    conic-gradient(from 180deg, transparent, rgba(139, 95, 255, .08), transparent, rgba(255, 211, 122, .08), transparent);
  animation: slowTurn 18s linear infinite;
  pointer-events: none;
}

@keyframes slowTurn {
  to { transform: rotate(360deg); }
}

.tempo-display,
.pulse-orb,
.beat-readout,
.beat-lights,
.keyboard-hint {
  position: relative;
  z-index: 1;
}

.tempo-display {
  display: grid;
  justify-items: center;
  line-height: 1;
}

.tempo-display span {
  font-size: clamp(64px, 13vw, 150px);
  font-weight: 950;
  letter-spacing: -.08em;
  text-shadow: 0 20px 65px rgba(0, 0, 0, .5);
}

.tempo-display small {
  color: var(--metro-muted);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .28em;
}

.pulse-orb {
  width: min(360px, 62vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.orb-ring,
.orb-core,
.pendulum {
  position: absolute;
  border-radius: 50%;
}

.orb-ring {
  inset: 0;
  border: 1px solid rgba(226, 208, 255, .23);
  background:
    radial-gradient(circle, rgba(185, 140, 255, .08) 0 41%, transparent 42%),
    repeating-conic-gradient(from -2deg, rgba(255,255,255,.18) 0 1deg, transparent 1deg 30deg);
  box-shadow: inset 0 0 80px rgba(112, 69, 201, .17), 0 22px 90px rgba(0,0,0,.36);
}

.orb-core {
  width: 46%;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, .95), rgba(255, 211, 122, .8) 18%, rgba(180, 121, 255, .34) 45%, rgba(37, 24, 66, .92) 76%);
  box-shadow: 0 0 50px rgba(185, 140, 255, .35), inset 0 1px rgba(255,255,255,.3);
  transform: scale(.88);
  transition: transform .08s ease, box-shadow .08s ease;
}

.pulse-orb.hit .orb-core {
  transform: scale(1);
  box-shadow: 0 0 72px rgba(248, 211, 122, .56), inset 0 1px rgba(255,255,255,.34);
}

.pulse-orb.accent .orb-core {
  box-shadow: 0 0 86px rgba(118, 240, 173, .52), inset 0 1px rgba(255,255,255,.34);
}

.pendulum {
  width: 4px;
  height: 46%;
  top: 6%;
  left: calc(50% - 2px);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(185, 140, 255, .35));
  transform-origin: 50% 95%;
  transform: rotate(0deg);
  transition: transform .12s ease-out;
}

.beat-readout {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.beat-readout strong {
  font-size: clamp(28px, 5vw, 54px);
  line-height: 1;
}

.beat-readout span,
.keyboard-hint {
  color: var(--metro-muted);
}

.beat-lights {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 580px;
}

.beat-light {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 15px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.58);
  font-weight: 950;
  transition: transform .1s ease, background .1s ease, color .1s ease, border-color .1s ease;
}

.beat-light.active {
  transform: translateY(-3px) scale(1.04);
  border-color: rgba(248, 211, 122, .7);
  background: rgba(248, 211, 122, .18);
  color: #fff;
}

.beat-light.accent {
  border-color: rgba(118, 240, 173, .7);
  background: rgba(118, 240, 173, .16);
}

.keyboard-hint {
  text-align: center;
  font-size: 13px;
}

@media (max-width: 860px) {
  .metro-main {
    width: min(100% - 20px, 1180px);
    padding-top: 92px;
  }

  .metro-hero,
  .metro-layout {
    grid-template-columns: 1fr;
  }

  .metro-hero-actions {
    justify-content: flex-start;
  }

  .metro-stage {
    min-height: 520px;
  }
}

@media (max-width: 520px) {
  .metro-main { padding-bottom: 44px; }
  .metro-panel { padding: 16px; border-radius: 20px; }
  .metro-stage { min-height: 500px; border-radius: 20px; }
  .primary-action,
  .secondary-action { flex: 1 1 auto; padding-inline: 16px; }
  .quick-tempos { grid-template-columns: repeat(2, 1fr); }
  .beat-light { width: 38px; height: 38px; border-radius: 12px; }
}

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


/* v191: JS-assisted dropdown open state, stable on mouse + touch. */
.site-header, .chess-header { overflow: visible !important; }
.nav-dropdown.is-open > .nav-dropdown-menu { display: block !important; opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; }
.nav-dropdown.is-open > .nav-dropbtn { background: rgba(255,255,255,0.12) !important; color: #fff !important; }
.nav-tools-menu { min-width: 220px; }
@media (hover: none), (pointer: coarse), (max-width: 760px) {
  .nav-dropdown:hover > .nav-dropdown-menu { display: none; }
  .nav-dropdown.is-open > .nav-dropdown-menu { display: block !important; }
}
