/* Kostenduell – Design nach FH-Grün. Nur Systemschriften, keine externen Ressourcen. */
:root {
  --bg: #F6F9EE; --card: #FFFFFF; --border: #D3E3B5;
  --primary: #2F7D22; --on-primary: #FFFFFF; --accent: #6AB42D; --hl: #E6F0AE;
  --text: #1B2A12; --muted: #55604A; --danger: #B3261E;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12190D; --card: #1B2614; --border: #34482A;
    --primary: #8FD16A; --on-primary: #10190B; --accent: #6AB42D; --hl: #2E3F17;
    --text: #E8F0DC; --muted: #A5B296; --danger: #FF8A80;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); overflow-x: hidden; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.wrap { max-width: 560px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin: 0 0 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.brand { font-weight: 700; color: var(--primary); font-size: 1.15rem; }
.chip { background: var(--hl); border-radius: 999px; padding: 2px 10px; font-size: .9rem; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { display: inline-block; width: .6em; height: .6em; border-radius: 50%; background: var(--accent); margin-right: .4em; }
.dot.off { background: var(--danger); }

/* Formulare */
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=number], select {
  width: 100%; font: inherit; font-size: 1.25rem; padding: 12px; border-radius: 10px;
  border: 2px solid var(--border); background: var(--bg); color: var(--text);
}
input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tipinput { font-family: var(--mono); font-size: 1.6rem; text-align: right; }
.field { position: relative; }
.field .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; color: var(--muted); pointer-events: none; }
.field input.tipinput { padding-right: 40px; }
button, .btn {
  font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 10px; padding: 12px 18px;
  background: var(--primary); color: var(--on-primary);
}
button.block { width: 100%; margin-top: 10px; font-size: 1.1rem; }
button.secondary { background: var(--hl); color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--danger); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
.msg { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--hl); }
.msg.err { background: transparent; border: 1px solid var(--danger); color: var(--danger); }

/* Vorgaben-Tabellen: Zeilen als Grid, damit nichts seitlich scrollt */
.rows { margin: 8px 0 0; }
.row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "lbl sum" "qty sum"; column-gap: 12px; padding: 7px 0; border-top: 1px solid var(--border); }
.row:first-child { border-top: 0; }
.row .lbl { grid-area: lbl; min-width: 0; overflow-wrap: anywhere; }
.row .qty { grid-area: qty; font-family: var(--mono); font-size: .88rem; color: var(--muted); }
.row .sum { grid-area: sum; font-family: var(--mono); font-weight: 700; text-align: right; align-self: center; white-space: nowrap; }
.row .note { color: var(--muted); font-size: .88rem; margin-left: .4em; }
.row.total { border-top: 2px solid var(--primary); font-weight: 700; }
.row.unknown { background: var(--hl); border-radius: 8px; padding: 7px 8px; margin-top: 4px; border-top: 0; }
.hl { background: var(--hl); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-top: 12px; }
.hl .big { font-family: var(--mono); font-size: 1.9rem; font-weight: 800; color: var(--primary); }
.footnote { font-size: .85rem; color: var(--muted); margin: 10px 0 0; }
.resultgrid { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: baseline; }
.resultgrid .v { font-family: var(--mono); font-weight: 700; text-align: right; }
.rank { font-family: var(--mono); font-size: 3rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.center { text-align: center; }
.spinner { color: var(--muted); }
table.plain { width: 100%; border-collapse: collapse; }
table.plain th, table.plain td { padding: 6px 4px; text-align: left; border-top: 1px solid var(--border); vertical-align: middle; }
table.plain td.r, table.plain th.r { text-align: right; font-family: var(--mono); }

/* ------------------------------------------------------------------ Beamer */
body.beamer { font-size: max(24px, 1.25vw); line-height: 1.3; overflow-y: auto; }
.bwrap { padding: 1.2vw 2vw; max-width: 2400px; margin: 0 auto; }
.btop { display: flex; justify-content: space-between; align-items: baseline; gap: 2vw; margin-bottom: .6em; }
.btop .brand { font-size: 1em; }
.btop h1 { font-size: 1.35em; margin: 0; }
.btop .sub { color: var(--muted); font-weight: 400; }
.beamer .card { padding: .6em .9em; border-radius: 16px; margin-bottom: .6em; }
.beamer h3 { font-size: 1em; margin: 0 0 .25em; color: var(--primary); }
.beamer .rows { margin: 0; }
.beamer .row { grid-template-columns: 1fr auto auto; grid-template-areas: "lbl qty sum"; padding: .12em 0; column-gap: 1em; align-items: baseline; }
.beamer .row .qty { font-size: 1em; text-align: right; }
.beamer .row .note { font-size: .85em; }
.beamer .row .sum { min-width: 5.5em; }
.beamer .footnote { font-size: .8em; margin-top: .3em; }
.beamer .hl { padding: .3em .8em; margin-top: .5em; }
.beamer .hl .big, .bigno { font-size: max(64px, 4vw); font-family: var(--mono); font-weight: 800; color: var(--primary); line-height: 1.05; }
.beamer .hl .big { font-size: max(64px, 3.4vw); }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2vw; align-items: start; }
@media (max-width: 1100px) { .cols2 { grid-template-columns: 1fr; } }
.resultband { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2vw; margin-bottom: .6em; }
.resultband .card { margin: 0; text-align: center; }
.resultband .card.truth { background: var(--hl); border-color: var(--accent); }
.resultband .lab { color: var(--muted); font-size: .85em; }
.counter { display: flex; align-items: baseline; gap: 1em; flex-wrap: wrap; }
.lobby { text-align: center; padding-top: 6vh; }
.lobby .bigno { display: block; }
.lobby .url { font-family: var(--mono); font-size: 1.6em; color: var(--primary); font-weight: 700; }

/* Zahlengerade */
.nl { position: relative; margin: .2em 0 .4em; padding: 0 1.2em; }
.nl-top { position: relative; height: 1.9em; }
.nl-lab { position: absolute; top: 0; white-space: nowrap; font-weight: 700; font-size: .95em; }
.nl-lab.truth { color: var(--primary); }
.nl-lab.saas { color: var(--muted); }
.nl-plot { position: relative; border-bottom: 3px solid var(--text); }
.nl-bar { position: absolute; bottom: 0; top: 0; width: 0; }
.nl-bar.truth { border-left: 5px solid var(--primary); z-index: 1; }
.nl-bar.saas { border-left: 3px dashed var(--muted); }
.nl-dot { position: absolute; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--card); box-shadow: 0 0 0 1.5px var(--primary); z-index: 2; }
.nl-axis { position: relative; height: 1.7em; }
.nl-tick { position: absolute; top: .1em; transform: translateX(-50%); font-family: var(--mono); font-size: .8em; color: var(--muted); white-space: nowrap; }
.nl-tick::before { content: ""; position: absolute; left: 50%; top: -.2em; height: .35em; border-left: 2px solid var(--text); }
.nl-over { color: var(--muted); font-size: .85em; text-align: right; }

/* Leaderboard */
.lb { list-style: none; margin: 0; padding: 0; }
.lb li { display: grid; grid-template-columns: 2.2em 1fr auto auto; gap: 1em; align-items: baseline; padding: .28em .6em; border-radius: 14px; margin-bottom: .3em;
  background: var(--card); border: 1px solid var(--border); opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.lb li.show { opacity: 1; transform: none; }
.lb .rk { font-family: var(--mono); font-weight: 800; color: var(--primary); font-size: 1.25em; }
.lb .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .pt { font-family: var(--mono); font-weight: 800; font-size: 1.25em; }
.lb .dv { font-family: var(--mono); color: var(--muted); font-size: .8em; min-width: 6em; text-align: right; }
.lb li.winner { background: var(--hl); border: 2px solid var(--accent); font-size: 1.25em; }
@media (prefers-reduced-motion: reduce) { .lb li { transition: none; transform: none; } }

/* Moderation */
.hostwrap { max-width: 1000px; margin: 0 auto; padding: 16px; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.btnrow button { flex: 1 1 200px; font-size: 1.05rem; }
.xbtn { padding: 0 6px; margin-left: 4px; background: transparent; color: var(--danger); border: 1px solid var(--border); font-size: .9rem; border-radius: 6px; }
.tipcell { white-space: nowrap; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; align-items: end; }
@media (max-width: 640px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.grid3 input, .grid3 select { font-size: 1rem; padding: 10px; }
.status { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.pill { padding: 3px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: .9rem; }
.pill.open { background: var(--hl); border-color: var(--accent); font-weight: 700; }

a { color: var(--primary); }
.beamer .lb { font-size: 1.15em; }

/* QR-Code zum Beitreten (immer schwarz auf weiß, auch im Dunkelmodus) */
.qrbox { background: #fff; border-radius: 14px; line-height: 0; overflow: hidden; }
.qrbox svg { display: block; width: 100%; height: auto; }
.lobby .qrbox { width: min(44vh, 520px); margin: .4em auto; }
.counter .qrside { margin-left: auto; text-align: center; }
.counter .qrside .qrbox { width: 200px; margin: 0 auto .1em; }
.beamer .counter { align-items: center; }
.beamer .lobby h1 { font-size: 2.2em; margin-bottom: .2em; }
