/* ===== Verwaltung ===== */
body { min-height: 100vh; background: radial-gradient(1000px 500px at 100% -20%, rgba(255, 92, 138, .12), transparent 60%), var(--night); }
.ic { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; }
.ic svg { width: 18px; height: 18px; }
.ic.big, .ic.big svg { width: 30px; height: 30px; }
.mono, code, .console { font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; }
code { font-size: .88em; background: var(--night-3); padding: 1px 6px; border-radius: 5px; }
.muted { color: var(--faint); font-size: .9rem; }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: min(400px, 100%); display: grid; gap: 14px;
  padding: 36px 32px 28px; border-radius: 26px;
  background: var(--night-2); border: 1px solid var(--line);
  box-shadow: 0 40px 80px -40px rgba(255, 92, 138, .4);
}
.auth-card img { border-radius: 14px; }
.auth-card h1 { margin: 6px 0 0; font: 800 1.6rem/1.1 var(--f-display); letter-spacing: -.03em; }
.auth-card p { margin: 0; color: var(--mute); }
.auth-card .btn-play { margin-top: 6px; }
.auth-back { justify-self: center; color: var(--faint); font-size: .9rem; text-decoration: none; }
.auth-back:hover { color: var(--ink); }

/* ---------- Formulare ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: .88rem; font-weight: 650; color: var(--mute); }
.field small { color: var(--faint); font-size: .82rem; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--night);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.field input:focus, .field textarea:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255, 181, 71, .15); }
.field input.mono, .field textarea.mono { font-size: .88rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { margin: 0; color: #ff9a9a; font-weight: 600; min-height: 0; }
.form-error:empty { display: none; }
.stack { display: grid; gap: 14px; }

.swatches { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; min-height: 44px; }
.swatches button {
  width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0;
  background: var(--sw); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
  transition: transform .12s;
}
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--night), 0 0 0 4px var(--ink); transform: scale(1.05); }
.swatches label { position: relative; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); cursor: pointer; }
.swatches label input { position: absolute; inset: -8px; opacity: 0; cursor: pointer; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 550; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span {
  position: relative; width: 44px; height: 26px; border-radius: 999px; flex: none;
  background: var(--night-3); border: 1px solid var(--line); transition: background .2s, border-color .2s;
}
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--mute); transition: transform .2s var(--ease), background .2s;
}
.switch input:checked + span { background: var(--pink); border-color: var(--pink); }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }
.switch.small { font-size: .88rem; margin-left: auto; }
.switch.small span { width: 36px; height: 22px; }
.switch.small span::after { width: 14px; height: 14px; }
.switch.small input:checked + span::after { transform: translateX(14px); }

.dropzone {
  display: grid; justify-items: center; gap: 6px; text-align: center;
  padding: 26px 20px; border-radius: 18px; cursor: pointer;
  border: 1.5px dashed var(--line); background: rgba(255, 255, 255, .02);
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--amber); background: rgba(255, 181, 71, .06); }
.dropzone.has-file { border-style: solid; border-color: var(--mint); background: rgba(94, 242, 194, .06); }
.dropzone .ic { color: var(--amber); margin-bottom: 4px; }
.dropzone small { color: var(--faint); max-width: 44ch; }

.progress { position: relative; height: 30px; border-radius: 10px; background: var(--night); overflow: hidden; border: 1px solid var(--line); }
.progress div { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--sunset); transition: width .2s; }
.progress span { position: relative; display: block; text-align: center; line-height: 28px; font-size: .85rem; font-weight: 700; mix-blend-mode: difference; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(16px, 3vw, 36px);
  background: rgba(23, 18, 46, .85); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(59, 50, 112, .6);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--mute); }
.brand img { border-radius: 9px; }
.brand b { color: var(--ink); font: 700 1rem var(--f-display); margin-right: 4px; }
.top-actions { margin-left: auto; display: flex; gap: 4px; align-items: center; }

.main { max-width: 1100px; margin: 0 auto; padding: 36px clamp(16px, 3vw, 36px) 80px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.head h1 { margin: 0; font: 800 clamp(1.7rem, 3.4vw, 2.4rem)/1.05 var(--f-display); letter-spacing: -.035em; }
.sub { margin: 8px 0 0; color: var(--mute); }

.drop-hint {
  position: fixed; inset: 16px; z-index: 50; display: grid; place-items: center;
  border: 2px dashed var(--amber); border-radius: 28px;
  background: rgba(23, 18, 46, .9); font: 700 1.3rem var(--f-display); color: var(--amber);
  pointer-events: none;
}

/* ---------- Spieleliste ---------- */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item {
  --c: var(--pink);
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto auto; align-items: center; gap: 18px;
  padding: 10px 12px 10px 10px; border-radius: 18px;
  background: var(--night-2); border: 1px solid var(--line);
  border-left: 4px solid var(--c);
  transition: border-color .15s, background .15s;
}
.item:hover { background: #251d4a; }
.thumb { position: relative; width: 96px; aspect-ratio: 16 / 10; border-radius: 11px; overflow: hidden; background: var(--night); }
.thumb .cover { position: absolute; inset: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .art span { font-size: 1.3rem; left: 9px; bottom: 6px; }
.thumb .art::before { display: none; }
.item-main { min-width: 0; display: grid; gap: 3px; }
.item-main h3 { margin: 0; font: 700 1.02rem/1.25 var(--f-display); letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main h3 button { all: unset; cursor: pointer; }
.item-main h3 button:hover { color: var(--amber); }
.item-main h3 button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--faint); font-size: .85rem; align-items: center; }
.item-meta .pill { padding: 1px 8px; border-radius: 6px; background: var(--night-3); color: var(--mute); font-weight: 650; font-size: .78rem; }
.item-meta .err { color: #ff9a9a; max-width: 52ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-stat { text-align: right; color: var(--mute); font-size: .85rem; white-space: nowrap; }
.item-stat b { display: block; color: var(--ink); font: 700 1.05rem var(--f-display); }
.item-actions { display: flex; gap: 4px; }
.item-actions .btn { min-height: 38px; }
.item-actions .btn-icon { width: 38px; }

.empty-admin {
  padding: 60px 24px; text-align: center; border-radius: 24px;
  border: 1.5px dashed var(--line); color: var(--mute);
}
.empty-admin h2 { margin: 0 0 8px; color: var(--ink); font: 700 1.3rem var(--f-display); }
.empty-admin p { margin: 0 auto 22px; max-width: 46ch; }
.empty-admin ol { text-align: left; margin: 0 auto 26px; max-width: 46ch; padding-left: 1.3em; display: grid; gap: 6px; }

/* ---------- Dialoge ---------- */
dialog { color: var(--ink); padding: 0; border: 0; background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(8, 6, 20, .66); backdrop-filter: blur(4px); }
.modal[open] { animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-body {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow-y: auto;
  display: grid; gap: 16px; padding: 22px 24px 24px; border-radius: 24px;
  background: var(--night-2); border: 1px solid var(--line);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font: 700 1.25rem var(--f-display); letter-spacing: -.02em; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.modal-body hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }
.modal-body h3 { margin: 0; font: 700 1rem var(--f-display); }

/* Seitenleiste */
.drawer { margin: 0 0 0 auto; height: 100vh; height: 100dvh; width: min(560px, 100vw); }
.drawer[open] { animation: slide .28s var(--ease); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-inner {
  height: 100%; display: flex; flex-direction: column;
  background: var(--night-2); border-left: 1px solid var(--line);
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.drawer-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.drawer-title h2 { margin: 0 0 2px; font: 700 1.15rem/1.2 var(--f-display); letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-thumb { position: relative; width: 64px; aspect-ratio: 16 / 10; border-radius: 9px; overflow: hidden; flex: none; }
.drawer-thumb .cover { position: absolute; inset: 0; }
.drawer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.drawer-thumb .art span { font-size: 1rem; left: 6px; bottom: 4px; }
.drawer-thumb .art::before { display: none; }

.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 12px 12px 11px; color: var(--mute); font-weight: 650;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--pink); }
.pane { flex: 1; overflow-y: auto; padding: 20px; display: grid; gap: 16px; align-content: start; }
.pane[hidden] { display: none; }
.pane-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.pane-foot .btn-play:only-child { margin-left: auto; }
.note { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--night); color: var(--mute); font-size: .9rem; }

.cover-edit { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: center; }
.cover-preview { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--night); }
.cover-preview .cover { position: absolute; inset: 0; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview .art span { font-size: 2rem; }
.cover-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cover-actions small { flex-basis: 100%; color: var(--faint); font-size: .82rem; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; padding: 14px 16px; border-radius: 14px; background: var(--night); }
.facts dt { color: var(--faint); font-size: .88rem; }
.facts dd { margin: 0; font-weight: 600; word-break: break-word; }

/* Protokoll */
.pane-logs { grid-template-rows: auto auto 1fr; align-content: stretch; }
.log-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.error-box { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(255, 107, 107, .1); border: 1px solid rgba(255, 107, 107, .4); color: #ffc4c4; }
.console {
  margin: 0; min-height: 280px; overflow: auto;
  padding: 14px 16px; border-radius: 14px;
  background: #0b0819; border: 1px solid var(--line);
  font-size: .8rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  color: #cfc8ea;
}
.console .sys { color: var(--amber); }
.console .err { color: #ff9a9a; }
.console .t { color: #5a527f; user-select: none; }

@media (max-width: 760px) {
  .hide-s { display: none; }
  .item { grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; }
  .thumb { width: 72px; }
  .item-stat { display: none; }
  .item-actions .btn-text { display: none; }
  .row2, .cover-edit { grid-template-columns: 1fr; }
}
