:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --wait: #b45309;
  --wait-soft: #fef3c7;
  --go: #15803d;
  --go-soft: #dcfce7;
  --danger: #dc2626;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #273449;
    --accent: #3b82f6;
    --accent-soft: #1e3a5f;
    --wait-soft: #422006;
    --go-soft: #052e16;
    --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.app {
  max-width: 600px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 14px calc(28px + env(safe-area-inset-bottom));
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 16px;
}
.topbar h1 { margin: 0; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }

/* Buttons */
button { font-family: inherit; cursor: pointer; border: none; }
.primary {
  background: var(--accent); color: #fff;
  padding: 12px 18px; border-radius: 12px;
  font-size: 1rem; font-weight: 600;
}
.primary:active { filter: brightness(.94); }

.icon-btn {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 999px;
  font-size: .82rem; font-weight: 600;
}
.icon-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.icon-btn.hidden-el { display: none; }

.link {
  background: none; color: var(--accent);
  font-size: .88rem; font-weight: 600; padding: 4px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.hidden { display: none; }

label { display: block; font-weight: 600; margin-bottom: 8px; }

/* Namens-Schritt hervorheben */
.name-card { border-color: var(--accent); }
.step-badge {
  display: inline-block; margin-bottom: 10px;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: 3px 10px; border-radius: 999px;
}

/* Umfrage gesperrt, solange kein Name */
.poll-locked {
  margin: 0 0 4px; padding: 10px 12px;
  background: var(--surface-2); border: 1px dashed var(--border);
  border-radius: 10px; color: var(--muted); font-size: .88rem; text-align: center;
}
.poll.needs-name .options,
.poll.needs-name .live-actions { opacity: .4; pointer-events: none; }
.row { display: flex; gap: 8px; }
input[type="text"] {
  flex: 1; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2); color: var(--text); font-size: 1rem;
}
input[type="text"]:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.hint { color: var(--muted); font-size: .82rem; margin: 10px 0 0; }

/* Me bar */
.me-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 6px 12px; font-size: .9rem; color: var(--muted);
}
.me-bar strong { color: var(--text); }

/* Day strip */
.day-strip {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 4px 2px 14px; margin: 0 -2px;
  scrollbar-width: none;
}
.day-strip::-webkit-scrollbar { display: none; }
.day-btn {
  flex: 0 0 auto;
  min-width: 58px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 8px 10px; text-align: center;
  display: flex; flex-direction: column; gap: 2px;
}
.day-btn .dow { font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; }
.day-btn .dnum { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.day-btn.active { background: var(--accent); border-color: var(--accent); }
.day-btn.active .dow, .day-btn.active .dnum { color: #fff; }
.day-btn.today:not(.active) { border-color: var(--accent); }

/* Poll */
.poll-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.poll-head h2 { margin: 0; font-size: 1.1rem; }
.poll-count { color: var(--muted); font-size: .85rem; }

.options { display: flex; flex-direction: column; gap: 10px; }
.options.locked .option-top { cursor: default; }
.options.locked .check { display: none; }

.option {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
  transition: border-color .12s, background .12s;
}
.option.mine { border-color: var(--accent); background: var(--accent-soft); }

.option-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  cursor: pointer;
}
.option-label { font-weight: 600; }
.option-meta { display: flex; align-items: center; gap: 10px; }
.option-num {
  min-width: 26px; height: 26px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; font-size: .82rem; font-weight: 700; color: var(--muted);
}
.option.mine .option-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border); flex: 0 0 auto;
}
.option.mine .check { border-color: var(--accent); background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--accent-soft); }

.voters {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
}
.voters:empty { display: none; }
.chip {
  font-size: .78rem; padding: 3px 9px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
}
.chip.me { color: var(--accent); border-color: var(--accent); }
.chip .tag { font-weight: 700; }
.chip.wait .tag { color: var(--wait); }
.chip.go .tag { color: var(--go); }

/* Live actions */
.live-actions { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.live-actions.hidden { display: none; }
.live-label { margin: 0 0 10px; font-size: .8rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em; }
.live-note { font-weight: 500; text-transform: none; letter-spacing: 0; }
.status:disabled, .clear-link.disabled { opacity: .45; cursor: default; }
.status-row { display: flex; gap: 10px; }
.status {
  flex: 1; padding: 13px 10px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-weight: 600; font-size: .95rem;
}
#btn-wait.active { background: var(--wait-soft); border-color: var(--wait); color: var(--wait); }
#btn-go.active { background: var(--go-soft); border-color: var(--go); color: var(--go); }
.clear-link { display: block; margin: 10px auto 0; color: var(--danger); }

/* Empty */
.empty { color: var(--muted); text-align: center; padding: 10px 0; }

/* Footer */
.footer { text-align: center; margin-top: 6px; }
.conn { font-size: .78rem; color: var(--muted); }
.conn::before { content: "•  "; }
.conn.online { color: var(--go); }
.conn.offline { color: var(--danger); }
.legal { margin-top: 8px; font-size: .78rem; }
.legal a { color: var(--muted); text-decoration: none; }
.legal a:hover { text-decoration: underline; }
.legal .sep { color: var(--border); margin: 0 6px; }
