/* ---------- Tokens ---------- */
:root {
  --ink: #14161F;
  --ink-2: #4A4F5C;
  --muted: #6B7080;
  --bg: #F3F5F9;
  --card: #FFFFFF;
  --soft: #E9ECF2;
  --line: #E1E5EE;
  /* Fragenfarben – müssen zu lib/config.php passen (Palette «Electric») */
  --q1: #FFD60A; --q1-text: #14161F;
  --q2: #3A5BFF; --q2-text: #FFFFFF;
  --q3: #00E5A0; --q3-text: #14161F;
  --alert: #FF4660;
  --danger: #D92D20;
  --r-block: 26px;
  --r-card: 20px;
  --r-btn: 14px;
  --r-input: 12px;
  --font-head: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, sans-serif;
  --shadow: 0 1px 2px rgba(20, 22, 31, .04), 0 8px 24px rgba(20, 22, 31, .06);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--ink); }
h1, h2, h3, p { margin: 0; }
img, svg { display: block; }
[hidden] { display: none !important; }

/* ---------- Typografie ---------- */
.t-display {
  font-family: var(--font-head);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.98;
  font-size: clamp(36px, 10vw, 44px);
}
.t-title {
  font-family: var(--font-head);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-size: 22px;
}
.t-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.t-muted { color: var(--muted); }
.t-small { font-size: 13px; }
.t-num {
  font-family: var(--font-head);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout ---------- */
.page { max-width: 560px; margin: 0 auto; padding-bottom: 32px; }
.page--wide { max-width: 1400px; }

.head {
  background: var(--card);
  color: var(--ink);
  padding: 18px 20px 24px;
  border-radius: 0 0 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(20, 22, 31, .05);
  position: relative;
  z-index: 2;
}
.head__bar { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.head__brand { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; white-space: nowrap; }
.head__title { margin-top: 8px; }
.head__sub { color: var(--ink-2); font-size: 15px; line-height: 1.4; }
.head__timer { display: flex; align-items: baseline; gap: 6px; }
.head__timer small { font-size: 12px; color: var(--muted); }
.head__timer b { font-family: var(--font-head); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.head__timer.is-done b { color: var(--alert); animation: pulse 1.2s ease-in-out infinite; }

.content { padding: 14px 12px 0; display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--card);
  border-radius: var(--r-card);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card--flat { box-shadow: none; border: 1px solid var(--line); }

/* ---------- Badges / Chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: 999px;
  background: var(--ink); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.badge--soft { background: var(--soft); color: var(--ink); }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  font-weight: 600; font-size: 14px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff;
  font-family: var(--font-head); font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: var(--r-btn);
  font-weight: 700; font-size: 15px;
  background: var(--ink); color: #fff;
  transition: transform .08s ease, opacity .15s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn--block { width: 100%; }
.btn--lg { min-height: 56px; font-size: 16px; border-radius: 16px; }
.btn--ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn--soft { background: var(--soft); color: var(--ink); }
.btn--white { background: #fff; color: var(--ink); }
.btn--q1 { background: var(--q1); color: var(--q1-text); }
.btn--q2 { background: var(--q2); color: var(--q2-text); }
.btn--q3 { background: var(--q3); color: var(--q3-text); }
.btn--alert { background: var(--alert); color: #fff; }
.btn--danger { background: transparent; color: var(--danger); border: 1.5px solid currentColor; }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: 13px; border-radius: 12px; }
.btn--icon { width: 48px; min-width: 48px; padding: 0; font-size: 24px; }
.btn--link { background: none; color: var(--ink); text-decoration: underline; min-height: 44px; padding: 0 8px; font-weight: 700; }

/* ---------- Inputs ---------- */
.input {
  width: 100%; min-height: 48px; padding: 0 16px;
  border-radius: var(--r-input); border: 1.5px solid var(--line);
  background: #fff; color: var(--ink); font-size: 16px;
  outline: none;
}
.input:focus { border-color: var(--ink); }
.input::placeholder { color: var(--muted); }
textarea.input { min-height: 110px; padding: 12px 16px; resize: vertical; line-height: 1.4; }
.select {
  appearance: none; -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2314161F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 14px center;
  padding-right: 40px;
}

/* ---------- Segment (Schalter) ---------- */
.seg {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px;
  background: var(--soft); border-radius: 14px; padding: 4px;
}
.seg__btn {
  min-height: 44px; border-radius: 11px;
  font-size: 13px; font-weight: 700; color: var(--muted);
  -webkit-tap-highlight-color: transparent;
}
.seg__btn[aria-checked="true"] { background: var(--ink); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); }

/* ---------- Fragen-Farben ---------- */
.q-1 { --qbg: var(--q1); --qtext: var(--q1-text); --qchip: rgba(255,255,255,.55); --qchip2: rgba(255,255,255,.75); }
.q-2 { --qbg: var(--q2); --qtext: var(--q2-text); --qchip: rgba(255,255,255,.18); --qchip2: rgba(255,255,255,.3); }
.q-3 { --qbg: var(--q3); --qtext: var(--q3-text); --qchip: rgba(255,255,255,.5);  --qchip2: rgba(255,255,255,.7); }

/* ---------- Diverses ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.center { text-align: center; }
.spacer { flex: 1; }
.hr { height: 1px; background: var(--line); margin: 6px 0; }
.lock { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; z-index: 50; max-width: calc(100vw - 32px);
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--error { background: var(--danger); }

.offline {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  background: #fff; color: var(--ink); border: 1.5px solid var(--line);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; z-index: 60;
  display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow);
}
.offline .dot { background: var(--alert); animation: pulse 1s ease-in-out infinite; }

.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes rise { 0% { transform: translateY(10px); opacity: 0; } 100% { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
