/* ───────────────────────────────────────────────────────────────
   Werwolf von Düsterwald — dunkles, atmosphärisches Theme.
   Mobile-First, große Touch-Targets, bewusst reduzierte Palette.
   ─────────────────────────────────────────────────────────────── */

:root {
  --bg-0:      #0b0d10;   /* Mondnacht */
  --bg-1:      #14181d;   /* Karton-Hintergrund */
  --bg-2:      #1c2229;   /* erhöhte Karte */
  --line:      #2a323c;
  --ink:       #f3e9d2;   /* warmes Pergament */
  --ink-soft:  #b9b09a;
  --ink-mute:  #6e6957;
  --accent:    #c84c2c;   /* Blut / Fackelschein */
  --accent-2:  #a98349;   /* Bronze */
  --moon:      #d8e5ee;
  --good:      #6fa86f;
  --bad:       #c84c2c;
  --shadow:    0 10px 30px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.4);
  --radius:    14px;
  --tap:       54px;       /* Mindesthöhe für Touch-Targets */
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 800px at 50% -10%, #1d2630 0%, #0b0d10 60%) fixed,
    var(--bg-0);
  color: var(--ink);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1, h2, h3 {
  font-family: 'Cinzel', 'Trajan Pro', Georgia, serif;
  letter-spacing: .02em;
  font-weight: 600;
  margin: 0 0 .4em 0;
  color: var(--ink);
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; color: var(--ink-soft); }

p { margin: .4em 0; line-height: 1.45; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--ink); }

main {
  max-width: 540px;
  margin: 0 auto;
  padding: 18px 14px 60px 14px;
}

.brand {
  position: relative;
  text-align: center;
  padding: 10px 0 6px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.sound-toggle {
  position: absolute;
  top: 8px;
  right: 4px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 38px; height: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 1rem;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sound-toggle:hover { border-color: var(--accent-2); color: var(--ink); }
.sound-toggle.muted { opacity: .55; }

.reset-btn {
  position: absolute;
  top: 8px;
  left: 4px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  height: 38px;
  min-height: 38px;
  font-size: .85rem;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.reset-btn:hover { border-color: var(--accent); color: var(--accent); }
.brand .moon { font-size: 1.5rem; }
.brand .name {
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: .25em;
  text-transform: uppercase;
  font-size: .85rem;
  color: var(--ink-soft);
}

.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
  box-shadow: var(--shadow);
}

.card.elev { background: var(--bg-2); }

.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px;
}
.qr-wrap img {
  width: min(78vw, 360px);
  height: auto;
  display: block;
  border-radius: 10px;
  background: #f3e9d2;
  padding: 10px;
}

.url-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  width: 100%;
  margin-top: 6px;
}
.url-row input {
  flex: 1;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: 10px 12px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .92rem;
  min-width: 0;
}

button, .btn {
  appearance: none;
  background: var(--bg-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  min-height: var(--tap);
  cursor: pointer;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
  letter-spacing: .02em;
  font-family: inherit;
}
button:hover:not(:disabled), .btn:hover { border-color: var(--accent-2); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; }

button.primary, .btn.primary {
  background: linear-gradient(180deg, var(--accent) 0%, #8a3621 100%);
  border-color: #5e2415;
  color: #fff;
}
button.primary:hover:not(:disabled) { border-color: var(--ink); }
button.ghost { background: transparent; }

input[type="text"] {
  appearance: none;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  padding: 14px 16px;
  font-size: 1.05rem;
  width: 100%;
  min-height: var(--tap);
  font-family: inherit;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-2);
}

.player-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.player-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
}
.player-list li > span:not(.dot) {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}
.player-list li.dead {
  text-decoration: line-through;
  color: var(--ink-mute);
  opacity: .7;
}
.player-list .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bad);
  flex-shrink: 0;
}
.player-list .dot.online { background: var(--good); }

.empty {
  color: var(--ink-mute);
  font-style: italic;
  padding: 6px 2px;
}

.flash {
  background: rgba(200, 76, 44, .12);
  border: 1px solid var(--accent);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
}
.flash.ok {
  background: rgba(111, 168, 111, .12);
  border-color: var(--good);
}

.hint {
  color: var(--ink-soft);
  font-size: .92rem;
}

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.center { text-align: center; }
.muted { color: var(--ink-mute); }

.kbd {
  font-family: ui-monospace, Menlo, monospace;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: .9em;
}

.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 8px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Rollen-Konfiguration ─ Stepper-Liste */
.role-config {
  display: grid;
  gap: 8px;
  margin: 8px 0;
}
.role-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.role-row .meta { min-width: 0; }
.role-row .role-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.role-row .role-team {
  display: inline-block;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.role-row .role-team.werewolf {
  color: var(--accent);
  border-color: rgba(200, 76, 44, .5);
  background: rgba(200, 76, 44, .08);
}
.role-row .role-team.village {
  color: var(--moon);
  border-color: rgba(216, 229, 238, .25);
  background: rgba(216, 229, 238, .05);
}
.role-row .role-desc {
  font-size: .85rem;
  color: var(--ink-soft);
  margin-top: 2px;
  line-height: 1.35;
}
.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.stepper button {
  min-height: 40px;
  min-width: 40px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink);
}
.stepper button:disabled { color: var(--ink-mute); }
.stepper .count {
  min-width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0 6px;
}

.config-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: .9rem;
  color: var(--ink-soft);
}
.config-summary .pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.config-summary .pill.ok { border-color: var(--good); color: var(--good); }
.config-summary .pill.bad { border-color: var(--bad); color: var(--bad); }

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  margin-top: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.toggle-row input[type="checkbox"] {
  width: 22px; height: 22px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.toggle-row .toggle-text { flex: 1; }
.toggle-row .toggle-text .hint { margin-top: 3px; font-size: .85rem; }
.toggle-row:hover { border-color: var(--accent-2); }

/* Analog-Mode Spieler-Status-Toggle im Dashboard */
.player-list li button.alive-toggle {
  margin-left: auto;
  flex-shrink: 0;
  min-height: 28px;
  padding: 2px 10px;
  font-size: .75rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 600;
}
.player-list li button.alive-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* Rollenkarte für den Spieler ─ groß, atmosphärisch */
.role-card {
  position: relative;
  border-radius: 18px;
  padding: 28px 22px;
  text-align: center;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0,0,0,.55), inset 0 0 60px rgba(0,0,0,.4);
  overflow: hidden;
}
.role-card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(closest-side, rgba(255,255,255,.08), transparent 70%);
  pointer-events: none;
}
.role-card.team-village {
  background: linear-gradient(160deg, #1f2a36 0%, #0e1620 100%);
}
.role-card.team-werewolf {
  background: linear-gradient(160deg, #3a1410 0%, #150707 100%);
  border-color: rgba(200, 76, 44, .45);
}
.role-card .glyph {
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 4px 14px rgba(0,0,0,.6));
}
.role-card .role-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.7rem;
  letter-spacing: .04em;
  margin: 14px 0 4px 0;
}
.role-card .role-team-label {
  text-transform: uppercase;
  letter-spacing: .25em;
  font-size: .8rem;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
.role-card.team-werewolf .role-team-label { color: var(--accent); }
.role-card .role-desc {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  max-width: 36ch;
  margin: 0 auto;
}
.role-card .role-warning {
  margin-top: 18px;
  font-size: .82rem;
  color: var(--ink-mute);
}

/* Verdeckte Rollenkarte — Default-State, damit niemand spickt. */
.role-card { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.role-card .face-back { display: none; }
.role-card.face-down .face-front { display: none; }
.role-card.face-down .face-back {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 280px;
}
.role-card.face-down {
  /* Generischer "Buchrücken"-Look — verrät weder Team noch Rolle. */
  background: linear-gradient(160deg, #1c2229 0%, #0a0d10 100%) !important;
  border-color: rgba(216, 180, 120, .35) !important;
}
.role-card.face-down .glyph {
  filter: drop-shadow(0 4px 14px rgba(216, 180, 120, .25));
  opacity: .9;
}
.role-card.face-down .back-title {
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: .15em;
  text-transform: uppercase;
  font-size: .9rem;
  color: var(--ink-soft);
}
.role-card.face-down .back-hint {
  color: var(--ink-mute);
  font-size: .85rem;
  letter-spacing: .04em;
}
.role-card .face { transition: opacity .25s ease; }
/* Sanfter Fade beim Umdrehen */
.role-card .face-front { animation: fade-in .25s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.assignments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

/* Auswahl-Liste (z. B. Amor wählt Liebespaar, Wolfsopfer, Seherin etc.) */
.pick-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.pick-list li {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  min-height: var(--tap);
  transition: border-color .15s ease, background .15s ease;
}
.pick-list li:hover { border-color: var(--accent-2); }
.pick-list li.selected {
  border-color: var(--accent);
  background: rgba(200, 76, 44, .12);
  color: #fff;
}
.pick-list li.selected::after {
  content: attr(data-badge);
  position: absolute;
  top: 6px; right: 8px;
  font-size: .7rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--accent);
}
.pick-list li.disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* Nacht-Hintergrund: dunkelt die Karte stärker ab und gibt Mond-Akzent */
.night-card {
  background: linear-gradient(160deg, #0d141d 0%, #060a10 100%);
  border-color: rgba(216, 229, 238, .15);
}
.night-card .night-title {
  font-family: 'Cinzel', Georgia, serif;
  display: flex; align-items: center; gap: 10px;
  font-size: 1.15rem;
  margin-bottom: 6px;
}

/* Liebespaar-Reveal — warme, aber gedämpfte Karte */
.lovers-card {
  background: linear-gradient(160deg, #2a1421 0%, #160712 100%);
  border-color: rgba(200, 76, 100, .35);
}
.lovers-card .heart {
  font-size: 48px;
  text-align: center;
  filter: drop-shadow(0 4px 14px rgba(200,76,100,.4));
}
.lovers-card .partner-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.5rem;
  text-align: center;
  margin: 8px 0 4px 0;
}
.lovers-card .partner-role {
  text-align: center;
  color: var(--ink-soft);
  font-size: .9rem;
}

/* Wolf-Pick-Indikatoren — Stimmenzähler an den Kacheln */
.pick-list li .vote-tags {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
}
.pick-list li .vote-tag {
  font-size: .65rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(200, 76, 44, .25);
  color: #fff;
  letter-spacing: .04em;
}
.pick-list li.consensus {
  border-color: var(--good);
  box-shadow: 0 0 0 2px rgba(111, 168, 111, .25);
}

/* Werwolf-Chat */
.wolf-chat {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}
.wolf-chat-log {
  max-height: 180px;
  overflow-y: auto;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: .9rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wolf-chat-log .msg {
  line-height: 1.35;
}
.wolf-chat-log .msg .who {
  color: var(--accent);
  font-weight: 600;
  margin-right: 6px;
}
.wolf-chat-log .empty {
  color: var(--ink-mute);
  font-style: italic;
}
.wolf-chat-input {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.wolf-chat-input input {
  flex: 1;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: 10px 12px;
  font-size: .92rem;
  min-width: 0;
}
.wolf-chat-input button {
  min-height: 44px;
  padding: 0 14px;
}

/* Hexe: Aktions-Bereich */
.witch-victim {
  background: var(--bg-2);
  border: 1px solid rgba(200, 76, 44, .3);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  text-align: center;
}
.witch-victim .victim-label {
  text-transform: uppercase;
  letter-spacing: .15em;
  font-size: .75rem;
  color: var(--ink-mute);
}
.witch-victim .victim-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.4rem;
  margin-top: 4px;
}
.witch-actions {
  display: grid;
  gap: 10px;
}
.witch-action {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.witch-action button {
  width: 100%;
}
.witch-action .hint {
  margin-top: 6px;
  font-size: .85rem;
}
.witch-action.used button {
  opacity: .5;
  cursor: not-allowed;
}

/* Reveal-Karte (Seherin enthüllt) */
.reveal-card {
  margin-top: 14px;
  background: linear-gradient(160deg, #1a2330 0%, #0a1018 100%);
  border: 1px solid rgba(216, 229, 238, .25);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
}
.reveal-card .glyph {
  font-size: 40px;
  filter: drop-shadow(0 4px 14px rgba(0,0,0,.6));
}
.reveal-card .name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.3rem;
  margin: 6px 0 2px 0;
}
.reveal-card .role-line {
  color: var(--ink-soft);
}
.reveal-card.team-werewolf {
  background: linear-gradient(160deg, #2a1410 0%, #100706 100%);
  border-color: rgba(200, 76, 44, .4);
}
.reveal-card.team-werewolf .role-line { color: var(--accent); }

/* Tag-Phase: warmes Licht statt Mondnacht */
.day-card {
  background: linear-gradient(160deg, #2a1c0e 0%, #150e07 100%);
  border-color: rgba(216, 180, 120, .25);
}
.day-card .day-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.2rem;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}

/* Verkündete Toten */
.death-card {
  background: rgba(20, 8, 8, .7);
  border: 1px solid rgba(200, 76, 44, .4);
  border-radius: 10px;
  padding: 14px;
  margin: 8px 0;
  display: flex;
  gap: 12px;
  align-items: center;
}
.death-card .skull { font-size: 28px; }
.death-card .who { flex: 1; }
.death-card .who b { font-family: 'Cinzel', Georgia, serif; font-size: 1.1rem; }

/* Captain-Badge an Spielerkacheln */
.player-list li.captain::before,
.pick-list  li.captain::before {
  content: '👑';
  position: absolute;
  top: 4px; left: 6px;
  font-size: .8rem;
}
.player-list li, .pick-list li { position: relative; }

/* Vote-Anzeige in der Pick-List bei Tagesabstimmung — wie Wolf-Update */
.pick-list li .vote-count {
  position: absolute;
  top: 6px; right: 8px;
  background: var(--accent-2);
  color: #1a1208;
  font-weight: 700;
  font-size: .75rem;
  padding: 2px 8px;
  border-radius: 999px;
}
.pick-list li.consensus { box-shadow: 0 0 0 2px rgba(111, 168, 111, .25); }

/* Game-Over-Banner */
.gameover-banner {
  text-align: center;
  padding: 30px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  font-family: 'Cinzel', Georgia, serif;
}
.gameover-banner.village  { background: linear-gradient(160deg, #1a2a36 0%, #0a1218 100%); border: 1px solid rgba(216, 229, 238, .3); }
.gameover-banner.werewolf { background: linear-gradient(160deg, #3a1410 0%, #150707 100%); border: 1px solid rgba(200, 76, 44, .5); }
.gameover-banner.lovers   { background: linear-gradient(160deg, #2a1421 0%, #160712 100%); border: 1px solid rgba(200, 76, 100, .5); }
.gameover-banner .glyph { font-size: 64px; line-height: 1; }
.gameover-banner h1 { letter-spacing: .04em; margin: 14px 0 4px 0; }
.gameover-banner .subtitle { color: var(--ink-soft); font-family: inherit; font-size: 1rem; }

/* "Du bist gerade nicht dran" — passive Wartekarte */
.idle-night {
  text-align: center;
  padding: 40px 20px;
}
.idle-night .moon-big {
  font-size: 56px;
  margin-bottom: 10px;
  opacity: .8;
}
.idle-night .idle-msg {
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.status-pill.ok .dot { background: var(--good); }
