:root {
  --bg: #f4f5f8;
  --card: #ffffff;
  --ink: #161b26;
  --ink-2: #5a6376;
  --ink-3: #8a93a5;
  --line: #e3e6ec;
  --accent: #3d63dd;
  --accent-ink: #ffffff;
  --accent-soft: rgba(61, 99, 221, 0.1);
  --click: #e5466f;
  --click-soft: rgba(229, 70, 111, 0.13);
  --wave: #aab3c4;
  --hero-1: #1b2440;
  --hero-2: #2c3c73;
  --hero-ink: #f3f5fb;
  --hero-ink-2: #c3cae0;
  --shadow: 0 1px 2px rgba(20, 30, 60, 0.05), 0 8px 24px rgba(20, 30, 60, 0.06);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f1218;
    --card: #171b23;
    --ink: #e9ecf3;
    --ink-2: #a0a8b9;
    --ink-3: #6f788b;
    --line: #262c38;
    --accent: #7c9cff;
    --accent-ink: #0c1020;
    --accent-soft: rgba(124, 156, 255, 0.14);
    --click: #ff6f93;
    --click-soft: rgba(255, 111, 147, 0.16);
    --wave: #4b5468;
    --hero-1: #121a33;
    --hero-2: #1d2b58;
    --shadow: none;
  }
}
:root[data-theme='dark'] {
  --bg: #0f1218;
  --card: #171b23;
  --ink: #e9ecf3;
  --ink-2: #a0a8b9;
  --ink-3: #6f788b;
  --line: #262c38;
  --accent: #7c9cff;
  --accent-ink: #0c1020;
  --accent-soft: rgba(124, 156, 255, 0.14);
  --click: #ff6f93;
  --click-soft: rgba(255, 111, 147, 0.16);
  --wave: #4b5468;
  --hero-1: #121a33;
  --hero-2: #1d2b58;
  --shadow: none;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------------------------------------------------------------- header */
.hero {
  background: linear-gradient(135deg, var(--hero-1), var(--hero-2));
  color: var(--hero-ink);
  padding: 32px 0;
}
.title {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.logo {
  width: 44px;
  height: 44px;
  flex: none;
  color: #9fb4ff;
  margin-top: 2px;
}
.logo-dot {
  fill: #ff6f93;
}
.logo-strike {
  stroke: #ffffff;
}
h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.sub {
  margin: 6px 0 0;
  color: var(--hero-ink-2);
  max-width: 560px;
}

/* ---------------------------------------------------------------- controls */
select,
.btn {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
  min-width: 0;
}
.btn:hover {
  border-color: var(--accent);
}
.btn.ghost {
  background: transparent;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
label.btn:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- cards */
/* main also carries .wrap, whose margin/padding shorthands would win over a plain `main` rule */
main.wrap {
  margin-top: 20px;
  padding-bottom: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card + .card {
  margin-top: 16px;
}

/* ---------------------------------------------------------------- player */
.player {
  position: relative;
}
.source {
  display: flex;
  gap: 10px 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.title-select {
  font-size: 17px;
  font-weight: 600;
  padding: 7px 34px 7px 12px;
  max-width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
}
.title-select[hidden] {
  display: none;
}
.file-meta {
  color: var(--ink-2);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.file-meta.status-err {
  color: var(--click);
}
.btn.open {
  margin-left: auto;
}
.wave-wrap {
  position: relative;
}
#overview {
  width: 100%;
  height: 160px;
  display: block;
  cursor: pointer;
  border-radius: 10px;
  background: var(--bg);
}
.drop-hint {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--accent);
  border-radius: 10px;
  background: var(--card);
  opacity: 0.94;
  font-weight: 600;
}
.player.dragging .drop-hint {
  display: flex;
}
.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-top: 14px;
}
.play {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 4px 14px var(--accent-soft);
}
.play svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}
.play:disabled {
  opacity: 0.4;
  cursor: default;
}
.play .i-pause,
.play.playing .i-play {
  display: none;
}
.play.playing .i-pause {
  display: block;
}
.time {
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  min-width: 140px;
}
.time .sep {
  color: var(--ink-3);
  margin: 0 6px;
}
#dur {
  color: var(--ink-2);
}
.listen {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}
.seg {
  font: inherit;
  font-size: 14px;
  padding: 7px 14px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.seg.active {
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.seg[data-mode='removed'].active {
  color: var(--click);
}
.live {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink-2);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.live b {
  color: var(--ink);
}
.led {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.3s, box-shadow 0.3s;
}
.led.on {
  background: var(--click);
  box-shadow: 0 0 0 4px var(--click-soft);
  transition: none;
}
@media (max-width: 640px) {
  .live,
  .btn.open {
    margin-left: 0;
  }
}

/* ---------------------------------------------------------------- strength */
.strength {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  gap: 8px 32px;
  align-items: center;
}
.strength .progress {
  grid-column: 1 / -1;
}
@media (max-width: 760px) {
  .strength {
    grid-template-columns: minmax(0, 1fr);
  }
}
.strength-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.strength-head label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  font-weight: 600;
}
#strengthVal {
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1;
}
#strength {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  margin: 10px 0 2px;
  cursor: pointer;
}
#strength::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
}
#strength::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
}
#strength::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--card);
  border: 3px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
#strength::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--card);
  border: 3px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.scale {
  display: flex;
  justify-content: space-between;
  color: var(--ink-3);
  font-size: 12px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  transition: opacity 0.2s;
}
.stats.updating {
  opacity: 0.45;
}
.stats div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.stats b {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stats span {
  color: var(--ink-2);
  font-size: 12px;
}
.progress {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.progress div {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.25s;
}

/* ---------------------------------------------------------------- footer */
.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--ink-3);
  font-size: 12px;
  padding-top: 8px;
  padding-bottom: 32px;
}
kbd {
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 5px;
  margin-right: 3px;
  color: var(--ink-2);
  background: var(--card);
}
