:root {
  --bg: #f3f4f7;
  --card: #ffffff;
  --text: #1c2233;
  --muted: #6b7386;
  --line: #e2e5ec;
  --accent: #2f5bd3;
  --accent-ink: #ffffff;
  --accent-soft: #e6ecfb;
  --danger: #c23a3a;
  --ok: #23a55a;
  --off: #b3b8c4;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 4px 14px rgba(20, 30, 60, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11141b;
    --card: #1b1f29;
    --text: #e8eaf0;
    --muted: #9aa1b2;
    --line: #2b3140;
    --accent: #6d8ff0;
    --accent-ink: #0e1220;
    --accent-soft: #24304f;
    --danger: #ef6b6b;
    --ok: #3cc777;
    --off: #555c6c;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; }
svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; margin: 18px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: .8rem; }
input, select, button { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=search], input:not([type]), select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }

#app { max-width: 760px; margin: 0 auto; padding: 0 12px 24px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; min-height: 40px; white-space: nowrap;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 20px; height: 20px; }
.icon {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; cursor: pointer; color: var(--text); flex: none;
}
.icon:hover { background: var(--accent-soft); }
.icon.big { width: 58px; height: 58px; background: var(--accent); color: var(--accent-ink); }
.icon.big svg { width: 30px; height: 30px; }
.icon.on { color: #e0a100; }
.icon.del:hover { color: var(--danger); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); padding: 24px; display: grid; gap: 14px; }
.login-card h1 { font-size: 1.4rem; }
.error { color: var(--danger); margin: 0; min-height: 1.2em; font-size: .9rem; }

/* Kopf */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px 10px; }
.brand { font-weight: 700; font-size: 1.15rem; }
.device { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: .9rem; }
.device select { width: auto; padding: 4px 8px; }
#dev-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--off); flex: none; }
.dot.on { background: var(--ok); }

/* Läuft gerade */
.now { padding: 14px; display: grid; grid-template-columns: 56px 1fr; gap: 10px 12px; position: sticky; top: 0; z-index: 5; }
.now-art { width: 56px; height: 56px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; overflow: hidden; }
.now-art img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.now-text { min-width: 0; align-self: center; }
.now-title { font-weight: 650; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-sub { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress, .controls, .volume, .now-error { grid-column: 1 / -1; }
.progress { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress input { flex: 1; }
.controls { display: flex; justify-content: center; align-items: center; gap: 14px; }
.volume { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.volume input { flex: 1; }
#volume-val { width: 2.5em; text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }
.now-error { color: var(--danger); font-size: .85rem; }
input[type=range] { accent-color: var(--accent); min-width: 0; height: 28px; }

/* Reiter */
.tabs { display: flex; gap: 6px; margin: 14px 0 10px; }
.tabs button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; color: var(--muted);
}
.tabs button.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.tabs svg { width: 20px; height: 20px; }

/* Listen */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 160px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); min-height: 56px; }
.list li:last-child { border-bottom: 0; }
.list li.click { cursor: pointer; }
.list li.click:hover { background: var(--accent-soft); }
.list li.playing { background: var(--accent-soft); }
.list .main { flex: 1; min-width: 0; }
.list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.list .meta { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .thumb { width: 36px; height: 36px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; overflow: hidden; flex: none; }
.list .thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.empty { color: var(--muted); padding: 18px; text-align: center; }

.folder-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.folder-head h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 16px; text-align: center; color: var(--muted);
  margin-bottom: 12px; cursor: pointer; display: grid; gap: 6px; justify-items: center;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.uploads { display: grid; gap: 6px; margin-bottom: 12px; }
.upload-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: .85rem; }
.upload-row progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--accent); }
.upload-row .err { color: var(--danger); }

.panel { padding: 14px; margin-bottom: 12px; display: grid; gap: 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.row > label { flex: 1; min-width: 140px; }
code.cmd { display: block; padding: 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); word-break: break-all; font-size: .85rem; user-select: all; }
.small { font-size: .85rem; color: var(--muted); }
.badge { display: inline-block; font-size: .75rem; padding: 1px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: 1px; }

.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: calc(100% - 32px);
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.toast.err { background: var(--danger); color: #fff; }

@media (max-width: 420px) {
  .tabs button { font-size: .85rem; }
  .now { grid-template-columns: 48px 1fr; }
  .now-art { width: 48px; height: 48px; }
}
