/* ==========================================================================
   QuizArena – Stylesheet (mobile first)
   ========================================================================== */

:root,
:root[data-theme="dark"] {
  --bg: #0c0e1d;
  --bg-2: #11142a;
  --surface: #161a33;
  --surface-2: #1d2242;
  --surface-3: #272d55;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef0ff;
  --text-2: #b4b9dc;
  --text-3: #7d83ae;
  --primary: #7c5cff;
  --primary-2: #9d86ff;
  --primary-soft: rgba(124, 92, 255, 0.16);
  --on-primary: #ffffff;
  --accent: #22d3ee;
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.16);
  --danger: #f43f5e;
  --danger-soft: rgba(244, 63, 94, 0.16);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.16);
  --gold: #fbbf24;
  --grad: linear-gradient(135deg, #7c5cff 0%, #c026d3 100%);
  --grad-cool: linear-gradient(135deg, #06b6d4 0%, #7c5cff 100%);
  --grad-warm: linear-gradient(135deg, #f59e0b 0%, #f43f5e 100%);
  --shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 28px 70px -24px rgba(0, 0, 0, 0.75);
  --glow: 0 0 0 4px rgba(124, 92, 255, 0.28);
  --map-filter: none;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f4fb;
  --bg-2: #e9ebf7;
  --surface: #ffffff;
  --surface-2: #f3f4fc;
  --surface-3: #e5e8f6;
  --border: rgba(20, 24, 60, 0.09);
  --border-strong: rgba(20, 24, 60, 0.18);
  --text: #15183a;
  --text-2: #4b5180;
  --text-3: #858bb2;
  --primary: #6d4aff;
  --primary-2: #5a38f0;
  --primary-soft: rgba(109, 74, 255, 0.12);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.12);
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, 0.1);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --shadow: 0 12px 30px -16px rgba(30, 30, 90, 0.28);
  --shadow-lg: 0 26px 60px -24px rgba(30, 30, 90, 0.35);
  --glow: 0 0 0 4px rgba(109, 74, 255, 0.22);
  --map-filter: none;
  color-scheme: light;
}

:root {
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --header-h: 60px;
  --nav-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Nunito Variable", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 560px at 0% -10%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(900px 520px at 110% 0%, rgba(34, 211, 238, 0.09), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}

:root[data-theme="light"] body {
  background:
    radial-gradient(1100px 560px at 0% -10%, rgba(124, 92, 255, 0.1), transparent 60%),
    radial-gradient(900px 520px at 110% 0%, rgba(34, 211, 238, 0.08), transparent 60%),
    var(--bg);
}

h1, h2, h3, h4 {
  margin: 0 0 0.4em;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); }
h2 { font-size: clamp(1.25rem, 3.4vw, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 0.8em; }
a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--primary-soft); }

.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.78rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.lg { gap: 20px; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 28px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }

/* Boot-Screen ------------------------------------------------------------- */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot-logo {
  width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center;
  font-size: 40px; font-weight: 900; color: #fff; background: var(--grad);
  animation: pulse 1.2s ease-in-out infinite;
}

/* App-Gerüst ---------------------------------------------------------------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.header {
  position: sticky; top: 0; z-index: 40;
  height: calc(var(--header-h) + var(--safe-t)); padding: var(--safe-t) 16px 0;
  display: flex; align-items: center; gap: 14px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.15rem; color: var(--text); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 900; box-shadow: 0 6px 18px -6px rgba(124, 92, 255, 0.8); }
.brand-mark svg { width: 22px; height: 22px; }
.topnav { display: none; gap: 4px; margin-left: 10px; }
.topnav a {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px;
  color: var(--text-2); font-weight: 700; font-size: 0.95rem;
}
.topnav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topnav a.active { color: var(--text); background: var(--primary-soft); }
.topnav svg { width: 18px; height: 18px; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.level-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-weight: 800; font-size: 0.85rem;
  white-space: nowrap;
}
.level-chip:hover { text-decoration: none; border-color: var(--border-strong); }
.main { flex: 1; width: 100%; }
.page { width: 100%; max-width: 1120px; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + var(--safe-b) + 28px); }
.page.narrow { max-width: 760px; }
.page.wide { max-width: 1320px; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--nav-h) + var(--safe-b)); padding: 6px 6px var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--border);
}
.bottomnav a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 0.72rem; font-weight: 800; border-radius: 14px;
}
.bottomnav a:hover { text-decoration: none; }
.bottomnav a svg { width: 23px; height: 23px; transition: transform 0.2s var(--ease); }
.bottomnav a.active { color: var(--primary-2); }
.bottomnav a.active svg { transform: translateY(-1px) scale(1.08); }
.nav-badge {
  position: absolute; top: 2px; left: 50%; margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.7rem; font-weight: 900;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.topnav .nav-badge { top: -2px; left: auto; right: -4px; margin: 0; }

@media (min-width: 900px) {
  .topnav { display: flex; }
  .bottomnav { display: none; }
  .page { padding: 28px 24px 48px; }
}
@media (max-width: 400px) {
  .header { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .brand > span:last-child { display: none; }
  .header-right { gap: 2px; }
  .sticky-bar { padding: 8px; gap: 8px; }
  .sticky-bar .btn-lg { min-height: 48px; padding: 10px 16px; font-size: 1rem; }
  .page { padding-left: 12px; padding-right: 12px; }
  .card { padding: 14px; }
  .question-card { padding: 14px; }
  .game { padding-left: 10px; padding-right: 10px; }
}

/* Buttons ----------------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--btn-bg); color: var(--btn-fg); font-weight: 800; font-size: 0.98rem; cursor: pointer;
  transition: transform 0.12s var(--ease), box-shadow 0.2s, background 0.2s, border-color 0.2s, opacity 0.2s;
  user-select: none; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: none; box-shadow: var(--glow); }
.btn[disabled], .btn.is-disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn-primary { --btn-bg: var(--grad); --btn-fg: #fff; border-color: transparent; box-shadow: 0 10px 24px -10px rgba(124, 92, 255, 0.85); }
.btn-primary:hover { border-color: transparent; filter: brightness(1.06); }
.btn-cool { --btn-bg: var(--grad-cool); --btn-fg: #fff; border-color: transparent; }
.btn-success { --btn-bg: var(--success); --btn-fg: #fff; border-color: transparent; }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); border-color: transparent; }
.btn-danger:hover { --btn-bg: var(--danger); --btn-fg: #fff; }
.btn-ghost { --btn-bg: transparent; border-color: transparent; }
.btn-ghost:hover { --btn-bg: var(--surface-2); }
.btn-outline { --btn-bg: transparent; }
.btn-lg { min-height: 56px; padding: 14px 24px; font-size: 1.08rem; border-radius: 16px; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.88rem; border-radius: 11px; }
.btn-block { display: flex; width: 100%; }
.row.wrap > .btn.grow, .row.wrap > a.btn.grow { flex: 1 1 auto; min-width: min(100%, max-content); }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--glow); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.btn .spinner { width: 18px; height: 18px; border-width: 2.5px; }

/* Karten & Container ------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card.pad-lg { padding: 24px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title h2, .card-title h3 { margin: 0; }
.section { margin-top: 28px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.section-title h2 { margin: 0; font-size: 1.2rem; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.split { display: grid; gap: 18px; }
.split > *, .grid > *, .form-grid > * { min-width: 0; }
@media (min-width: 980px) {
  .split { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
  .split.sticky-right > :last-child { position: sticky; top: calc(var(--header-h) + 16px); }
}
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }

/* Formulare ---------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 800; font-size: 0.9rem; color: var(--text-2); }
.field-hint { font-size: 0.8rem; color: var(--text-3); }
.field-error { font-size: 0.84rem; color: var(--danger); font-weight: 700; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 13px;
  background: var(--surface-2); border: 1.5px solid var(--border); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s; outline: none;
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: var(--glow); background: var(--surface); }
.input.has-error, .textarea.has-error, .select.has-error { border-color: var(--danger); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input-lg { min-height: 56px; font-size: 1.15rem; font-weight: 700; }
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group .input { flex: 1; min-width: 0; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
.char-count { font-size: 0.75rem; color: var(--text-3); text-align: right; }
.char-count.over { color: var(--danger); font-weight: 800; }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 700; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 48px; height: 28px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; transition: background 0.2s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 0.22s var(--ease); }
.switch input:checked + .switch-track { background: var(--primary); border-color: transparent; }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--glow); }
.switch-label { font-weight: 700; }

.segmented { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; border-radius: 15px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button {
  flex: 1 1 auto; min-height: 40px; padding: 7px 12px; border-radius: 11px; border: 0; background: transparent;
  color: var(--text-2); font-weight: 800; cursor: pointer; transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.4); }
:root[data-theme="dark"] .segmented button.active { background: var(--surface-3); }
.segmented button:focus-visible { outline: none; box-shadow: var(--glow); }

.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-bottom: 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a {
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 800; cursor: pointer; white-space: nowrap;
}
.tabs button:hover, .tabs a:hover { color: var(--text); text-decoration: none; }
.tabs button.active, .tabs a.active { background: var(--primary-soft); border-color: transparent; color: var(--text); }
.tabs svg { width: 17px; height: 17px; }

/* Chips, Badges, Pills ------------------------------------------------------ */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 0.82rem; font-weight: 800; color: var(--text-2); white-space: nowrap;
}
.chip.cat { background: color-mix(in srgb, var(--c, var(--primary)) 16%, transparent); color: var(--text); border-color: color-mix(in srgb, var(--c, var(--primary)) 30%, transparent); }
button.chip { cursor: pointer; }
button.chip.toggle.active { background: var(--primary-soft); color: var(--text); border-color: var(--primary); }
.chip .x { cursor: pointer; opacity: 0.7; }
.chip .x:hover { opacity: 1; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.75rem; font-weight: 900; }
.badge.soft { background: var(--surface-3); color: var(--text-2); }
.diff { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; font-weight: 800; color: var(--text-2); }
.diff i { width: 7px; height: 7px; border-radius: 50%; background: var(--surface-3); display: inline-block; }
.diff.d1 i:nth-child(-n+1), .diff.d2 i:nth-child(-n+2), .diff.d3 i:nth-child(-n+3) { background: var(--dc); }
.diff.d1 { --dc: #22c55e; } .diff.d2 { --dc: #f59e0b; } .diff.d3 { --dc: #f43f5e; }

/* Avatar --------------------------------------------------------------------- */
.avatar {
  --size: 40px; width: var(--size); height: var(--size); flex: none; border-radius: 30%;
  display: grid; place-items: center; font-size: calc(var(--size) * 0.56); line-height: 1;
  background: color-mix(in srgb, var(--ac, var(--primary)) 26%, var(--surface-2));
  border: 2px solid color-mix(in srgb, var(--ac, var(--primary)) 65%, transparent);
  position: relative;
}
.avatar.xs { --size: 26px; border-width: 1.5px; }
.avatar.sm { --size: 32px; }
.avatar.lg { --size: 64px; border-width: 3px; }
.avatar.xl { --size: 92px; border-width: 3px; }
.avatar .online-dot { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--success); border: 2px solid var(--surface); }
.user-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-line .name { font-weight: 850; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.user-line { color: var(--text); }
a.user-line:hover { text-decoration: none; }

/* Fortschritt ---------------------------------------------------------------- */
.progress { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width 0.6s var(--ease); }
.progress.thin { height: 6px; }
.progress.success > span { background: var(--success); }

/* Kacheln (Kategorien & Modi) ----------------------------------------------- */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile {
  --c: var(--primary);
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
  min-height: 112px; padding: 14px; border-radius: 16px; cursor: pointer; color: var(--text);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 18%, var(--surface)) 0%, var(--surface) 70%);
  border: 1.5px solid color-mix(in srgb, var(--c) 22%, var(--border));
  transition: transform 0.15s var(--ease), border-color 0.15s, box-shadow 0.15s;
}
.tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 60%, transparent); text-decoration: none; }
.tile:active { transform: scale(0.98); }
.tile:focus-visible { outline: none; box-shadow: var(--glow); }
.tile .tile-icon { font-size: 1.9rem; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25)); }
.tile .tile-name { font-weight: 850; line-height: 1.2; }
.tile .tile-meta { margin-top: auto; font-size: 0.78rem; color: var(--text-3); font-weight: 700; }
.tile.selected { border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 55%, transparent) inset; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 34%, var(--surface)) 0%, color-mix(in srgb, var(--c) 8%, var(--surface)) 100%); }
.tile .tile-check { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--c); color: #fff; opacity: 0; transform: scale(0.6); transition: 0.18s var(--ease); }
.tile .tile-check svg { width: 15px; height: 15px; }
.tile.selected .tile-check { opacity: 1; transform: scale(1); }
.tile.disabled { opacity: 0.45; pointer-events: none; }
.tiles.compact { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.tiles.compact .tile { min-height: 88px; padding: 12px; }
.tiles.compact .tile-icon { font-size: 1.5rem; }

.mode-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.mode-card {
  --c: var(--primary);
  position: relative; overflow: hidden; display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer; text-align: left;
  transition: transform 0.15s var(--ease), border-color 0.15s, box-shadow 0.2s; box-shadow: var(--shadow);
}
.mode-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(420px 160px at 0% 0%, color-mix(in srgb, var(--c) 26%, transparent), transparent 70%); pointer-events: none; }
.mode-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 55%, transparent); text-decoration: none; }
.mode-card:active { transform: scale(0.985); }
.mode-card .mode-icon { position: relative; width: 54px; height: 54px; flex: none; border-radius: 16px; display: grid; place-items: center; font-size: 1.7rem; background: color-mix(in srgb, var(--c) 22%, var(--surface-2)); }
.mode-card .mode-text { position: relative; min-width: 0; }
.mode-card .mode-title { font-weight: 900; font-size: 1.05rem; }
.mode-card .mode-desc { color: var(--text-2); font-size: 0.88rem; line-height: 1.35; }
.mode-card .badge { position: absolute; top: 12px; right: 12px; }
.mode-card.featured { --c: #7c5cff; background: var(--grad); color: #fff; border: 0; box-shadow: 0 18px 40px -16px rgba(124, 92, 255, 0.85); }
.mode-card.featured::before { background: radial-gradient(380px 200px at 100% 0%, rgba(255, 255, 255, 0.22), transparent 70%); }
.mode-card.featured .mode-icon { background: rgba(255, 255, 255, 0.18); }
.mode-card.featured .mode-desc { color: rgba(255, 255, 255, 0.85); }

/* Hero (Startseite) ---------------------------------------------------------- */
.hero { display: grid; gap: 16px; align-items: center; grid-template-columns: 1fr; padding: 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(124, 92, 255, 0.35), transparent 70%); pointer-events: none; }
.hero h1 { margin: 0; }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { flex: 1 1 110px; padding: 12px 14px; border-radius: 15px; background: var(--surface-2); border: 1px solid var(--border); }
.stat .stat-value { font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .stat-label { font-size: 0.78rem; color: var(--text-3); font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.level-ring { position: relative; width: 74px; height: 74px; flex: none; }
.level-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.level-ring .lr-bg { stroke: var(--surface-3); }
.level-ring .lr-fg { stroke: url(#lvlgrad); stroke-linecap: round; transition: stroke-dashoffset 0.8s var(--ease); }
.level-ring .lr-text { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1; }
.level-ring .lr-num { font-size: 1.5rem; font-weight: 900; }
.level-ring .lr-lbl { font-size: 0.62rem; font-weight: 900; color: var(--text-3); letter-spacing: 0.06em; }

/* Listen --------------------------------------------------------------------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 15px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); min-width: 0;
}
a.list-item:hover, button.list-item:hover { border-color: var(--border-strong); text-decoration: none; }
button.list-item { width: 100%; text-align: left; cursor: pointer; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 800; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.list-item .li-sub { font-size: 0.83rem; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 3px; }
.list-item .li-side { display: flex; align-items: center; gap: 6px; flex: none; }
.list-item.selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }

.empty { text-align: center; padding: 34px 16px; color: var(--text-2); }
.empty .empty-icon { font-size: 2.6rem; margin-bottom: 8px; }
.empty h3 { color: var(--text); }

/* Rangliste ------------------------------------------------------------------ */
.rank { width: 34px; flex: none; text-align: center; font-weight: 900; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rank.r1 { color: #fbbf24; font-size: 1.25rem; }
.rank.r2 { color: #cbd5e1; font-size: 1.15rem; }
.rank.r3 { color: #d97706; font-size: 1.1rem; }
.list-item.me { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 10px; align-items: end; margin-bottom: 16px; }
.podium-place { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.podium-place .name { font-weight: 850; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-block { width: 100%; border-radius: 14px 14px 6px 6px; display: grid; place-items: center; font-weight: 900; font-size: 1.4rem; color: #fff; }
.podium-place.p1 .podium-block { height: 92px; background: linear-gradient(180deg, #fbbf24, #d97706); }
.podium-place.p2 .podium-block { height: 68px; background: linear-gradient(180deg, #cbd5e1, #64748b); }
.podium-place.p3 .podium-block { height: 52px; background: linear-gradient(180deg, #f59e0b, #92400e); }

/* Toasts --------------------------------------------------------------------- */
.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); top: calc(var(--safe-t) + 12px); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 15px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); font-weight: 750;
  animation: toastIn 0.35s var(--ease);
}
.toast .toast-icon { font-size: 1.35rem; flex: none; }
.toast.success { border-color: color-mix(in srgb, var(--success) 50%, transparent); }
.toast.error { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.toast.achievement { background: linear-gradient(135deg, color-mix(in srgb, #fbbf24 22%, var(--surface)), var(--surface)); border-color: rgba(251, 191, 36, 0.5); }
.toast .toast-actions { margin-left: auto; display: flex; gap: 6px; }
.toast.leaving { animation: toastOut 0.25s ease forwards; }

/* Modal & Sheet --------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(5, 6, 18, 0.62); backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn 0.2s ease; }
.modal {
  width: 100%; max-height: min(92dvh, 900px); overflow: auto; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 24px 24px 0 0; padding: 20px 18px calc(18px + var(--safe-b)); box-shadow: var(--shadow-lg); animation: sheetIn 0.32s var(--ease);
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; flex: 1; font-size: 1.25rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1 1 auto; }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { width: min(560px, 100%); border-radius: 24px; padding: 24px; animation: popIn 0.25s var(--ease); }
  .modal.wide { width: min(860px, 100%); }
  .modal-actions .btn { flex: 0 0 auto; }
}

/* Spinner & Skeleton ---------------------------------------------------------- */
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--primary); animation: spin 0.8s linear infinite; display: inline-block; }
.loading { display: grid; place-items: center; padding: 48px 0; gap: 12px; color: var(--text-3); }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }

/* Auth ------------------------------------------------------------------------ */
.auth-wrap { min-height: 100dvh; display: grid; align-items: center; padding: calc(var(--safe-t) + 20px) 16px calc(var(--safe-b) + 20px); }
.auth-grid { width: 100%; max-width: 1060px; margin: 0 auto; display: grid; gap: 28px; align-items: center; }
@media (min-width: 900px) { .auth-grid { grid-template-columns: 1.1fr 1fr; gap: 56px; } }
.auth-hero h1 { font-size: clamp(2rem, 6vw, 3.3rem); line-height: 1.05; margin-bottom: 14px; }
.auth-hero h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.feature-list { display: grid; gap: 10px; margin-top: 18px; }
.feature { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--border); font-weight: 750; }
.feature .f-icon { font-size: 1.4rem; width: 36px; text-align: center; }
.auth-card { padding: 24px; }
.auth-card h2 { margin-bottom: 4px; }
.auth-switch { text-align: center; margin-top: 14px; color: var(--text-2); }
.auth-switch button { background: none; border: 0; color: var(--primary-2); font-weight: 850; cursor: pointer; padding: 4px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-wrap .icon-btn { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); }
.strength { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.strength > span { display: block; height: 100%; transition: width 0.3s, background 0.3s; }

/* Spiel ----------------------------------------------------------------------- */
.game { min-height: 100dvh; display: flex; flex-direction: column; max-width: 860px; margin: 0 auto; padding: calc(var(--safe-t) + 10px) 14px calc(var(--safe-b) + 16px); }
.game-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.game-top .progress { flex: 1; }
.game-score { font-weight: 900; font-variant-numeric: tabular-nums; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.game-score.bump { animation: bump 0.45s var(--ease); }
.game-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.lives { display: flex; gap: 3px; font-size: 1.15rem; }
.lives .lost { filter: grayscale(1); opacity: 0.35; }
.streak { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; color: #fb923c; }
.streak.hot { animation: pulse 1s ease-in-out infinite; }

.timer { position: relative; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.timer > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--success); transition: background 0.3s; }
.timer.warn > span { background: var(--warning); }
.timer.crit > span { background: var(--danger); }
.timer-text { font-weight: 900; font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.timer-text.crit { color: var(--danger); animation: pulse 0.6s ease-in-out infinite; }

.question-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); animation: fadeUp 0.35s var(--ease); }
.q-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.q-text { font-size: clamp(1.15rem, 3.6vw, 1.5rem); font-weight: 850; line-height: 1.3; margin: 6px 0 4px; overflow-wrap: anywhere; }
.q-image { margin: 12px 0 2px; border-radius: 16px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; max-height: 280px; }
.q-image img { max-height: 280px; width: auto; object-fit: contain; display: block; }
.q-type-hint { font-size: 0.82rem; color: var(--text-3); font-weight: 750; margin-top: 4px; }

.answers { display: grid; gap: 10px; margin-top: 16px; }
@media (min-width: 640px) { .answers.cols-2 { grid-template-columns: 1fr 1fr; } }
.answer-btn {
  --ac: var(--primary);
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 12px 14px; width: 100%;
  border-radius: 16px; border: 2px solid var(--border); background: var(--surface-2); color: var(--text);
  font-weight: 800; font-size: 1.02rem; text-align: left; cursor: pointer; overflow-wrap: anywhere;
  transition: transform 0.12s var(--ease), border-color 0.15s, background 0.2s, opacity 0.25s;
}
.answer-btn:hover:not([disabled]) { border-color: color-mix(in srgb, var(--ac) 70%, transparent); background: color-mix(in srgb, var(--ac) 10%, var(--surface-2)); }
.answer-btn:active:not([disabled]) { transform: scale(0.98); }
.answer-btn:focus-visible { outline: none; box-shadow: var(--glow); }
.answer-btn[disabled] { cursor: default; }
.answer-btn .letter { width: 34px; height: 34px; flex: none; border-radius: 11px; display: grid; place-items: center; font-weight: 900; color: #fff; background: var(--ac); font-size: 0.95rem; }
.answer-btn .a-text { flex: 1; min-width: 0; }
.answer-btn .a-mark { flex: none; display: flex; gap: 4px; align-items: center; }
.answer-btn:nth-child(1) { --ac: #7c5cff; }
.answer-btn:nth-child(2) { --ac: #06b6d4; }
.answer-btn:nth-child(3) { --ac: #f59e0b; }
.answer-btn:nth-child(4) { --ac: #ec4899; }
.answer-btn:nth-child(5) { --ac: #22c55e; }
.answer-btn:nth-child(6) { --ac: #f97316; }
.answer-btn.is-selected { border-color: var(--ac); background: color-mix(in srgb, var(--ac) 16%, var(--surface-2)); }
.answer-btn.is-correct { border-color: var(--success); background: var(--success-soft); animation: pop 0.4s var(--ease); }
.answer-btn.is-correct .letter { background: var(--success); }
.answer-btn.is-wrong { border-color: var(--danger); background: var(--danger-soft); animation: shake 0.42s ease; }
.answer-btn.is-wrong .letter { background: var(--danger); }
.answer-btn.is-dim { opacity: 0.45; }
.answer-btn.is-removed { opacity: 0.12; pointer-events: none; filter: grayscale(1); }

.tf-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.tf-btn { min-height: 92px; flex-direction: column; justify-content: center; gap: 6px; font-size: 1.15rem; text-align: center; }
.tf-btn .tf-icon { font-size: 1.8rem; line-height: 1; }
.tf-btn.true { --ac: #22c55e !important; }
.tf-btn.false { --ac: #f43f5e !important; }

.input-answer { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.estimate-box { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.estimate-value { display: flex; align-items: center; gap: 10px; }
.estimate-value .input { text-align: center; font-size: 1.5rem; font-weight: 900; min-height: 60px; }
.estimate-value .unit { font-weight: 850; color: var(--text-2); font-size: 1.05rem; }
.range { width: 100%; accent-color: var(--primary); height: 32px; }
.range-labels { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-3); font-weight: 750; margin-top: -6px; }
.scale-bar { position: relative; height: 46px; margin: 8px 6px 0; }
.scale-bar .sb-line { position: absolute; left: 0; right: 0; top: 22px; height: 4px; border-radius: 4px; background: var(--surface-3); }
.scale-bar .sb-mark { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; font-size: 0.72rem; font-weight: 900; white-space: nowrap; }
.scale-bar .sb-dot { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--surface); margin-top: 16px; }
.scale-bar .sb-mark.answer .sb-dot { background: var(--success); width: 20px; height: 20px; margin-top: 14px; }
.scale-bar .sb-label { position: absolute; top: -2px; }

.order-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.order-label { font-size: 0.78rem; font-weight: 900; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 6px; }
.order-item {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border-radius: 15px;
  border: 2px dashed var(--border-strong); background: var(--surface-2); color: var(--text); font-weight: 800; text-align: left; cursor: pointer; width: 100%;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.order-item:active { transform: scale(0.985); }
.order-item .o-num { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; font-weight: 900; background: var(--surface-3); color: var(--text-3); }
.order-item.assigned { border-style: solid; border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface-2)); }
.order-item.assigned .o-num { background: var(--primary); color: #fff; }
.order-item.is-correct { border-style: solid; border-color: var(--success); background: var(--success-soft); }
.order-item.is-correct .o-num { background: var(--success); color: #fff; }
.order-item.is-wrong { border-style: solid; border-color: var(--danger); background: var(--danger-soft); }
.order-item.is-wrong .o-num { background: var(--danger); color: #fff; }
.order-item .o-hint { margin-left: auto; font-size: 0.8rem; color: var(--text-3); font-weight: 800; white-space: nowrap; }

.map-answer { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.map-box { position: relative; height: min(56dvh, 520px); min-height: 280px; border-radius: 18px; overflow: hidden; border: 1px solid var(--border-strong); background: #0b2239; }
.map-box.tall { height: min(64dvh, 600px); }
.map-box .leaflet-container { width: 100%; height: 100%; font-family: var(--font); background: #0b2239; }
.map-box .leaflet-tile-pane { filter: var(--map-filter); }
.map-hint { position: absolute; z-index: 500; left: 50%; top: 10px; transform: translateX(-50%); padding: 6px 12px; border-radius: 999px; background: rgba(12, 14, 29, 0.78); color: #fff; font-size: 0.82rem; font-weight: 800; pointer-events: none; white-space: nowrap; }
.map-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: #fff; font-weight: 800; }
.pin { background: none; border: 0; }
.pin-body {
  position: relative; width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--pin, #7c5cff);
  border: 3px solid #fff; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35); display: grid; place-items: center;
}
.pin-body span { transform: rotate(45deg); font-size: 14px; line-height: 1; }
.pin-target .pin-body { background: #16a34a; }
.pin-drop { animation: pinDrop 0.35s var(--ease); }
.dist-label { background: rgba(12, 14, 29, 0.85) !important; color: #fff !important; border: 0 !important; border-radius: 999px !important; font-weight: 900 !important; padding: 4px 10px !important; box-shadow: none !important; font-family: var(--font) !important; }
.dist-label::before { display: none !important; }

.reveal { margin-top: 14px; border-radius: 18px; padding: 14px 16px; border: 1.5px solid var(--border); background: var(--surface-2); animation: fadeUp 0.35s var(--ease); }
.reveal.good { border-color: color-mix(in srgb, var(--success) 60%, transparent); background: var(--success-soft); }
.reveal.bad { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: var(--danger-soft); }
.reveal.partial { border-color: color-mix(in srgb, var(--warning) 60%, transparent); background: var(--warning-soft); }
.reveal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reveal-title { font-weight: 900; font-size: 1.15rem; }
.reveal-points { margin-left: auto; font-weight: 900; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.reveal-points.plus { color: var(--success); }
.reveal-solution { margin-top: 6px; font-weight: 750; }
.explanation { margin-top: 10px; padding: 10px 12px; border-radius: 13px; background: color-mix(in srgb, var(--surface) 75%, transparent); border: 1px solid var(--border); font-size: 0.95rem; color: var(--text-2); }
.explanation b { color: var(--text); }
.game-actions { display: flex; gap: 10px; margin-top: 14px; align-items: center; }
.game-actions .btn-primary { flex: 1; }
.jokers { display: flex; gap: 8px; }
.joker { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); font-weight: 900; font-size: 0.85rem; cursor: pointer; color: var(--text); }
.joker:hover:not([disabled]) { border-color: var(--primary); }
.joker[disabled] { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }
.kbd { display: inline-block; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border-strong); font-size: 0.72rem; font-weight: 900; color: var(--text-3); }

/* Ergebnis ----------------------------------------------------------------------- */
.result-hero { text-align: center; padding: 28px 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.result-hero::before { content: ""; position: absolute; inset: -40% -10% auto; height: 300px; background: radial-gradient(closest-side, rgba(124, 92, 255, 0.3), transparent); pointer-events: none; }
.result-emoji { font-size: 3.4rem; line-height: 1; margin-bottom: 6px; animation: popIn 0.5s var(--ease); position: relative; }
.result-score { font-size: clamp(2.6rem, 10vw, 4rem); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; position: relative; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-sub { color: var(--text-2); font-weight: 750; margin-top: 6px; position: relative; }
.result-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 18px; position: relative; }
.review-item { display: flex; gap: 12px; align-items: flex-start; }
.review-item .ri-icon { width: 30px; height: 30px; flex: none; border-radius: 10px; display: grid; place-items: center; font-weight: 900; color: #fff; }
.review-item .ri-icon.ok { background: var(--success); }
.review-item .ri-icon.no { background: var(--danger); }
.review-item .ri-icon.skip { background: var(--surface-3); color: var(--text-2); }
.achievement-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 15px; background: linear-gradient(135deg, rgba(251, 191, 36, 0.16), transparent); border: 1px solid rgba(251, 191, 36, 0.4); animation: popIn 0.45s var(--ease); }
.achievement-card .ach-icon { font-size: 1.9rem; }
.ach-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.ach { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 15px; background: var(--surface-2); border: 1px solid var(--border); }
.ach .ach-icon { font-size: 1.7rem; width: 40px; text-align: center; }
.ach.locked { opacity: 0.45; }
.ach.locked .ach-icon { filter: grayscale(1); }
.ach-title { font-weight: 850; }
.ach-desc { font-size: 0.8rem; color: var(--text-3); line-height: 1.3; }

/* Duell -------------------------------------------------------------------------- */
.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.vs-player { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vs-player.right { flex-direction: row-reverse; text-align: right; }
.vs-player .vs-name { font-weight: 850; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; }
.vs-player .vs-score { font-weight: 900; font-size: 1.3rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.vs-player .vs-status { font-size: 0.75rem; font-weight: 800; color: var(--text-3); }
.vs-player .vs-status.ok { color: var(--success); }
.vs-badge { font-weight: 900; font-size: 0.85rem; color: var(--text-3); padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.vs-player.disconnected { opacity: 0.5; }
.room-code { font-size: clamp(2.2rem, 10vw, 3.2rem); font-weight: 900; letter-spacing: 0.18em; font-variant-numeric: tabular-nums; text-align: center; line-height: 1.1; padding: 8px 0; }
.qr { width: 168px; height: 168px; border-radius: 14px; background: #fff; padding: 8px; margin: 0 auto; display: block; }
.countdown { min-height: 60dvh; display: grid; place-items: center; }
.countdown-num { font-size: clamp(6rem, 30vw, 10rem); font-weight: 900; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; animation: countPop 1s var(--ease) infinite; }
.reactions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.reaction-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); font-size: 1.3rem; cursor: pointer; transition: transform 0.1s; }
.reaction-btn:active { transform: scale(0.88); }
.reaction-float { position: fixed; z-index: 180; font-size: 2.6rem; pointer-events: none; animation: floatUp 2.2s ease-out forwards; }
.player-marks { display: flex; gap: 3px; }
.player-marks .avatar { --size: 24px; font-size: 13px; border-width: 1.5px; }
.online-list .list-item { padding: 10px 12px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--success); }
.status-dot.busy { background: var(--warning); }
.invite-toast { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.queue-pulse { width: 90px; height: 90px; border-radius: 50%; margin: 10px auto; display: grid; place-items: center; font-size: 2.4rem; background: var(--primary-soft); animation: ring 1.6s ease-out infinite; }

/* Editor -------------------------------------------------------------------------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .input, .toolbar .select { min-height: 42px; width: auto; }
.toolbar .search { flex: 1 1 220px; }
.type-picker { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 560px) { .type-picker { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); } .type-option .t-desc { display: none; } .type-option { padding: 10px; } }
.type-option { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 15px; border: 2px solid var(--border); background: var(--surface-2); cursor: pointer; text-align: left; color: var(--text); transition: border-color 0.15s, background 0.15s; }
.type-option:hover { border-color: var(--border-strong); }
.type-option.active { border-color: var(--primary); background: var(--primary-soft); }
.type-option .t-icon { font-size: 1.4rem; }
.type-option .t-name { font-weight: 850; font-size: 0.95rem; }
.type-option .t-desc { font-size: 0.76rem; color: var(--text-3); line-height: 1.3; }
.option-row { display: flex; align-items: center; gap: 8px; }
.option-row .input { flex: 1; min-width: 0; }
.correct-toggle { width: 42px; height: 42px; flex: none; border-radius: 12px; border: 2px solid var(--border-strong); background: var(--surface-2); display: grid; place-items: center; cursor: pointer; color: transparent; transition: 0.15s; }
.correct-toggle svg { width: 20px; height: 20px; }
.correct-toggle.on { background: var(--success); border-color: var(--success); color: #fff; }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-section + .form-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
.preview-panel { position: relative; }
.preview-label { position: absolute; top: -10px; left: 16px; z-index: 2; padding: 2px 10px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 0.72rem; font-weight: 900; letter-spacing: 0.05em; text-transform: uppercase; }
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; border-radius: 13px; background: var(--surface-2); border: 1.5px solid var(--border); min-height: 46px; }
.tag-input:focus-within { border-color: var(--primary); box-shadow: var(--glow); }
.tag-input input { flex: 1 1 120px; min-width: 100px; border: 0; background: transparent; outline: none; padding: 6px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; max-height: 220px; overflow: auto; padding: 2px; }
.emoji-grid button { height: 42px; border-radius: 11px; border: 2px solid transparent; background: var(--surface-2); font-size: 1.35rem; cursor: pointer; }
.emoji-grid button.active { border-color: var(--primary); background: var(--primary-soft); }
.color-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.color-grid button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25); }
.color-grid button.active { border-color: var(--text); }
.image-preview { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); max-width: 320px; }
.image-preview img { display: block; max-height: 200px; width: 100%; object-fit: contain; }
.image-preview .icon-btn { position: absolute; top: 6px; right: 6px; background: rgba(0, 0, 0, 0.6); color: #fff; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 16px; padding: 22px; text-align: center; color: var(--text-2); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.sticky-bar { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); z-index: 30; display: flex; gap: 10px; padding: 10px; border-radius: 18px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); margin-top: 18px; }
@media (min-width: 900px) { .sticky-bar { bottom: 12px; } }
.sticky-bar .btn-primary { flex: 1; }
.bulk-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-radius: 15px; background: var(--primary-soft); margin-bottom: 10px; }
.pagination { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 14px; }
.code-box { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.82rem; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; max-height: 260px; overflow: auto; }
.error-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.error-list > div { padding: 8px 10px; border-radius: 10px; background: var(--danger-soft); font-size: 0.85rem; }

/* Setup ---------------------------------------------------------------------------- */
.setup-block { display: flex; flex-direction: column; gap: 10px; }
.setup-block + .setup-block { margin-top: 22px; }
.setup-block h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.option-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.option-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 15px; border: 2px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left; transition: border-color 0.15s, background 0.15s; }
.option-card:hover { border-color: var(--border-strong); }
.option-card.active { border-color: var(--primary); background: var(--primary-soft); }
.option-card .oc-icon { font-size: 1.5rem; line-height: 1.2; }
.option-card .oc-title { font-weight: 850; }
.option-card .oc-desc { font-size: 0.8rem; color: var(--text-3); line-height: 1.3; }
.available { font-weight: 800; color: var(--text-2); }
.available.none { color: var(--danger); }

/* Profil ---------------------------------------------------------------------------- */
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.profile-head h1 { margin: 0; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.bar-row .progress { grid-column: 1 / -1; height: 8px; }
.activity { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 90px; }
.activity > div { border-radius: 6px 6px 3px 3px; background: var(--primary); min-height: 3px; opacity: 0.85; }

/* Karten-Modus ------------------------------------------------------------------- */
.preset-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); }

/* Leaflet-Feinschliff --------------------------------------------------------------- */
.leaflet-control-attribution { font-size: 10px !important; }
.leaflet-touch .leaflet-bar a { width: 36px !important; height: 36px !important; line-height: 36px !important; }
.leaflet-container a.leaflet-popup-close-button { display: none; }

/* Animationen --------------------------------------------------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(0.97); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes countPop { 0% { transform: scale(0.6); opacity: 0; } 25% { transform: scale(1.08); opacity: 1; } 70% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.9); opacity: 0; } }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(20px) scale(0.6); } 15% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-180px) scale(1); } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(124, 92, 255, 0.45); } 100% { box-shadow: 0 0 0 30px rgba(124, 92, 255, 0); } }
@keyframes pinDrop { from { transform: translateY(-18px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
:root.reduced-motion *, :root.reduced-motion *::before, :root.reduced-motion *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }

/* Editor-Vorschau: auf dem Handy einklappbar */
.preview-collapsed { display: none; }
[data-mobile-only] { display: inline-flex; }
@media (min-width: 980px) {
  .preview-collapsed { display: block; }
  [data-mobile-only] { display: none !important; }
}
@media (max-width: 480px) {
  .hide-sm { display: none; }
}
fieldset[disabled] .type-option, fieldset[disabled] .correct-toggle { cursor: not-allowed; }

/* Rechtliche Texte */
.legal-text h2 { font-size: 1.25rem; margin-top: 1.2em; }
.legal-text h3 { font-size: 1.05rem; margin-top: 1em; }
.legal-text h2:first-child, .legal-text h3:first-child { margin-top: 0; }
.legal-text p, .legal-text li { color: var(--text-2); overflow-wrap: anywhere; }
.legal-text ul { padding-left: 1.2em; margin: 0 0 0.8em; }

/* Konfetti */
.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 190; }

/* Speicherleiste auf kleinen Displays */
@media (max-width: 420px) {
  .hide-xs { display: none !important; }
  .sticky-bar .btn:not(.btn-primary) { padding-left: 12px; padding-right: 12px; }
}
.input-group .select { flex: 1; min-width: 0; }
.form-grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }

/* Admin-Bereich */
.kpi-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi-grid.small-kpis { grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); }
.small-kpis .stat .stat-value { font-size: 1.15rem; }
.stat .stat-sub { font-size: 0.8rem; color: var(--text-3); margin-top: 2px; }
button.stat-btn { text-align: left; cursor: pointer; font: inherit; color: inherit; width: 100%; }
button.stat-btn:hover { border-color: var(--border-strong); }
.live-row { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 0.9rem; }
.kv > span { color: var(--text-3); }
.kv > b { font-weight: 800; overflow-wrap: anywhere; }
.kv .mono, input.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.85em; }
.chip.chip-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.notice { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); font-weight: 700; }
.notice.danger { background: var(--danger-soft); border-color: transparent; }

/* Ankündigung auf der Startseite */
.announcement { --ann: var(--primary); display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px;
  background: color-mix(in srgb, var(--ann) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ann) 38%, transparent); }
.announcement.success { --ann: var(--success); }
.announcement.warning { --ann: var(--warning); }
.announcement .ann-icon { font-size: 1.4rem; line-height: 1.3; }
.announcement .ann-text { flex: 1; min-width: 0; }
.announcement .legal-text p { color: var(--text); margin: 0 0 0.5em; }
.announcement .legal-text > :last-child { margin-bottom: 0; }

/* Spezialthemen (Unterkategorien) */
.sub-group { margin-top: 12px; padding: 10px 12px; border-radius: 14px; border: 1px dashed color-mix(in srgb, var(--c, var(--primary)) 45%, var(--border)); background: color-mix(in srgb, var(--c, var(--primary)) 6%, transparent); }
.sub-group-toggle { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--text); font: inherit; font-weight: 800; cursor: pointer; padding: 4px 0; text-align: left; }
.sub-group-toggle svg { width: 18px; height: 18px; flex: none; }
.sub-group .tiles { margin-top: 10px; }
.tile .tile-sub { font-size: 0.72rem; font-weight: 800; color: var(--c, var(--primary)); }
.chip.chip-warn { background: var(--warning-soft); color: var(--text); border-color: transparent; }
.live-row.revoked { opacity: 0.55; }
.live-row.revoked .small { text-decoration: line-through; }

/* Hinweise an Spieler (Verwarnung, Punkte, Sperren) */
.notice-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.notice-item .ni-icon { font-size: 1.5rem; line-height: 1.2; }
.notice-item .ni-title { font-weight: 900; margin-bottom: 2px; }

/* Duell: Frist nach dem ersten „Weiter“ */
.duel-wait { margin-top: 8px; padding: 8px 12px; border-radius: 12px; background: var(--warning-soft); font-weight: 800; font-size: 0.9rem; text-align: center; }
.duel-wait b { font-variant-numeric: tabular-nums; }
.duel-wait span { font-weight: 700; color: var(--text-2); }
.tile.included { opacity: 0.72; }
.tile.included .tile-check { opacity: 0.7; }
button.chip.toggle.included { opacity: 0.7; border-style: dashed; }
