:root {
  --bg: #14161c;
  --card: #1f232c;
  --line: #343b49;
  --fg: #f2f2f2;
  --muted: #9aa3b2;
  --accent: #e8b04a;
  --early: #6cb6f0;
  --late: #f08c5c;
  --ok: #5cc489;
  --err: #ff8a8a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, p { margin: 0; }
.muted { color: var(--muted); }
.error { color: var(--err); min-height: 1.3em; }
.hidden { display: none !important; }

button {
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px 22px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #1a1a1a;
  cursor: pointer;
  touch-action: manipulation;
}
button.secondary { background: var(--line); color: var(--fg); }
button.danger { background: #8e2f2f; color: #fff; }
button:disabled { opacity: .45; cursor: default; }

input {
  font: inherit;
  font-size: 1.2rem;
  padding: 14px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
}

.diff.early { color: var(--early); }
.diff.late  { color: var(--late); }

/* ---------- Teilnehmer-Seite ---------- */

.wrap {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
}

.top { text-align: center; position: relative; }
.top h1 { font-size: 1.3rem; line-height: 40px; }
.fs-mini {
  position: absolute;
  right: 0;
  top: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.2rem;
  border-radius: 10px;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  text-align: center;
}
.screen.active { display: flex; }

.big-text { font-size: 1.6rem; font-weight: 700; line-height: 1.3; }

.press-btn {
  width: min(78vw, 320px);
  height: min(78vw, 320px);
  margin: 0 auto;
  border-radius: 50%;
  font-size: 2.4rem;
  box-shadow: 0 0 0 12px rgba(232, 176, 74, .18);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.press-btn:active { transform: scale(.97); }

.result-rank { font-size: 3.2rem; font-weight: 800; }
.result-line { font-size: 1.3rem; }

.status-line { text-align: center; font-size: .85rem; color: var(--muted); min-height: 1.2em; }

/* ---------- Leiter-Seite ---------- */

.leiter { display: flex; flex-direction: column; min-height: 100vh; }

.bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.bar h1 { font-size: 1.2rem; margin-right: auto; }
.pill { padding: 4px 12px; border-radius: 999px; background: var(--line); font-size: .95rem; }
.pill.running { background: var(--accent); color: #1a1a1a; }
.pill.done { background: var(--ok); color: #1a1a1a; }

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 30px 20px;
  text-align: center;
}

.stage .huge { font-size: clamp(2rem, 5vw, 4rem); font-weight: 800; }
.stage .large { font-size: clamp(1.3rem, 2.6vw, 2.2rem); }

.join-box { display: flex; gap: 40px; align-items: center; justify-content: center; flex-wrap: wrap; }
.join-url { font-size: clamp(1.2rem, 2.6vw, 2.2rem); font-weight: 700; word-break: break-all; }
.qr { background: #fff; padding: 14px; border-radius: 12px; }
.qr img { display: block; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 1100px; }
.chip { padding: 8px 16px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 1.15rem; }
.chip.ok { border-color: var(--ok); color: var(--ok); }

.ranking { width: min(1000px, 100%); border-collapse: collapse; font-size: clamp(1.1rem, 2.2vw, 1.8rem); }
.ranking td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.ranking td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ranking tr.top td { font-weight: 800; }
.ranking tr { opacity: 0; animation: fadeIn .4s ease forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--card);
  border-top: 1px solid var(--line);
}
.controls label { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.controls input { width: 90px; padding: 10px; font-size: 1.1rem; }

.login { max-width: 360px; margin: 15vh auto 0; display: flex; flex-direction: column; gap: 14px; padding: 20px; text-align: center; }
