:root {
  --bg: #121212;
  --panel: #1f1f1f;
  --hover: #2a2a2a;
  --line: #333;
  --text: #fff;
  --muted: #b3b3b3;
  --green: #1ed760;
  --flp: #ff9a3c;
  --accent: #c8372b; /* Artist-Farbe, wird per JS gesetzt */
  --font: "Helvetica Neue", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #000; color: var(--text); font: 14px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.sub { color: var(--muted); font-size: 12px; }
.bar { height: 4px; background: #3a3a3a; border-radius: 9px; overflow: hidden; margin-top: 6px; }
.bar span { display: block; height: 100%; width: 0; background: var(--green); }

/* ---------- Grundgerüst ---------- */
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 8px; padding: 8px; min-height: 100vh; }
.content { background: var(--bg); border-radius: 8px; min-width: 0; overflow: hidden; padding-bottom: 110px; }
.sidebar {
  background: var(--bg); border-radius: 8px; padding: 10px;
  display: flex; flex-direction: column;
  position: sticky; top: 8px; height: calc(100vh - 16px); overflow-y: auto;
}

/* ---------- Artists ---------- */
.artists { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-bottom: 12px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.artist {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; border: 0; border-radius: 8px; background: none;
  font-weight: 600; font-size: 13px; color: var(--muted);
}
.artist:hover { background: var(--panel); }
.artist[aria-pressed="true"] { background: var(--hover); color: var(--text); }
.artist-img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: #333; display: grid; place-items: center; font-size: 22px; font-weight: 800; }

/* ---------- Menü ---------- */
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu-item {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 10px; border: 0; border-radius: 6px; background: none;
  text-align: left; font-size: 15px; font-weight: 600; color: var(--muted);
}
.menu-item:hover { background: var(--panel); color: var(--text); }
.menu-item[aria-current] { background: var(--hover); color: var(--text); }
.menu-item.over { outline: 2px solid var(--c); outline-offset: -2px; color: var(--text); }
.menu-item.extra { margin-top: 14px; }
.menu-item.extra::before { content: ""; position: absolute; left: 10px; right: 10px; top: -8px; border-top: 1px solid var(--line); }
.menu-item > * { pointer-events: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.menu-label { flex: 1; min-width: 0; }
.count { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }

.side-foot { margin-top: auto; padding: 16px 10px 4px; font-size: 12px; color: var(--muted); }
.me { margin-top: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Kopf ---------- */
.hero {
  display: flex; align-items: flex-end; gap: 18px; padding: 32px 24px 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 85%, #000), color-mix(in srgb, var(--accent) 45%, #121212));
}
.hero-img { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: rgb(0 0 0 / .3); box-shadow: 0 6px 28px rgb(0 0 0 / .5); display: grid; place-items: center; font-size: 42px; font-weight: 800; }
.hero-text { min-width: 0; }
.hero-kicker { font-weight: 700; }
.hero h1 { margin: 0 0 4px; font-size: clamp(28px, 5vw, 56px); line-height: 1.1; font-weight: 900; letter-spacing: -.03em; }

.action-bar { display: flex; align-items: center; gap: 12px; padding: 16px 24px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 20%, #121212), var(--bg)); }
.search { margin-left: auto; width: 260px; min-width: 0; background: #242424; border: 1px solid transparent; border-radius: 99px; padding: 9px 16px; }
.search:focus { border-color: #fff; outline: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-block; background: none; border: 1px solid #727272; border-radius: 99px; padding: 8px 18px; color: var(--text); font-weight: 700; font-size: 14px; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: #fff; }
.btn-primary { background: var(--green); border-color: var(--green); color: #000; }
.btn-primary:hover { background: #3be477; border-color: #3be477; }
.btn-danger { color: #f87171; border-color: #6b2b2b; }
.btn-danger:hover { border-color: #f87171; }
.btn-small { padding: 5px 12px; font-size: 12px; }
.icon-btn { width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--muted); flex-shrink: 0; }
.icon-btn:hover { background: #3a3a3a; color: var(--text); }
.icon-btn.danger:hover { color: #f87171; }

/* ---------- Songliste ---------- */
.list { padding: 0 16px; container-type: inline-size; }
.row {
  display: grid; grid-template-columns: 40px minmax(120px, 1fr) minmax(0, 1.5fr) 158px;
  align-items: center; gap: 14px; padding: 10px; border-radius: 8px;
  border-bottom: 1px solid #1e1e1e;
}
.row:hover { background: var(--panel); }
.row.dragging { opacity: .4; }
.row.drop-active { outline: 2px dashed var(--green); outline-offset: -2px; }
.play { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--green); color: #000; font-size: 13px; padding: 0 0 0 2px; }
.play:hover { background: #3be477; }
.play:disabled { background: #2a2a2a; color: #555; cursor: default; }
.row-title { border: 0; background: none; padding: 4px 0; text-align: left; min-width: 0; }
.row-title b { display: block; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.row-title:hover b { text-decoration: underline; }
.row-title .sub { display: block; }
.title-cell { min-width: 0; }
.plan-toggle { position: relative; display: block; width: 32px; height: 24px; margin-left: -8px; padding: 0; border: 0; border-radius: 6px; background: none; }
.plan-toggle:hover { background: #3a3a3a; }
.plan-toggle::before { content: ""; position: absolute; left: 11px; top: 6px; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.plan-toggle[aria-expanded="true"]::before { top: 10px; transform: rotate(-135deg); }
.plan-toggle.filled::before { border-color: var(--green); }
.flp { display: flex; align-items: center; gap: 8px; min-width: 0; }
.flp-info { flex: 1; min-width: 0; }
.flp-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-cell { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.flp-tag, .wav-tag, .beat-tag, .zip-tag, .file-ext { font-size: 11px; font-weight: 800; border-radius: 4px; padding: 5px 7px; flex-shrink: 0; min-width: 42px; text-align: center; }
.flp-tag { background: var(--flp); color: #000; }
.wav-tag { background: #4cb3ff; color: #000; }
.beat-tag { background: #fff; color: #000; }
.zip-tag { background: #ffd84d; color: #000; }
.plan-fields { grid-column: 2 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 14px; padding-bottom: 6px; }
.plan-fields .field { min-width: 0; }
.plan-fields textarea { min-height: 58px; }
.link-row { display: flex; align-items: center; gap: 8px; }
.link-row input { flex: 1; min-width: 0; }
.field input.invalid { border-color: #f87171; }
.link-field { min-width: 0; }
.link-field label { display: flex; flex-direction: column; gap: 5px; }
.file-ext { background: #3a3a3a; }
.phase-select { width: 100%; background: #2a2a2a; border: 1px solid transparent; border-radius: 6px; padding: 8px; font-size: 13px; }
.phase-select:hover { border-color: #666; }
.empty { color: var(--muted); padding: 40px 10px; text-align: center; font-size: 15px; }

/* Schmale Liste: FLP rutscht unter den Titel */
@container (max-width: 820px) {
  .row { grid-template-columns: 40px minmax(0, 1fr) 150px; row-gap: 8px; }
  .file-cell { grid-column: 2 / -1; grid-row: 2; }
}
@container (max-width: 600px) {
  .plan-fields { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 480px) {
  .row { grid-template-columns: 40px minmax(0, 1fr); }
  .phase-select, .file-cell { grid-column: 1 / -1; grid-row: auto; }
  .flp { flex-wrap: wrap; }
  .flp-info { flex-basis: calc(100% - 60px); }
}

/* ---------- Player + Uploads ---------- */
.player { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 8; display: flex; align-items: center; gap: 14px; background: #282828; border-radius: 8px; padding: 10px 14px; box-shadow: 0 8px 30px rgb(0 0 0 / .6); }
.player-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player audio { flex: 2; min-width: 0; height: 38px; }
.uploads { position: fixed; right: 16px; bottom: 80px; z-index: 15; width: min(320px, calc(100vw - 32px)); margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.upload { background: #282828; border-radius: 8px; padding: 12px; box-shadow: 0 8px 30px rgb(0 0 0 / .6); }
.upload .btn { margin-top: 8px; }
.upload-error { color: #f87171; }

/* ---------- Detailansicht ---------- */
.backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / .6); z-index: 10; }
.drawer { position: fixed; top: 8px; right: 8px; bottom: 8px; width: min(560px, calc(100vw - 16px)); background: var(--bg); border-radius: 8px; z-index: 11; overflow-y: auto; padding-bottom: 40px; }
.drawer.drop-active { outline: 2px dashed var(--green); outline-offset: -8px; }
.drawer-top { padding: 22px 22px 18px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 60%, #121212), var(--bg)); }
.drawer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.title-input { flex: 1; min-width: 0; font-size: 28px; font-weight: 900; letter-spacing: -.02em; background: none; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; margin-left: -7px; }
.title-input:hover, .title-input:focus { border-color: #777; background: rgb(0 0 0 / .2); outline: none; }
.drawer-body { padding: 0 22px; display: flex; flex-direction: column; gap: 24px; }
.drawer h3 { font-size: 16px; margin: 0 0 10px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { border: 0; background: #2a2a2a; border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.pill:hover { background: #3a3a3a; }
.pill.active { background: var(--c); color: #000; }
.field-row { display: grid; grid-template-columns: 1fr 170px; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 700; color: var(--muted); }
.field input, .field textarea, .dialog input, .dialog select { background: #2a2a2a; border: 1px solid transparent; border-radius: 6px; padding: 9px 12px; color: var(--text); font-weight: 400; font-size: 14px; }
.field input:focus, .field textarea:focus, .dialog input:focus, .dialog select:focus { border-color: #fff; outline: none; }
.field textarea { min-height: 90px; resize: vertical; }
.dropzone { width: 100%; border: 2px dashed #444; border-radius: 8px; padding: 18px; background: none; color: var(--muted); font-weight: 600; }
.dropzone:hover { border-color: var(--green); color: var(--text); }
.dropzone small { display: block; margin-top: 4px; font-weight: 400; }
.file-list, .activity { list-style: none; margin: 10px 0 0; padding: 0; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; }
.file:hover { background: var(--panel); }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity li { padding: 7px 0; border-bottom: 1px solid #2a2a2a; color: var(--muted); font-size: 13px; }
.activity b { color: var(--text); }
.activity time { float: right; font-size: 12px; margin-left: 10px; }
.drawer-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }

/* ---------- Dialog + Hinweis ---------- */
.dialog { background: #282828; color: var(--text); border: 0; border-radius: 12px; padding: 24px; width: min(440px, 92vw); }
.dialog::backdrop { background: rgb(0 0 0 / .7); }
.dialog h2 { margin: 0 0 16px; font-size: 24px; font-weight: 900; }
.dialog-artist { color: var(--green); font-size: 14px; }
.dialog label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.dialog input, .dialog select { background: #3e3e3e; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); background: #fff; color: #000; font-weight: 600; padding: 10px 18px; border-radius: 8px; z-index: 20; max-width: 90vw; }
.toast.error { background: #f15e6c; }

/* ---------- Konten ---------- */
.auth { position: fixed; inset: 0; z-index: 30; background: #000; overflow-y: auto; display: grid; place-items: center; padding: 20px; }
.auth-box { width: min(400px, 100%); background: var(--bg); border-radius: 12px; padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.auth-box:empty { display: none; }
.auth-box h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 900; letter-spacing: -.02em; overflow-wrap: anywhere; }
.auth-box p { margin: 0; font-size: 13px; }
.auth-brand { color: var(--green); font-weight: 800; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .btn { padding: 12px; }
.auth-form .btn:disabled { opacity: .6; cursor: default; }
.form-error { background: #4a1d22; color: #ffb4bb; border-radius: 6px; padding: 10px 12px; font-weight: 600; font-size: 13px; }
.link-btn { border: 0; background: none; padding: 4px 0; color: var(--muted); text-decoration: underline; font-size: 13px; text-align: left; }
.link-btn:hover { color: var(--text); }
.me { white-space: normal; }
.me-name { font-weight: 700; color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.me-actions { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.me-actions .link-btn { font-size: 12px; }
.share-btn { margin-top: 12px; }
.dialog-wide { width: min(560px, 94vw); max-height: 86vh; }
.dialog-head { display: flex; align-items: flex-start; gap: 10px; }
.dialog-head h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dialog h3 { margin: 20px 0 10px; font-size: 15px; }
.dialog .auth-form label { margin: 0; }
.people { list-style: none; margin: 14px 0; padding: 0; }
.people li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #3a3a3a; }
.people .person-full { flex-direction: column; align-items: stretch; }
.person { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 0; border-radius: 99px; background: #3e3e3e; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.chip:hover { background: #6b2b2b; }
.add-row { display: flex; align-items: center; gap: 8px; }
.add-row select { flex: 1; min-width: 0; }
.link-box { margin-top: 12px; }
.link-box .sub { margin-top: 6px; }

/* ---------- Handy ---------- */
@media (max-width: 620px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 0; gap: 0; }
  .sidebar { position: static; height: auto; border-radius: 0; }
  .artist { flex-direction: row; padding: 6px 10px; }
  .artist-img { width: 36px; height: 36px; font-size: 16px; }
  .menu { display: grid; grid-template-columns: 1fr 1fr; }
  .menu-item.extra { grid-column: 1 / -1; }
  .menu-item { font-size: 13px; gap: 8px; padding: 10px 8px; }
  .side-foot { padding: 12px 8px 2px; }
  .content { border-radius: 0; }
  .hero { padding: 20px 16px; }
  .hero-img { width: 64px; height: 64px; font-size: 26px; }
  .action-bar { padding: 14px 16px; }
  .search { flex: 1; }
  .list { padding: 0 6px; }
  .field-row { grid-template-columns: 1fr; }
}
