:root {
  --bg: #f7f5f0;
  --card: #ffffff;
  --ink: #1d2033;
  --muted: #6b6f80;
  --line: #e4e1d8;
  --accent: #5b4bdb;
  --accent-ink: #ffffff;
  --accent-soft: #ecebfd;
  --good: #1a9e6e;
  --warn: #e0662f;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 20, 40, .06), 0 6px 20px rgba(20, 20, 40, .06);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; border: 1px solid var(--line); background: var(--card); padding: .6em 1.1em; border-radius: 12px; font-weight: 600; transition: transform .08s, background .15s, border-color .15s; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #cfcabd; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: #c0392b; }
.btn.small { padding: .35em .75em; font-size: .9em; border-radius: 10px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }

input[type=text], input[type=password], input[type=url], input[type=number], textarea, select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: .7em .9em; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { resize: vertical; min-height: 5em; }
label.field { display: block; margin: 0 0 1em; }
label.field > span { display: block; font-weight: 600; font-size: .92em; margin-bottom: .35em; }
.hint { color: var(--muted); font-size: .88em; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4em; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: .7em 1.2em; border-radius: 12px; opacity: 0; transition: .25s; z-index: 1000; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Ergebnis-Darstellungen (Beamer + Vorschau) ============ */
.res { width: 100%; height: 100%; position: relative; }
.bars { display: flex; flex-direction: column; justify-content: center; gap: 1.1em; height: 100%; }
.bar-row { display: grid; grid-template-columns: minmax(8em, 32%) 1fr 5.5em; align-items: center; gap: 1em; }
.bar-label { font-weight: 600; font-size: 1.15em; overflow-wrap: anywhere; }
.bar-track { height: 2.4em; background: rgba(0,0,0,.05); border-radius: 12px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 12px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.bar-val { font-weight: 700; font-size: 1.3em; font-variant-numeric: tabular-nums; }
.bar-val small { font-weight: 500; color: var(--muted); font-size: .7em; margin-left: .2em; }

.smileys { display: flex; align-items: flex-end; justify-content: center; gap: 4%; height: 100%; padding-top: 1em; }
.smiley-col { flex: 1; max-width: 170px; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.smiley-bar-wrap { flex: 1; width: 64%; display: flex; align-items: flex-end; }
.smiley-bar { width: 100%; height: 0; border-radius: 14px 14px 6px 6px; transition: height .6s cubic-bezier(.2,.8,.2,1); min-height: 6px; }
.smiley-num { font-weight: 800; font-size: 1.7em; margin: .25em 0 0; font-variant-numeric: tabular-nums; }
.smiley-face { font-size: 3.6em; line-height: 1.1; }

.scale-list { display: flex; flex-direction: column; justify-content: center; gap: 1.6em; height: 100%; }
.scale-item .scale-head { display: flex; justify-content: space-between; gap: 1em; align-items: baseline; margin-bottom: .45em; }
.scale-item .scale-title { font-weight: 600; font-size: 1.2em; }
.scale-item .scale-avg { font-weight: 800; font-size: 1.5em; font-variant-numeric: tabular-nums; }
.scale-track { position: relative; height: 3em; background: rgba(0,0,0,.05); border-radius: 999px; }
.scale-dist { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 0 1.5em; gap: 3px; }
.scale-dist div { flex: 1; background: rgba(0,0,0,.09); border-radius: 4px 4px 0 0; transition: height .6s; }
.scale-dot { position: absolute; top: 50%; width: 2.3em; height: 2.3em; border-radius: 50%; transform: translate(-50%, -50%); transition: left .6s cubic-bezier(.2,.8,.2,1); box-shadow: 0 3px 10px rgba(0,0,0,.2); border: 3px solid #fff; }
.scale-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: .95em; margin-top: .35em; padding: 0 .4em; }

.cloud { position: absolute; inset: 0; overflow: hidden; }
.cloud-word { position: absolute; white-space: nowrap; font-weight: 700; line-height: 1; transition: left .6s, top .6s, font-size .6s, opacity .4s; transform: translate(-50%, -50%); }

.cards { columns: 3 260px; column-gap: 1em; }
.cards .entry { break-inside: avoid; background: #fff; border-radius: 14px; padding: .9em 1.1em; margin: 0 0 1em; font-size: 1.15em; box-shadow: var(--shadow); border-top: 5px solid var(--accent); animation: pop .4s; overflow-wrap: anywhere; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

.qa-list { display: flex; flex-direction: column; gap: .8em; }
.qa-item { display: flex; gap: 1em; align-items: center; background: #fff; border-radius: 14px; padding: .9em 1.1em; box-shadow: var(--shadow); font-size: 1.15em; animation: pop .4s; }
.qa-item.answered { opacity: .5; }
.qa-votes { min-width: 3.2em; text-align: center; font-weight: 800; font-size: 1.15em; color: var(--accent); }
.qa-votes span { display: block; font-size: .6em; font-weight: 600; color: var(--muted); }
.qa-text { flex: 1; overflow-wrap: anywhere; }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--muted); text-align: center; gap: .4em; font-size: 1.3em; }
.empty-state .big { font-size: 2.6em; }

/* ---- Kuchen / Donut */
.pie-wrap { display: flex; align-items: center; justify-content: center; gap: 3em; height: 100%; }
.pie { height: 100%; max-height: 100%; max-width: 48%; aspect-ratio: 1; }
.legend { display: flex; flex-direction: column; gap: .7em; min-width: 14em; max-width: 45%; }
.legend-row { display: flex; align-items: center; gap: .6em; font-size: 1.15em; }
.legend-row .dot { width: 1em; height: 1em; border-radius: 4px; flex: none; }
.legend-row .lt { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.legend-row b { font-variant-numeric: tabular-nums; }
.legend-row small { color: var(--muted); width: 3em; text-align: right; }

/* ---- Quiz */
.quiz-ready { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; font-size: 1.8em; color: var(--muted); font-weight: 700; }
.quiz-count { font-size: 4em; color: var(--accent); font-weight: 900; line-height: 1.1; animation: pop .5s; }
.quiz-run { display: flex; gap: 2em; height: 100%; align-items: stretch; }
.quiz-side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6em; min-width: 7em; }
.quiz-timer { width: 3.2em; height: 3.2em; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 2.6em; font-weight: 900; font-variant-numeric: tabular-nums; }
.quiz-timer.hurry { background: #e5533d; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.quiz-answers { color: var(--muted); font-weight: 600; font-size: 1.1em; }
.quiz-tiles { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 1em; align-content: center; }
.quiz-tile { color: #fff; border-radius: 16px; padding: 1.1em 1.3em; font-size: 1.35em; font-weight: 700; display: flex; align-items: center; gap: .7em; min-height: 3.4em; overflow-wrap: anywhere; box-shadow: var(--shadow); }
.quiz-tile .shape { font-size: 1.3em; opacity: .9; }
.bar-row.wrong .bar-label { color: var(--muted); }
.bar-row.correct .bar-label { color: #1a9e6e; }

/* ---- Rangliste */
.leader { display: flex; flex-direction: column; gap: .55em; justify-content: center; height: 100%; width: 100%; max-width: 1000px; margin: 0 auto; }
.lrow { width: 100%; display: grid; grid-template-columns: 3em minmax(6em, 28%) 1fr 5em; align-items: center; gap: .8em; font-size: 1.15em; animation: pop .4s; }
.lrow.ltop { font-size: 1.35em; }
.lrank { font-size: 1.4em; text-align: center; font-weight: 800; color: var(--muted); }
.lname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ltrack { height: 1.5em; background: rgba(0,0,0,.05); border-radius: 10px; overflow: hidden; }
.lfill { height: 100%; border-radius: 10px; transition: width .6s; }
.lscore { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Schätzfrage */
.guess { display: flex; flex-direction: column; height: 100%; gap: .8em; }
.gstats { display: flex; gap: 2.5em; justify-content: center; }
.gstats div { display: flex; flex-direction: column; align-items: center; }
.gstats b { font-size: 1.9em; font-variant-numeric: tabular-nums; }
.gstats span { color: var(--muted); font-size: .95em; }
.gstats .sol b { color: #1a9e6e; }
.hist { flex: 1; display: flex; align-items: flex-end; gap: .5em; position: relative; border-bottom: 2px solid var(--line); min-height: 0; padding-top: 1.6em; }
.hcol { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.hbar { width: 100%; background: var(--accent); border-radius: 8px 8px 0 0; transition: height .6s; min-height: 2px; opacity: .85; }
.hnum { font-weight: 700; color: var(--muted); font-size: .95em; }
.hmark { position: absolute; top: 0; bottom: 0; width: 0; border-left: 3px dashed #ff6b4a; }
.hmark span { position: absolute; top: -.2em; left: 50%; transform: translateX(-50%); background: #ff6b4a; color: #fff; font-weight: 800; border-radius: 6px; padding: 0 .4em; font-size: .85em; }
.hmark.sol { border-left: 3px solid #1a9e6e; }
.hmark.sol span { background: #1a9e6e; }
.haxis { display: flex; justify-content: space-between; color: var(--muted); font-weight: 600; }

/* ---- 2x2 */
.grid2 { width: 100%; height: 100%; display: block; }

/* ---- Bild-Markierung */
.pin-box { height: 100%; display: flex; align-items: center; justify-content: center; }
.pin-wrap { position: relative; display: inline-block; max-height: 100%; }
.pin-wrap img { display: block; width: 100%; height: 100%; border-radius: 12px; }
.pin-layer { position: absolute; inset: 0; pointer-events: none; }
.pin-dot { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: rgba(229, 83, 61, .55); border: 2px solid rgba(255,255,255,.9); box-shadow: 0 1px 4px rgba(0,0,0,.3); animation: pop .4s; }

/* ---- Glücksrad */
.wheel-box { display: flex; align-items: center; justify-content: center; gap: 3em; height: 100%; }
.wheel { position: relative; height: 100%; aspect-ratio: 1; max-width: 60%; }
.wheel-rot { width: 100%; height: 100%; border-radius: 50%; box-shadow: 0 10px 40px rgba(0,0,0,.18); }
.wheel-rot svg { width: 100%; height: 100%; display: block; }
.wheel-pointer { position: absolute; top: -4%; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 1.1em solid transparent; border-right: 1.1em solid transparent; border-top: 2em solid #1d2033; z-index: 2; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.wheel-side { display: flex; flex-direction: column; gap: 1em; min-width: 12em; }
.wheel-info { color: var(--muted); font-size: 1.2em; }
.wheel-info b { color: var(--ink); font-size: 1.6em; }
.wheel-banner { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: .8em 1.2em; font-size: 2.2em; text-align: center; }
.wheel-banner b { display: block; font-size: 1.15em; color: var(--accent); overflow-wrap: anywhere; }
.wheel-banner.pop { animation: pop .5s; }
