:root {
  color-scheme: dark;
  --bg: #14120e;
  --ink: #f6f1e7;
  --muted: #9c9284;
  --line: rgba(246, 241, 231, 0.1);
  --amber: #f0a202;
  --amber-ink: #1a1203;
  --card: #221e18;
  --danger: #e07058;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: "Avenir Next", Avenir, ui-rounded, system-ui, sans-serif;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  touch-action: manipulation;
  cursor: pointer;
}

:focus { outline: none; }

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

.sink {
  position: fixed;
  width: 1px;
  height: 1px;
  left: 0;
  bottom: 0;
  opacity: 0.02;
  pointer-events: none;
}

.picker {
  position: fixed;
  left: -1200px;
  top: 0;
  width: 240px;
  height: 80px;
  opacity: 0.01;
}

.app {
  width: min(100%, 34rem);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(18px + env(safe-area-inset-top)) 18px 28px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  width: 54px;
  height: 36px;
  color: var(--amber);
  flex: none;
}

.word, .tag, .count, .kicker, .fine, .queue-head p {
  margin: 0;
}

.word {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.tag, .fine, .queue-head p, .kicker {
  color: var(--muted);
}

.tag {
  margin-top: 4px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.count {
  flex: none;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.status {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(240, 162, 2, 0.12);
  color: #ffd98a;
  font-size: 0.92rem;
}

.app.is-empty .mark { display: none; }

.hero {
  position: relative;
  margin-top: 28px;
}

.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -28px;
  top: -24px;
  width: 240px;
  height: 180px;
  background: radial-gradient(circle, rgba(240, 162, 2, 0.16), transparent 68%);
  pointer-events: none;
}

.constellation {
  display: block;
  width: min(100%, 250px);
  height: auto;
  margin: 8px 0 26px;
  color: var(--amber);
  filter: drop-shadow(0 0 16px rgba(240, 162, 2, 0.28));
}

.constellation .dust { opacity: 0.35; }

.stage {
  margin-top: 28px;
}

.hero .wow {
  color: var(--amber);
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  max-width: 8ch;
  font-size: clamp(2.15rem, 8vw, 2.85rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.hero .lead {
  margin: 14px 0 0;
  max-width: 18rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.4;
}

.hero .dip { margin-top: 22px; }

.hero .fine {
  margin-top: 16px;
  max-width: 16rem;
  line-height: 1.4;
}

.title {
  margin: 0;
  font-size: clamp(1.7rem, 6vw, 2.25rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
  font-weight: 700;
}

.hero p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.dip, .add, .clear, .play, .step, .icon-btn {
  border: 0;
  background: transparent;
}

.dip, .add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  margin-top: 22px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--amber);
  color: var(--amber-ink);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dip { font-size: 1.15rem; padding: 0 28px; min-height: 58px; }

.hero .fine { margin-top: 14px; }

.stage {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  column-gap: 14px;
  align-items: center;
  padding: 18px 18px 16px;
  border-radius: 28px;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(240, 162, 2, 0.18), transparent 52%),
    var(--card);
  box-shadow: var(--shadow);
}

.cover {
  display: block;
  width: 84px;
  height: 84px;
  grid-column: 1;
  grid-row: 1 / span 2;
  margin: 0 0 12px;
  object-fit: cover;
  border-radius: 16px;
  background: #e4e4ea;
}

.kicker {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.title {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  margin-top: 4px;
  font-size: clamp(1.35rem, 5vw, 1.7rem);
  overflow-wrap: anywhere;
}

.times,
.scrubber,
.transport {
  grid-column: 1 / -1;
}

.times {
  display: flex;
  justify-content: space-between;
  margin-top: 22px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

.scrubber {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  margin: 0;
  background: transparent;
}

.scrubber:disabled { opacity: 0.45; }

.scrubber::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: #3c362e;
}

.scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border: 0;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(240, 162, 2, 0.16);
}

.scrubber::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: #3c362e;
}

.scrubber::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--amber);
}

.transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 8px;
}

.step, .play {
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.step {
  width: 52px;
  height: 52px;
  background: rgba(246, 241, 231, 0.06);
}

.step svg, .icon-btn svg { width: 22px; height: 22px; fill: currentColor; }

.step:disabled, .icon-btn:disabled, .clear:disabled {
  opacity: 0.35;
  cursor: default;
}

.play {
  width: 76px;
  height: 76px;
  background: var(--amber);
  color: var(--amber-ink);
}

.play svg { width: 32px; height: 32px; fill: currentColor; }

.icon-pause { display: none; }

.is-playing .icon-play { display: none; }

.is-playing .icon-pause { display: block; }

.queue-wrap {
  margin-top: 26px;
  flex: 1 0 auto;
}

.queue-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}

.queue-head p { margin-top: 4px; font-size: 0.88rem; }

.queue {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: 36px 44px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 64px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(246, 241, 231, 0.03);
  border: 1px solid transparent;
  user-select: none;
}

.row.is-current {
  background: rgba(240, 162, 2, 0.1);
  border-color: rgba(240, 162, 2, 0.28);
}

.row.is-dragging {
  opacity: 0.72;
  border-color: var(--amber);
}

.thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: #e4e4ea;
}

.grip {
  width: 36px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background:
    radial-gradient(circle, var(--muted) 1.3px, transparent 1.5px) 0 0 / 8px 8px;
  background-position: center;
  touch-action: none;
  cursor: grab;
}

.row-main {
  min-width: 0;
}

.name-line {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.play-hit {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  text-align: left;
  background: transparent;
  border: 0;
}

.name-line .play-hit {
  flex: 1;
  width: auto;
}

.rename-btn {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.rename-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.rename {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 2px 6px;
  border: 1px solid rgba(240, 162, 2, 0.55);
  border-radius: 8px;
  background: rgba(20, 18, 14, 0.55);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
  user-select: text;
  -webkit-user-select: text;
}

.row-main strong, .row-main .meta {
  display: block;
}

.row-main strong {
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.row-actions {
  display: flex;
  gap: 2px;
}

.icon-btn {
  width: 36px;
  height: 40px;
  border-radius: 10px;
  color: var(--ink);
}

.icon-btn.remove { color: var(--danger); }

.dock {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  padding: 22px 0 calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 72%, rgba(20, 18, 14, 0));
}

.dock .add, .dock .clear { margin-top: 0; }

.clear {
  min-height: 52px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--danger);
}

.clear.is-armed {
  background: rgba(224, 112, 88, 0.14);
}

.dock .fine {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  line-height: 1.4;
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
