:root {
  --bg: #101217;
  --bg-deep: #0b0d11;
  --panel: #171a21;
  --line: #262a33;
  --text: #e9ebef;
  --muted: #9097a3;
  --accent: #8aa4ff;
  --note: #8aa4ff;
  --note-dark: #5b6fd6;
  --note-lit: #c3d0ff;
  --ok: #6fcf97;
  --warn: #e7b35a;
  --bad: #ef7a7a;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Component display rules must never override the hidden attribute. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); font-weight: 650; letter-spacing: -0.01em; font-size: 17px; }
.brand:hover { text-decoration: none; }
nav { display: flex; gap: 20px; }
nav a { color: var(--muted); }
nav a:hover { color: var(--text); text-decoration: none; }

main { padding: 32px 24px 48px; }
.narrow { max-width: 400px; margin: 40px auto 0; }
.wide { max-width: 760px; margin: 0 auto; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 28px 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.hint { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.note { background: #1c2a22; color: var(--ok); padding: 8px 12px; border-radius: 8px; margin: 0 0 16px; }
.error { color: var(--bad); margin: 8px 0; }
.empty { color: var(--muted); }
.switch { color: var(--muted); margin: 20px 0 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0 4px; }

form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input:not([type=range]):not([type=file]) {
  font: inherit;
  color: var(--text);
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button, .button {
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #1f232c;
  color: var(--text);
  cursor: pointer;
}
button:hover:not(:disabled), .button:hover { background: #262b36; text-decoration: none; }
button:disabled { opacity: 0.55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #0b0d11; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #a2b6ff; }
button.danger { color: var(--bad); }
button.link { background: none; border: 0; color: var(--accent); height: auto; padding: 0; justify-self: start; }
button.icon { width: 38px; padding: 0; color: var(--muted); }
button.icon:hover { color: var(--bad); }

.drop {
  display: grid;
  place-items: center;
  gap: 6px;
  text-align: center;
  padding: 44px 20px;
  border: 1.5px dashed #343a46;
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
  color: var(--text);
  font-size: 15px;
}
.drop:hover, .drop.over { border-color: var(--accent); background: #1a1e28; }
.drop.working { opacity: 0.7; pointer-events: none; }

.songs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.song {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.song .status { grid-column: 2; grid-row: 1; }
.song .open { grid-column: 3; grid-row: 1; }
.song .delete { grid-column: 4; grid-row: 1; }
.info { display: grid; gap: 2px; min-width: 0; grid-column: 1; grid-row: 1; }
.name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { color: var(--muted); font-size: 13px; }
.job-error { color: var(--bad); font-size: 13px; }
.status { font-size: 13px; color: var(--muted); white-space: nowrap; }
.status[data-state=done] { color: var(--ok); }
.status[data-state=processing], .status[data-state=queued] { color: var(--warn); }
.status[data-state=failed], .status[data-state=rejected] { color: var(--bad); }
.bar { display: block; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.bar span { display: block; height: 100%; background: var(--warn); transition: width 0.6s ease; }

body[data-view=play] main { padding: 16px 24px 24px; }
.playpage { display: grid; gap: 12px; height: calc(100vh - 104px); grid-template-rows: auto auto 1fr auto; }
.playhead { display: flex; align-items: baseline; gap: 16px; min-width: 0; }
.playhead h1 { font-size: 18px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { color: var(--muted); white-space: nowrap; }
.player { min-height: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.player canvas { display: block; width: 100%; height: 100%; }
.controls { display: grid; grid-template-columns: 90px 1fr auto; gap: 16px; align-items: center; }
.seek { width: 100%; accent-color: var(--accent); }
.time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }

@media (max-width: 600px) {
  main { padding: 20px 16px 40px; }
  .top { padding: 14px 16px; }
  .drop { padding: 28px 16px; }
  .song { grid-template-columns: 1fr auto auto; row-gap: 4px; }
  .song .status { grid-column: 1; grid-row: 2; }
  .song .open { grid-column: 2; }
  .song .delete { grid-column: 3; }
  .playpage { height: calc(100vh - 92px); }
}
