/* ------------------------------------------------------------------ Grundfarben
   Willst du ein anderes Farbschema? Ändere nur diese Variablen. */
:root {
  --bg: #0f1115;
  --bg2: #161922;
  --card: #1b1f2a;
  --card2: #222736;
  --line: #2a3040;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #7c6cff;
  --accent2: #a497ff;
  --ok: #3ecf8e;
  --warn: #f5b84b;
  --bad: #ff6b6b;
  --cloud: #4ea8ff;
  --media: #ff6b9a;
  --games: #3ecf8e;
  --admin: #f5b84b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background: radial-gradient(1200px 600px at 80% -200px, #241f4a 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent2); text-decoration: none; }
h1, h2 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; display: flex; align-items: center; gap: .5rem; }
h2 { font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; }
.muted { color: var(--muted); }
small { color: var(--muted); }
.icon { flex: none; }

/* ------------------------------------------------------------------ Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.2rem;
  background: rgba(15, 17, 21, .8);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; }
.logo {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #4ea8ff); color: #fff;
}
.mainnav { display: flex; gap: .25rem; margin: 0 auto; }
.mainnav a {
  display: flex; align-items: center; gap: .45rem;
  padding: .5rem .85rem; border-radius: 10px; color: var(--muted); font-weight: 500;
}
.mainnav a:hover { color: var(--text); background: var(--card); }
.mainnav a.active { color: var(--text); background: var(--card2); }
.usermenu { display: flex; align-items: center; gap: .4rem; }
.usermenu form { margin: 0; }
.chip { display: flex; align-items: center; gap: .5rem; padding: .25rem .7rem .25rem .25rem; border-radius: 99px; color: var(--text); }
.chip:hover, .chip.active { background: var(--card); }
.avatar {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #ff6b9a, var(--accent)); color: #fff; font-weight: 700; font-size: .9rem;
}
.avatar.sm { width: 24px; height: 24px; font-size: .75rem; margin-right: .3rem; vertical-align: middle; }

/* ------------------------------------------------------------------ Seiten */
.page { max-width: 1100px; margin: 0 auto; padding: 1.6rem 1.2rem 6rem; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.pagehead p { margin: .3rem 0 0; }
.section { margin: 1.8rem 0 .8rem; font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hello { margin: .5rem 0 1.4rem; }
.hello h1 { font-size: 2rem; }
.hello p { margin: .3rem 0 0; }

.crumbs { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:last-child { color: var(--text); }
.backlink { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); margin-bottom: 1rem; }
.backlink:hover { color: var(--text); }

/* ------------------------------------------------------------------ Meldungen */
.flashes { display: grid; gap: .5rem; margin-bottom: 1rem; }
.flash { padding: .75rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); transition: opacity .4s; }
.flash.ok { border-color: rgba(62, 207, 142, .4); background: rgba(62, 207, 142, .08); }
.flash.error { border-color: rgba(255, 107, 107, .45); background: rgba(255, 107, 107, .08); }
.flash.warn { border-color: rgba(245, 184, 75, .45); background: rgba(245, 184, 75, .08); }
.flash.hide { opacity: 0; }
.banner { display: flex; gap: .8rem; align-items: center; padding: .9rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.2rem; color: var(--text); }
.banner.warn { background: rgba(245, 184, 75, .1); border: 1px solid rgba(245, 184, 75, .4); }
.banner.warn .icon { color: var(--warn); }

/* ------------------------------------------------------------------ Buttons & Formulare */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .08s, background .15s;
}
.btn:hover { background: #2a3042; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { background: #6b5bf0; }
.btn.danger { color: var(--bad); }
.btn.wide { width: 100%; padding: .8rem; }
.iconbtn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.iconbtn:hover { background: var(--card2); color: var(--text); }
.iconbtn.danger:hover { color: var(--bad); }
.iconbtn.copied, .secret.copied { color: var(--ok); }

input, select {
  width: 100%; padding: .7rem .85rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
label { display: grid; gap: .35rem; font-weight: 500; font-size: .92rem; }
.stack { display: grid; gap: .9rem; }
form.inline { display: inline-flex; gap: .4rem; margin: 0; }
.row-form { display: flex; gap: .5rem; flex-wrap: wrap; margin: .6rem 0 1rem; }
.row-form input { flex: 1 1 180px; width: auto; min-width: 0; }
.row-form select { flex: 0 1 170px; width: auto; }
input.code { text-align: center; font-size: 1.6rem; letter-spacing: .35em; font-family: ui-monospace, monospace; }

progress {
  appearance: none; width: 100%; height: 6px; border: 0; border-radius: 99px; overflow: hidden; background: var(--line);
}
progress::-webkit-progress-bar { background: var(--line); border-radius: 99px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), #4ea8ff); border-radius: 99px; }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--accent), #4ea8ff); border-radius: 99px; }

.pill { display: inline-block; padding: .12rem .55rem; border-radius: 99px; font-size: .8rem; background: var(--card2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: rgba(62, 207, 142, .13); color: var(--ok); }
.pill.warn { background: rgba(245, 184, 75, .13); color: var(--warn); }
.pill.bad { background: rgba(255, 107, 107, .13); color: var(--bad); }
.pill.accent { background: rgba(124, 108, 255, .18); color: var(--accent2); }

/* ------------------------------------------------------------------ Login-Seiten */
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; }
.authwrap .flashes { width: min(400px, 100%); }
body.auth main { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.authcard {
  width: min(400px, 100%); padding: 2rem; border-radius: 20px;
  background: rgba(27, 31, 42, .85); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.authcard h1 { justify-content: center; margin-top: .8rem; }
.authcard > p.muted { text-align: center; margin: .4rem 0 1.5rem; }
.authlogo {
  width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), #4ea8ff); box-shadow: 0 8px 24px rgba(124, 108, 255, .4);
}
.authfoot { text-align: center; color: var(--muted); margin: 1.3rem 0 0; font-size: .92rem; }

/* ------------------------------------------------------------------ Startseite */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: .4rem; padding: 1.3rem;
  border-radius: 18px; background: var(--card); border: 1px solid var(--line); color: var(--text);
  overflow: hidden; transition: transform .15s, border-color .15s;
}
.tile:hover { transform: translateY(-3px); }
.tile::after {
  content: ""; position: absolute; inset: auto -40px -60px auto; width: 160px; height: 160px; border-radius: 50%;
  background: var(--c); opacity: .12; filter: blur(30px);
}
.tile p { margin: 0; color: var(--muted); }
.tile-icon { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); margin-bottom: .4rem; }
.tile-foot { margin-top: auto; padding-top: .9rem; display: grid; gap: .4rem; font-size: .85rem; color: var(--muted); }
.tile:hover { border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.t-cloud { --c: var(--cloud); }
.t-media { --c: var(--media); }
.t-games { --c: var(--games); }
.t-admin { --c: var(--admin); }

/* ------------------------------------------------------------------ Cloud */
.quota { min-width: 220px; display: grid; gap: .3rem; text-align: right; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar form input { width: 180px; }
.dropzone { border-radius: var(--radius); border: 2px dashed transparent; transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--accent); background: rgba(124, 108, 255, .06); }
.filelist { list-style: none; margin: 0; padding: 0; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.row { display: flex; align-items: center; gap: .8rem; padding: .45rem .6rem .45rem .9rem; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--card2); }
.row .name { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; color: var(--text); }
.row .name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.actions { display: flex; gap: .1rem; }
.actions form { margin: 0; }
.ficon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--card2); color: var(--muted); flex: none; }
.ficon.folder { color: var(--cloud); background: rgba(78, 168, 255, .12); }
.ficon.image { color: var(--ok); background: rgba(62, 207, 142, .12); }
.ficon.video { color: var(--media); background: rgba(255, 107, 154, .12); }
.ficon.audio { color: var(--accent2); background: rgba(124, 108, 255, .14); }

.uploads { display: grid; gap: .4rem; margin-bottom: .8rem; }
.uprow { display: grid; grid-template-columns: minmax(0, 1fr) 160px 70px; gap: .8rem; align-items: center; padding: .6rem .9rem; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.uprow .upname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uprow.done small { color: var(--ok); }
.uprow.failed small { color: var(--bad); }

.empty { display: grid; place-items: center; text-align: center; gap: .6rem; padding: 3.5rem 1rem; color: var(--muted); border-radius: var(--radius); border: 1px dashed var(--line); }
.empty b { color: var(--text); }
.bigcode { font-size: 4rem; color: var(--accent2); justify-content: center; }

/* ------------------------------------------------------------------ Medien */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .7rem; }
.foldercard { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--text); font-weight: 500; }
.foldercard .icon { color: var(--media); }
.foldercard:hover { background: var(--card2); }
.mediagrid, .gamegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.mediacard, .gamecard { border-radius: var(--radius); overflow: hidden; background: var(--card); border: 1px solid var(--line); color: var(--text); transition: transform .15s; }
.mediacard:hover, .gamecard:hover { transform: translateY(-3px); }
.poster, .cover {
  aspect-ratio: 16 / 9; display: grid; place-items: center; color: rgba(255, 255, 255, .85);
  background: linear-gradient(135deg, #3a2457, #1e2c4f);
}
.gamecard .cover { aspect-ratio: 4 / 3; background: linear-gradient(135deg, #17402f, #1e2c4f); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.mediacard:nth-child(3n+2) .poster { background: linear-gradient(135deg, #4a1f35, #2b1d4a); }
.mediacard:nth-child(3n+3) .poster { background: linear-gradient(135deg, #18384a, #2d1f4a); }
.mc-body { padding: .75rem .9rem; display: grid; gap: .15rem; }
.mc-body b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tracklist { list-style: none; margin: 0; padding: 0; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.tracklist a { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; color: var(--text); border-bottom: 1px solid var(--line); }
.tracklist li:last-child a { border-bottom: 0; }
.tracklist a:hover { background: var(--card2); }
.tracklist .tn { width: 1.6rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.tracklist .tt { flex: 1; }
.tracklist li.current a { background: rgba(124, 108, 255, .12); }
.tracklist li.current .tn, .tracklist li.current .tt { color: var(--accent2); font-weight: 600; }

.player { border-radius: 18px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.player video { width: 100%; display: block; max-height: 72vh; background: #000; }
.player.audio { background: linear-gradient(135deg, #2b1d4a, #18384a); padding: 2rem; display: grid; gap: 1.2rem; justify-items: center; }
.player.audio audio { width: 100%; max-width: 560px; }
.albumart { width: 180px; height: 180px; border-radius: 20px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); color: var(--accent2); box-shadow: var(--shadow); }
.nowplaying { padding: 1rem 1.2rem; font-size: 1.25rem; background: var(--card); justify-content: flex-start; }
.player.audio .nowplaying { background: none; padding: 0; }

/* ------------------------------------------------------------------ Spiele */
.gamepage { max-width: none; padding: 1rem; }
.gamebar { display: flex; align-items: center; gap: 1rem; margin-bottom: .8rem; }
.gamebar .backlink { margin: 0; }
.gamebar b { flex: 1; }
.gameframe { width: 100%; height: calc(100vh - 150px); border: 0; border-radius: var(--radius); background: #000; }

/* ------------------------------------------------------------------ Chat */
.mainnav a { position: relative; }
.badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--media); color: #fff; font-size: .7rem; font-weight: 700; margin-left: auto;
}
.mainnav .badge { position: absolute; top: -4px; right: -6px; margin: 0; }
.chatpage { max-width: 1100px; padding-bottom: 1rem; }
.chat { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; height: calc(100vh - 110px); height: calc(100dvh - 110px); }
.rooms { display: flex; flex-direction: column; gap: .2rem; overflow-y: auto; }
.rooms a { display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; border-radius: 10px; color: var(--muted); }
.rooms a:hover { background: var(--card); color: var(--text); }
.rooms a.active { background: var(--card2); color: var(--text); }
.rooms .avatar.sm { margin: 0; flex: none; }
.avatar.all { background: var(--card2); color: var(--muted); }
.chatbox { display: flex; flex-direction: column; min-height: 0; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.chathead { padding: .8rem 1rem; border-bottom: 1px solid var(--line); font-weight: 600; }
.msgs { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .35rem; }
.msg { display: flex; }
.msg.mine { justify-content: flex-end; }
.bubble { position: relative; max-width: min(75%, 560px); padding: .45rem .75rem .35rem; border-radius: 14px 14px 14px 4px; background: var(--card2); }
.msg.mine .bubble { border-radius: 14px 14px 4px 14px; background: var(--accent); color: #fff; }
.bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .from { display: block; font-size: .8rem; color: var(--accent2); }
.bubble time { display: block; text-align: right; font-size: .7rem; opacity: .6; }
.bubble .del { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; border: 0; padding: 0;
  background: var(--bg2); color: var(--muted); cursor: pointer; line-height: 1; opacity: 0; transition: opacity .15s; }
.bubble:hover .del { opacity: 1; }
.bubble .del:hover { color: var(--bad); }
@media (pointer: coarse) { .bubble .del { opacity: .5; } }
.older { align-self: center; border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: .85rem; }
.composer { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; padding: .65rem .85rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); font: inherit; max-height: 160px;
}
.composer textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.t-chat { --c: var(--accent2); }

/* ------------------------------------------------------------------ Karten, Tabellen, Admin */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.card { min-width: 0; padding: 1.3rem; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); margin-bottom: 1rem; }
.card h2 { margin-bottom: .8rem; }
.card p { margin: 0 0 .9rem; }
.card.narrow { max-width: 560px; }
.card details summary { cursor: pointer; color: var(--muted); margin-bottom: .8rem; }
.cardhead { display: flex; justify-content: space-between; align-items: center; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { padding: 1rem; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); display: grid; gap: .3rem; align-content: start; }
.stat b { font-size: 1.4rem; }
.stat em { font-style: normal; font-size: .8rem; color: var(--muted); }
.stat.alert { border-color: rgba(255, 107, 107, .5); }
.stat.alert b { color: var(--bad); }

.tablewrap { overflow-x: auto; margin: 0 -1.3rem; padding: 0 1.3rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.dim td { opacity: .5; }
td.right { text-align: right; }
table.compact td { padding: .4rem .6rem; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 1.4rem; }
.steps li { counter-increment: s; display: grid; grid-template-columns: minmax(0, 1fr); gap: .45rem; padding-left: 2.6rem; position: relative; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: -.1rem; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; font-size: .9rem;
}
.steps .btn { justify-self: start; }
.secret {
  font-family: ui-monospace, monospace; font-size: 1.05rem; letter-spacing: .08em; padding: .8rem 1rem; border-radius: 10px;
  background: var(--bg2); border: 1px dashed var(--line); cursor: pointer; word-break: break-all;
}

/* ------------------------------------------------------------------ Handy */
@media (max-width: 760px) {
  /* backdrop-filter würde die feste Navigation unten an die Kopfzeile kleben */
  .topbar { padding: .55rem .9rem; backdrop-filter: none; background: var(--bg); }
  .uname { display: none; }
  .chip { padding: .25rem; }
  /* Navigation wandert nach unten wie bei einer App */
  .mainnav {
    position: fixed; left: 0; right: 0; bottom: 0; margin: 0; justify-content: space-around;
    padding: .4rem .4rem calc(.4rem + env(safe-area-inset-bottom));
    background: rgba(15, 17, 21, .92); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  }
  .mainnav a { flex-direction: column; gap: .15rem; font-size: .7rem; padding: .4rem .6rem; }
  .brand { margin-right: auto; }
  .page { padding: 1.1rem .9rem 6.5rem; }
  .hello h1 { font-size: 1.6rem; }
  .tiles { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .tile { padding: 1rem; }
  .tile p { display: none; }
  .tile h2 { font-size: 1rem; }
  .tile-icon { width: 42px; height: 42px; }
  .quota { text-align: left; width: 100%; }
  .row .meta { display: none; }
  .actions .iconbtn { width: 32px; }
  .toolbar form input { width: 140px; }
  .mediagrid, .gamegrid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .uprow { grid-template-columns: 1fr 60px; }
  .uprow progress { grid-column: 1 / -1; grid-row: 2; }
  .gameframe { height: calc(100vh - 190px); }
  .chatpage { padding: .6rem .6rem 0; }
  .chat { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: .6rem; height: calc(100dvh - 150px - env(safe-area-inset-bottom)); }
  .rooms { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .rooms a { flex: none; padding: .35rem .7rem .35rem .35rem; border-radius: 99px; background: var(--card); }
  .chathead { display: none; }
  .bubble { max-width: 85%; }
  .mainnav a { padding: .4rem .45rem; }
}
