:root {
  --bg: #0b0b0d;
  --panel: #151518;
  --line: #26262b;
  --text: #ededf0;
  --muted: #8b8b94;
  --accent: #c6ff3d;
  --danger: #ff5a5a;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- Kopf ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(11, 11, 13, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: -.02em; font-size: 18px; white-space: nowrap; }
.brand span { color: var(--accent); }
.count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.search {
  flex: 1; min-width: 0; max-width: 360px; margin-left: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px; outline: none;
}
.search:focus { border-color: #44444c; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel);
  padding: 9px 16px; border-radius: 999px; white-space: nowrap;
  text-decoration: none; color: var(--text);
}
.btn:hover { border-color: #44444c; }
.btn.primary { background: var(--accent); color: #0b0b0d; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: none; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .45; cursor: default; }
.top [hidden], .empty [hidden] { display: none; }
.logout { margin: 0; }

/* ---------- Seitenleiste (Filter links) ---------- */
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.tabs {
  position: sticky; top: 67px; align-self: start; max-height: calc(100vh - 67px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px 24px clamp(16px, 3vw, 32px);
}
.tabs h3 { margin: 16px 0 4px 12px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tabs [hidden] { display: none; }
.people { display: contents; }
.tabs button {
  display: flex; justify-content: space-between; align-items: center; text-align: left;
  background: none; border: 1px solid transparent; border-radius: 10px;
  padding: 7px 12px; color: var(--muted);
}
.tabs button:hover { color: var(--text); background: var(--panel); }
.tabs button.on { background: var(--text); color: var(--bg); font-weight: 600; }
.tabs span { opacity: .6; font-size: 12px; margin-left: 8px; }
.sort {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px; outline: none; cursor: pointer;
}
.sort:hover, .sort:focus { border-color: #44444c; }

/* ---------- Galerie ---------- */
main { padding: 18px clamp(16px, 4vw, 40px) 80px 16px; min-width: 0; }
.grid { columns: 4 260px; column-gap: 16px; }
.card {
  break-inside: avoid; margin: 0 0 16px;
  background: var(--panel); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); cursor: pointer;
  transition: transform .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-2px); border-color: #3a3a42; }
.card video, .card img { display: block; width: 100%; height: auto; background: #000; min-height: 120px; }
/* freigestellte Bilder auf Schachbrett, damit die Transparenz sichtbar ist */
.card.cutout img, .player img.cutout {
  background: repeating-conic-gradient(#2a2a30 0 25%, #1c1c21 0 50%) 0 0 / 20px 20px;
}
.card .meta { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; font-size: 13px; }
.card .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .sub { color: var(--muted); white-space: nowrap; }

.empty {
  margin: 10vh auto 0; max-width: 440px; text-align: center; color: var(--muted);
  border: 1.5px dashed var(--line); border-radius: 20px; padding: 56px 28px;
}
.empty h2 { color: var(--text); margin: 0 0 8px; font-size: 20px; }
.empty p { margin: 0 0 22px; }

/* ---------- Ablegen ---------- */
.drop {
  position: fixed; inset: 0; z-index: 50; display: none;
  place-items: center; background: rgba(11, 11, 13, .88);
  border: 3px dashed var(--accent); font-size: 22px; font-weight: 600;
}
.drop.on { display: grid; }

/* ---------- Upload-Fortschritt ---------- */
.tray {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  width: min(340px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 8px;
}
.job { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.job .row { display: flex; justify-content: space-between; gap: 10px; }
.job .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .bar { height: 4px; background: var(--line); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.job .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.job.err .bar i { background: var(--danger); }

/* ---------- Player ---------- */
dialog {
  border: 0; padding: 0; background: transparent; color: var(--text);
  max-width: min(1100px, 94vw); width: 100%;
}
dialog::backdrop { background: rgba(0, 0, 0, .86); }
.player video, .player img { display: block; width: 100%; max-height: 74vh; object-fit: contain; background: #000; border-radius: var(--radius); }
.player [hidden] { display: none; }
.player .bar { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.player .name {
  flex: 1; min-width: 180px; background: transparent; border: 1px solid transparent;
  border-radius: 8px; padding: 7px 10px; font-size: 16px; font-weight: 600;
}
.player .name:hover, .player .name:focus { border-color: var(--line); outline: none; }
.player .tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; padding-left: 10px; }
.player .tags[hidden] { display: none; }
.player .tags > span { color: var(--muted); font-size: 13px; margin-right: 4px; }
.tag { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--muted); }
.tag:hover { color: var(--text); border-color: #44444c; }
.tag.on { background: var(--accent); border-color: var(--accent); color: #0b0b0d; font-weight: 600; }
.player .info { color: var(--muted); font-size: 13px; width: 100%; padding-left: 10px; }

/* schmal: Filter als waagrechte Leiste oben */
@media (max-width: 800px) {
  .layout { display: block; }
  .tabs {
    position: static; max-height: none; flex-direction: row; overflow-x: auto;
    padding: 14px 16px 0; gap: 6px; scrollbar-width: none;
  }
  .tabs h3 { display: none; }
  .tabs button { flex: none; border-color: var(--line); border-radius: 999px; padding: 7px 14px; }
  .tabs button.on { border-color: var(--text); }
  .sort { flex: none; order: 99; }
  main { padding: 18px 16px 80px; }
}

@media (max-width: 640px) {
  .top { flex-wrap: wrap; }
  .search { order: 5; max-width: none; flex-basis: 100%; }
  .count { display: none; }
  .grid { columns: 2 140px; column-gap: 10px; }
  .card { margin-bottom: 10px; }
}

/* ---------- Anmeldung ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form {
  width: 100%; max-width: 340px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 18px; padding: 28px;
}
.login h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
.login h1 span { color: var(--accent); }
.login p { margin: 0 0 20px; color: var(--muted); }
.login input {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 14px; margin-bottom: 12px; outline: none;
}
.login input:focus { border-color: #44444c; }
.login .btn { width: 100%; justify-content: center; }
.login .err { color: var(--danger); font-size: 13px; margin: 0 0 12px; }
