:root {
  --bg: #10120e;
  --raise: #1a1e16;
  --ink: #f6f1e4;
  --muted: #b7b09f;
  --line: rgba(246, 241, 228, 0.16);
  --amber: #ffb020;
  --amber-ink: #241802;
  --teal: #2fe0c8;
  --coral: #ff5d3a;
  --font: "Segoe UI", "Helvetica Neue", "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Noto Sans CJK JP", "Noto Sans KR", "Apple SD Gothic Neo", "WenQuanYi Micro Hei", sans-serif;
  --display: "Iowan Old Style", Palatino, "Palatino Linotype", "Times New Roman", serif;
  color-scheme: dark;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1000px 520px at 12% -10%, rgba(255, 176, 32, 0.14), transparent 55%),
    radial-gradient(860px 480px at 110% 0%, rgba(47, 224, 200, 0.1), transparent 50%),
    var(--bg);
  line-height: 1.5;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 60;
  background: var(--amber);
  color: var(--amber-ink);
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}

.skip:focus {
  top: 8px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: rgba(16, 18, 14, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand span {
  font-size: 15px;
}

.lang-menu {
  position: relative;
}

.lang-menu summary {
  list-style: none;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #141710;
  cursor: pointer;
  font-size: 14px;
}

.lang-menu summary::-webkit-details-marker {
  display: none;
}

.lang-menu summary::marker {
  content: "";
}

.lang-menu summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.lang-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 148px;
  padding: 6px;
  background: #171b13;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  z-index: 40;
}

.lang-panel a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.lang-panel a:hover,
.lang-panel a[aria-current="page"] {
  background: rgba(255, 176, 32, 0.14);
}

.first-screen {
  display: grid;
  align-content: start;
  gap: 12px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 14px 0 6px;
}

.title-block h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.lede {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.35;
}

.deck {
  display: grid;
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.stage {
  position: relative;
  width: min(100%, 440px);
  aspect-ratio: 1;
  margin-inline: auto;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #1c2418 0%, #090b08 72%);
  box-shadow:
    inset 0 0 0 1px rgba(246, 241, 228, 0.18),
    0 18px 44px rgba(0, 0, 0, 0.32);
}

body.is-playing .stage {
  box-shadow:
    inset 0 0 0 1px rgba(255, 176, 32, 0.45),
    0 18px 44px rgba(0, 0, 0, 0.32);
}

.stage canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
}

.stage-readout {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 38%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  gap: 2px;
}

.badge,
.live-bpm,
.live-counts {
  font-variant-numeric: tabular-nums;
}

.badge {
  margin: 0;
  font-family: var(--display);
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0.04em;
  font-weight: 650;
}

.live-bpm {
  margin: 2px 0 0;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.live-bpm strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.live-counts {
  margin: 3px 0 0;
  display: flex;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
}

.ca {
  color: var(--amber);
}

.cb {
  color: var(--teal);
}

.controls {
  min-width: 0;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  background: rgba(26, 30, 22, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.transport,
.sub-row,
.mix-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.play,
.tap,
.mute,
.stepper button,
.preset {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
}

.play {
  min-width: 112px;
  height: 44px;
  padding: 0 16px;
  border: 0;
  background: var(--amber);
  color: var(--amber-ink);
  font-weight: 800;
}

.play.is-on {
  background: var(--coral);
  color: #2a0d07;
}

.tap,
.mute {
  height: 44px;
  padding: 0 14px;
}

.tap.is-hit {
  background: var(--teal);
  color: #06221e;
  border-color: var(--teal);
}

.bpm-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  min-width: 0;
}

.bpm-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

#bpm-number,
#beats-a,
#beats-b {
  width: 4.4rem;
  background: #0d0f0b;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  text-align: center;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="range"] {
  width: 100%;
  min-width: 0;
  accent-color: var(--amber);
  height: 28px;
}

.track-b input[type="range"] {
  accent-color: var(--teal);
}

.keys,
.tap-status,
.audio-error {
  margin: 0;
  font-size: 13px;
}

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
}

kbd {
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
  font-size: 0.85em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 0 5px;
  background: #0c0e0a;
  color: var(--ink);
}

.tap-status {
  min-height: 1.2em;
  color: var(--amber);
}

.audio-error {
  color: #ffb4a6;
}

.group-label {
  margin: 2px 0 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset {
  min-width: 52px;
  height: 36px;
  padding: 0 10px;
}

.preset[aria-pressed="true"] {
  background: var(--ink);
  color: #16140f;
  border-color: var(--ink);
}

.ratio-pair,
.tracks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ratio-ctrl,
.track {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  margin: 0;
}

.ratio-ctrl {
  display: grid;
  gap: 4px;
}

.ratio-ctrl label,
.track legend {
  font-size: 13px;
  font-weight: 700;
}

.ratio-ctrl.track-a label,
.track.track-a legend {
  color: var(--amber);
}

.ratio-ctrl.track-b label,
.track.track-b legend {
  color: var(--teal);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stepper button {
  width: 32px;
  height: 32px;
  padding: 0;
}

.track {
  display: grid;
  gap: 6px;
  min-inline-size: 0;
}

.track label,
.sub-row label,
.mix-row label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

select {
  width: 100%;
  background: #0d0f0b;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  font-size: 14px;
  color: var(--ink);
}

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

.mute[aria-pressed="true"] {
  background: #3a2820;
  border-color: var(--coral);
  color: #ffd0c6;
}

.noscript-note {
  margin: 0;
  color: var(--muted);
}

.guide {
  width: min(68ch, calc(100% - 40px));
  margin: 28px auto 56px;
}

.guide h2,
.guide h3,
.not-found h1,
.title-block h1 {
  font-family: var(--display);
}

.guide h2 {
  font-size: 1.45rem;
  line-height: 1.25;
  margin: 1.5em 0 0.4em;
}

.guide h3 {
  font-size: 1.08rem;
  margin: 1.05em 0 0.25em;
  color: var(--amber);
}

.guide p,
.not-found p {
  margin: 0 0 0.75em;
}

.partners {
  margin-top: 2rem;
  padding-top: 0.4rem;
}

.affiliate-disclosure {
  background: #2c2618;
  color: #f6f1e4;
  border: 1px solid rgba(255, 176, 32, 0.55);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.95rem;
}

.partners ul {
  padding-left: 1.15rem;
}

.partners a {
  color: #b8fff4;
}

.locale-list {
  padding-left: 1.15rem;
}

.locale-list a {
  color: #b8fff4;
}

.not-found {
  width: min(68ch, calc(100% - 40px));
  margin: 12px auto 48px;
}

.site-footer {
  border-top: 1px solid var(--line);
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
}

.site-footer p {
  margin: 0;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}

@media (min-width: 960px) {
  .deck {
    grid-template-columns: minmax(300px, 440px) minmax(0, 1fr);
    gap: 28px;
  }

  .first-screen h1 {
    white-space: nowrap;
  }
}

@media (max-width: 720px) {
  .title-block h1 {
    font-size: 28px;
  }

  .ratio-pair,
  .tracks {
    grid-template-columns: 1fr;
  }

  .site-footer p {
    white-space: normal;
    text-align: center;
  }

  .first-screen,
  .guide,
  .not-found {
    width: min(100% - 28px, 1180px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .play,
  .tap,
  .preset,
  .mute {
    transition: none;
  }
}
