/* Showdown Paterino – Portal
   Optik angelehnt an die Alvion League (rote Kopfleiste, Reiter, helle Karten, Dark Mode). */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1d2330;
  --muted: #6b7385;
  --line: #e2e5ea;
  --accent: #d63c3c;
  --accent-ink: #ffffff;
  --link: #2a5bd7;
  --good: #1f9d55;
  --warn: #b07d00;
  --info: #2a5bd7;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 4px 16px rgba(20, 30, 50, .05);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171d; --panel: #1d2129; --ink: #e6e8ee; --muted: #9aa2b2;
    --line: #2d333e; --link: #7ea6ff; --good: #4cd38a; --warn: #f0c040; --info: #7ea6ff;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
h1, h2, h3 { line-height: 1.25; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: .95em; }

/* ---------- Kopfleiste ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 10px 20px; background: var(--accent); color: var(--accent-ink);
  box-shadow: var(--shadow);
}
.brand { color: inherit; font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; white-space: nowrap; }
.brand span { font-weight: 400; opacity: .85; }
.brand:hover { text-decoration: none; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { color: inherit; padding: 6px 12px; border-radius: 6px; opacity: .85; font-weight: 500; }
.tabs a:hover { background: rgba(255, 255, 255, .15); text-decoration: none; opacity: 1; }
.tabs a.active { background: rgba(255, 255, 255, .25); opacity: 1; }
.tabs a .ext { font-size: .75em; opacity: .7; margin-left: 2px; }

.user-menu { margin-left: auto; position: relative; }
.user-btn { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 6px; padding: 7px 12px; font: inherit; cursor: pointer; white-space: nowrap; }
.user-btn:hover { background: rgba(255,255,255,.25); }
.role-tag { font-size: .7rem; background: #fff; color: var(--accent); border-radius: 4px; padding: 1px 5px; font-weight: 700; margin-left: 6px; }
.dropdown {
  position: absolute; top: 110%; right: 0; min-width: 240px;
  background: var(--panel); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line); overflow: hidden; z-index: 30;
}
.dropdown .group { padding: 8px 12px 2px; font-size: .72rem; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.dropdown a, .dropdown button.dd-item { display: block; width: 100%; text-align: left; padding: 7px 12px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown a:hover, .dropdown button.dd-item:hover { background: var(--bg); text-decoration: none; }
.dropdown button.dd-item.on { font-weight: 700; color: var(--accent); }

.draft-banner { background: #e0a40022; color: var(--warn); text-align: center; font-size: .85rem; padding: 5px 12px; border-bottom: 1px solid #e0a40044; }

/* ---------- Layout ---------- */
main { padding: 20px; max-width: 1300px; margin: 0 auto; }
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-head h1 { margin: 0; font-size: 1.7rem; }
.page-head p { margin: 4px 0 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.stack { display: grid; gap: 16px; }
h2.section { font-size: 1.05rem; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
@media (max-width: 960px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Buttons & Formulare ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: inherit; font-size: .88rem; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; padding: 8px 16px; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.big { font-size: 1rem; padding: 10px 20px; }
.btn.danger { color: #c0392b; border-color: #c0392b55; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; font-size: .95rem;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; }
.form-grid label, .login-box label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
.form-grid .wide { grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 9px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); font-size: .86rem; color: var(--ink); }
label.chip.toggle { cursor: pointer; user-select: none; }
label.chip.toggle input { display: none; }
label.chip.toggle.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }

/* ---------- Anmeldung ---------- */
body.logged-out .topbar, body.logged-out main, body.logged-out .draft-banner { display: none; }
body:not(.logged-out) #login { display: none; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 50% -20%, #d63c3c33, transparent 60%), var(--bg); }
.login-box { width: min(380px, 100%); display: grid; gap: 12px; padding: 28px; }
.login-logo img { width: 56px; height: 56px; }
.login-box h1 { margin: 0; color: var(--accent); }
.login-box h1 span { font-weight: 400; color: var(--ink); }
.login-error { background: #d63c3c22; color: #d63c3c; padding: 8px 10px; border-radius: 6px; font-size: .9rem; }

/* ---------- Karten ---------- */
.card { display: block; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; color: var(--ink); border-top: 4px solid var(--accent); }
a.card:hover { text-decoration: none; transform: translateY(-2px); transition: transform .12s; }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: .9rem; }
.card .meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; font-size: .82rem; color: var(--muted); }
.card.t-draft { border-top-color: #6a3cf0; }
.card.t-lc { border-top-color: #e6a21f; }
.card.t-done { border-top-color: var(--line); }
.hero { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--accent), #a52a2a); color: #fff; border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.hero h1 { margin: 0 0 4px; font-size: 1.6rem; }
.hero p { margin: 0; opacity: .9; }
.hero .btn { background: #fff; color: var(--accent); border: 0; font-weight: 700; }
.stat-row { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; display: grid; min-width: 86px; text-align: center; }
.stat span { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.stat strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.badge.open { background: #1f9d5522; color: var(--good); border-color: transparent; }
.badge.live { background: #d63c3c22; color: var(--accent); border-color: transparent; }
.badge.draft { background: #6a3cf022; color: #6a3cf0; border-color: transparent; }
.badge.done { }
.badge.win { background: #1f9d5522; color: var(--good); border-color: transparent; }
.badge.loss { background: #d63c3c22; color: var(--accent); border-color: transparent; }
@media (prefers-color-scheme: dark) { .badge.draft { color: #a98bff; } }
.role { font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.role.admin { background: var(--accent); color: #fff; }
.role.organisator { background: #6a3cf0; color: #fff; }
.role.spieler { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

/* ---------- Tabellen ---------- */
table.data { border-collapse: collapse; width: 100%; font-size: .92rem; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; padding: 6px 8px; border-bottom: 2px solid var(--line); }
table.data td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--bg); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.me td { background: #d63c3c0d; font-weight: 600; }

/* ---------- Pokémon ---------- */
.mon { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; width: 72px; font-size: .75rem; text-align: center; }
.mon img { width: 64px; height: 64px; image-rendering: pixelated; }
.mon.small { width: 48px; }
.mon.small img { width: 40px; height: 40px; }
.mon.out img { filter: grayscale(1); opacity: .45; }
.mon.out { color: var(--muted); }
.mon.unused img { opacity: .35; }
.mon .tag { font-size: .65rem; font-weight: 700; color: var(--accent); }
.mons { display: flex; flex-wrap: wrap; gap: 4px; }
.type { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: .68rem; font-weight: 600; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.t-Normal{background:#9a9a74}.t-Fire{background:#e8742f}.t-Water{background:#5b84e6}.t-Grass{background:#6cb946}
.t-Electric{background:#e6c021}.t-Ice{background:#6fc6c6}.t-Fighting{background:#b2302a}.t-Poison{background:#9140a0}
.t-Ground{background:#cfaa55}.t-Flying{background:#9a85e6}.t-Psychic{background:#ea4f7d}.t-Bug{background:#9aac22}
.t-Rock{background:#b19a3a}.t-Ghost{background:#6b5694}.t-Dragon{background:#6a3cf0}.t-Dark{background:#6b5646}
.t-Steel{background:#a8a8c4}.t-Fairy{background:#de88a6}

/* ---------- Draft ---------- */
.draft-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.draft-status { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.on-clock { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; background: #6a3cf01a; border: 1px solid #6a3cf044; }
.on-clock strong { font-size: 1.05rem; }
.timer { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #6a3cf0; }
@media (prefers-color-scheme: dark) { .timer { color: #a98bff; } }
.pool-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pool-filters input[type=search] { flex: 1; min-width: 180px; }
.pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.pool-item { position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 6px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); cursor: pointer; font: inherit; color: var(--ink); }
.pool-item:hover { border-color: #6a3cf0; }
.pool-item img { width: 64px; height: 64px; image-rendering: pixelated; }
.pool-item .nm { font-size: .85rem; font-weight: 600; }
.pool-item .types { display: flex; gap: 3px; }
.pool-item .cost { position: absolute; top: 6px; right: 6px; font-size: .7rem; font-weight: 700; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.pool-item.taken { cursor: default; opacity: .4; }
.pool-item.taken:hover { border-color: var(--line); }
.pool-item.taken .by { font-size: .68rem; color: var(--muted); }
.pick-order { display: grid; gap: 4px; }
.pick-order .slot { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; font-size: .88rem; }
.pick-order .slot.current { background: #6a3cf01a; font-weight: 700; }
.pick-order .slot.done { color: var(--muted); }
.pick-order .slot img { width: 32px; height: 32px; image-rendering: pixelated; margin: -4px 0; }
.pick-order .nr { width: 22px; color: var(--muted); font-size: .78rem; text-align: right; }
.roster { display: grid; gap: 10px; }
.roster .who { font-weight: 600; font-size: .9rem; margin-bottom: 2px; display: flex; justify-content: space-between; }

/* ---------- Turnier-Spielplan ---------- */
.match { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.match .p2 { text-align: left; }
.match .p1 { text-align: right; }
.match .score { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 48px; text-align: center; }
.match .winner { font-weight: 700; }
.round-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 4px; }

/* ---------- Replays ---------- */
.vs-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; }
.vs-head .side h2 { margin: 0; font-size: 1.2rem; }
.vs-head .side.right { text-align: right; }
.vs-head .vs { font-weight: 800; color: var(--muted); }
.team-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.team-compare h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 6px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.ko-list { display: grid; gap: 6px; }
.ko { display: grid; grid-template-columns: 54px 1fr auto 1fr; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font-size: .9rem; }
.ko .turn { font-size: .75rem; color: var(--muted); }
.ko .who { display: flex; align-items: center; gap: 6px; }
.ko .who img { width: 40px; height: 40px; image-rendering: pixelated; margin: -6px 0; }
.ko .arrow { color: var(--accent); font-weight: 700; text-align: center; font-size: .8rem; }
.ko .arrow small { display: block; color: var(--muted); font-weight: 400; }
.mvp { display: flex; align-items: center; gap: 12px; }
.mvp img { width: 72px; height: 72px; image-rendering: pixelated; }

/* ---------- Avatare & Personen ---------- */
.avatar { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; border-radius: 50%; background: #eef0f4; border: 1px solid var(--line); flex: none; }
.avatar.xs { width: 22px; height: 22px; vertical-align: middle; }
.avatar.sm { width: 32px; height: 32px; }
.avatar.lg { width: 80px; height: 80px; background: rgba(255,255,255,.85); }
.user-btn .avatar { margin: -4px 6px -4px -4px; background: #fff; }
.who-inline { display: inline-flex; align-items: center; gap: 8px; text-align: left; line-height: 1.2; }
.avatars { display: flex; margin-top: 10px; }
.avatars .avatar { margin-right: -6px; border: 2px solid var(--panel); }
.avatars.big { gap: 14px; flex-wrap: wrap; }
.avatars.big > span { text-align: center; }
.avatars.big .avatar { width: 56px; height: 56px; margin: 0; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.list-row:hover { text-decoration: none; background: var(--bg); }

/* Hero mit eigenem Hintergrund */
.hero { position: relative; overflow: hidden; background: linear-gradient(100deg, rgba(214,60,60,.95) 0%, rgba(214,60,60,.75) 45%, rgba(140,30,30,.25) 100%), var(--hero-bg, none) center / cover; }
.hero-main { display: flex; align-items: center; gap: 16px; }
.replay-head { background: linear-gradient(90deg, var(--panel) 30%, rgba(255,255,255,.55)), var(--hero-bg, none) center / cover; }
@media (prefers-color-scheme: dark) { .replay-head { background: linear-gradient(90deg, var(--panel) 30%, rgba(29,33,41,.7)), var(--hero-bg, none) center / cover; } }
.vs-head .side { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.vs-head .side.right { align-items: flex-end; }
.vs-head .vs { display: grid; text-align: center; font-size: 1.4rem; }
.vs-head .vs small { font-size: .78rem; font-weight: 400; color: var(--muted); }
.side-head { margin-bottom: 4px; }

/* ---------- Live ---------- */
.live-box { margin-top: 16px; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 16px; border-left: 4px solid #e0245e; }
.live-box.inline { margin: 0; box-shadow: none; border: 1px solid var(--line); border-left: 4px solid #e0245e; padding: 6px 10px; }
.live-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #e0245e; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #e0245e; display: inline-block; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #e0245e88; } 70% { box-shadow: 0 0 0 7px #e0245e00; } 100% { box-shadow: 0 0 0 0 #e0245e00; } }
.live-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line); }
.live-row:first-of-type { border-top: 0; }
.live-row .vs { color: var(--muted); font-size: .8rem; }
.live-players { display: flex; align-items: center; gap: 8px; }
.live-row .btn.live-btn, .btn.live-btn { margin-left: auto; background: #e0245e; color: #fff; border-color: #e0245e; font-weight: 600; }
.match .btn.live-btn { margin-left: 0; }
.live-pill { display: inline-flex; align-items: center; gap: 5px; color: #e0245e; font-weight: 700; }

/* ---------- Unterreiter ---------- */
.subtabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 16px 0; flex-wrap: wrap; }
.subtabs a { padding: 8px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.subtabs a:hover { color: var(--ink); text-decoration: none; }
.subtabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Eingebetteter Kampf-Client ---------- */
main.wide { max-width: none; padding: 0; }
.frame-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.game-frame { display: block; width: 100%; height: calc(100vh - 140px); min-height: 520px; border: 0; background: #fff; }
body:has(main.wide) .site-footer { display: none; }

/* ---------- Matches ---------- */
.match-card .vs-mini, .modal .vs-mini { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.score.big { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.match { grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr) auto; }
.match .p1 { justify-self: end; }
.match .score { display: grid; }
.match .score small { font-size: .7rem; color: var(--muted); font-weight: 400; }
.match .act { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: nowrap; white-space: nowrap; }
.match .act .btn { padding: 6px 14px; }
.match .act .m-battle-btn { font-weight: 700; padding: 7px 18px; }
/* Listen von Spielen: bei wenig Platz rutschen die Knöpfe in eine eigene Zeile unter die Paarung */
.match-list { container-type: inline-size; }
@container (max-width: 820px) {
  .match { grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr); row-gap: 8px; }
  .match .act { grid-column: 1 / -1; justify-content: center; flex-wrap: wrap; }
  .match .act:empty { display: none; }
}
.sched-top { flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.sched-filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.sched-filter label { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; }
.sched-filter select { min-width: 240px; }
.sched-sum { margin: 4px 0 0; }
.match.mine { background: #d63c3c0d; border-radius: 6px; }
.match .winner b { color: var(--good); }
.round-title.current { color: var(--accent); font-weight: 700; }
.games { padding: 4px 10px 10px; display: grid; gap: 4px; }
.game-link { font-size: .85rem; padding: 4px 8px; border-radius: 6px; background: var(--bg); }
table.data.compact td { padding: 4px 6px; }
table.data.compact td.num:first-child { width: 28px; text-align: right; color: var(--muted); }
table.data tr.cut td { border-bottom: 2px dashed var(--accent); }
td.pos { color: var(--good); } td.neg { color: var(--accent); }
.form { display: inline-flex; gap: 3px; }
.form span { width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; font-size: .7rem; font-weight: 700; color: #fff; }
.form .w { background: var(--good); } .form .l { background: var(--accent); } .form .o { background: var(--line); color: var(--muted); }
img.icon { width: 40px; height: 40px; image-rendering: pixelated; margin: -8px 0; vertical-align: middle; }
.roster-card.mine { outline: 2px solid var(--accent); }

/* ---------- Draft ---------- */
.tier { margin-bottom: 14px; }
.tier-head { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 6px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.pool-item.wished { border-color: #e0a400; box-shadow: inset 0 0 0 1px #e0a400; }
.pool-item .wish-no { position: absolute; top: 6px; left: 6px; font-size: .7rem; font-weight: 700; color: #b07d00; }
.on-clock .avatar { width: 48px; height: 48px; }
.timer.urgent { color: var(--accent); animation: pulse-text 1s infinite; }
@keyframes pulse-text { 50% { opacity: .5; } }
label.check { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; cursor: pointer; }
label.check input { margin-top: 3px; }
.wish-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; counter-reset: wish; }
.wish-list li { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; background: var(--bg); font-size: .88rem; counter-increment: wish; }
.wish-list li::before { content: counter(wish); width: 18px; color: var(--muted); font-size: .75rem; text-align: right; }
.wish-list li.gone { opacity: .5; text-decoration: line-through; }
.wish-list li.muted::before { content: ""; }
button.mini { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 4px; padding: 0 6px; cursor: pointer; font: inherit; font-size: .8rem; }
button.mini:hover { background: var(--accent); color: #fff; }
.roster .who { gap: 6px; align-items: center; }
.pick-log { display: grid; gap: 2px; }
.pick-log .slot { display: flex; align-items: center; gap: 8px; font-size: .86rem; padding: 3px 4px; }

/* ---------- Profil-Bilder ---------- */
.pic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin: 10px 0; }
.pic-grid.bgs { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.pic { position: relative; display: grid; place-items: center; height: 64px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); cursor: pointer; padding: 0; }
.pic img { width: 56px; height: 56px; object-fit: contain; image-rendering: pixelated; }
.pic.bg { height: 68px; background-size: cover; background-position: center; }
.pic.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
span.pic { cursor: default; }
.pic-tag { position: absolute; bottom: 2px; right: 2px; font-size: .6rem; background: var(--accent); color: #fff; border-radius: 3px; padding: 0 3px; }
.profile-preview { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); color: #fff; text-shadow: 0 1px 3px #000;
  background: linear-gradient(90deg, rgba(0,0,0,.45), transparent), var(--hero-bg) center / cover; font-size: 1.2rem; }
h3.sub { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 0; }
.modal-box { max-width: 720px; }

/* ---------- Code & Footer ---------- */
pre.code { white-space: pre-wrap; background: var(--bg); padding: 12px; border-radius: 6px; margin: 0; font-size: .82rem; }
.site-footer { max-width: 1300px; margin: 24px auto 0; padding: 16px 20px 28px; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); }
body.logged-out .site-footer { display: none; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: .92rem; transition: all .2s; z-index: 60; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(10, 15, 25, .55); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-box { background: var(--panel); border-radius: var(--radius); max-width: 640px; width: 100%; max-height: 85vh; overflow: auto; padding: 22px 24px; position: relative; box-shadow: var(--shadow); }
.modal-close { position: absolute; top: 8px; right: 12px; border: 0; background: none; font-size: 1.6rem; cursor: pointer; color: var(--muted); }
.modal h2 { margin-top: 0; }

/* Kleine Pokémon-Kacheln: Namen umbrechen statt überlappen */
.mon.small { width: 62px; }
.mon.small span { font-size: .66rem; line-height: 1.15; overflow-wrap: anywhere; }
/* Replay: „nicht eingesetzt“ klar von „besiegt“ unterscheiden */
.mon.unused { border: 1px dashed var(--line); border-radius: 8px; padding: 2px 0; }
.mon.unused img { opacity: .3; filter: none; }
.mon.out img { filter: grayscale(1); opacity: .55; }
.mon .tag { color: var(--muted); }
.mon:not(.unused) .tag { color: var(--accent); }

/* Backend-Anbindung: Admin & Profil */
.pic-del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: .7rem; cursor: pointer; display: none; }
.pic:hover .pic-del { display: block; }
.pic-del:hover { background: var(--accent); }
table.data tr.suspended td { opacity: .6; }
label.grow { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
form.row { align-items: flex-end; }
.profile-preview small { font-weight: 400; opacity: .9; }

/* ---------- Turniere (echt) ---------- */
.empty-state { text-align: center; padding: 36px 20px; }
.empty-state h2 { margin: 0 0 6px; }
.panel.loading { color: var(--muted); text-align: center; padding: 40px; }
details.samples { margin-top: 28px; }
details.samples summary { cursor: pointer; color: var(--muted); font-weight: 600; }
label.stacked { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
label.stacked select, label.stacked input { color: var(--ink); }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.module { display: grid; gap: 4px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--bg); position: relative; }
.module input { position: absolute; top: 12px; right: 12px; }
.module.on { border-color: var(--accent); background: #d63c3c0d; }
.module-settings { margin-top: 14px; padding-top: 4px; border-top: 1px dashed var(--line); }
.rules-preview { margin-top: 12px; }
.rules-preview h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 6px; }
.rules-preview .chips { max-height: 160px; overflow: auto; }
.chip.ban { border-color: #d63c3c55; color: var(--accent); }
.count-pill { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; text-align: center; }
ol.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
ol.steps li { display: grid; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font-size: .88rem; }
ol.steps li.done { opacity: .6; }
ol.steps li.done b::before { content: "✓ "; color: var(--good); }
ol.steps li.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
@media (max-width: 700px) { ol.steps { grid-template-columns: 1fr 1fr; } }
.report-grid { display: grid; grid-template-columns: 1fr auto auto auto 1fr; gap: 10px; align-items: center; }
.report-grid .right { justify-self: end; }
.report-grid select { font-size: 1.2rem; font-weight: 700; padding: 6px 10px; }
.btn.danger:hover { background: #c0392b; color: #fff; }

/* ---------- Kopfleiste: vom Admin gestaltbar (Banner/Logo) ---------- */
.topbar.has-banner { background-size: cover; background-position: center; }
.topbar.has-banner .tabs a, .topbar.has-banner .brand { text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-logo { height: 34px; width: auto; max-width: 160px; object-fit: contain; display: block; }
.site-slot { display: flex; gap: 14px; align-items: center; }
.site-thumb { flex: 0 0 auto; width: 160px; height: 56px; border-radius: 8px; border: 1px dashed var(--line); background: var(--bg) center / cover no-repeat; display: grid; place-items: center; }
.site-thumb.logo { width: 56px; background-size: contain; }
label.check { display: flex; align-items: center; gap: 8px; }

/* Admin: Account-Filter */
.user-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.user-filter input[type=search] { flex: 1 1 200px; }
.user-filter .chip { cursor: pointer; font: inherit; font-size: .85rem; }
.user-filter .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.user-filter .chip b { opacity: .7; margin-left: 3px; }

/* Ton-Button in der Kopfleiste */
.sound-menu { margin-left: auto; position: relative; }
.sound-menu + .user-menu { margin-left: 8px; }
.sound-btn { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 6px; padding: 6px 10px; font-size: 1rem; cursor: pointer; line-height: 1.2; }
.sound-btn:hover { background: rgba(255,255,255,.25); }
#sound-dd { min-width: 260px; padding: 12px 14px; }
.snd-panel { display: grid; gap: 10px; }
.snd-row { display: grid; grid-template-columns: 100px 1fr 30px; align-items: center; gap: 8px; font-size: .9rem; }
input[type=checkbox] { accent-color: var(--accent); }
/* Schieberegler: eigenes Design (das allgemeine Eingabefeld-Styling zerteilte die Leiste und verschob den Griff).
   Gefüllter Teil über --fill (js/settings.js setzt ihn bei jeder Änderung): 0 = ganz links, 100 = ganz rechts. */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; padding: 0; margin: 0; border: 0; border-radius: 0;
  background: transparent; box-shadow: none; cursor: pointer; --fill: 50%; }
input[type=range]:focus { outline: none; box-shadow: none; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--fill), var(--line) var(--fill)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.35); transition: transform .1s; }
input[type=range]:hover::-webkit-slider-thumb, input[type=range]:focus-visible::-webkit-slider-thumb { transform: scale(1.15); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--line); border: 0; }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.35); }
input[type=range]:disabled { opacity: .4; cursor: default; }
input[type=color] { width: 64px; height: 38px; padding: 3px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }

/* Eigenes Profilbild: Foto statt Pixel-Sprite */
.avatar.photo { object-fit: cover; image-rendering: auto; background: var(--panel); }
.photo-row { gap: 14px; align-items: center; }
.photo-row { flex-wrap: nowrap; }
.photo-row > div { flex: 1; }

/* ---------- Untermenü als Streifen unter der Kopfleiste (wie Alvion League) ---------- */
.subnav { position: sticky; top: var(--topbar-h, 56px); z-index: 9; background: var(--panel); border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(20, 30, 50, .06); overflow-x: auto; }
.subnav .subtabs { display: flex; gap: 2px; margin: 0; padding: 0 20px; border: 0; flex-wrap: nowrap; }
.subnav .subtabs a { position: relative; padding: .6rem .95rem; color: var(--muted); font-weight: 600; font-size: .92rem; white-space: nowrap;
  border: 0; margin: 0; text-decoration: none; }
.subnav .subtabs a:hover { color: var(--ink); }
.subnav .subtabs a.active { color: var(--ink); }
.subnav .subtabs a.active::after { content: ""; position: absolute; left: .6rem; right: .6rem; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.subnav .subtabs .p-gametab { color: var(--accent); }
body.logged-out .subnav { display: none; }
.acc-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acc-name .badge { white-space: nowrap; }

/* Kopfleiste: viele Reiter → kompakter, eine Zeile; bei schmalen Fenstern seitlich scrollbar */
.topbar { gap: 16px; }
.topbar .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 2px; min-width: 0; }
.topbar .tabs::-webkit-scrollbar { display: none; }
.topbar .tabs a { padding: 6px 9px; font-size: .95rem; white-space: nowrap; }
@media (max-width: 1250px) { .topbar .brand span { display: none; } .topbar .tabs a { padding: 6px 7px; font-size: .9rem; } }

/* ---------- Eigene Vorschlagsliste (js/suggest.js) statt Browser-Datalist ---------- */
.sg-box { position: fixed; z-index: 80; max-height: 340px; overflow-y: auto; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.35); padding: 4px; }
.sg-item { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 3px 8px; border-radius: 7px; cursor: pointer; font-size: .92rem; }
.sg-item:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.sg-item.on { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.sg-ic { width: 34px; flex: none; display: flex; justify-content: center; margin: -4px 0; }
.sg-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-types { flex: none; display: flex; gap: 3px; align-items: center; }
.sg-types .type { font-size: .68rem; }

/* Beim Laden (Sitzung wird geprüft) weder Login noch Seite zeigen – nur einen kleinen Lade-Kreis */
body.booting #login, body.booting .topbar, body.booting main, body.booting .site-footer { visibility: hidden; }
body.booting::after { content: ""; position: fixed; left: 50%; top: 45%; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: boot-spin .8s linear infinite; }
@keyframes boot-spin { to { transform: rotate(360deg); } }

/* Benutzernamen ändern (js/rename.js) */
.rn-pending { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0 12px; font-size: .9rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rn-req { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rn-req:last-child { border-bottom: 0; }

/* Online-Anzeige (js/presence.js): Ring um Avatare, Kopfleisten-Liste, Status-Texte */
img.avatar.pres-online { outline: 2px solid #2ecc71; outline-offset: 1px; }
img.avatar.pres-away   { outline: 2px solid #f0b429; outline-offset: 1px; }
img.avatar.pres-battle { outline: 2px solid #e0245e; outline-offset: 1px; }
.pres-label { font-size: .78rem; color: var(--muted); }
.pres-label.pres-t-online { color: #2ecc71; }
.pres-label.pres-t-away { color: #d49a12; }
.pres-label.pres-t-battle { color: #e0245e; }
.pres-menu { margin-left: auto; position: relative; }
.pres-menu + .sound-menu { margin-left: 8px; }
.pres-btn { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 6px; padding: 6px 10px; font-size: .85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pres-btn:hover { background: rgba(255,255,255,.25); }
.pres-dot { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 0 2px rgba(46,204,113,.3); }
#pres-dd { min-width: 290px; right: 0; max-height: 70vh; overflow: auto; }
.pres-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; }
.pres-row:hover { background: var(--bg); }
.pres-who { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; min-width: 0; }
.pres-who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pres-row .btn.small { padding: 2px 8px; }
.pf-card .pres-label { display: block; min-height: 1.1em; }
.tr-profile-id .pres-label { display: block; margin-top: -4px; }

/* Wartungsmodus */
#maint-bar { position: relative; z-index: 8; background: #f0b429; color: #3a2a00; padding: 6px 20px; font-size: .88rem; text-align: center; }
#tabs a.maint-hidden { display: none; }
.maint-panel { border-top: 4px solid #f0b429; }
.maint-admin.on { border-left: 4px solid #f0b429; }

/* Angekündigter Neustart des Kampfservers */
#restart-bar { position: relative; z-index: 8; background: #e0245e; color: #fff; padding: 7px 20px; font-size: .9rem; text-align: center; }

/* Admin-Vorschau „View as“ */
#viewas-bar { position: relative; z-index: 8; background: #3b82f6; color: #fff; padding: 6px 20px; font-size: .88rem; text-align: center; }
#viewas-bar .btn { margin-left: 10px; padding: 2px 10px; }

.snd-row span[data-volval] { text-align: right; font-variant-numeric: tabular-nums; }
