:root {
  --bg: #0f1117;
  --panel: #181b24;
  --panel2: #222634;
  --text: #e8eaf0;
  --muted: #8a90a2;
  --accent: #7c5cff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 12px; align-items: center;
  padding: 14px 24px;
  background: rgba(15, 17, 23, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--panel2);
}
.brand { font-size: 20px; font-weight: 700; white-space: nowrap; }
#search {
  flex: 1; max-width: 420px; margin-left: auto;
  padding: 9px 14px; border-radius: 8px; border: 1px solid var(--panel2);
  background: var(--panel); color: var(--text); font-size: 14px;
}
.btn {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--panel2);
  background: var(--panel2); color: var(--text); cursor: pointer; font-size: 14px;
}
.btn:hover { filter: brightness(1.2); }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.danger { background: #c0392b; border-color: #c0392b; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 24px 0; }
.tag {
  padding: 5px 12px; border-radius: 999px; font-size: 13px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--panel2); color: var(--muted);
}
.tag.active { background: var(--accent); color: #fff; border-color: var(--accent); }
main { padding: 0 24px 40px; }
h2 { font-size: 18px; margin: 24px 0 12px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12px; }
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.card {
  position: relative; background: var(--panel); border-radius: 12px; overflow: hidden;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid var(--panel2);
}
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.cover {
  aspect-ratio: 16 / 10; display: grid; place-items: center;
  font-size: 44px; font-weight: 800; color: rgba(255,255,255,0.9);
  background-size: cover; background-position: center;
}
.card .info { padding: 10px 12px 12px; }
.card .title { font-weight: 600; }
.card .desc {
  font-size: 13px; color: var(--muted); margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .actions {
  position: absolute; top: 8px; right: 8px; display: none; gap: 6px;
}
.card:hover .actions { display: flex; }
.card .actions button {
  border: none; border-radius: 6px; padding: 4px 8px; cursor: pointer;
  background: rgba(0,0,0,0.6); color: #fff;
}
.badge {
  position: absolute; top: 8px; left: 8px; font-size: 11px; padding: 2px 8px;
  border-radius: 999px; background: rgba(0,0,0,0.6);
}
.player {
  position: fixed; inset: 0; z-index: 10; background: #000;
  display: flex; flex-direction: column;
}
.player-bar {
  display: flex; gap: 10px; align-items: center; padding: 8px 12px;
  background: var(--panel);
}
.spacer { flex: 1; }
#frame { flex: 1; width: 100%; border: 0; background: #000; }
dialog {
  border: 1px solid var(--panel2); border-radius: 14px; padding: 0;
  background: var(--panel); color: var(--text); width: min(460px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,0.6); }
#form { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
#form h3 { margin: 0 0 6px; }
#form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
#form input:not([type=color]) {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--panel2);
  background: var(--bg); color: var(--text); font-size: 14px;
}
.row { display: flex; gap: 8px; justify-content: flex-end; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* ---------- Multiplayer ---------- */
.name-input {
  width: 130px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--panel2);
  background: var(--panel); color: var(--text); font-size: 14px;
}
.pad { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.pad h3, .pad h4 { margin: 0; }
.pad label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.code-input {
  padding: 10px; border-radius: 8px; border: 1px solid var(--panel2); background: var(--bg);
  color: var(--text); font-size: 26px; letter-spacing: 8px; text-transform: uppercase; text-align: center;
}
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.big { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px; font-size: 30px; }
.btn.big span { font-size: 14px; }
#form label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.lobby-head { display: flex; align-items: center; gap: 12px; }
.lobby-code { font-size: 40px; font-weight: 800; letter-spacing: 8px; color: var(--accent); }
.lobby-game { font-weight: 600; }
.lobby-players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lobby-players li {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--bg); border-radius: 8px;
}
.lobby-players .dot { width: 10px; height: 10px; border-radius: 50%; }
.lobby-players .you { color: var(--muted); font-size: 12px; }
.room-chip {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: #fff;
}
.mp-badge {
  position: absolute; top: 8px; right: 8px; font-size: 11px; padding: 2px 8px;
  border-radius: 999px; background: rgba(124, 92, 255, 0.85);
}
.card:hover .mp-badge { display: none; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--panel2); padding: 10px 18px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

/* ---------- Anmeldung ---------- */
.auth {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 20%, #2a1f5c, var(--bg) 60%);
}
.auth-box {
  width: min(360px, 92vw); background: var(--panel); border: 1px solid var(--panel2);
  border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.auth-logo { font-size: 44px; text-align: center; }
.auth-box h1 { margin: 0 0 6px; text-align: center; font-size: 22px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 10px; padding: 4px; }
.auth-tabs button {
  border: 0; background: none; color: var(--muted); padding: 8px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.auth-tabs button.active { background: var(--panel2); color: var(--text); }
.auth-box label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.auth-box input {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--panel2);
  background: var(--bg); color: var(--text); font-size: 15px;
}
.auth-error { margin: 0; color: #ff6b6b; font-size: 13px; }
.big-btn { padding: 11px; font-size: 15px; }
.user { display: flex; align-items: center; gap: 8px; padding-left: 8px; border-left: 1px solid var(--panel2); }
.user-name { font-weight: 600; white-space: nowrap; }
