:root {
  --brand: #12355b;
  --brand-dark: #0b2440;
  --brand-light: #2f6aa3;
  --brand-tint: #e8f0f9;
  /* Farben der Antworten A–D */
  --ans-a: #6c4bd8;
  --ans-b: #0f9aa8;
  --ans-c: #ee7b1f;
  --ans-d: #d6336c;
  --red: #e21b3c;
  --blue: #1368ce;
  --yellow: #d89e00;
  --green: #26890c;
  --ok: #66bf39;
  --bad: #f35;
  --gray: #f2f2f2;
  --text: #333;
  --muted: #6e6e6e;
  --shadow: 0 2px 6px rgba(0, 0, 0, .15);
  --font: "Montserrat", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-weight: 600; color: var(--text); background: var(--gray); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.ic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  border: 0; border-radius: 4px; padding: .55em 1em .7em; min-height: 42px;
  background: #fff; color: var(--text); font-weight: 700; font-size: 15px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18), var(--shadow);
  transition: transform .06s, filter .15s; white-space: nowrap; user-select: none;
}
.btn:hover { filter: brightness(.96); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.go { background: var(--green); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.dark { background: rgba(0, 0, 0, .35); color: #fff; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(0, 0, 0, .06); filter: none; }
.btn.big { font-size: 20px; min-height: 56px; padding: .6em 1.4em .75em; }
.btn.icon { padding: 0; width: 42px; }

/* ---------- Toast & Dialog ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); z-index: 1000;
  background: #222; color: #fff; padding: 12px 20px; border-radius: 6px; font-weight: 700;
  transition: transform .25s; box-shadow: 0 4px 20px rgba(0, 0, 0, .3); max-width: 90vw; text-align: center;
}
#toast.show { transform: translate(-50%, 0); }
#toast.error { background: var(--red); }
#toast.success { background: var(--green); }
.modal-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: grid; place-items: center; z-index: 900; padding: 16px; animation: fade .15s; }
.modal { background: #fff; color: var(--text); border-radius: 8px; padding: 24px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .4); animation: pop .2s; }
.modal.wide { width: min(980px, 100%); }
.modal h2 { margin: 0 0 12px; font-size: 22px; }
.modal-body { font-weight: 500; line-height: 1.5; }
.modal-body ul { padding-left: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

/* ---------- Logo ---------- */
.logo { font-weight: 900; font-size: 28px; letter-spacing: -1px; color: var(--brand); line-height: 1; }
.logo span { color: var(--ans-c); }

/* ---------- Topbar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 64px; background: #fff; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 20; }

/* ---------- Navigation & Seiten ---------- */
.topbar .logo { margin-right: 12px; }
.nav { display: flex; gap: 4px; height: 100%; }
.nav-btn { border: 0; background: none; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.nav-btn:hover { color: var(--text); background: var(--gray); }
.nav-btn.on { color: var(--brand); border-bottom-color: var(--brand); }
.me { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); padding: 0 6px; }
.page { max-width: 1200px; margin: 0 auto; padding: 28px 16px 80px; }
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; margin: 0 12px 0 0; }
.search { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 2px solid #ddd; border-radius: 4px; padding: 0 10px; height: 42px; color: var(--muted); }
.search:focus-within { border-color: var(--brand); }
.search input { border: 0; outline: none; font-weight: 600; width: 200px; background: transparent; }
.spinner.dark { border-color: rgba(0, 0, 0, .1); border-top-color: var(--brand); margin: 60px auto; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; background: #eee; color: var(--muted); padding: 2px 7px; border-radius: 3px; vertical-align: 1px; }
.table-card { background: #fff; border-radius: 8px; box-shadow: var(--shadow); overflow-x: auto; }
.res-table.hist td { padding: 12px; vertical-align: middle; }
.res-table .acts { white-space: nowrap; text-align: right; }
.res-table .acts .btn { margin-left: 4px; }
.btn.icon-only { width: 30px; padding: 0; }
.nowrap { white-space: nowrap; }
.lobby-title { text-align: center; }
.lobby-quiz { font-size: 16px; opacity: .8; margin-top: 6px; font-weight: 700; }

/* ---------- Einstellungen ---------- */
.set-page { display: grid; grid-template-columns: 230px 1fr; gap: 28px; align-items: start; }
.set-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.set-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 14px; }
.set-nav a:hover { background: #fff; color: var(--brand); }
.set-nav .ic { color: var(--brand); }
.set-reset { margin-top: 14px; font-size: 13px; color: var(--muted); justify-content: flex-start; }
.set-main h1 { font-size: 26px; margin: 0 0 20px; }
.set-card { background: #fff; border-radius: 8px; box-shadow: var(--shadow); padding: 8px 24px 12px; margin-bottom: 20px; scroll-margin-top: 84px; }
.set-card h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; margin: 14px 0 6px; }
.set-card h2 .ic { color: var(--brand); }
.set-note { color: var(--muted); font-size: 14px; font-weight: 500; margin: 0 0 6px; }
.set-row { display: grid; grid-template-columns: 1fr minmax(200px, 300px); gap: 20px; align-items: center; padding: 14px 0; border-top: 1px solid #eee; }
.set-row.wide { grid-template-columns: 1fr; gap: 8px; }
.set-row > label { display: flex; flex-direction: column; gap: 3px; }
.set-row > label small { color: var(--muted); font-weight: 500; font-size: 13px; line-height: 1.4; }
.set-row select, .set-row input:not([type]), .set-row input[type=password], .set-row textarea, .name-pair input {
  width: 100%; border: 2px solid #ddd; border-radius: 4px; padding: 8px 10px; font-weight: 600; background: #fff; }
.set-row select:focus, .set-row input:focus, .set-row textarea:focus { outline: none; border-color: var(--brand); }
.set-row textarea { resize: vertical; font-size: 14px; }
.set-row .switch, .set-row .range, .set-row .swatches, .set-row .who { justify-self: end; }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #ccc; border-radius: 14px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--brand-light); outline-offset: 2px; }
.range { display: flex; align-items: center; gap: 10px; width: 100%; }
.range input { flex: 1; accent-color: var(--brand); }
.range output { width: 48px; text-align: right; font-weight: 800; }
.name-pair { display: flex; gap: 6px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #ddd; padding: 0; cursor: pointer; position: relative; overflow: hidden; }
.swatch.on { box-shadow: 0 0 0 3px var(--text); }
.swatch.custom { background: conic-gradient(#e33, #ee3, #3e3, #3ee, #33e, #e3e, #e33); }
.swatch.custom input { position: absolute; inset: -10px; opacity: 0; cursor: pointer; }
.brand-preview { justify-self: end; }
.bp-stage { width: 260px; border-radius: 8px; padding: 14px; color: #fff; text-align: center; }
.bp-stage .logo { color: #fff; font-size: 24px; }
.bp-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 12px; }
.bp-tiles i { height: 30px; border-radius: 4px; display: grid; place-items: center; }
.bp-tiles .shape svg { width: 18px; height: 18px; fill: #fff; }
.who { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }
.set-actions { display: flex; justify-content: flex-end; padding: 6px 0 10px; }
.savebar { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 150%); display: flex; align-items: center; gap: 10px; background: #222; color: #fff; padding: 10px 10px 10px 20px; border-radius: 8px; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); transition: transform .25s; z-index: 50; }
.savebar.show { transform: translate(-50%, 0); }
.savebar span { margin-right: 10px; }
code { background: #f1f1f1; padding: 1px 6px; border-radius: 3px; font-size: .92em; }

/* ---------- Login ---------- */
body.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--brand) radial-gradient(circle at 20% 10%, rgba(255, 255, 255, .12), transparent 50%); }
.login-card { width: min(400px, 100%); background: #fff; border-radius: 12px; padding: 32px 28px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.login-card .login-logo { font-size: 40px; text-align: center; }
.login-sub { text-align: center; color: var(--muted); margin: 8px 0 18px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; font-size: 13px; }
.login-card input { width: 100%; border: 2px solid #ddd; border-radius: 6px; padding: 11px 12px; font-size: 16px; font-weight: 600; }
.login-card input:focus { outline: none; border-color: var(--brand); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 46px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); width: 38px; height: 38px; display: grid; place-items: center; }
.login-err { color: var(--red); min-height: 22px; font-size: 14px; margin: 6px 0; }
.login-card .btn { width: 100%; }
.login-help { text-align: center; font-size: 12px; color: var(--muted); margin: 18px 0 0; font-weight: 500; }

/* ---------- Import aus Word / KI ---------- */
.imp textarea, .imp input, .imp select { width: 100%; border: 2px solid #ddd; border-radius: 4px; padding: 8px 10px; font-weight: 600; background: #fff; }
.imp textarea { resize: vertical; font-family: Consolas, "Cascadia Mono", monospace; font-size: 14px; line-height: 1.45; }
.imp textarea:focus, .imp input:focus, .imp select:focus { outline: none; border-color: var(--brand); }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid #eee; margin-bottom: 16px; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; display: inline-flex; gap: 6px; align-items: center; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.dropzone { display: flex; align-items: center; gap: 14px; border: 3px dashed #c8d3df; border-radius: 8px; padding: 18px; cursor: pointer; background: #f7f9fc; margin-bottom: 14px; }
.dropzone .ic { width: 36px; height: 36px; color: var(--brand); }
.dropzone.drag, .dropzone:hover { border-color: var(--brand); background: var(--brand-tint); }
.lbl { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; margin: 12px 0 6px; }
.lbl.inline { flex-direction: row; align-items: center; margin: 0; }
.lbl.inline select { width: auto; }
.lbl .btn.mini { align-self: flex-start; }
.btn.mini { min-height: 30px; font-size: 13px; padding: 2px 10px 4px; }
.imp-grid { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 10px; }
.imp-grid .lbl { margin-bottom: 0; }
.toggle.dark { margin-top: 10px; font-size: 14px; }
.toggle.dark input { background: #ccc; }
.ki-copy { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; flex-wrap: wrap; }
.imp details { margin-top: 12px; font-size: 14px; }
.imp details summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.imp details ul { padding-left: 20px; line-height: 1.6; }
.imp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 2px solid #eee; flex-wrap: wrap; }
@media (max-width: 700px) { .imp-grid { grid-template-columns: 1fr; } }

/* ---------- Bibliothek ---------- */
.library { max-width: 1200px; margin: 0 auto; padding: 28px 16px 60px; }
.library h1 { font-size: 26px; margin: 0 0 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.btn.icon { flex: none; }
.qcard { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.qcard:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, .15); }
.qcard .cover { height: 140px; background: linear-gradient(135deg, var(--brand), var(--brand-light)); background-size: cover; background-position: center; position: relative; display: grid; place-items: center; cursor: pointer; }
.qcard .cover .ph .shape { color: rgba(255, 255, 255, .25); }
.qcard .cover .ph svg { width: 64px; height: 64px; fill: rgba(255, 255, 255, .25); }
.qcard .count { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 13px; padding: 3px 8px; border-radius: 4px; }
.qcard .warn { position: absolute; left: 8px; top: 8px; background: var(--yellow); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 4px; }
.qcard .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.qcard h3 { margin: 0; font-size: 18px; word-break: break-word; }
.qcard .meta { font-size: 13px; }
.qcard .actions { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; }
.qcard .actions .btn { min-height: 38px; font-size: 14px; }
.qcard .actions .btn.icon { width: 38px; }
.empty { text-align: center; padding: 60px 20px; background: #fff; border-radius: 8px; box-shadow: var(--shadow); }
.empty h2 { margin-top: 0; }

/* ---------- Editor ---------- */
.ed-top .title-input { flex: 0 1 420px; min-width: 120px; border: 2px solid #ddd; border-radius: 4px; padding: 8px 12px; font-weight: 700; font-size: 16px; }
.ed-top .title-input:focus { border-color: var(--brand); outline: none; }
#ed-status { font-size: 14px; }
.editor { display: grid; grid-template-columns: 230px 1fr 260px; height: calc(100vh - 64px); }
.ed-side { background: #fff; border-right: 1px solid #ddd; display: flex; flex-direction: column; min-height: 0; }
#ed-list { flex: 1; overflow-y: auto; padding: 10px; }
.ed-item { display: flex; gap: 8px; padding: 8px; border-radius: 6px; cursor: pointer; position: relative; margin-bottom: 4px; }
.ed-item:hover { background: var(--brand-tint); }
.ed-item.sel { background: #d3e2f3; }
.ed-item .num { font-size: 13px; width: 22px; color: var(--muted); padding-top: 2px; }
.ed-item .thumb { flex: 1; min-width: 0; background: #fff; border: 2px solid #ddd; border-radius: 6px; padding: 6px; }
.ed-item.sel .thumb { border-color: var(--brand); }
.ed-item.invalid .thumb { border-color: var(--red); }
.ed-item .ty { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.ed-item .tx { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-item .mini { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-top: 4px; }
.ed-item .mini i { height: 6px; border-radius: 2px; background: #ddd; }
.ed-item .mini i.ok { background: var(--ok); }
.ed-item .tools { position: absolute; right: 4px; top: 4px; display: none; gap: 2px; }
.ed-item:hover .tools { display: flex; }
.ed-item .tools button { border: 0; background: #fff; border-radius: 4px; width: 26px; height: 26px; display: grid; place-items: center; box-shadow: var(--shadow); padding: 0; }
.ed-item .tools button:hover { background: #eee; }
.ed-add { padding: 10px; border-top: 1px solid #ddd; display: grid; gap: 6px; }
.ed-add .btn { width: 100%; font-size: 14px; min-height: 38px; }
.ed-main { overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; background: #f2f2f2 radial-gradient(circle at 50% 0, #fff, #f2f2f2 70%); }
.q-text { width: 100%; border: 0; border-radius: 6px; box-shadow: var(--shadow); padding: 18px; font-size: 22px; font-weight: 700; text-align: center; resize: none; background: #fff; min-height: 76px; }
.q-text:focus { outline: 3px solid var(--brand-light); }
.ed-media { align-self: center; width: min(480px, 100%); aspect-ratio: 16 / 9; border-radius: 8px; background: rgba(255, 255, 255, .7); border: 3px dashed #c8c8c8; display: grid; place-items: center; text-align: center; color: var(--muted); cursor: pointer; position: relative; overflow: hidden; }
.ed-media.drag { border-color: var(--brand); background: var(--brand-tint); }
.ed-media .ph .ic { width: 48px; height: 48px; display: block; margin: 0 auto 8px; }
.ed-media img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.ed-media .rm { position: absolute; right: 8px; top: 8px; }
.ed-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ed-answer { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 6px; padding: 10px; box-shadow: var(--shadow); min-height: 80px; transition: background .15s; }
.ed-answer .shape-wrap { width: 46px; height: 100%; min-height: 60px; border-radius: 4px; display: grid; place-items: center; flex: none; }
.ed-answer .shape svg { width: 26px; height: 26px; fill: #fff; display: block; }
.ed-answer input { flex: 1; min-width: 0; border: 0; font-size: 17px; font-weight: 700; background: transparent; padding: 8px 4px; }
.ed-answer input:focus { outline: none; }
.ed-answer.filled { color: #fff; }
.ed-answer.filled input::placeholder { color: rgba(255, 255, 255, .7); }
.ed-answer.c-a.filled { background: var(--ans-a); }
.ed-answer.c-b.filled { background: var(--ans-b); }
.ed-answer.c-c.filled { background: var(--ans-c); }
.ed-answer.c-d.filled { background: var(--ans-d); }
.correct-toggle { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #ccc; background: #fff; display: grid; place-items: center; color: transparent; flex: none; padding: 0; }
.ed-answer.filled .correct-toggle { border-color: #fff; background: transparent; }
.correct-toggle:hover { color: #ccc; }
.correct-toggle.on, .ed-answer.filled .correct-toggle.on { background: var(--ok); border-color: #fff; color: #fff; }
.correct-toggle .ic { width: 22px; height: 22px; }
.ed-hint { text-align: center; font-size: 13px; }
.ed-settings { background: #fff; border-left: 1px solid #ddd; padding: 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.ed-settings label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.ed-settings select { border: 2px solid #ddd; border-radius: 4px; padding: 8px; font-weight: 600; background: #fff; }
.ed-settings select:focus { border-color: var(--brand); outline: none; }
.ed-settings .row { display: flex; gap: 8px; margin-top: auto; }
.ed-settings .row .btn { flex: 1; font-size: 14px; }
.ed-problems { background: #fff4f4; border: 2px solid #f6c6cd; border-radius: 6px; padding: 10px 12px; font-size: 13px; color: #a01; }
.ed-problems ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Spielbildschirm (Host) ---------- */
.stage { position: fixed; inset: 0; background: var(--brand); color: #fff; overflow: hidden; display: flex; flex-direction: column; }
.stage::before, .stage::after { content: ""; position: absolute; width: 70vmax; height: 70vmax; background: rgba(255, 255, 255, .05); transform: rotate(45deg); pointer-events: none; }
.stage::before { left: -45vmax; top: -45vmax; }
.stage::after { right: -40vmax; bottom: -50vmax; border-radius: 50%; }
.stage > * { position: relative; z-index: 1; }
.stage .logo { color: #fff; }
.corner { position: absolute; right: 14px; top: 14px; display: flex; gap: 8px; z-index: 30; }
.corner-left { position: absolute; left: 14px; top: 14px; display: flex; gap: 8px; z-index: 30; }
.chip-small { background: rgba(0, 0, 0, .35); padding: 8px 14px; border-radius: 4px; font-weight: 800; }

/* Lobby */
.lobby-head { display: flex; justify-content: center; padding: 18px 16px 0; }
.join-box { display: flex; align-items: stretch; background: #fff; color: var(--text); border-radius: 8px; box-shadow: 0 4px 20px rgba(0, 0, 0, .3); overflow: hidden; }
.join-box > div { padding: 14px 26px; display: flex; flex-direction: column; justify-content: center; }
.join-box .small { font-size: 18px; font-weight: 700; }
.join-box .url { font-size: 30px; font-weight: 900; cursor: pointer; }
.join-box .url small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.join-box .pin-box { border-left: 2px solid #eee; }
.join-box .pin { font-size: 72px; font-weight: 900; letter-spacing: 2px; line-height: 1; }
.join-box .qr { padding: 10px; background: #fff; cursor: zoom-in; }
.join-box .qr svg { width: 140px; height: 140px; display: block; }
.qr-big svg { width: min(70vh, 90vw); height: min(70vh, 90vw); display: block; margin: 0 auto; }
.lobby-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 28px; }
.lobby-bar .count { display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, .35); padding: 10px 18px; border-radius: 4px; font-size: 22px; font-weight: 800; min-width: 130px; }
.lobby-bar .logo { font-size: 48px; }
.lobby-bar .acts { display: flex; gap: 10px; min-width: 130px; justify-content: flex-end; }
.lobby-players { flex: 1; overflow-y: auto; display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; gap: 12px; padding: 10px 40px 20px; }
.lobby-players .wait { margin-top: 6vh; font-size: 28px; font-weight: 800; background: rgba(0, 0, 0, .35); padding: 14px 26px; border-radius: 6px; animation: breathe 2s infinite; }
.pchip { background: #fff; color: var(--text); font-size: 22px; font-weight: 800; padding: 10px 18px; border-radius: 6px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .15); animation: popin .35s cubic-bezier(.3, 1.6, .5, 1); cursor: pointer; border: 0; }
.pchip:hover { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 3px; }
.pchip.off { opacity: .5; }
@keyframes popin { from { transform: scale(0); } }
@keyframes breathe { 50% { transform: scale(1.04); } }
.lobby-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; padding: 12px 16px 18px; background: rgba(0, 0, 0, .2); font-size: 15px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.toggle input { appearance: none; width: 40px; height: 22px; border-radius: 11px; background: rgba(255, 255, 255, .3); position: relative; transition: background .2s; cursor: pointer; margin: 0; }
.toggle input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; }
.toggle input:checked { background: var(--ok); }
.toggle input:checked::after { left: 21px; }

/* Get ready */
.getready { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; text-align: center; }
.qcounter { background: #fff; color: var(--text); padding: 8px 20px; border-radius: 4px; font-size: 22px; font-weight: 800; }
.getready h1 { font-size: clamp(32px, 5vw, 64px); margin: 30px 0; max-width: 1100px; animation: pop .4s; }
.readybar { width: min(700px, 80vw); height: 14px; border-radius: 7px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.readybar div { height: 100%; background: #fff; animation: shrink linear forwards; }
@keyframes shrink { from { width: 100%; } to { width: 0; } }

/* Frage */
.qtitle { margin: 80px auto 0; background: #fff; color: var(--text); padding: 14px 24px; border-radius: 6px; font-size: clamp(22px, 3vw, 38px); font-weight: 800; text-align: center; width: min(1400px, calc(100% - 32px)); box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.qmid { flex: 1; display: grid; grid-template-columns: 1fr minmax(0, 3fr) 1fr; align-items: center; gap: 16px; padding: 16px 24px; min-height: 0; }
.qmedia { height: 100%; display: grid; place-items: center; min-height: 0; }
.qmedia img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); object-fit: contain; }
.qmedia .noimg { width: min(260px, 30vh); opacity: .9; animation: float 3s ease-in-out infinite; }
.qmedia .noimg .shape svg { width: 100%; fill: rgba(255, 255, 255, .12); }
@keyframes float { 50% { transform: translateY(-10px) rotate(6deg); } }
.timer { justify-self: center; width: 130px; height: 130px; border-radius: 50%; background: var(--brand-dark); display: grid; place-items: center; font-size: 56px; font-weight: 900; position: relative; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer circle { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.timer.warn { animation: pulse .5s infinite alternate; }
.timer.warn circle { stroke: var(--red); }
@keyframes pulse { to { transform: scale(1.08); } }
.acount { justify-self: center; text-align: center; font-size: 56px; font-weight: 900; line-height: 1; }
.acount small { display: block; font-size: 20px; font-weight: 700; margin-top: 6px; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 16px; }
.atile { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: 6px; color: #fff; font-size: clamp(18px, 2.2vw, 30px); font-weight: 800; min-height: 90px; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .2); transition: opacity .3s; word-break: break-word; }
.atile .shape svg { width: 40px; height: 40px; fill: #fff; display: block; }
.atile .txt { flex: 1; }
.atile .mark .ic { width: 40px; height: 40px; stroke-width: 3.5; }
.atile.dim { opacity: .3; }
.shape { color: #fff; display: inline-flex; }
.qmedia .noimg .shape { color: rgba(255, 255, 255, .12); }
.c-a { background: var(--ans-a); }
.c-b { background: var(--ans-b); }
.c-c { background: var(--ans-c); }
.c-d { background: var(--ans-d); }

/* Auflösung */
.chart { height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 24px; padding-top: 10px; }
.chart .col { width: min(140px, 18vw); height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; }
.chart .cnt { text-align: center; font-size: 30px; font-weight: 900; padding-bottom: 6px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.chart .bar { height: 0; min-height: 6px; border-radius: 4px 4px 0 0; transition: height 1s cubic-bezier(.2, .9, .3, 1); }
.chart .base { height: 44px; display: grid; place-items: center; border-radius: 0 0 4px 4px; }
.chart .base .shape svg { width: 26px; height: 26px; fill: #fff; display: block; }
.chart .col.dim { opacity: .35; }

/* Rangliste */
.banner { align-self: center; margin: 24px 0; background: #fff; color: var(--text); padding: 10px 40px; border-radius: 6px; font-size: clamp(28px, 4vw, 48px); font-weight: 900; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.rows { width: min(1000px, calc(100% - 32px)); margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.srow { display: flex; align-items: center; gap: 16px; background: #fff; color: var(--text); padding: 16px 24px; border-radius: 6px; font-size: clamp(20px, 2.6vw, 34px); font-weight: 900; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .12); animation: slidein .5s both; }
.srow .rk { width: 1.6em; color: var(--muted); }
.srow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .streak { font-size: .7em; background: var(--brand); color: #fff; padding: 2px 10px; border-radius: 20px; }
@keyframes slidein { from { transform: translateX(-60px); opacity: 0; } }
.next-hint { text-align: center; margin-top: 20px; opacity: .7; font-size: 16px; }

/* Siegertreppchen */
.podium-screen { flex: 1; display: flex; flex-direction: column; align-items: center; min-height: 0; }
.podium { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 8px; width: min(900px, 100%); padding: 0 16px; min-height: 0; }
.pod { flex: 1; display: flex; flex-direction: column; align-items: stretch; height: 100%; justify-content: flex-end; }
.pod .pname { text-align: center; font-size: clamp(22px, 3vw, 40px); font-weight: 900; padding: 10px; opacity: 0; transform: translateY(20px); transition: all .5s .5s; word-break: break-word; }
.pod .pblock { background: var(--brand-light); border-radius: 6px 6px 0 0; display: flex; flex-direction: column; align-items: center; padding-top: 18px; gap: 8px; height: 0; transition: height 1s cubic-bezier(.2, 1.2, .4, 1); overflow: hidden; box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .15); }
.pod.p1 .pblock { background: #ffbe0b; color: #6b4b00; }
.pod.p2 .pblock { background: #c9d2dc; color: #3a4552; }
.pod.p3 .pblock { background: #d68a4c; color: #5a3010; }
.pod .medal { width: 70px; height: 70px; border-radius: 50%; background: rgba(255, 255, 255, .5); display: grid; place-items: center; font-size: 40px; font-weight: 900; border: 4px solid rgba(255, 255, 255, .8); }
.pod .pscore { font-size: 24px; font-weight: 900; }
.pod .pcorrect { font-size: 15px; opacity: .8; }
.pod.show .pname { opacity: 1; transform: none; }
.pod.p1.show .pblock { height: 62%; }
.pod.p2.show .pblock { height: 46%; }
.pod.p3.show .pblock { height: 34%; }
.pod-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 16px; opacity: 0; transition: opacity .5s; }
.pod-actions.show { opacity: 1; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* Ergebnistabelle */
.res-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.res-table th, .res-table td { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; }
.res-table th { background: var(--brand-tint); }
.res-table td.num, .res-table th.num { text-align: right; }
.pct { display: inline-block; height: 10px; border-radius: 5px; background: var(--ok); vertical-align: middle; margin-right: 8px; }

/* ---------- Spielerseite ---------- */
body.player { background: var(--brand); color: #fff; overflow: hidden; }
body.player.ok { background: var(--ok); }
body.player.bad { background: var(--bad); }
body.player.neutral { background: #3d5a7d; }
.p-app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.p-top, .p-bottom { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; height: 52px; background: #fff; color: var(--text); font-weight: 800; flex: none; }
.p-top .pin { font-size: 15px; }
.p-top .qn { background: var(--brand-dark); color: #fff; padding: 4px 10px; border-radius: 4px; font-size: 14px; }
.p-bottom .nm { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-bottom .sc { background: #333; color: #fff; padding: 5px 12px; border-radius: 4px; font-size: 18px; }
.p-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; text-align: center; gap: 14px; min-height: 0; overflow-y: auto; }
.p-main h1 { font-size: 30px; margin: 0; }
.p-main h2 { font-size: 22px; margin: 0; font-weight: 700; }
.p-main p { margin: 0; font-size: 17px; opacity: .9; }
.join-card { background: #fff; color: var(--text); padding: 16px; border-radius: 6px; width: min(340px, 100%); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 4px 20px rgba(0, 0, 0, .3); }
.join-card input { border: 2px solid #ccc; border-radius: 4px; padding: 12px; font-size: 20px; font-weight: 800; text-align: center; }
.join-card input:focus { outline: none; border-color: var(--text); }
.join-card .btn { background: #333; color: #fff; font-size: 18px; min-height: 52px; }
.join-card .err { color: var(--red); font-size: 14px; min-height: 1em; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.p-logo { font-size: 46px; color: #fff; margin-bottom: 12px; }
.spinner { width: 54px; height: 54px; border: 6px solid rgba(255, 255, 255, .3); border-top-color: #fff; border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.big-ic { width: 110px; height: 110px; border-radius: 50%; background: rgba(255, 255, 255, .25); display: grid; place-items: center; animation: popin .5s cubic-bezier(.3, 1.6, .5, 1); }
.big-ic .ic { width: 64px; height: 64px; stroke-width: 3.5; }
.points-pill { background: rgba(0, 0, 0, .3); padding: 8px 20px; border-radius: 6px; font-size: 26px; font-weight: 900; }
.streak-pill { background: rgba(0, 0, 0, .2); padding: 6px 14px; border-radius: 20px; font-size: 16px; }
.p-q { background: #fff; color: var(--text); padding: 10px 14px; border-radius: 6px; font-size: 18px; font-weight: 800; width: 100%; flex: none; }
.p-timebar { height: 6px; background: rgba(255, 255, 255, .25); flex: none; }
.p-timebar div { height: 100%; background: #fff; animation: shrink linear forwards; }
.p-answers { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; min-height: 0; }
.p-answers.two { grid-template-columns: 1fr 1fr; }
.p-btn { border: 0; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #fff; font-size: 18px; font-weight: 800; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .2); transition: transform .08s, opacity .15s; padding: 10px; word-break: break-word; position: relative; }
.p-btn:active { transform: scale(.96); }
.p-btn .shape svg { width: 72px; height: 72px; fill: #fff; display: block; }
.p-answers.with-text .p-btn .shape svg { width: 40px; height: 40px; }
.p-btn.sel { outline: 6px solid #fff; outline-offset: -6px; }
.p-btn.sel::after { content: "✓"; position: absolute; right: 10px; top: 6px; font-size: 26px; }
.p-answers.multi-on .p-btn:not(.sel) { opacity: .75; }
.p-submit { margin: 0 10px 10px; flex: none; }
.p-hint { text-align: center; font-size: 15px; font-weight: 700; padding: 8px 10px 0; flex: none; }
.p-top > * { white-space: nowrap; }
.overlay { position: fixed; inset: 0; background: rgba(8, 25, 45, .88); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; z-index: 100; text-align: center; padding: 20px; font-size: 20px; }
.rank-big { font-size: 90px; font-weight: 900; line-height: 1; }

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 1000px) {
  .editor { grid-template-columns: 1fr; height: auto; }
  .ed-side { border-right: 0; border-bottom: 1px solid #ddd; }
  #ed-list { max-height: 220px; }
  .ed-settings { border-left: 0; }
  .join-box { flex-wrap: wrap; justify-content: center; }
  .join-box .pin { font-size: 48px; }
  .lobby-bar .lobby-title { display: none; }
  .set-page { grid-template-columns: 1fr; }
  .set-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .nav-btn span, .hide-sm, .me span { display: none; }
}
@media (max-width: 600px) {
  .set-row { grid-template-columns: 1fr; }
  .set-row .switch, .set-row .range, .set-row .swatches, .brand-preview { justify-self: start; }
  .search input { width: 120px; }
  .ed-answers, .answers { grid-template-columns: 1fr; }
  .ed-top .title-input { flex-basis: 100%; }
  .ed-top { flex-wrap: wrap; height: auto; padding: 8px 16px; }
  .qmid { grid-template-columns: 1fr 1fr; }
  .qmedia { display: none; }
}
