﻿:root {
  --bg: #1a0e0a;
  --sun: #ffb347;
  --sun-glow: #ff9b2f;
  --text: #f7eadb;
  --muted: #d9c1a5;
  --accent: #ffd6a1;
  --panel: rgba(0, 0, 0, 0.45);
  --line: rgba(255, 255, 255, 0.12);
  --tempo-bpm: 120;
  --tempo-beat-sec: 0.5000s;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 70% 15%, rgba(255, 178, 71, 0.25), transparent 40%),
              linear-gradient(180deg, #0d0604 0%, #35130b 30%, #5a1f0f 60%, #2a0f08 100%);
  overflow-x: hidden;
}

body {
  position: relative;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: -28%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 16% 30%, rgba(255, 190, 102, 0.28), transparent 45%),
    radial-gradient(circle at 80% 26%, rgba(255, 118, 78, 0.26), transparent 42%),
    radial-gradient(circle at 45% 78%, rgba(255, 214, 161, 0.2), transparent 48%);
  filter: blur(34px) saturate(118%);
  transition: opacity 380ms ease;
}

body.is-playing::before {
  opacity: 0.52;
  animation: auroraDrift 18s linear infinite;
}

.page {
  min-height: 100vh;
  display: grid;
  gap: 28px;
  padding: 24px clamp(16px, 4vw, 40px) 48px;
  padding-left: max(clamp(16px, 4vw, 40px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 40px), env(safe-area-inset-right));
  width: 100%;
  position: relative;
  z-index: 1;
}

.app-version {
  position: fixed;
  right: 10px;
  bottom: 10px;
  font-size: 10px;
  color: rgba(217, 193, 165, 0.4);
  letter-spacing: 0.04em;
  pointer-events: none;
  z-index: 999;
}

.page,
.deck,
.controls,
.library,
.drop,
.list,
.track-list,
.track-list li {
  min-width: 0;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.home {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
}

.hero-title {
  flex: 1;
  text-align: right;
  position: relative;
  padding-right: clamp(98px, 16vw, 210px);
}

.hero-sub {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--muted);
}

.hero h1 {
  margin: 8px 0 8px;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(48px, 12vw, 120px);
  letter-spacing: 0.08em;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.deck {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  min-height: 320px;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.2) 100%);
  border: 1px solid var(--line);
}

.sun {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(88px, 14vw, 170px);
  height: clamp(88px, 14vw, 170px);
  border-radius: 50%;
  background: radial-gradient(circle, var(--sun) 0%, var(--sun-glow) 60%, rgba(255,155,47,0) 70%);
  filter: blur(1px);
  opacity: 0.9;
  pointer-events: none;
}

.sea {
  position: absolute;
  inset: auto 0 0 0;
  height: clamp(110px, 32%, 230px);
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  background:
    linear-gradient(
      180deg,
      rgba(70, 129, 160, 0) 0%,
      rgba(40, 85, 112, 0.16) 26%,
      rgba(25, 54, 79, 0.48) 68%,
      rgba(11, 22, 34, 0.74) 100%
    );
}

.wave {
  position: absolute;
  left: -32%;
  width: 164%;
  border-radius: 46% 54% 0 0 / 32% 33% 0 0;
  background:
    radial-gradient(28% 24% at 16% 6%, rgba(255, 230, 198, 0.24), transparent 62%),
    radial-gradient(24% 24% at 55% 8%, rgba(255, 242, 215, 0.18), transparent 65%),
    radial-gradient(26% 26% at 84% 7%, rgba(255, 240, 210, 0.19), transparent 64%),
    linear-gradient(180deg, rgba(103, 179, 212, 0.38), rgba(24, 64, 92, 0.82));
  box-shadow:
    0 -10px 18px rgba(132, 193, 224, 0.15),
    inset 0 10px 20px rgba(255, 255, 255, 0.08);
}

.wave-a {
  height: 82%;
  bottom: -58%;
  opacity: 0.58;
  animation: waveDriftA 14s ease-in-out infinite;
}

.wave-b {
  height: 76%;
  bottom: -56%;
  opacity: 0.44;
  animation: waveDriftB 11s ease-in-out infinite;
}

.wave-c {
  height: 70%;
  bottom: -54%;
  opacity: 0.34;
  animation: waveDriftC 18s ease-in-out infinite;
}

.controls {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 16px;
  padding: 24px;
  max-width: 720px;
  margin-inline: auto;
}

.now .label {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-size: 11px;
}

.now .title {
  font-size: 24px;
  font-weight: 600;
}

.now .status {
  color: var(--muted);
  font-size: 13px;
}

.busy-indicator {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.busy-indicator.hidden {
  display: none;
}

.busy-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 214, 161, 0.4);
  border-top-color: var(--accent);
  animation: busySpin 0.8s linear infinite;
}

.diag {
  margin-top: 10px;
  width: min(100%, 560px);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 214, 161, 0.14);
  background: rgba(0, 0, 0, 0.34);
  color: rgba(255, 242, 214, 0.86);
}

.diag summary {
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
}

.diag-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.diag-copy {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.diag-copy:active {
  transform: translateY(1px) scale(0.99);
}

.diag-text {
  margin: 10px 0 0;
  max-height: 220px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.35;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: pre-wrap;
  color: rgba(255, 242, 214, 0.82);
  opacity: 0.95;
}

.tempo-panel {
  margin-top: 8px;
  width: min(100%, 560px);
  padding: 8px 10px;
  border: 1px solid rgba(255, 214, 161, 0.2);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.26);
  display: grid;
  gap: 4px;
}

.tempo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tempo-key {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tempo-value {
  color: var(--accent);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.vinyl-wrap {
  margin-top: 14px;
  width: min(100%, 720px);
  margin-inline: auto;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.vinyl-stage {
  position: relative;
  width: clamp(280px, 44vw, 390px);
  height: clamp(230px, 36vw, 320px);
  display: grid;
  place-items: center;
}

.vinyl-disc {
  --vinyl-hold-angle: 0deg;
  position: relative;
  width: clamp(210px, 34vw, 300px);
  height: clamp(210px, 34vw, 300px);
  border-radius: 50%;
  border: 1px solid rgba(255, 214, 161, 0.24);
  background:
    radial-gradient(circle at 50% 50%, #2a1a14 0 9px, #0e0907 10px 15px, transparent 16px),
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.07) 0 1px, rgba(0, 0, 0, 0) 2px 6px),
    radial-gradient(circle at 30% 26%, rgba(255, 221, 160, 0.18), rgba(20, 10, 7, 0.95) 55%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -10px 18px rgba(0, 0, 0, 0.45),
    0 10px 18px rgba(0, 0, 0, 0.38);
  cursor: grab;
  flex: 0 0 auto;
  touch-action: none;
  user-select: none;
  transition: transform 120ms ease, box-shadow 120ms ease;
  z-index: 1;
}

.vinyl-disc::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(145deg, #d7c5aa, #8d7860);
  transform: translate(-50%, -50%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45);
}

.vinyl-disc::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 236, 200, 0.08);
  pointer-events: none;
}

.vinyl-disc:focus-visible {
  outline: 2px solid rgba(255, 214, 161, 0.7);
  outline-offset: 2px;
}

.tonearm {
  position: absolute;
  right: clamp(-8px, 1.2vw, 10px);
  top: clamp(18px, 3.2vw, 30px);
  width: clamp(148px, 24vw, 198px);
  height: 28px;
  z-index: 2;
  pointer-events: none;
  transform-origin: calc(100% - 10px) 14px;
  transform: rotate(25deg);
  transition: transform 620ms cubic-bezier(0.2, 0.82, 0.15, 1.02);
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.32));
}

.tonearm-bar {
  position: absolute;
  left: 24px;
  top: 10px;
  width: calc(100% - 40px);
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #cfc4b1 0%, #9d8f7b 45%, #756a5d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 1px 1px rgba(0, 0, 0, 0.32);
}

.tonearm-head {
  position: absolute;
  left: 0;
  top: 5px;
  width: 19px;
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(180deg, #ece0cd 0%, #948977 100%);
  border: 1px solid rgba(54, 42, 30, 0.45);
  transform: rotate(-8deg);
}

.tonearm-head::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 2px;
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, #f0d9aa 0%, #8e7754 100%);
  transform: rotate(-24deg);
  transform-origin: top center;
}

.tonearm-base {
  position: absolute;
  right: 0;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 242, 214, 0.35);
  background: radial-gradient(circle at 35% 30%, #d6c9b3 0%, #8f816f 55%, #564b3f 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.vinyl-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  max-width: 420px;
  text-align: center;
}

.progress-wrap {
  margin-top: 10px;
  display: grid;
  gap: 6px;
  max-width: 560px;
  margin-inline: auto;
}

.progress-times {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.progress-rail {
  position: relative;
}

#progress {
  width: 100%;
  margin: 0;
  accent-color: var(--sun);
}

#progress:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.switch-marker {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: 0 0 8px rgba(255, 214, 161, 0.7);
}

.switch-marker.hidden {
  display: none;
}

.switch-hint {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.buttons {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.buttons button {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

button.is-pressed {
  transform: translateY(1px) scale(0.98);
  filter: brightness(1.08);
}

button.is-pending {
  cursor: wait !important;
  pointer-events: none;
}

.btn-spinner {
  display: none;
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 214, 161, 0.35);
  border-top-color: var(--accent);
  pointer-events: none;
  animation: busySpin 0.7s linear infinite;
}

.buttons button .btn-spinner,
.drop button .btn-spinner {
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.buttons button.is-pending,
.drop button.is-pending {
  padding-right: 34px;
}

.buttons button.is-pending .btn-spinner,
.drop button.is-pending .btn-spinner {
  display: block;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.toggle input {
  accent-color: var(--sun);
}

.sliders {
  display: grid;
  gap: 10px;
}

.slider {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.slider input[type="range"] {
  width: 100%;
}

.slider-select select {
  min-width: 132px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  padding: 6px 10px;
}

.library {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(240px, 340px) 1fr;
}

.drop {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 20px;
  background: var(--panel);
  display: grid;
  gap: 8px;
  text-align: center;
}

.drop.dragging {
  border-color: var(--accent);
  background: rgba(255, 214, 161, 0.08);
}

.drop-title {
  font-size: 18px;
  font-weight: 600;
}

.drop-sub {
  color: var(--muted);
}

.drop button {
  justify-self: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.4);
  color: var(--text);
  cursor: pointer;
  position: relative;
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.upload-status {
  font-size: 12px;
  color: var(--muted);
}

.upload-status.loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.upload-status.loading::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 214, 161, 0.35);
  border-top-color: var(--accent);
  animation: busySpin 0.8s linear infinite;
}

.list {
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 16px;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.list-library-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.36);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  padding: 4px 12px;
  cursor: pointer;
  position: relative;
  transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease, color 120ms ease;
}

.list-library-btn:hover {
  border-color: rgba(255, 214, 161, 0.5);
  color: var(--accent);
}

.list-library-btn:focus-visible {
  outline: 2px solid rgba(255, 214, 161, 0.75);
  outline-offset: 2px;
}

.list-library-btn.is-hit {
  animation: listButtonHit 0.28s cubic-bezier(0.2, 0.78, 0.16, 1);
}

.list-library-btn .btn-spinner {
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.list-library-btn.is-pending {
  padding-right: 28px;
}

.list-library-btn.is-pending .btn-spinner {
  display: block;
}

.track-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.track-list li {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.35);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.track-list li.is-hit {
  animation: listRowHit 0.3s cubic-bezier(0.2, 0.74, 0.2, 1);
}

.track-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.track-rating {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 161, 0.25);
  background: rgba(0, 0, 0, 0.28);
}

.track-star-btn {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(255, 214, 161, 0.28);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: color 120ms ease, transform 120ms ease, text-shadow 120ms ease;
}

.track-star-btn:hover {
  color: rgba(255, 223, 153, 0.76);
  transform: translateY(-1px);
}

.track-star-btn.is-hit {
  animation: starHit 0.26s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.track-star-btn.is-on {
  color: #ffcf68;
  text-shadow: 0 0 7px rgba(255, 207, 104, 0.36);
}

.track-star-btn:focus-visible {
  outline: 2px solid rgba(255, 214, 161, 0.75);
  outline-offset: 1px;
  border-radius: 4px;
}

.track-star-btn .btn-spinner {
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
}

.track-star-btn.is-pending {
  color: transparent;
}

.track-star-btn.is-pending .btn-spinner {
  display: block;
}

.track-delete-btn {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255, 150, 150, 0.55);
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 224, 224, 0.26), transparent 45%),
    linear-gradient(145deg, rgba(255, 122, 122, 0.28), rgba(115, 22, 22, 0.72));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 8px 14px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  flex: 0 0 auto;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.track-delete-btn::before,
.track-delete-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: #ffe3e3;
  transform-origin: center;
}

.track-delete-btn::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.track-delete-btn::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.track-delete-btn .btn-spinner {
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  transform: translate(-50%, -50%);
}

.track-delete-btn.is-pending::before,
.track-delete-btn.is-pending::after {
  opacity: 0;
}

.track-delete-btn.is-pending .btn-spinner {
  display: block;
}

.track-delete-btn:hover {
  transform: translateY(-1px) scale(1.05);
  border-color: rgba(255, 176, 176, 0.9);
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 228, 228, 0.35), transparent 45%),
    linear-gradient(145deg, rgba(255, 140, 140, 0.35), rgba(140, 28, 28, 0.78));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 10px 18px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 168, 168, 0.2);
}

.track-delete-btn.is-hit {
  animation: deleteHit 0.3s cubic-bezier(0.2, 0.72, 0.2, 1);
}

.track-delete-btn:active {
  transform: translateY(0) scale(0.98);
}

.track-delete-btn:focus-visible {
  outline: 2px solid rgba(255, 214, 161, 0.75);
  outline-offset: 2px;
}

.track-list li.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 214, 161, 0.2);
}

body.is-playing .hero-title {
  animation: heroSway calc(var(--tempo-beat-sec) * 14) ease-in-out infinite;
}

body.is-playing .hero-sub {
  animation: heroBlink calc(var(--tempo-beat-sec) * 4.8) steps(2, end) infinite;
}

body.is-playing .deck {
  border-color: rgba(255, 214, 161, 0.35);
  box-shadow: 0 12px 44px rgba(255, 128, 72, 0.24);
}

body.is-playing .controls {
  animation: controlsFloat calc(var(--tempo-beat-sec) * 5.6) ease-in-out infinite;
}

body.is-playing .sun {
  animation: sunBeat calc(var(--tempo-beat-sec) * 4.4) ease-in-out infinite;
}

body.is-playing .wave-a {
  animation-duration: calc(var(--tempo-beat-sec) * 20);
}

body.is-playing .wave-b {
  animation-duration: calc(var(--tempo-beat-sec) * 17);
}

body.is-playing .wave-c {
  animation-duration: calc(var(--tempo-beat-sec) * 26);
}

body.is-playing .progress-wrap {
  animation: progressGlow calc(var(--tempo-beat-sec) * 3.8) ease-in-out infinite;
}

body.is-playing .switch-marker {
  animation: markerPulse calc(var(--tempo-beat-sec) * 1.9) ease-in-out infinite;
}

body.is-playing .track-list li.active {
  animation: activeTrackPulse calc(var(--tempo-beat-sec) * 3) ease-in-out infinite;
}

body.is-playing #play-btn {
  animation: btnBeat calc(var(--tempo-beat-sec) * 4.8) ease-in-out infinite;
}

body.is-playing #stop-btn {
  animation: btnBeat calc(var(--tempo-beat-sec) * 4.8) ease-in-out infinite 0.16s;
}

body.is-playing #next-btn {
  animation: btnBeat calc(var(--tempo-beat-sec) * 4.8) ease-in-out infinite 0.32s;
}

body.is-playing .vinyl-disc {
  animation: vinylSpin calc(var(--tempo-beat-sec) * 3.3) linear infinite;
}

body.is-playing .tonearm {
  transform: rotate(-5deg);
}

body.vinyl-holding .vinyl-disc {
  animation: none;
  cursor: grabbing;
  transform: rotate(var(--vinyl-hold-angle, 0deg)) scale(0.98);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -10px 18px rgba(0, 0, 0, 0.45),
    0 6px 10px rgba(0, 0, 0, 0.3);
}

body.vinyl-holding .vinyl-hint {
  color: var(--accent);
}

body.vinyl-holding .tonearm {
  transform: rotate(-3deg);
}

body.is-crossfading .deck {
  animation: crossfadeFlash 0.58s ease-in-out infinite alternate;
}

@keyframes auroraDrift {
  0% { transform: translate3d(-2%, 0%, 0) scale(1) rotate(0deg); }
  50% { transform: translate3d(2%, 1.8%, 0) scale(1.04) rotate(3deg); }
  100% { transform: translate3d(-2%, 0%, 0) scale(1) rotate(0deg); }
}

@keyframes heroSway {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes heroBlink {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

@keyframes controlsFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes sunBeat {
  0%, 100% { transform: scale(1); filter: blur(1px) brightness(1); }
  50% { transform: scale(1.07); filter: blur(0.2px) brightness(1.09); }
}

@keyframes waveDriftA {
  0% { transform: translate3d(-8%, 0%, 0) scaleX(1.05); }
  50% { transform: translate3d(5%, -20%, 0) scaleX(0.98); }
  100% { transform: translate3d(-8%, 0%, 0) scaleX(1.05); }
}

@keyframes waveDriftB {
  0% { transform: translate3d(6%, 0%, 0) scaleX(0.96); }
  50% { transform: translate3d(-7%, -25%, 0) scaleX(1.04); }
  100% { transform: translate3d(6%, 0%, 0) scaleX(0.96); }
}

@keyframes waveDriftC {
  0% { transform: translate3d(-3%, 0%, 0) scaleX(1.02); }
  50% { transform: translate3d(3%, -15%, 0) scaleX(0.99); }
  100% { transform: translate3d(-3%, 0%, 0) scaleX(1.02); }
}

@keyframes progressGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

@keyframes markerPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes activeTrackPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 214, 161, 0.2); }
  50% { box-shadow: 0 0 0 2px rgba(255, 214, 161, 0.38), 0 0 18px rgba(255, 184, 102, 0.32); }
}

@keyframes btnBeat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes listButtonHit {
  0% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
    border-color: var(--line);
  }
  45% {
    transform: translateY(-1px) scale(1.04);
    filter: brightness(1.18);
    border-color: rgba(255, 214, 161, 0.85);
  }
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
    border-color: var(--line);
  }
}

@keyframes listRowHit {
  0% {
    border-color: var(--line);
    background: rgba(0, 0, 0, 0.35);
    box-shadow: none;
  }
  45% {
    border-color: rgba(255, 214, 161, 0.72);
    background: rgba(255, 214, 161, 0.12);
    box-shadow: 0 0 0 2px rgba(255, 214, 161, 0.2);
  }
  100% {
    border-color: var(--line);
    background: rgba(0, 0, 0, 0.35);
    box-shadow: none;
  }
}

@keyframes starHit {
  0% {
    transform: translateY(0) scale(1);
    text-shadow: none;
  }
  45% {
    transform: translateY(-1px) scale(1.28);
    text-shadow: 0 0 8px rgba(255, 223, 142, 0.55);
  }
  100% {
    transform: translateY(0) scale(1);
    text-shadow: none;
  }
}

@keyframes deleteHit {
  0% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
  45% {
    transform: translateY(-1px) scale(1.09);
    filter: brightness(1.15);
  }
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes vinylSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes crossfadeFlash {
  from { box-shadow: 0 12px 44px rgba(255, 128, 72, 0.24); }
  to { box-shadow: 0 16px 54px rgba(255, 187, 125, 0.38); }
}

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

@media (prefers-reduced-motion: reduce) {
  body.is-playing::before,
  body.is-playing .hero-title,
  body.is-playing .hero-sub,
  body.is-playing .deck,
  body.is-playing .controls,
  body.is-playing .sun,
  body.is-playing .wave-a,
  body.is-playing .wave-b,
  body.is-playing .wave-c,
  body.is-playing .progress-wrap,
  body.is-playing .switch-marker,
  body.is-playing .track-list li.active,
  body.is-playing #play-btn,
  body.is-playing #stop-btn,
  body.is-playing #next-btn,
  body.is-playing .vinyl-disc,
  body.is-crossfading .deck,
  .list-library-btn.is-hit,
  .track-list li.is-hit,
  .track-star-btn.is-hit,
  .track-delete-btn.is-hit,
  .busy-spinner,
  .upload-status.loading::before {
    animation: none !important;
  }
  .tonearm {
    transition: none !important;
  }
}

@media (max-width: 980px) {
  .page {
    gap: 18px;
    padding-top: 16px;
    padding-bottom: 34px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .library {
    grid-template-columns: 1fr;
  }
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-title {
    text-align: left;
    padding-right: 0;
  }
  .sun {
    right: 6px;
    top: 6px;
    transform: none;
    width: clamp(64px, 18vw, 108px);
    height: clamp(64px, 18vw, 108px);
    opacity: 0.78;
  }
  .controls {
    width: 100%;
    max-width: 100%;
    padding: 16px;
  }
  .buttons {
    gap: 8px;
  }
  .buttons button {
    padding: 8px 14px;
  }
  .slider input[type="range"] {
    min-width: 0;
  }
  .list {
    padding: 12px;
  }
  .track-list li {
    gap: 8px;
  }
}

@media (max-width: 760px) {
  .page {
    gap: 14px;
    padding-top: 10px;
    padding-bottom: 24px;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }
  .deck {
    border-radius: 16px;
  }
  .controls {
    padding: 12px;
  }
  .hero h1 {
    letter-spacing: 0.04em;
  }
  .slider {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .slider input[type="range"],
  .slider-select select {
    width: 100%;
    min-width: 0;
    justify-self: stretch;
  }
  .track-actions {
    gap: 5px;
  }
  .track-rating {
    padding: 1px 4px;
  }
  .track-star-btn {
    width: 16px;
    height: 16px;
    font-size: 11px;
  }
  .track-delete-btn {
    width: 28px;
    height: 28px;
  }
}
