body { font-size: 15px; }
.muted { color: var(--muted); }
code { background: var(--panel-strong); padding: 0 0.3em; border-radius: 4px; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px; backdrop-filter: blur(10px); }
.login h1 { font-size: 32px; }

.app { max-width: 1400px; margin: 0 auto; padding: 12px 16px 40px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.top nav { display: flex; gap: 6px; flex-wrap: wrap; }
.brand { font-family: var(--font-display); font-size: 24px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.phase { font-family: var(--font); font-size: 13px; font-weight: 900; background: var(--pink); padding: 3px 10px; border-radius: 99px; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }
.main, .side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; backdrop-filter: blur(10px); }
.panel h3 { font-family: var(--font); font-weight: 900; font-size: 16px; margin: 0 0 10px; }
.panel:empty { display: none; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 14px; }

.controls { display: flex; flex-direction: column; gap: 10px; }
.next { font-size: 22px; padding: 18px; width: 100%; }
.extra { display: flex; gap: 6px; flex-wrap: wrap; }

.qcard .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tag { background: var(--panel-strong); border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 900; }
.tag.accent { background: var(--accent); color: #2a1600; }
.qcard .q { font-size: 20px; font-weight: 900; margin-bottom: 8px; }
.qcard .a { background: rgba(46, 229, 157, 0.15); border: 1px solid var(--green); border-radius: 10px; padding: 8px 10px; font-weight: 800; }
.qcard .a small { color: var(--muted); display: block; font-weight: 700; }
.qcard img { display: block; max-width: 100%; height: 280px; object-fit: contain; border-radius: 8px; margin: 6px 0; }
.qcard ol { margin: 6px 0; padding-left: 22px; }
.qcard ol li.cur { color: var(--accent); font-weight: 900; }
.qcard ol li.future { color: var(--muted); }
.timer-big { font-family: var(--font-display); font-size: 28px; }

/* Antworten & Bewertung */
.ans-summary { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.ans-list { display: flex; flex-direction: column; gap: 6px; }
.ans-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 1.4fr) auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.2); border-left: 5px solid var(--line); transition: background 0.2s; }
.ans-row.ok { border-left-color: var(--green); background: rgba(46, 229, 157, 0.1); }
.ans-row.no { border-left-color: var(--red); }
.ans-row.pending { border-left-color: var(--accent); background: rgba(255, 204, 51, 0.1); }
.ans-row.none { opacity: 0.65; }
.ans-row .who { display: flex; align-items: center; gap: 6px; font-weight: 800; min-width: 0; }
.ans-row .who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ans-row .val { font-weight: 900; font-size: 17px; word-break: break-word; }
.ans-row .val small { font-weight: 700; color: var(--muted); font-size: 12px; }
.seg { display: inline-flex; border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 2px var(--line); }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 38px; min-width: 44px; font-weight: 900; font-size: 17px; cursor: pointer; color: var(--muted); }
.seg button.on.yes { background: var(--green); color: #00301e; }
.seg button.on.no { background: var(--red); color: #fff; }
.stepper { display: inline-flex; align-items: center; gap: 2px; background: rgba(0, 0, 0, 0.25); border-radius: 10px; padding: 2px; }
.stepper button { border: 0; width: 34px; height: 34px; border-radius: 8px; background: var(--panel-strong); font-weight: 900; font-size: 18px; cursor: pointer; }
.stepper b { min-width: 34px; text-align: center; font-family: var(--font-display); font-size: 20px; }
.stepper b.zero { color: var(--muted); }
.swatch { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--team); flex: none; }
.pending-tag { color: var(--accent); font-size: 11px; font-weight: 900; text-transform: uppercase; display: block; }

.phone-qr { display: flex; gap: 12px; align-items: center; }
.phone-qr img { width: 120px; height: 120px; background: #fff; border-radius: 10px; padding: 4px; flex: none; }
.phone-qr p { margin: 0; font-size: 13px; }

.teams { display: flex; flex-direction: column; gap: 6px; }
.team { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 10px; background: rgba(0, 0, 0, 0.18); }
.team .nm { flex: 1; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team .sc { font-family: var(--font-display); font-size: 18px; min-width: 32px; text-align: right; }
.team .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.team .dot.off { background: var(--red); }
.team button { padding: 3px 7px; font-size: 12px; border-radius: 7px; }

.outline { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
.outline .rnd { font-weight: 900; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.outline .qs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.outline .qb { border: 0; min-width: 34px; height: 30px; border-radius: 8px; background: var(--panel-strong); font-weight: 900; cursor: pointer; }
.outline .qb.done { background: rgba(46, 229, 157, 0.3); }
.outline .qb.cur { background: var(--accent); color: #2a1600; }

/* ---------- Handy-Layout mit Tabs ---------- */
.mobile-only { display: none !important; }
.tabbar { display: none; }
@media (max-width: 900px) {
  body { font-size: 15px; }
  .app { padding: calc(8px + env(safe-area-inset-top)) 10px calc(150px + env(safe-area-inset-bottom)); }
  .desktop-only { display: none !important; }
  .mobile-only { display: flex !important; }
  .top { margin-bottom: 8px; }
  .brand { font-size: 18px; }
  .grid, .main, .side { gap: 10px; }
  .panel { padding: 12px; }
  body:not(.tab-live) .app [data-tab="live"],
  body:not(.tab-teams) .app [data-tab="teams"],
  body:not(.tab-flow) .app [data-tab="flow"],
  body:not(.tab-setup) .app [data-tab="setup"] { display: none; }
  .toast { bottom: calc(170px + env(safe-area-inset-bottom)); }
  .controls { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 20; border-radius: 18px 18px 0 0; background: rgba(20, 8, 43, 0.92); backdrop-filter: blur(14px); padding: 10px; display: flex !important; gap: 8px; }
  .controls .next { padding: 14px; font-size: 19px; }
  .extra { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .extra .btn { flex: none; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: #0d0520; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar button { flex: 1; border: 0; background: none; color: var(--muted); font-weight: 800; font-size: 12px; padding: 6px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; position: relative; cursor: pointer; }
  .tabbar button span { font-size: 20px; }
  .tabbar button.on { color: var(--accent); }
  .tabbar i { position: absolute; top: 4px; left: calc(50% + 8px); background: var(--pink); color: #fff; font-style: normal; font-size: 11px; font-weight: 900; border-radius: 99px; padding: 0 6px; }
  .tabbar i:empty { display: none; }
  .ans-row { grid-template-columns: 1fr auto; grid-template-areas: "who who" "val val" "seg step"; gap: 6px 10px; }
  .ans-row .who { grid-area: who; }
  .ans-row .val { grid-area: val; font-size: 19px; }
  .ans-row .seg { grid-area: seg; justify-self: start; }
  .ans-row .stepper { grid-area: step; }
  .outline { max-height: none; }
  .team button { padding: 6px 10px; font-size: 14px; }
}

/* QR-Dialog fürs Handy */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(5, 0, 20, 0.8); backdrop-filter: blur(6px); }
.modal-card { width: min(420px, 100%); background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; animation: toastIn 0.25s ease-out; }
.modal-card h2 { font-size: 28px; }
.modal-card img { width: 260px; height: 260px; background: #fff; border-radius: 14px; padding: 8px; }
.modal-card p { margin: 0; }
.modal-card .warn { color: var(--accent); font-weight: 800; }
.modal-card #hostQrUrl { font-size: 12px; word-break: break-all; }

/* Live-Vorschau des Presenters */
.grid.big-preview { grid-template-columns: minmax(0, 1fr) 600px; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.preview-head h3 { margin: 0; }
.preview-box { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; box-shadow: 0 0 0 2px var(--line); }
.preview-box iframe { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; border: 0; transform-origin: 0 0; pointer-events: none; }
.preview-box .off { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-weight: 800; }
.preview-panel.collapsed .preview-box { display: none; }

/* Papier-Modus: Auswertung der Zettel */
.entry-wrap { overflow-x: auto; margin: 0 -4px; }
.entry { border-collapse: separate; border-spacing: 4px; width: 100%; }
.entry th { font-size: 13px; text-align: left; white-space: nowrap; }
.entry th small { display: block; font-weight: 600; color: var(--muted); max-width: 7em; overflow: hidden; text-overflow: ellipsis; }
.entry td .field { padding: 8px 10px; min-width: 9em; }
.entry td .field.num { min-width: 0; width: 4.5em; text-align: center; }
.entry .sum { font-weight: 900; white-space: nowrap; padding: 0 6px; }
.entry-add { display: flex; gap: 8px; margin-top: 10px; }
.entry-add .field { flex: 1; }

/* Spielart wählen (Lobby) */
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 12px; }
.mode-pick .mode {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px; cursor: pointer;
  border-radius: 14px; border: 2px solid rgba(255, 255, 255, 0.15); background: rgba(255, 255, 255, 0.06); color: inherit; font: inherit;
}
.mode-pick .mode span { font-size: 30px; }
.mode-pick .mode small { color: var(--muted); font-size: 12px; text-align: center; }
.mode-pick .mode.on { border-color: var(--accent); background: rgba(255, 204, 51, 0.16); box-shadow: 0 0 0 3px rgba(255, 204, 51, 0.25); }
.entry th.open { opacity: 0.45; }
.entry td .field:disabled { opacity: 0.35; }
.rr-list { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 4px; }
.rr-list li.cur { font-weight: 900; color: var(--accent); }
.rr-list li.future { opacity: 0.5; }
