/* ===== Werwolf Buddy – App-spezifische Styles (Basis aus Blackjack Buddy, Standard-Indigo) ===== */

:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --accent-color: #818cf8;
  --text-color: #f1f5f9;
  --text-muted: rgba(241, 245, 249, 0.55);
  --card-bg: #1e293b;
  --border-color: rgba(255, 255, 255, 0.12);
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0f172a 100%);
  --input-bg: rgba(255, 255, 255, 0.07);
  --win-color: #4ade80;
  --lose-color: #f87171;
  --bj-color: #fbbf24;
  --night-color: #a5b4fc;
  --dead-color: #64748b;
}

body {
  background: var(--bg-gradient);
  min-height: 100vh;
}

/* ===== Screens ===== */
.screen { display: none; }
.screen.active { display: block; }

/* ===== Container ===== */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* ===== Headings ===== */
h1 {
  font-size: 1.75rem;
  font-weight: 800;
  text-align: center;
  margin: 24px 0 8px;
  background: linear-gradient(135deg, var(--accent-color), #e0e7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.center { text-align: center; }
.muted { color: var(--text-muted); }

/* ===== Player name rows ===== */
.player-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.player-name-row .badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== Settings / Regeln & Chips ===== */
.settings-row {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}
.option-block {
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}
.option-block > label {
  display: block;
  color: var(--text-color);
  font-weight: 600;
  font-size: .92rem;
  margin-bottom: 4px;
}
.option-block select,
.option-block input[type="number"] {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: .95rem;
  font-family: inherit;
}
.option-block select { width: 100%; }
.option-block select option { background: var(--card-bg); color: var(--text-color); }
.option-hint { font-size: .8rem; margin-top: 8px; line-height: 1.5; }
.option-hint strong { color: var(--text-color); }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text-color);
  font-weight: 600;
  font-size: .92rem;
}
.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary-color);
  flex-shrink: 0;
}

/* ===== Row actions ===== */
.row-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.row-actions .btn { flex: 1; }

/* ===== Game screen gamebar ===== */
.buddy-gamebar-mode {
  white-space: normal;
  word-break: break-word;
  text-align: right;
}

/* ===== Game actions ===== */
.game-actions-card { margin-top: 12px; }
.finish-btn {
  background: rgba(251,191,36,0.15);
  border: 2px solid var(--bj-color);
  color: var(--bj-color);
  font-weight: 800;
}
.finish-btn:hover { background: rgba(251,191,36,0.3); }

/* ===== Info section ===== */
.info-section {
  margin-top: 16px;
  padding: 16px;
  background: var(--card-bg);
  border-radius: 14px;
  border: 1px solid var(--border-color);
  font-size: .9rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.info-section h3 { color: var(--text-color); margin-bottom: 8px; font-size: 1rem; }
.info-section ul, .info-section ol { padding-left: 18px; margin: 8px 0; }
.info-section li { margin-bottom: 4px; }
.info-section strong { color: var(--text-color); }

/* ===== Feedback section ===== */
.feedback-section { text-align: center; }
.feedback-section h3 { margin-bottom: 6px; }

/* ===== Icon button ===== */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.08); }

/* ===== Rules modal ===== */
.rules-modal-box { max-width: 560px; max-height: 90vh; overflow-y: auto; }
.rules-content h3 { color: var(--text-color); margin: 16px 0 6px; font-size: 1rem; }
.rules-content p, .rules-content li { color: var(--text-muted); font-size: .9rem; line-height: 1.6; }
.rules-content ul, .rules-content ol { padding-left: 18px; margin: 6px 0; }
.rules-content li { margin-bottom: 6px; }
.rules-content strong { color: var(--text-color); }

/* ===== Confetti ===== */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2000;
}
.confetti-piece {
  position: absolute;
  top: -10vh;
  width: 10px;
  height: 18px;
  opacity: 0.9;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0%   { transform: translate3d(0,0,0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(0,120vh,0) rotate(540deg); opacity: 0; }
}

/* ===== Inline spinner ===== */
.spinner-sm {
  display: inline-block;
  border: 2px solid rgba(255,255,255,0.4);
  border-top: 2px solid #fff;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  animation: spin 0.8s linear infinite;
  margin: 0 6px -2px 0;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== Werwolf-spezifisch ===================== */
.beta-badge { display:inline-block; font-size:.62rem; font-weight:800; letter-spacing:.06em; vertical-align:middle;
  padding:3px 7px; border-radius:6px; background:rgba(251,191,36,.18); color:#fbbf24; border:1px solid rgba(251,191,36,.45);
  -webkit-text-fill-color:#fbbf24; }
.count-pill { display:inline-block; min-width:22px; padding:1px 8px; border-radius:999px; background:rgba(99,102,241,.2);
  color:var(--accent-color); font-size:.8rem; font-weight:800; text-align:center; }

/* Spielweisen-Auswahl */
.mode-list { display:flex; flex-direction:column; gap:10px; }
.mode-card { display:flex; align-items:flex-start; gap:12px; width:100%; text-align:left; padding:14px; border-radius:14px;
  background:var(--input-bg); border:2px solid var(--border-color); color:var(--text-color); cursor:pointer; font-family:inherit;
  transition:border-color .15s, background .15s; }
.mode-card:hover { border-color:var(--primary-color); background:rgba(99,102,241,.12); }
.mode-emoji { font-size:1.8rem; line-height:1; }
.mode-text { display:flex; flex-direction:column; gap:3px; }
.mode-text b { font-size:1rem; }
.mode-text small { color:var(--text-muted); font-size:.82rem; line-height:1.45; }

/* Namensliste */
.name-row { display:flex; gap:8px; align-items:center; margin-bottom:8px; }
.name-row .badge { width:30px; height:30px; border-radius:50%; background:var(--primary-color); color:#fff; font-weight:700;
  display:flex; align-items:center; justify-content:center; flex-shrink:0; font-size:.85rem; }
.name-row input { flex:1; }
.name-row .x-btn { background:none; border:none; color:var(--lose-color); font-size:1.2rem; cursor:pointer; padding:4px 8px; }

/* QR */
.qr-box { width:min(260px,70vw); margin:8px auto; background:#fff; border-radius:16px; padding:10px; }
.qr-box svg { width:100%; height:auto; display:block; }

/* Lobby-Spieler */
.lobby-player { display:flex; align-items:center; gap:10px; padding:8px 4px; border-bottom:1px solid rgba(255,255,255,.06); }
.lobby-player:last-child { border-bottom:none; }
.lobby-player .lp-name { flex:1; font-weight:600; }
.lobby-player .lp-tag { font-size:.72rem; color:var(--text-muted); }
.lobby-player .lp-me { color:var(--win-color); font-size:.75rem; font-weight:700; }

/* Rollen-Konfiguration */
.role-row { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid rgba(255,255,255,.06); }
.role-row:last-child { border-bottom:none; }
.role-row .rr-emoji { font-size:1.4rem; width:32px; text-align:center; }
.role-row .rr-text { flex:1; min-width:0; }
.role-row .rr-text b { display:block; font-size:.95rem; }
.role-row .rr-text small { color:var(--text-muted); font-size:.76rem; line-height:1.35; display:block; }
.stepper { display:flex; align-items:center; gap:6px; }
.stepper button { width:34px; height:34px; border-radius:10px; border:1px solid var(--border-color); background:var(--input-bg);
  color:var(--text-color); font-size:1.1rem; font-weight:800; cursor:pointer; }
.stepper button:disabled { opacity:.35; cursor:not-allowed; }
.stepper span { min-width:20px; text-align:center; font-weight:800; }
.sum-ok { color:var(--win-color); } .sum-bad { color:var(--lose-color); }

/* Eigene Rolle */
.role-card { text-align:center; }
.role-reveal { width:100%; padding:22px 12px; border-radius:16px; border:2px dashed var(--border-color); background:var(--input-bg);
  color:var(--text-color); font-family:inherit; cursor:pointer; }
.role-big-emoji { font-size:3.4rem; line-height:1.1; }
.role-big-name { font-size:1.5rem; font-weight:800; margin-top:4px; }
.role-desc { color:var(--text-muted); font-size:.88rem; margin-top:6px; line-height:1.5; }
.role-extra { margin-top:10px; padding:10px; border-radius:12px; background:rgba(99,102,241,.1); font-size:.88rem; text-align:left; }
.team-werwolf .role-big-name { color:#f87171; }
.team-dorf .role-big-name { color:#86efac; }
.dead-banner { margin-top:10px; padding:8px; border-radius:10px; background:rgba(100,116,139,.2); color:#cbd5e1; font-weight:700; }

/* Spielleiter-/Erzaehler-Karte */
.host-card, .action-card { border:2px solid rgba(99,102,241,.45); }
.phase-title { font-size:1.15rem; font-weight:800; margin-bottom:6px; }
.script { font-size:1.02rem; line-height:1.55; padding:12px 14px; border-radius:12px; background:rgba(15,23,42,.55);
  border-left:4px solid var(--accent-color); margin:8px 0 12px; font-style:italic; }
.script-note { font-size:.8rem; color:var(--text-muted); margin:-6px 0 10px; }
.step-dots { display:flex; gap:6px; flex-wrap:wrap; margin:4px 0 8px; }
.step-dot { font-size:.75rem; padding:3px 8px; border-radius:999px; background:var(--input-bg); color:var(--text-muted); border:1px solid var(--border-color); }
.step-dot.done { color:var(--win-color); border-color:rgba(74,222,128,.4); }
.step-dot.now { color:#fff; background:var(--primary-color); border-color:var(--primary-color); }
.pick-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:8px; margin:8px 0; }
.pick-btn { padding:12px 8px; border-radius:12px; border:2px solid var(--border-color); background:var(--input-bg); color:var(--text-color);
  font-family:inherit; font-weight:700; cursor:pointer; text-align:center; line-height:1.25; }
.pick-btn small { display:block; font-weight:500; font-size:.72rem; color:var(--text-muted); margin-top:2px; }
.pick-btn:hover { border-color:var(--primary-color); }
.pick-btn.sel { border-color:var(--accent-color); background:rgba(99,102,241,.28); }
.pick-btn:disabled { opacity:.35; cursor:not-allowed; }
.pick-btn .votes { display:inline-block; margin-left:4px; font-size:.75rem; color:var(--bj-color); }
.info-line { font-size:.88rem; color:var(--text-muted); margin:6px 0; }
.info-line b { color:var(--text-color); }
.potion-row { display:flex; gap:8px; margin:8px 0; flex-wrap:wrap; }
.potion { flex:1; min-width:140px; padding:12px; border-radius:12px; border:2px solid var(--border-color); background:var(--input-bg);
  color:var(--text-color); font-family:inherit; font-weight:700; cursor:pointer; }
.potion.sel { border-color:var(--win-color); background:rgba(74,222,128,.14); }
.potion.poison.sel { border-color:var(--lose-color); background:rgba(248,113,113,.14); }
.potion:disabled { opacity:.35; cursor:not-allowed; }
.wait-pulse { display:inline-block; animation:pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity:.4; } 50% { opacity:1; } }
.btn-skip { background:transparent; border:1px dashed var(--border-color); color:var(--text-muted); }

/* Spielerraster */
.player-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:8px; }
.pg-cell { padding:10px; border-radius:12px; background:var(--input-bg); border:1px solid var(--border-color); position:relative; }
.pg-cell.dead { opacity:.5; }
.pg-cell.dead .pg-name { text-decoration:line-through; }
.pg-name { font-weight:700; font-size:.95rem; word-break:break-word; }
.pg-role { font-size:.78rem; color:var(--text-muted); margin-top:2px; }
.pg-tools { position:absolute; top:6px; right:6px; display:flex; gap:2px; }
.pg-tools button { background:none; border:none; cursor:pointer; font-size:.85rem; opacity:.65; padding:2px; }
.pg-tools button:hover { opacity:1; }

/* Verlauf */
.log-list { display:flex; flex-direction:column; gap:4px; max-height:320px; overflow-y:auto; }
.log-entry { font-size:.86rem; padding:5px 0; border-bottom:1px solid rgba(255,255,255,.05); color:var(--text-muted); }
.log-entry.death { color:#fca5a5; }
.log-entry.phase { color:var(--night-color); font-weight:700; }
.log-entry.end { color:var(--bj-color); font-weight:800; }

/* Ende */
.end-roles { display:flex; flex-direction:column; gap:6px; margin-top:12px; }
.end-role { display:flex; align-items:center; gap:10px; padding:8px 12px; border-radius:12px; background:var(--input-bg); border:1px solid var(--border-color); }
.end-role.dead { opacity:.6; }
.end-role .er-name { flex:1; font-weight:700; }
.end-role.winner { border-color:#fbbf24; background:rgba(251,191,36,.08); }
.winner-line { font-size:1.25rem; font-weight:800; margin-bottom:6px; }

/* Rollen reihum */
.pass-name { font-size:1.6rem; font-weight:800; margin:10px 0; }
