:root {
  --bg: #0e0f12;
  --panel: #16181d;
  --line: #262a32;
  --text: #d8dbe2;
  --dim: #7d8492;
  --accent: #7aa2ff;
  --warn: #ff7a7a;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { font-weight: 600; margin: 0 0 .75rem; }
h1 { font-size: 1.2rem; }
h2 { font-size: 1rem; color: var(--text); }

.center {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 1.5rem;
}
.mark { font-size: 3rem; margin: 0; color: var(--dim); }
.quiet { color: var(--dim); margin: .25rem 0 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.login { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: .6rem; }
.login label { color: var(--dim); font-size: .85rem; }
.msg { color: var(--warn); margin: 0; font-size: .9rem; }

input, button {
  font: inherit; color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .55rem .7rem;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { background: var(--accent); color: #0b0d12; border-color: var(--accent); cursor: pointer; font-weight: 600; }
button.ghost { background: transparent; color: var(--dim); border-color: var(--line); font-weight: 400; padding: .3rem .7rem; }
button.ghost:hover { color: var(--text); }

.bar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky; top: 0;
}
.bar .brand { font-weight: 600; }
.bar .dim { color: var(--dim); font-weight: 400; }
.bar nav { display: flex; gap: 1rem; flex: 1; }
.bar nav a { color: var(--dim); }
.bar nav a:hover { color: var(--text); text-decoration: none; }
.bar form { margin: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
  max-width: 1200px; margin: 0 auto;
}
.placeholder {
  color: var(--dim); margin: 0;
  border: 1px dashed var(--line); border-radius: 6px;
  padding: 2rem 1rem; text-align: center; font-size: .9rem;
}
@media (max-width: 600px) {
  .bar { flex-wrap: wrap; gap: .75rem; }
  .bar nav { order: 3; flex-basis: 100%; }
}

/* Phase 2: Verwaltung (Tabellen, Filter) und oeffentliche Playlist */
.bar a.brand { color: var(--text); }
.bar a.brand:hover { text-decoration: none; }
.bar nav a[aria-current="page"] { color: var(--text); }
.wide { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }
.narrow { max-width: 640px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.narrow .card { margin-bottom: 1rem; }
.stack { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.row, .filter, .tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 1rem; }
.tools form, .act form, td form { margin: 0; display: inline; }
.dim { color: var(--dim); }
select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: .5rem .6rem;
}
input[type="search"] { min-width: 18rem; }
input.pos { width: 4.5rem; padding: .2rem .4rem; }
button.warn { background: var(--warn); border-color: var(--warn); }
button:disabled { opacity: .35; cursor: default; }
.counts { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; padding: 0; margin: 0 0 1rem; color: var(--dim); }
.counts b { color: var(--text); font-weight: 600; }
table.list { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: 1rem; }
table.list th, table.list td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { color: var(--dim); font-weight: 400; }
table.list .num { text-align: right; white-space: nowrap; }
table.list .act { white-space: nowrap; text-align: right; }
table.list .act a { margin-left: .75rem; }
table.list tr.off td { color: var(--dim); }
table.list tr.gone td { color: var(--dim); text-decoration: line-through; }
table.list tr.gone td.act { text-decoration: none; }
.pager { display: flex; gap: 1rem; justify-content: center; color: var(--dim); }
ol.tracks { list-style: none; padding: 0; margin: 0; }
ol.tracks li { display: flex; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
ol.tracks .nr { color: var(--dim); min-width: 2.5rem; text-align: right; font-variant-numeric: tabular-nums; }
ol.tracks .who { color: var(--dim); }

/* Phase 3: Player */
body.player { padding-bottom: calc(9.5rem + env(safe-area-inset-bottom)); }
.phead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .75rem; }
.phead h1 { margin: 0; }
.phead p { margin: 0; font-size: .85rem; }
.pl ol.tracks li { padding: 0; align-items: center; gap: 0; }
.pl ol.tracks li[aria-current="true"] .what, .pl ol.tracks li[aria-current="true"] .nr { color: var(--accent); }
.pl #liste button {
  flex: 1; display: flex; gap: .75rem; align-items: baseline; text-align: left;
  background: none; border: 0; border-radius: 0; color: var(--text); font-weight: 400; padding: .6rem 0; min-width: 0;
}
.pl #liste button:focus-visible, .pl a.dl:focus-visible, .ctl button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pl .tx { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; column-gap: .6rem; }
.pl .dur { color: var(--dim); font-variant-numeric: tabular-nums; font-size: .85rem; }
.pl a.dl { color: var(--dim); padding: .6rem .25rem .6rem .75rem; display: flex; }
.pl a.dl:hover { color: var(--text); }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.alle { margin: 1.25rem 0; color: var(--dim); font-size: .9rem; }
.alle summary { cursor: pointer; }
.alle ol { padding-left: 1.5rem; }
.alle li { padding: .2rem 0; }
svg.defs { position: absolute; width: 0; height: 0; }
.ctl {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
}
.ctl > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.ctl .now { margin-bottom: .3rem; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctl .seek { display: flex; align-items: center; gap: .75rem; }
.ctl .time { color: var(--dim); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ctl input[type="range"] { flex: 1; accent-color: var(--accent); padding: 0; border: 0; background: none; min-width: 0; }
.ctl .btns { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-top: .35rem; }
.ctl button.ic {
  position: relative; background: none; border: 0; color: var(--text); padding: .45rem; border-radius: 50%;
  display: inline-flex; font-weight: 400;
}
.ctl button.ic[aria-pressed="true"], .ctl button.ic[data-mode="all"], .ctl button.ic[data-mode="one"] { color: var(--accent); }
.ctl button.big { background: var(--accent); color: #0b0d12; padding: .7rem; }
.ctl button.big svg, #b-prev svg, #b-next svg { fill: currentColor; }
.ctl button.big svg { width: 1.5rem; height: 1.5rem; stroke-width: 1; }
.ctl .i-pause, .ctl .playing .i-play { display: none; }
.ctl .playing .i-pause { display: inline; }
.ctl .one { display: none; position: absolute; right: 0; bottom: 0; font-size: .6rem; font-weight: 700; }
.ctl [data-mode="one"] .one { display: block; }
.ctl input.vol { flex: 0 1 6rem; margin-left: .5rem; }
@media (max-width: 420px) { .ctl input.vol { display: none; } }
/* Nicht display:none (iOS bricht sonst die Wiedergabe ab): im Fluss lassen, aus dem Bild schieben. */
audio.offscreen { display: block; width: 1px; height: 1px; opacity: 0; transform: translateX(-200vw); pointer-events: none; }
.hint {
  position: fixed; left: .75rem; right: .75rem; top: .75rem; z-index: 10; max-width: 480px; margin: 0 auto;
  display: flex; gap: .75rem; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .6rem .75rem; font-size: .85rem; color: var(--dim);
}
.hint span { flex: 1; }
.hint button { padding: .25rem .6rem; font-size: .85rem; }

/* Phase 4: Upload und Log */
.block { margin-bottom: 1.25rem; }
.tops { display: flex; flex-wrap: wrap; gap: 1rem 3rem; margin-bottom: 1rem; }
.tops h2 { font-size: .9rem; color: var(--dim); font-weight: 400; margin-bottom: .3rem; }
ol.top { margin: 0; padding-left: 1.25rem; font-size: .9rem; }
table.list .nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.log td { vertical-align: top; }
input[type="date"] { padding: .35rem .5rem; }
#token { font-family: ui-monospace, monospace; font-size: .85rem; min-width: 0; flex: 1; max-width: 40rem; }

/* Phase 5: Visualisierung */
.viz {
  height: 48px; margin: 0 0 .75rem; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  background: var(--bg); cursor: zoom-in; touch-action: manipulation;
}
.viz canvas, .viz-stage canvas { display: block; width: 100%; height: 100%; }
.viz:focus-visible, .viz-btns button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px) { .viz { height: 40px; } }
.viz-big {
  position: fixed; left: 0; right: 0; top: 0; z-index: 8; height: 45vh; height: 45dvh;
  background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.viz-big[hidden] { display: none; }
.viz-big:fullscreen { height: 100%; border: 0; }
.viz-big:-webkit-full-screen { height: 100%; border: 0; }
.viz-stage { position: absolute; inset: 0; touch-action: manipulation; }
.viz-btns { position: absolute; top: calc(.5rem + env(safe-area-inset-top)); right: .5rem; display: flex; gap: .4rem; }
.viz-btns button {
  background: rgba(22, 24, 29, .75); color: var(--text); border: 1px solid var(--line);
  padding: .3rem .7rem; font-weight: 400; font-size: .85rem; min-width: 2.25rem;
}
