:root {
  --bg: #101a2c;
  --bg-2: #18263f;
  --panel: #ffffff;
  --ink: #16202f;
  --ink-soft: #5b6678;
  --line: #e2e6ee;
  --accent: #ff7a3d;
  --accent-dark: #e05f22;
  --ok: #22a06b;
  --bad: #e5484d;
  --a0: #e5484d;
  --a1: #3e63dd;
  --a2: #b07a00;
  --a3: #22a06b;
  --radius: 14px;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: radial-gradient(1200px 700px at 20% -10%, #24406b 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 110%, #3a2350 0%, transparent 60%), var(--bg);
  color: #fff;
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 12px 22px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.06s, box-shadow 0.06s, filter 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { filter: brightness(0.96); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 4px 0 var(--accent-dark); }
.btn.dark { background: #26344f; color: #fff; box-shadow: 0 4px 0 #0b1322; }
.btn.danger { background: var(--bad); color: #fff; box-shadow: 0 4px 0 #a92a2e; }
.btn.ghost { background: transparent; color: inherit; box-shadow: none; border: 2px solid currentColor; }
.btn.small { padding: 7px 12px; font-size: 0.9rem; }
.btn.big { padding: 16px 30px; font-size: 1.2rem; }

/* ---------- Layout ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
}
.logo {
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.logo .dot { color: var(--accent); }
.logo-mark { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 26px; height: 26px; }
.logo-mark span { border-radius: 3px; }
.logo-mark span:nth-child(1) { background: var(--a0); }
.logo-mark span:nth-child(2) { background: var(--a1); }
.logo-mark span:nth-child(3) { background: var(--a2); }
.logo-mark span:nth-child(4) { background: var(--a3); }

.center-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
}

.card {
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.join-card { width: min(360px, 100%); display: grid; gap: 12px; }
.join-card input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
}
.join-card input:focus { outline: none; border-color: var(--accent); }
.join-card .btn { width: 100%; padding: 14px; font-size: 1.1rem; background: #1d2840; color: #fff; box-shadow: 0 4px 0 #000; }

.error-msg { color: var(--bad); font-size: 0.95rem; min-height: 1.2em; }
.muted { color: var(--ink-soft); font-weight: 600; }
.on-dark-muted { color: rgba(255, 255, 255, 0.7); font-weight: 600; }

.footer-link { margin-top: 28px; color: rgba(255, 255, 255, 0.75); font-weight: 600; }
.footer-link a { color: #fff; }

/* ---------- Toast & Overlay ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #0b1322;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  z-index: 100;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  max-width: calc(100% - 32px);
}
.toast.error { background: var(--bad); }

.conn-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bad);
  color: #fff;
  text-align: center;
  padding: 6px;
  z-index: 90;
  font-size: 0.9rem;
}

/* ---------- Antwortformen ---------- */
.shape { width: 1.6em; height: 1.6em; flex: none; fill: #fff; }
.c0 { background: var(--a0); }
.c1 { background: var(--a1); }
.c2 { background: var(--a2); }
.c3 { background: var(--a3); }

/* ---------- Timer ---------- */
.timer-bubble {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  font-weight: 900;
  box-shadow: var(--shadow);
}
.timer-bubble.urgent { background: var(--bad); color: #fff; }
.progress { height: 8px; background: rgba(255, 255, 255, 0.15); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 100%; transition: width 0.25s linear; }

/* ---------- Bibliothek (Host) ---------- */
.library { max-width: 1100px; margin: 0 auto; padding: 8px 24px 48px; }
.library-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 16px 0 20px; }
.library-head h1 { margin: 0; font-size: 2rem; font-weight: 900; }
.library-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.quiz-card { display: flex; flex-direction: column; gap: 10px; }
.quiz-card .stripe { height: 8px; border-radius: 99px; display: flex; overflow: hidden; }
.quiz-card .stripe span { flex: 1; }
.quiz-card h3 { margin: 0; font-size: 1.25rem; font-weight: 900; word-break: break-word; }
.quiz-card p { margin: 0; flex: 1; }
.quiz-card .meta { font-size: 0.9rem; }
.quiz-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 48px 16px; }

/* ---------- Lobby (Host) ---------- */
.lobby { min-height: 100vh; display: flex; flex-direction: column; }
.pin-banner {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 16px;
  padding: 20px 16px 8px;
  flex-wrap: wrap;
}
.pin-box { background: #fff; color: var(--ink); border-radius: var(--radius); padding: 12px 28px; box-shadow: var(--shadow); text-align: center; }
.pin-box .label { font-size: 1rem; color: var(--ink-soft); }
.pin-box .pin { font-size: clamp(2.6rem, 8vw, 4.6rem); font-weight: 900; letter-spacing: 0.06em; line-height: 1.05; }
.pin-box .url { font-size: 1.05rem; word-break: break-all; }
.lobby-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 24px; flex-wrap: wrap; }
.player-count { font-size: 1.4rem; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.lobby-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.player-cloud { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 8px 24px 40px; align-content: flex-start; flex: 1; }
.player-chip {
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  animation: pop 0.25s ease-out;
}
.player-chip:hover { background: var(--bad); text-decoration: line-through; }
.player-chip.offline { opacity: 0.45; }
.waiting-hint { opacity: 0.7; font-size: 1.2rem; margin-top: 40px; }

@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Spielansicht (Host) ---------- */
.stage { min-height: 100vh; display: flex; flex-direction: column; padding: 16px 24px 24px; gap: 16px; }
.stage-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stage-top .count { font-size: 1.1rem; opacity: 0.85; }
.question-title {
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius);
  padding: 18px 24px;
  font-size: clamp(1.4rem, 3.2vw, 2.4rem);
  font-weight: 900;
  text-align: center;
  box-shadow: var(--shadow);
  word-break: break-word;
}
.stage-middle { flex: 1; display: grid; grid-template-columns: 140px 1fr 140px; align-items: center; gap: 16px; min-height: 160px; }
.stage-middle .side { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 1.1rem; }
.stage-middle .side .big { font-size: 2.6rem; font-weight: 900; }
.media { display: flex; justify-content: center; align-items: center; height: 100%; }
.media img { max-height: 34vh; max-width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; }
.media .placeholder { width: 120px; height: 120px; opacity: 0.25; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.media .placeholder span { border-radius: 10px; }

.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 10px;
  color: #fff;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  font-weight: 800;
  box-shadow: var(--shadow);
  min-height: 84px;
  word-break: break-word;
  text-align: left;
}
.answer-tile .txt { flex: 1; }
.answer-tile.dim { opacity: 0.3; }
.answer-tile .check { font-size: 1.6em; line-height: 1; }

.intro-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; text-align: center; }
.intro-screen .question-title { max-width: 1000px; width: 100%; }
.intro-screen .progress { width: min(600px, 80%); }
.badge { display: inline-block; background: rgba(255, 255, 255, 0.15); padding: 6px 14px; border-radius: 99px; font-size: 1rem; }
.badge.double { background: var(--accent); }

/* Balkendiagramm */
.chart { display: flex; justify-content: center; align-items: flex-end; gap: 18px; height: 100%; min-height: 180px; }
.chart .bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; width: 90px; height: 100%; }
.chart .bar { width: 100%; border-radius: 8px 8px 0 0; min-height: 8px; transition: height 0.6s cubic-bezier(.2,.8,.2,1); }
.chart .bar-label { display: flex; align-items: center; gap: 6px; font-size: 1.4rem; font-weight: 900; }
.chart .bar-col.dim { opacity: 0.35; }

/* Bestenliste */
.scoreboard { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.scoreboard h2 { font-size: 2.2rem; margin: 8px 0; font-weight: 900; background: #fff; color: var(--ink); padding: 8px 32px; border-radius: var(--radius); box-shadow: var(--shadow); }
.score-row {
  width: min(760px, 100%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 1.4rem;
  font-weight: 900;
  box-shadow: var(--shadow);
  animation: slidein 0.35s ease-out both;
}
.score-row:first-of-type { background: var(--accent); color: #fff; }
.score-row .rank { width: 2ch; text-align: center; }
.score-row .name { flex: 1; word-break: break-word; }
.score-row .move { font-size: 0.9rem; opacity: 0.75; }
@keyframes slidein { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Podium */
.podium-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; width: min(760px, 100%); margin-top: 20px; flex: 1; }
.podium .place { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 220px; }
.podium .place .who { font-size: 1.5rem; font-weight: 900; text-align: center; word-break: break-word; }
.podium .place .block {
  width: 100%;
  border-radius: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 14px;
  font-weight: 900;
  color: #fff;
  box-shadow: var(--shadow);
  animation: rise 0.8s cubic-bezier(.2,.8,.2,1) both;
  transform-origin: bottom;
}
.podium .place .block .num { font-size: 3rem; line-height: 1; }
.podium .p1 .block { height: 260px; background: linear-gradient(#ffc83d, #e09b00); animation-delay: 1.2s; }
.podium .p2 .block { height: 190px; background: linear-gradient(#c7d0dd, #8d99ab); animation-delay: 0.6s; }
.podium .p3 .block { height: 140px; background: linear-gradient(#e2a072, #b56b3b); }
.podium .p1 .who { animation: fadein 0.4s 1.8s both; }
.podium .p2 .who { animation: fadein 0.4s 1.2s both; }
.podium .p3 .who { animation: fadein 0.4s 0.6s both; }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes fadein { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rest-list { width: min(560px, 100%); display: grid; gap: 6px; }
.rest-list .score-row { font-size: 1.05rem; padding: 8px 16px; background: rgba(255, 255, 255, 0.12); color: #fff; box-shadow: none; }

.stage-bottom { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Spieler ---------- */
.player-app { min-height: 100vh; display: flex; flex-direction: column; }
.player-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 1rem;
  gap: 12px;
}
.player-head .pname { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-head .pscore { background: #fff; color: var(--ink); padding: 4px 12px; border-radius: 8px; font-weight: 900; }
.player-main { flex: 1; display: flex; flex-direction: column; padding: 16px; }
.player-msg { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 16px; }
.player-msg h1 { margin: 0; font-size: clamp(1.8rem, 6vw, 2.6rem); font-weight: 900; }
.player-msg p { margin: 0; font-size: 1.15rem; }
.player-msg .big-icon { font-size: 4rem; line-height: 1; }
.player-question-text { text-align: center; font-size: 1.15rem; margin: 0 0 12px; padding: 0 4px; word-break: break-word; }
.player-answers { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.player-answers.two { grid-template-rows: 1fr; }
.player-answers button {
  border: 0;
  border-radius: 12px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 10px;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  min-height: 120px;
  word-break: break-word;
  transition: transform 0.06s;
}
.player-answers button .shape { width: 3rem; height: 3rem; }
.player-answers button:active { transform: scale(0.97); }
.result-screen { border-radius: 0; }
.result-screen.good { background: var(--ok); }
.result-screen.bad { background: var(--bad); }
.result-screen.none { background: #4a5568; }
.points-pill { background: rgba(0, 0, 0, 0.25); padding: 10px 22px; border-radius: 99px; font-size: 1.6rem; font-weight: 900; }
.spinner { width: 48px; height: 48px; border: 6px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.player-timer { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.player-timer .progress { flex: 1; }
.player-timer .secs { min-width: 2.5ch; text-align: right; font-size: 1.2rem; font-weight: 900; }

/* ---------- Editor ---------- */
.editor { display: grid; grid-template-columns: 280px 1fr; gap: 20px; max-width: 1200px; margin: 0 auto; padding: 8px 24px 48px; }
.editor .meta-card { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 0.95rem; }
.field label { color: var(--ink-soft); }
.field input, .field textarea, .field select {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 44px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.q-list { display: flex; flex-direction: column; gap: 10px; }
.q-item {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  cursor: pointer;
  text-align: left;
  display: grid;
  gap: 4px;
  font-weight: 700;
}
.q-item.active { border-color: var(--accent); background: rgba(255, 255, 255, 0.18); }
.q-item.invalid .q-num::after { content: ' ⚠'; color: #ffb4b4; }
.q-item .q-num { font-size: 0.85rem; opacity: 0.75; }
.q-item .q-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-editor { display: grid; gap: 16px; align-content: start; }
.q-editor .row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.q-editor .q-text-input { font-size: 1.4rem; text-align: center; font-weight: 900; }
.edit-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.edit-answer { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; color: #fff; box-shadow: var(--shadow); }
.edit-answer input[type='text'] { flex: 1; min-width: 0; border: 0; background: rgba(255, 255, 255, 0.95); border-radius: 8px; padding: 12px; font-weight: 800; color: var(--ink); }
.edit-answer input[type='text']:disabled { background: transparent; color: #fff; font-size: 1.2rem; }
.correct-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: transparent;
  color: transparent;
  font-size: 1.3rem;
  cursor: pointer;
  flex: none;
  display: grid;
  place-items: center;
}
.correct-toggle.on { background: #fff; color: var(--ok); }
.q-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.editor-side { display: flex; flex-direction: column; gap: 12px; }
.hint { font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .editor { grid-template-columns: 1fr; padding: 8px 16px 40px; }
  .editor .meta-card { grid-template-columns: 1fr; }
  .q-list { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .q-item { min-width: 160px; }
  .stage { padding: 12px 16px 16px; }
  .stage-middle { grid-template-columns: 90px 1fr 90px; }
  .stage-middle .side .big { font-size: 1.8rem; }
  .timer-bubble { width: 70px; height: 70px; font-size: 1.7rem; }
  .chart .bar-col { width: 60px; }
}

@media (max-width: 560px) {
  .answer-grid, .edit-answers { grid-template-columns: 1fr; }
  .q-editor .row { grid-template-columns: 1fr; }
  .topbar, .library, .lobby-bar { padding-left: 16px; padding-right: 16px; }
  .podium .place .who { font-size: 1.1rem; }
}

/* ---------- Anmeldung ---------- */
.auth-card { width: min(400px, 100%); display: grid; gap: 14px; text-align: left; }
.auth-card h1 { margin: 0; font-size: 1.8rem; font-weight: 900; }
.auth-card p { margin: 0; }
.auth-card .btn { width: 100%; padding: 14px; }
.field > span { color: var(--ink-soft); }
.link-btn { background: none; border: 0; color: var(--a1); font-weight: 800; cursor: pointer; padding: 4px; text-decoration: underline; }
.user-menu { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Schnellfunktionen ---------- */
.stage-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sound-btn { font-size: 1.1rem; padding: 5px 10px; }
.auto-btn.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.auto-progress { margin-top: -6px; }
.qr-box { display: flex; align-items: center; justify-content: center; padding: 10px; }
.qr-box img { display: block; width: 132px; height: 132px; image-rendering: pixelated; }
.settings-row { grid-column: 1 / -1; display: flex; gap: 20px; flex-wrap: wrap; }
.check-field { display: flex; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; }
.check-field input { width: 20px; height: 20px; accent-color: var(--accent); }
@media (max-width: 860px) { .qr-box { display: none; } }
.player-head .head-right { display: flex; align-items: center; gap: 8px; }
.player-head .sound-btn { color: #fff; border-color: rgba(255,255,255,.4); }

/* ---------- Fragetypen ---------- */
.slider-editor { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.edit-answers.order .edit-answer { background: #3b4a66; }
.order-num { width: 1.8em; height: 1.8em; border-radius: 50%; background: #fff; color: var(--ink); display: grid; place-items: center; font-weight: 900; flex: none; }
@media (max-width: 560px) { .slider-editor { grid-template-columns: 1fr 1fr; } }

/* Schätzfrage & Reihenfolge – Host */
.slider-info { display: flex; align-items: center; gap: 16px; font-size: 1.4rem; font-weight: 900; padding: 18px 8px; }
.slider-track { flex: 1; height: 14px; border-radius: 99px; background: linear-gradient(90deg, var(--a1), var(--a3), var(--a2), var(--a0)); }
.numberline-wrap { width: 100%; padding: 50px 24px 0; }
.numberline { position: relative; height: 18px; border-radius: 99px; background: rgba(255, 255, 255, 0.18); }
.numberline .tolerance { position: absolute; top: 0; bottom: 0; background: rgba(34, 160, 107, 0.55); border-radius: 99px; }
.numberline .guess { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--bad); border: 2px solid #fff; opacity: 0.85; }
.numberline .guess.hit { background: var(--ok); }
.numberline .target { position: absolute; top: -40px; bottom: -8px; width: 4px; margin-left: -2px; background: #fff; border-radius: 2px; }
.numberline .target span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #fff; color: var(--ink); padding: 4px 10px; border-radius: 8px; white-space: nowrap; font-weight: 900; }
.numberline-scale { display: flex; justify-content: space-between; margin-top: 10px; opacity: 0.8; }
.result-summary { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.result-summary span { background: #fff; color: var(--ink); padding: 10px 18px; border-radius: 10px; font-size: 1.2rem; font-weight: 900; box-shadow: var(--shadow); }
.result-summary span:first-child { background: var(--ok); color: #fff; }
.big-stat { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 1.3rem; }
.big-stat .big { font-size: 3.4rem; font-weight: 900; }
.order-list { display: grid; gap: 10px; }
.order-list .answer-tile { min-height: 56px; padding: 10px 18px; }

/* Schätzfrage & Reihenfolge – Spieler */
.result-details { display: grid; gap: 12px; justify-items: center; }
.result-details .solution { background: rgba(0, 0, 0, 0.22); padding: 8px 14px; border-radius: 10px; }
.slider-answer, .order-answer { flex: 1; display: flex; flex-direction: column; gap: 16px; justify-content: center; }
.slider-value { text-align: center; font-size: clamp(2.4rem, 12vw, 4rem); font-weight: 900; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row input[type='range'] { flex: 1; height: 40px; accent-color: var(--accent); }
.slider-row .btn { width: 52px; height: 52px; padding: 0; font-size: 1.6rem; }
.slider-scale { display: flex; justify-content: space-between; opacity: 0.75; }
.order-input { display: grid; gap: 10px; }
.order-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; color: #fff; box-shadow: var(--shadow); font-size: 1.1rem; }
.order-item .shape { width: 1.4em; height: 1.4em; }
.order-item .txt { flex: 1; word-break: break-word; }
.order-arrows { display: flex; gap: 6px; }
.order-arrows .btn { width: 44px; height: 44px; padding: 0; }

/* Kopfleiste auf schmalen Bildschirmen umbrechen statt überlaufen */
.topbar { flex-wrap: wrap; }
@media (max-width: 560px) {
  .topbar { padding: 10px 16px; }
  .topbar-right { width: 100%; justify-content: flex-start; }
  .topbar-right .btn { padding: 8px 12px; font-size: 0.9rem; }
  .stage-top { flex-wrap: wrap; }
}
.editor > * { min-width: 0; }
.q-tools { flex-wrap: wrap; }

/* Bild-Upload im Editor */
.image-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.image-row input[type='url'] { flex: 1; min-width: 180px; }
.image-preview img { max-height: 160px; max-width: 100%; border-radius: 10px; margin-top: 6px; border: 2px solid var(--line); }

/* ---------- Berichte ---------- */
.report-list { display: grid; gap: 10px; }
.report-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; flex-wrap: wrap; padding: 16px 20px; transition: transform 0.1s; }
.report-row:hover { transform: translateY(-2px); }
.report-main { display: grid; gap: 2px; }
.report-main strong { font-size: 1.15rem; }
.report-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 0.8rem; font-weight: 800; background: #e8ecf5; color: var(--ink); vertical-align: middle; }
.tag.live { background: #dfe7ff; color: #2647b8; }
.tag.homework { background: #dff5ea; color: #157a50; }
.tag.warn { background: #fff0d6; color: #9a6200; margin-left: 6px; }
.back-link { color: rgba(255, 255, 255, 0.75); text-decoration: none; font-weight: 700; }
.back-link:hover { color: #fff; }
.report h1 { margin: 6px 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 8px; }
.kpi { padding: 16px 18px; }
.kpi-value { font-size: 1.8rem; font-weight: 900; }
.section-title { font-size: 1.3rem; margin: 26px 0 10px; }
.question-stats { display: grid; gap: 18px; }
.qstat { display: grid; gap: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.qstat:last-child { border-bottom: 0; padding-bottom: 0; }
.qstat-head { display: flex; gap: 12px; align-items: flex-start; }
.qnum { width: 2em; height: 2em; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; flex: none; font-size: 0.9rem; }
.qstat-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.qstat-nums { display: grid; justify-items: end; gap: 2px; }
.rate { font-size: 1.25rem; font-weight: 900; }
.rate.good { color: var(--ok); } .rate.mid { color: #b57f00; } .rate.bad { color: var(--bad); }
.rate-bar { height: 10px; background: #edf0f5; border-radius: 99px; overflow: hidden; }
.rate-bar > div { height: 100%; border-radius: 99px; }
.rate-bar .good { background: var(--ok); } .rate-bar .mid { background: var(--a2); } .rate-bar .bad { background: var(--bad); }
.dist { display: grid; gap: 6px; padding-left: 2.8em; }
.dist-row { display: grid; grid-template-columns: 1.2em minmax(80px, 220px) 1fr 2.5em; gap: 10px; align-items: center; font-size: 0.95rem; }
.dist-row .shape { width: 1.1em; height: 1.1em; fill: var(--ink-soft); }
.dist-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-bar { height: 12px; background: #edf0f5; border-radius: 99px; overflow: hidden; }
.dist-bar > div { height: 100%; }
.dist-count { text-align: right; }
.table-wrap { overflow-x: auto; padding: 8px; }
.result-table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.result-table th, .result-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.result-table th { color: var(--ink-soft); font-size: 0.85rem; position: sticky; top: 0; background: #fff; }
.result-table .num { text-align: right; }
.result-table .qcol, .result-table .mark { text-align: center; width: 2.6em; }
.result-table .mark { font-weight: 900; cursor: help; }
.mark.yes { color: var(--ok); background: #eefaf4; }
.mark.no { color: var(--bad); background: #fdf0f0; }
.mark.none { color: #a0a8b6; }
.mark.poll { color: var(--a1); }
.pname-cell { white-space: normal !important; min-width: 120px; }
.small { font-size: 0.8rem; }
@media (max-width: 760px) { .kpis { grid-template-columns: 1fr 1fr; } .dist { padding-left: 0; } }
@media print {
  body { background: #fff; color: var(--ink); }
  .topbar, .library-actions, .back-link { display: none !important; }
  .card { box-shadow: none; border: 1px solid var(--line); }
  .on-dark-muted, .section-title, .report h1 { color: var(--ink); }
  .table-wrap { overflow: visible; }
}

/* ---------- Teammodus ---------- */
.team-btn.on { background: var(--a1); border-color: var(--a1); color: #fff; }
.chip-members { display: block; font-size: 0.8rem; font-weight: 600; opacity: 0.75; }
.row-members { display: block; font-size: 0.85rem; font-weight: 600; opacity: 0.7; }
.podium .members { font-size: 0.95rem; text-align: center; }
.badge.team-talk { background: var(--a1); font-size: 1.2rem; padding: 8px 18px; }
.intro-preview { width: min(1000px, 100%); }
.member-list { display: grid; gap: 8px; }
.member-list input { font-size: 1rem !important; padding: 10px !important; }
.team-hint { background: #eef2ff; color: #2647b8; padding: 8px 12px; border-radius: 8px; font-size: 0.95rem; }
.talk { display: grid; gap: 12px; width: min(420px, 100%); }
.talk-question { font-size: 1.2rem; }
.talk-preview { display: grid; gap: 8px; }
.talk-preview > div { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; text-align: left; }
.talk-preview .shape { width: 1.3em; height: 1.3em; }
.join-card .btn.ghost { width: auto; justify-self: center; background: transparent; color: var(--ink-soft); box-shadow: none; border: 2px solid var(--line); padding: 8px 16px; font-size: 0.95rem; }

/* ---------- Hausaufgaben ---------- */
.assignment-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; }
.modal { border: 0; width: min(460px, calc(100% - 32px)); padding: 24px; }
.modal::backdrop { background: rgba(5, 10, 20, 0.6); }
.modal-form { display: grid; gap: 14px; }
.modal-form h2 { margin: 0; font-size: 1.4rem; }
.modal-form p { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.hw-code { font-size: 2.4rem; font-weight: 900; letter-spacing: 0.12em; text-align: center; background: #f2f4f8; border-radius: 10px; padding: 10px; }
.hw-share { display: flex; align-items: center; gap: 14px; word-break: break-all; font-size: 0.9rem; }
.hw-share img { flex: none; border: 1px solid var(--line); border-radius: 6px; }
.hw-card { width: min(480px, 100%); display: grid; gap: 14px; text-align: left; }
.hw-card h1 { margin: 0; font-size: 1.7rem; }
.hw-card p { margin: 0; }
.hw-card .big-icon { font-size: 3.4rem; text-align: center; }
.hw-card .btn.big { width: 100%; }
.hw-card input { border: 2px solid var(--line); border-radius: 10px; padding: 12px; font-weight: 800; font-size: 1.1rem; }
.hw-facts { margin: 0; padding-left: 20px; display: grid; gap: 4px; color: var(--ink-soft); }
.hw-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 800; }
.hw-head .pscore { background: var(--ink); color: #fff; padding: 4px 12px; border-radius: 8px; }
.hw-feedback { display: grid; gap: 6px; justify-items: center; text-align: center; padding: 14px; border-radius: 12px; color: #fff; }
.hw-feedback.good { background: var(--ok); }
.hw-feedback.bad { background: var(--bad); }
.hw-feedback.none { background: #4a5568; }
.hw-feedback strong { font-size: 1.3rem; }
.hw-feedback .points-pill { font-size: 1.2rem; padding: 6px 16px; }
.hw-image { display: flex; justify-content: center; margin-bottom: 12px; }
.hw-image img { max-height: 28vh; max-width: 100%; border-radius: 10px; }
.hw-text { font-size: 1.3rem; }

/* ---------- Konto ---------- */
.user-link { color: rgba(255, 255, 255, 0.8); font-weight: 700; text-decoration: none; }
.user-link:hover { color: #fff; text-decoration: underline; }
.account { max-width: 640px; display: grid; gap: 16px; }
.account-card { display: grid; gap: 12px; }
.account-card h2 { margin: 0; font-size: 1.3rem; }
.account-card p { margin: 0; }
.account-card .field input { border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; font-weight: 700; }
.danger-zone { border: 2px solid #f3c2c3; }
.info-msg { background: #e8f6ef; color: #157a50; padding: 10px 12px; border-radius: 8px; font-size: 0.95rem; }
.auth-links { display: flex; flex-direction: column; align-items: center; gap: 4px; }

/* ---------- Import ---------- */
.small-links { font-size: 0.9rem; margin-top: 4px; }
.small-links a, .template-links a { color: inherit; font-weight: 800; }
.side-tools { display: grid; gap: 8px; }
.import-preview { margin: 0; padding-left: 22px; max-height: 200px; overflow: auto; display: grid; gap: 2px; }
.import-errors { background: #fff4e0; border-radius: 8px; padding: 8px 12px; color: #7a4d00; font-size: 0.9rem; }
.import-errors summary { cursor: pointer; font-weight: 800; }
.import-errors ul { margin: 6px 0 0; padding-left: 18px; max-height: 160px; overflow: auto; }
.modal .field input, .modal .field select { border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; font-weight: 700; }
.copy-list { display: grid; gap: 6px; max-height: 300px; overflow: auto; }
.copy-list .check-field { align-items: flex-start; font-weight: 700; }
.copy-list .check-field.all { border-bottom: 1px solid var(--line); padding-bottom: 6px; }

/* ---------- KI-Vorschläge ---------- */
.ai-btn { background: linear-gradient(90deg, #7b5cff, #3e63dd); color: #fff; box-shadow: 0 4px 0 #2a3c99; }
.ai-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-types { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.modal textarea { border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; font-weight: 700; resize: vertical; }
.modal { max-height: calc(100vh - 32px); overflow: auto; }
.ai-result { display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.ai-q { align-items: flex-start; font-weight: 600; }
.spinner.dark { border-color: #e2e6ee; border-top-color: var(--accent); margin: 10px auto; }

/* ---------- Avatare, Reaktionen, Mehrfachauswahl ---------- */
.avatar-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.avatar-option { font-size: 1.4rem; border: 2px solid transparent; background: #f2f4f8; border-radius: 10px; padding: 4px 0; cursor: pointer; line-height: 1.3; }
.avatar-option.picked { border-color: var(--accent); background: #fff1e8; }
.chip-avatar { margin-right: 6px; }
.podium-avatar { font-size: 3rem; line-height: 1.1; }
.reaction-bar { position: sticky; bottom: 0; display: flex; justify-content: center; gap: 6px; padding: 10px; background: rgba(0, 0, 0, 0.25); }
.reaction-bar button { font-size: 1.6rem; background: rgba(255, 255, 255, 0.15); border: 0; border-radius: 12px; width: 48px; height: 48px; cursor: pointer; }
.reaction-bar button.sent { animation: bump 0.35s ease-out; }
@keyframes bump { 50% { transform: scale(1.35); } }
.reaction-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 80; }
.floating-reaction { position: absolute; bottom: -60px; font-size: 3rem; animation: floatUp 3s ease-out forwards; }
@keyframes floatUp {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  15% { opacity: 1; transform: translateY(-15vh) scale(1); }
  100% { transform: translateY(-85vh) scale(1.1); opacity: 0; }
}
.reactions-btn.on { background: var(--a2); border-color: var(--a2); color: #fff; }
.multi-badge { display: inline-block; margin-top: 8px; font-size: 1rem; background: var(--a1); color: #fff; padding: 4px 12px; border-radius: 99px; }
.multi-answer { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.multi-hint { text-align: center; opacity: 0.85; }
.player-answers button.multi { position: relative; opacity: 0.75; }
.player-answers button.multi.picked { opacity: 1; outline: 5px solid #fff; outline-offset: -5px; }
.player-answers button .tick { position: absolute; top: 8px; right: 12px; font-size: 1.4rem; opacity: 0; }
.player-answers button.picked .tick { opacity: 1; }
.result-screen.partial, .hw-feedback.partial { background: #c98a00; }
@media (prefers-reduced-motion: reduce) {
  .floating-reaction { animation-duration: 0.01s !important; }
}

/* ---------- Teilen, Ordner, Vorlagen ---------- */
.library-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.library-search { flex: 1; min-width: 220px; max-width: 420px; border: 0; border-radius: 10px; padding: 11px 14px; font-weight: 700; color: var(--ink); }
.folder-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.folder-chip { border: 2px solid rgba(255, 255, 255, 0.35); background: transparent; color: #fff; border-radius: 99px; padding: 6px 12px; font-weight: 800; cursor: pointer; }
.folder-chip.active { background: #fff; color: var(--ink); border-color: #fff; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.actions.center { justify-content: center; }
.dialog-sub { margin: 6px 0 0; font-size: 1.05rem; }
.share-list { display: grid; gap: 6px; }
.share-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 0.95rem; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.share-add { display: flex; gap: 8px; flex-wrap: wrap; }
.share-add input, .share-add select { flex: 1; min-width: 160px; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; font-weight: 700; }
.readonly-banner { max-width: 1200px; margin: 0 auto 12px; padding: 10px 16px; border-radius: 10px; background: #fff0d6; color: #7a4d00; font-weight: 700; width: calc(100% - 48px); }
.readonly-banner.edit { background: #dfe7ff; color: #2647b8; }
.template-questions { margin: 0; padding-left: 22px; display: grid; gap: 8px; max-height: 50vh; overflow: auto; }

/* ---------- Admin & Rechtstexte ---------- */
.site-footer { text-align: center; padding: 24px 16px; font-size: 0.9rem; color: rgba(255, 255, 255, 0.6); }
.site-footer a { color: rgba(255, 255, 255, 0.8); }
.center-screen .site-footer { padding-bottom: 0; }
.legal { max-width: 800px; }
.legal h1 { margin-top: 0; }
.rich-text p { line-height: 1.55; font-weight: 600; }
.rich-text a { color: var(--a1); word-break: break-all; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-table td { vertical-align: middle; }
.admin-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.disabled-row td { opacity: 0.6; }
.admin-settings textarea { border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; font-weight: 600; font-family: inherit; resize: vertical; }
.admin-settings h2 { margin-top: 10px; }
.admin-settings input[type='text'] { border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; font-weight: 700; }

/* ---------- Barrierefreiheit ---------- */
:focus-visible { outline: 3px solid #ffd166; outline-offset: 2px; }
.card :focus-visible, dialog :focus-visible { outline-color: var(--a1); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.footer-btn { background: none; border: 0; color: rgba(255, 255, 255, 0.8); font: inherit; cursor: pointer; padding: 2px 4px; text-decoration: underline; }
.footer-btn.active { color: #fff; font-weight: 900; text-decoration: none; }
.footer-group { display: inline-flex; gap: 2px; }

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

/* Hoher Kontrast: einfarbiger Hintergrund, kräftigere Farben, deutliche Ränder */
html.contrast {
  --bg: #000;
  --accent: #c2410c;
  --accent-dark: #7c2d12;
  --a0: #b91c1c;
  --a1: #1d4ed8;
  --a2: #8a5a00;
  --a3: #15803d;
  --ok: #15803d;
  --bad: #b91c1c;
  --ink-soft: #2b3340;
  --line: #6b7280;
}
html.contrast body { background: #000; }
html.contrast .on-dark-muted, html.contrast .footer-link, html.contrast .site-footer, html.contrast .back-link { color: #fff; }
html.contrast .card, html.contrast .btn, html.contrast .answer-tile, html.contrast .player-answers button, html.contrast .edit-answer { border: 2px solid #fff; }
html.contrast .card { border-color: #000; }
html.contrast .muted, html.contrast .hint { color: #1f2937; }
html.contrast .btn.ghost { border-width: 2px; }
html.contrast .answer-tile.dim, html.contrast .bar-col.dim { opacity: 0.55; }
html.contrast :focus-visible { outline: 4px solid #ffff00; outline-offset: 3px; }
