/* Teilnehmer-Ansicht: groß, ruhig, einhändig bedienbar */
:root {
  /* Farben der Präsentation (siehe brand.css): hell wie die Inhaltsfolien, dunkel wie die Titelfolien */
  --bg: #ffffff;
  --bg-image: url("/assets/brand/punkte-hell.png");
  --card: #ffffff;
  --ink: var(--ao-navy);
  --muted: var(--ao-slate);
  --line: var(--ao-line);
  --accent: var(--ao-blue);
  --accent-ink: #ffffff;
  --accent-soft: var(--ao-mist);
  --hi: var(--ao-orange);
  --ok: var(--ao-blue);
  --ok-soft: var(--ao-mist);
  --err: #c0392b;
  --c0: var(--ao-blue);
  --c1: var(--ao-orange);
  --c2: var(--ao-sky);
  --c3: var(--ao-slate);
  --col0: var(--ao-blue);
  --col1: var(--ao-orange);
  --col2: var(--ao-slate);
  --radius: 18px;
  --tap: 56px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--ao-navy);
    --bg-image: url("/assets/brand/punkte-dunkel.jpg");
    --card: #132a50;
    --ink: #ffffff;
    --muted: var(--ao-ice);
    --line: #2a4170;
    --accent: var(--ao-orange);
    --accent-ink: var(--ao-navy);
    --accent-soft: #3a2a26;
    --hi: var(--ao-orange);
    --ok: var(--ao-sky);
    --ok-soft: #1c3763;
    --err: #ff8a80;
    --c0: var(--ao-blue-lift);
    --c1: var(--ao-orange);
    --c2: var(--ao-sky);
    --c3: var(--ao-ice);
    --col0: var(--ao-blue-lift);
    --col1: var(--ao-orange);
    --col2: #6b7fa3;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.45 var(--font);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(env(safe-area-inset-bottom) + 24px) env(safe-area-inset-left);
  min-height: 100vh;
}
/* Punktraster der Folien als feste, bildschirmfüllende Ebene (iOS kann kein background-attachment: fixed) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--bg) var(--bg-image) right top / cover no-repeat;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 6px; max-width: 560px; margin: 0 auto;
}
.brand { font-weight: 700; letter-spacing: .02em; font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.brand::before { content: "Handy-Runde"; font-family: var(--mono); font-weight: 700; color: var(--hi); }
.conn { font-size: 14px; color: var(--muted); }
.conn.getrennt { color: var(--err); }

main { max-width: 560px; margin: 0 auto; padding: 0 12px; }
main.busy { opacity: .75; pointer-events: none; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 16px 22px;
  margin-top: 8px;
}
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 16px; letter-spacing: -.01em; }
h2.sub { font-size: 1.05rem; margin: 26px 0 10px; }
.kicker { margin: 0 0 6px; font-size: 15px; font-weight: 700; color: var(--hi); }
.lead { color: var(--muted); margin: -6px 0 18px; }
.hint { color: var(--muted); font-size: 15px; margin: 12px 0 0; }
.hint.center, .center { text-align: center; }
.error { color: var(--err); font-weight: 600; margin: 10px 0 0; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }

.btn {
  min-height: 48px; padding: 10px 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); font-weight: 600;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.big { min-height: var(--tap); width: 100%; font-size: 1.1rem; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 15px; }
.btn.round { width: 48px; height: 48px; min-height: 48px; padding: 0; border-radius: 50%; font-size: 26px; line-height: 1; flex: none; }
.btn:disabled { opacity: .4; cursor: default; }
.btn:focus-visible, .scale-opt:focus-visible, .chip:focus-visible, .seg3 button:focus-visible, .vote:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.actions { display: grid; gap: 10px; margin-top: 18px; }

/* Beitritt */
.join h1 { font-size: 1.7rem; }
.code-input {
  width: 100%; height: 72px; font-size: 2.2rem; font-weight: 700; letter-spacing: .3em; text-align: center;
  text-transform: uppercase; border: 2px solid var(--line); border-radius: 16px; background: var(--bg); margin-bottom: 14px;
}
.code-input:focus { outline: none; border-color: var(--accent); }
.join .error { margin: -4px 0 14px; }

/* Warten */
.wait { text-align: center; padding: 40px 20px; }
.wait h1 { margin-top: 18px; }
.wait .pulse + .kicker { margin-top: 20px; }
.live-badge { display: inline-block; margin: 0 0 14px; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 16px; background: var(--line); color: var(--muted); }
.live-badge.ok { background: var(--ok-soft); color: var(--ok); }
.live-badge.getrennt { background: var(--err); color: #fff; }
.pulse { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); margin: 0 auto; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(.8); opacity: .5; } 50% { transform: scale(1.3); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* Hinweis, wenn der Beamer schon eine andere Frage zeigt */
.beamer-hint {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; width: 100%; margin-top: 8px;
  padding: 12px 14px; border-radius: 14px; border: 2px solid var(--accent); background: var(--accent-soft); color: var(--ink);
  font-size: 15px; text-align: left;
}
.beamer-hint .go { font-weight: 700; color: var(--accent); }
.beamer-hint:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.done { background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: 12px 14px; font-weight: 600; margin: 16px 0 0; font-size: 16px; }

/* Skala */
.scale { display: grid; gap: 10px; }
.scale-opt {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 16px;
  border: 2px solid var(--line); border-radius: 16px; background: var(--card); text-align: left;
}
.scale-opt .emoji { font-size: 34px; line-height: 1; width: 40px; text-align: center; }
.scale-opt .emoji.num { font-size: 22px; font-weight: 800; width: 40px; height: 40px; line-height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.scale-opt.on .emoji.num { background: var(--accent); color: var(--accent-ink); }
.scale-opt .lbl { font-weight: 600; font-size: 1.05rem; }
.scale-opt.on { border-color: var(--accent); background: var(--accent-soft); }

/* Texte */
textarea, select {
  width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--bg); resize: vertical;
}
select { min-height: var(--tap); appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
textarea:focus, select:focus { outline: none; border-color: var(--accent); }
.entry { display: grid; gap: 10px; }
.entry label { font-weight: 600; font-size: 16px; margin-top: 6px; }
.count { font-size: 14px; color: var(--muted); }
.mine { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.mine li { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--bg); border-radius: 12px; padding: 8px 8px 8px 14px; }
.mine li span { overflow-wrap: anywhere; }

/* Prozentverteilung */
.alloc-sum { position: sticky; top: 0; background: var(--card); padding: 6px 0 10px; z-index: 2; }
.alloc-sum p { margin: 8px 0 0; font-size: 16px; }
.alloc-sum p.ok { color: var(--ok); }
.alloc-sum p.over { color: var(--err); }
.stack { display: flex; height: 18px; border-radius: 9px; overflow: hidden; background: var(--line); }
.stack .seg { height: 100%; transition: width .15s; }
.seg.c0, .alloc-row.c0 input { --c: var(--c0); }
.seg.c1, .alloc-row.c1 input { --c: var(--c1); }
.seg.c2, .alloc-row.c2 input { --c: var(--c2); }
.seg.c3, .alloc-row.c3 input { --c: var(--c3); }
.stack .seg { background: var(--c); }
.alloc { display: grid; gap: 16px; margin-top: 6px; }
.alloc-row label { font-weight: 600; }
.alloc-row output { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 4ch; text-align: right; }
.alloc-row.c0 label::before, .alloc-row.c1 label::before, .alloc-row.c2 label::before, .alloc-row.c3 label::before {
  content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; vertical-align: 1px;
}
.alloc-row.c0 label::before { background: var(--c0); }
.alloc-row.c1 label::before { background: var(--c1); }
.alloc-row.c2 label::before { background: var(--c2); }
.alloc-row.c3 label::before { background: var(--c3); }
.alloc-ctl { margin-top: 4px; }
/* Eigener Schieberegler: in allen Browsern gleich, gefüllter Teil in der Kategoriefarbe */
input[type="range"] { flex: 1; min-width: 0; height: 44px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; touch-action: pan-y; }
input[type="range"]:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
input[type="range"]::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; background: linear-gradient(to right, var(--c) var(--p, 0%), var(--line) var(--p, 0%)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -10px; border-radius: 50%; background: var(--c); border: 3px solid var(--card); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
input[type="range"]::-moz-range-track { height: 10px; border-radius: 5px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 10px; border-radius: 5px; background: var(--c); }
input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 3px solid var(--card); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }

/* Sortieren */
.legend { list-style: none; padding: 0; margin: 0 0 4px; display: grid; gap: 4px; font-size: 15px; color: var(--muted); }
.legend small { font-size: 14px; }
/* Auswahl als Knöpfe (kurze Listen) */
.label { font-weight: 600; font-size: 16px; margin-top: 6px; }
.choice-list { display: grid; gap: 8px; }
.choice { min-height: 52px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-weight: 600; text-align: left; }
.choice.on { border-color: var(--accent); background: var(--accent-soft); }
.choice:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: 14px; color: #fff; }
.pill.col0 { background: var(--col0); }
.pill.col1 { background: var(--col1); }
.pill.col2 { background: var(--col2); }
.sort { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.sort-item { border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: var(--bg); }
.sort-name { display: block; font-weight: 600; margin: 0 2px 8px; }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg3 button {
  min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-weight: 600; font-size: 15px; padding: 4px;
}
.seg3 button.on { color: #fff; }
.seg3 button.col0.on { background: var(--col0); border-color: var(--col0); }
.seg3 button.col1.on { background: var(--col1); border-color: var(--col1); }
.seg3 button.col2.on { background: var(--col2); border-color: var(--col2); }
.progress { text-align: center; margin: 14px 0 0; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 48px; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); font-weight: 600; font-size: 15px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Punkte */
.dots-left { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-weight: 600; }
.dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--accent); }
.dot.full { background: var(--accent); }
.dots-left span:last-child { margin-left: 6px; }
.dots { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.dots li { border: 2px solid var(--line); border-radius: 14px; padding: 10px 10px 10px 14px; display: grid; gap: 6px; }
.dots li.has { border-color: var(--accent); background: var(--accent-soft); }
.dots-name { font-weight: 600; }
.dots-ctl { justify-content: space-between; }
.dots-val { font-size: 24px; letter-spacing: 4px; color: var(--accent); min-width: 4ch; text-align: center; }

/* Fragen */
.qlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.qlist .empty { color: var(--muted); padding: 10px 0; }
.q { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 12px 12px 12px 14px; background: var(--bg); }
.q.answered { opacity: .6; }
.q.marked { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }
.q-text { overflow-wrap: anywhere; }
.q .btn.small { grid-column: 1 / -1; justify-self: start; }
.tag { display: inline-block; margin-left: 8px; font-size: 13px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 8px; border-radius: 999px; vertical-align: 1px; }
.tag.ok { color: var(--ok); background: var(--ok-soft); }
.vote {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 60px; min-height: 60px;
  border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-size: 14px; line-height: 1.1;
}
.vote b { font-size: 20px; }
.vote.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.vote.static { opacity: .7; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translate(-50%, 140%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; max-width: calc(100% - 32px);
  transition: transform .2s, visibility .2s; z-index: 10; text-align: center; visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast.err { background: var(--err); color: #fff; }

@media (max-width: 340px) {
  body { font-size: 17px; }
  .card { padding: 16px 12px 18px; }
  h1 { font-size: 1.3rem; }
  .seg3 button { font-size: 14px; }
  .code-input { font-size: 1.9rem; }
}
