/* ==========================================================================
   Mensch / Maschine – Basis + Gästeansicht (mobile first, dunkel)
   ========================================================================== */

@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/urbanist-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/urbanist-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Farben nach aheadx.at: tiefes Violett, warmes Amber, Lavendel. */
:root {
  --bg: #160c2e;
  --bg-2: #1b1038;
  --surface: #211641;
  --surface-2: #2a1a52;
  --surface-3: #3a2870;
  --line: #36265f;
  --text: #f3effa;
  --muted: #b3a6d6;
  --faint: #8375ad;

  --accent: #f0ad4e;
  --accent-ink: #211641;

  --human: #f0ad4e;
  --human-ink: #211641;
  --human-soft: rgba(240, 173, 78, 0.15);
  --machine: #a48bff;
  --machine-ink: #160c2e;
  --machine-soft: rgba(164, 139, 255, 0.16);
  --live: #ff5a6e;
  --ok: #5fe3a1;
  --ok-ink: #062b18;
  --warn: #f0ad4e;

  --radius: 18px;
  --radius-sm: 12px;
  --sans: "Urbanist", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg) linear-gradient(180deg, var(--surface) 0%, var(--bg) 70%) no-repeat fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

h1, h2, h3, p { margin: 0; }
svg { display: block; }

.serif { font-family: var(--serif); font-style: italic; font-weight: 500; letter-spacing: .005em; }
.muted { color: var(--muted); }
.center { text-align: center; }
.noscript { padding: 24px; text-align: center; }

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-weight: 600;
  text-decoration: none;
  transition: transform .12s var(--ease), background .2s, opacity .2s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
a.btn { color: var(--text); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .35; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 750; }
/* Stimmabgabe hell statt Amber – Amber steht im Formular für „Mensch“. */
.btn-light { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 750; }
.btn-block { width: 100%; min-height: 60px; font-size: 18px; border-radius: 16px; }

/* ---------- Spinner ---------- */

.spinner {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid var(--surface-3);
  border-top-color: var(--text);
  animation: spin .8s linear infinite;
}
.spinner.big { width: 44px; height: 44px; border-width: 4px; margin-bottom: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Gäste
   ========================================================================== */

.guest { display: flex; flex-direction: column; }

.g-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 6px;
}
.brand {
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.brand i { font-style: normal; color: var(--faint); padding: 0 .15em; }
.g-meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.g-main {
  flex: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 24px);
}

.screen { display: flex; flex-direction: column; gap: 18px; min-height: calc(100dvh - 90px); }
.screen.enter { animation: enter .42s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.center-block { margin: auto; display: grid; justify-items: center; gap: 14px; }

.hero { display: grid; gap: 10px; padding: 28px 4px 4px; }
.hero.compact { padding-top: 16px; }
.hero h1 {
  font-size: clamp(34px, 10vw, 46px);
  line-height: 1.02;
  font-weight: 750;
  letter-spacing: -.025em;
}
.lead { font-size: 19px; line-height: 1.4; color: var(--text); opacity: .92; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card.quiet { background: var(--bg-2); display: grid; gap: 6px; text-align: center; }
.card.upnext { display: grid; gap: 6px; }

.poet-name {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 500;
}
.poet-name.xl { font-size: clamp(40px, 12vw, 56px); margin: 6px 0 4px; }

.count { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

.note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 15px;
}
.note svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.note.ok { border-color: rgba(95, 227, 161, .35); background: rgba(95, 227, 161, .08); }
.note.ok svg { color: var(--ok); }
.note small { display: block; color: var(--muted); margin-top: 2px; font-size: 13px; }

.howto {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.howto li {
  counter-increment: step;
  position: relative;
  padding: 14px 14px 14px 54px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 15px;
}
.howto li b { color: var(--text); }
.howto li::before {
  content: counter(step);
  position: absolute;
  left: 14px; top: 50%;
  translate: 0 -50%;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
}

.progress { display: flex; gap: 8px; justify-content: center; margin-top: auto; padding-top: 12px; }
.progress .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); }
.progress .dot.done { background: var(--text); }
.progress .dot.performing, .progress .dot.voting, .progress .dot.closed { background: var(--live); box-shadow: 0 0 0 4px rgba(255, 90, 110, .2); }

/* ---------- Live ---------- */

.hero.live { padding-top: 36px; }
.live-chip {
  justify-self: start;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: rgba(255, 90, 110, .14);
  color: var(--live);
  font-size: 13px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase;
}
.live-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--live); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

.wave { display: flex; gap: 5px; align-items: center; height: 44px; margin: 8px 0 10px; }
.wave i {
  width: 5px; height: 100%;
  border-radius: 3px;
  background: var(--text);
  opacity: .8;
  transform-origin: center;
  animation: wave 1.2s ease-in-out infinite;
}
.wave i:nth-child(2n) { animation-delay: -.3s; }
.wave i:nth-child(3n) { animation-delay: -.6s; }
.wave i:nth-child(4n) { animation-delay: -.9s; }
@keyframes wave { 0%, 100% { transform: scaleY(.2); } 50% { transform: scaleY(1); } }

/* ---------- Voting ---------- */

.screen-vote { gap: 14px; }

.timer {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -16px;
  padding: 10px 16px 12px;
  background: rgba(22, 12, 46, .9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.timer-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.timer-label { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-label .serif { color: var(--text); }
.timer-num { font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 4px; }
.timer-num b { font-size: 34px; line-height: 1; font-weight: 800; letter-spacing: -.02em; }
.timer-num small { color: var(--muted); font-size: 13px; }
.timer-bar { height: 6px; margin-top: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.timer-bar i { display: block; height: 100%; background: var(--text); transform-origin: left; transition: transform .25s linear; }
.timer.urgent .timer-num b { color: var(--live); }
.timer.urgent .timer-bar i { background: var(--live); }

.q { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.q legend {
  display: flex; align-items: center; gap: 10px;
  padding: 0; margin-bottom: 10px;
  font-size: 20px; font-weight: 700; letter-spacing: -.01em;
}
.q-num {
  width: 24px; height: 24px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3);
  font-size: 13px; font-weight: 750;
}

.rating { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rating button {
  height: 58px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 23px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: transform .14s var(--ease), background .15s, color .15s, border-color .15s;
  touch-action: manipulation;
}
.rating button:active { transform: scale(.94); }
.rating button[aria-checked="true"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  transform: scale(1.05);
  box-shadow: 0 6px 22px rgba(243, 239, 250, .18);
}
.scale { display: flex; justify-content: space-between; font-size: 13px; color: var(--faint); }

.guess { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.guess button {
  display: grid; justify-items: center; gap: 8px;
  padding: 16px 8px;
  min-height: 104px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 17px; font-weight: 700;
  transition: transform .14s var(--ease), background .15s, color .15s, border-color .15s;
  touch-action: manipulation;
}
.guess button svg { width: 34px; height: 34px; }
.guess button:active { transform: scale(.97); }
.guess .human svg { color: var(--human); }
.guess .ai svg { color: var(--machine); }
.guess .human[aria-checked="true"] { background: var(--human); border-color: var(--human); color: var(--human-ink); }
.guess .ai[aria-checked="true"] { background: var(--machine); border-color: var(--machine); color: var(--machine-ink); }
.guess button[aria-checked="true"] svg { color: currentColor; }

.submit { margin-top: 4px; }
.hint { text-align: center; font-size: 14px; color: var(--muted); min-height: 1.4em; }

/* ---------- Gespeichert ---------- */

.hero.done { justify-items: center; text-align: center; padding-top: 44px; }
.check-circle {
  width: 84px; height: 84px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ok);
  color: var(--ok-ink);
  margin-bottom: 8px;
  animation: pop .5s var(--ease) both;
}
.check-circle svg { width: 44px; height: 44px; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }

.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 15px; font-weight: 650;
}
.chip svg { width: 18px; height: 18px; }
.chip.human { color: var(--human); background: var(--human-soft); border-color: transparent; }
.chip.ai { color: var(--machine); background: var(--machine-soft); border-color: transparent; }

/* ---------- Rangliste ---------- */

.ranking, .reveals { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rank-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  animation: enter .5s var(--ease) both;
}
.rank-row:nth-child(2) { animation-delay: .06s; }
.rank-row:nth-child(3) { animation-delay: .12s; }
.rank-row:nth-child(4) { animation-delay: .18s; }
.rank { font-size: 22px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank svg { width: 30px; height: 30px; color: var(--warn); }
.rank-name { display: grid; min-width: 0; }
.rank-name .serif { font-size: 21px; line-height: 1.15; overflow-wrap: anywhere; }
.rank-name small { color: var(--muted); font-size: 13px; }
.rank-avg { text-align: right; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.rank-avg small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.rank-row.winner { background: linear-gradient(135deg, rgba(240, 173, 78, .16), rgba(240, 173, 78, .03)); border-color: rgba(240, 173, 78, .4); }

/* ---------- Auflösung ---------- */

.score {
  display: flex; align-items: baseline; justify-content: center; gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.score b { font-size: 30px; font-weight: 800; }
.score span { color: var(--muted); }

.reveal-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color .3s, background .3s;
}
.reveal-row.revealed.human { border-color: rgba(240, 173, 78, .45); background: linear-gradient(135deg, var(--human-soft), transparent); }
.reveal-row.revealed.ai { border-color: rgba(164, 139, 255, .4); background: linear-gradient(135deg, var(--machine-soft), transparent); }
.reveal-main { display: grid; gap: 2px; min-width: 0; }
.reveal-main .serif { font-size: 20px; line-height: 1.15; overflow-wrap: anywhere; }
.reveal-main small { color: var(--muted); font-size: 13px; }
.reveal-main small.hit { color: var(--ok); font-weight: 650; }
.reveal-main small.miss { color: var(--live); font-weight: 650; }

.badge {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.badge svg { width: 18px; height: 18px; }
.badge.unknown { background: var(--surface-3); color: var(--muted); font-size: 18px; padding: 6px 16px; }
.badge.human { background: var(--human); color: var(--human-ink); animation: pop .5s var(--ease) both; }
.badge.ai { background: var(--machine); color: var(--machine-ink); animation: pop .5s var(--ease) both; }

/* ---------- Duell & Finale ---------- */

.duel-card { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-align: center; animation: pop .5s var(--ease) both; }
.duel-card.human { border-color: rgba(240, 173, 78, .5); }
.duel-card.ai { border-color: rgba(164, 139, 255, .45); }
.duel-sides { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.duel-sides .side { display: grid; justify-items: center; gap: 2px; }
.duel-sides .side svg { width: 26px; height: 26px; }
.duel-sides .side span { font-size: 12px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.duel-sides .side b { font-size: 34px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.duel-sides .human svg, .duel-sides .human b { color: var(--human); }
.duel-sides .ai svg, .duel-sides .ai b { color: var(--machine); }
.duel-sides .vs { font-size: 24px; color: var(--faint); font-weight: 800; }
.duel-lead { font-size: 20px; font-weight: 800; }
.duel-card.human .duel-lead { color: var(--human); }
.duel-card.ai .duel-lead { color: var(--machine); }

.score.big { flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.score.big b { font-size: 36px; }
.finale-stat { display: grid; gap: 4px; }
.finale-stat b { font-size: 44px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.finale-stat.small b { font-size: 30px; color: var(--machine); }
.finale-stat span { color: var(--muted); }

.winner-stamp {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 20px; border-radius: 12px;
  font-size: 30px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase;
  animation: pop .6s var(--ease) both;
}
.winner-stamp svg { width: 30px; height: 30px; }
.winner-stamp.human { background: var(--human); color: var(--human-ink); }
.winner-stamp.ai { background: var(--machine); color: var(--machine-ink); }
.hero.finale h1 { font-size: 34px; }

/* ---------- Verbindungsbanner ---------- */

.conn {
  position: fixed;
  z-index: 50;
  left: 12px; right: 12px;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  max-width: 496px;
  margin: 0 auto;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: 16px;
  background: #2a1d3f;
  border: 1px solid rgba(240, 173, 78, .35);
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  animation: enter .3s var(--ease) both;
}
.conn svg { width: 22px; height: 22px; flex: none; color: var(--warn); }
.conn b { display: block; }
.conn[hidden] { display: none; }

@media (max-height: 640px) {
  .rating button { height: 50px; font-size: 21px; }
  .guess button { min-height: 86px; padding: 12px 8px; }
  .guess button svg { width: 28px; height: 28px; }
  .q legend { font-size: 18px; margin-bottom: 6px; }
  .hero { padding-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
