/* ===== GLOBAL ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #fff;
  overflow: hidden;
  user-select: none;
  /* Minen-Boden-Look passend zum Schienenbett: dunkle Erde mit kleinen Stein-Sprenkeln.
     Kein Blau mehr — fließender Übergang in den Canvas-Hintergrund des Spielfelds.
     Die radialen Gradienten simulieren zerstreute Steinchen (vier Layer mit Offset). */
  background-color: #2a1d12;
  background-image:
    radial-gradient(circle at 12% 28%, rgba(80,65,48,0.45) 0 1.2px, transparent 1.4px),
    radial-gradient(circle at 72% 18%, rgba(110,90,65,0.35) 0 1.1px, transparent 1.3px),
    radial-gradient(circle at 38% 72%, rgba(60,48,32,0.55) 0 1.6px, transparent 1.8px),
    radial-gradient(circle at 88% 62%, rgba(95,78,55,0.40) 0 0.9px, transparent 1.1px),
    radial-gradient(circle at 55% 40%, rgba(70,55,38,0.30) 0 1.3px, transparent 1.5px),
    radial-gradient(ellipse 80% 70% at 50% 50%, rgba(70,50,30,0.22), transparent 70%),
    radial-gradient(ellipse 120% 100% at 50% 50%, #3b2818 0%, #1a0f08 80%);
  background-size: 26px 28px, 34px 30px, 22px 24px, 18px 20px, 40px 38px, 100% 100%, 100% 100%;
}

.screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hidden { display: none !important; }
/* Spezifität-Fix: ID-qualifiziertes .screen darf .hidden nicht aushebeln */
#setup-screen.screen.hidden,
#game-screen.screen.hidden,
#mp-lobby-screen.screen.hidden,
#victory-screen.screen.hidden { display: none !important; }

/* ===== SETUP-SCREEN ===== */
.setup-box {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(12px);
  padding: 40px 60px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  max-width: 720px;
  width: 90%;
  text-align: center;
}

.setup-box h1 {
  font-size: 3em;
  background: linear-gradient(45deg, #ff006e, #ffbe0b, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
  letter-spacing: -1px;
}
.weasel-emoji {
  display: inline-block;
  font-size: 1em;
  filter: none;
  -webkit-text-fill-color: initial;
  margin-right: 10px;
}

.subtitle { font-size: 1.1em; opacity: 0.75; margin-bottom: 30px; line-height: 1.5; }

.setup-grid { margin-bottom: 20px; }

.setup-grid label,
#player-inputs label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  font-size: 0.9em;
  opacity: 0.8;
  margin: 10px auto;
  max-width: 360px;
}

select, input[type="text"] {
  padding: 12px 14px;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #fff;
  font-size: 1em;
  outline: none;
}
select:focus, input[type="text"]:focus {
  border-color: #ff006e;
  background: rgba(255,0,110,0.08);
}
select option { background: #1a1a3e; }

#player-inputs .player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 360px;
  margin: 8px auto;
}
.player-row .color-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 10px currentColor;
}
.player-row input {
  flex: 1;
  padding: 10px 14px;
}

.btn-primary {
  background: linear-gradient(45deg, #ff006e, #ffbe0b);
  color: #fff;
  padding: 14px 36px;
  border: none;
  border-radius: 30px;
  font-size: 1.15em;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 8px 24px rgba(255,0,110,0.3);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 32px rgba(255,0,110,0.5);
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.rules {
  text-align: left;
  background: rgba(0,0,0,0.3);
  padding: 16px 20px;
  border-radius: 12px;
  margin-top: 30px;
  font-size: 0.88em;
  opacity: 0.85;
  line-height: 1.55;
}
.rules strong { display: block; margin-bottom: 8px; color: #ffbe0b; }
.rules ul { list-style: none; }
.rules li { padding: 3px 0; padding-left: 20px; position: relative; }
.rules li::before { content: '▸'; position: absolute; left: 0; color: #ff006e; }

/* ===== GAME-SCREEN ===== */
#gameCanvas {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, #2a1a4e 0%, #0a0a1e 100%);
  box-shadow: 0 0 80px rgba(139, 92, 246, 0.15) inset;
}

/* HUD links: Spielerliste */
#player-panels {
  position: absolute;
  top: 20px; left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.player-panel {
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(10px);
  border-left: 5px solid;
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 240px;
  transition: all 0.25s;
  position: relative;
}
.player-panel.active {
  transform: scale(1.05);
  box-shadow: 0 0 30px currentColor;
}
.player-panel.active::before {
  content: '▶';
  position: absolute;
  left: -22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2em;
  color: currentColor;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: translateY(-50%) translateX(0); }
  50%      { opacity: 0.5; transform: translateY(-50%) translateX(-4px); }
}
.player-panel.shielded::after {
  content: '🛡';
  position: absolute;
  right: 10px; top: 10px;
  font-size: 1.1em;
}

.player-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.panel-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid currentColor;
  overflow: hidden;
  background: #1a0e05;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.panel-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.panel-avatar.fallback,
.panel-avatar.bot { background: rgba(255,255,255,0.04); }

.player-name {
  font-weight: 700;
  font-size: 1.05em;
  color: #fff;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-kugels {
  display: flex;
  gap: 6px;
}
.kugel-slot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  background: transparent;
  transition: all 0.3s;
}
.kugel-slot.collected {
  border-color: rgba(255,255,255,0.9);
  box-shadow: 0 0 10px currentColor, inset 0 0 4px rgba(255,255,255,0.3);
}

/* HUD rechts */
#turn-info {
  position: absolute;
  top: 20px; right: 20px;
  text-align: center;
  z-index: 10;
}

#current-player-box {
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(10px);
  padding: 10px 20px;
  border-radius: 12px;
  margin-bottom: 14px;
  min-width: 200px;
}
#current-player-label {
  font-size: 0.75em;
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: 2px;
}
#current-player-name {
  font-size: 1.4em;
  font-weight: 700;
  margin-top: 4px;
}

#roll-btn { padding: 12px 30px; font-size: 1.1em; }

#dice-display {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  width: 96px;
  height: 96px;
  padding: 12px;
  margin: 14px auto 0;
  background: linear-gradient(135deg, #fff 0%, #e8e8ee 100%);
  border-radius: 16px;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.8),
    inset 0 -2px 6px rgba(0,0,0,0.15),
    0 6px 14px rgba(0,0,0,0.45),
    0 0 26px rgba(255,190,11,0.35);
  transition: transform 0.15s ease-out;
}
#dice-display .dice-dot {
  border-radius: 50%;
  align-self: center;
  justify-self: center;
  width: 70%;
  height: 70%;
}
#dice-display .dice-dot.on {
  background: radial-gradient(circle at 35% 30%, #555 0%, #111 60%, #000 100%);
  box-shadow: inset 0 2px 2px rgba(0,0,0,0.6), 0 0 2px rgba(0,0,0,0.4);
}
#dice-display.empty {
  background: transparent;
  box-shadow: none;
}
#dice-display.empty::after {
  content: '—';
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  align-self: center;
  justify-self: center;
  font-size: 2em;
  color: rgba(255,255,255,0.3);
}
#dice-display.rolling { animation: diceRoll 0.22s ease-in-out infinite; }
@keyframes diceRoll {
  0%   { transform: rotate(-18deg) scale(0.9); }
  25%  { transform: rotate(12deg) scale(1.05); }
  50%  { transform: rotate(-10deg) scale(0.95); }
  75%  { transform: rotate(18deg) scale(1.05); }
  100% { transform: rotate(-18deg) scale(0.9); }
}

#phase-hint {
  margin-top: 12px;
  font-size: 0.9em;
  opacity: 0.7;
  max-width: 220px;
  min-height: 1.2em;
}

/* Announcement banner */
#announcement {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.8em;
  font-weight: 900;
  padding: 18px 44px;
  background: rgba(0,0,0,0.85);
  border-radius: 20px;
  text-shadow: 0 0 20px currentColor;
  animation: pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 100;
  border: 2px solid rgba(255,255,255,0.1);
  white-space: nowrap;
}
@keyframes pop {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  60%  { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Modals */
.modal {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  z-index: 200;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  background: linear-gradient(135deg, #2a1a4e 0%, #1a0a3e 100%);
  padding: 36px 44px;
  border-radius: 20px;
  max-width: 650px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 70px rgba(0,0,0,0.8);
  border: 2px solid rgba(255,255,255,0.1);
  animation: modalPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalPop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

#question-category {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.85em;
  box-shadow: 0 0 20px currentColor;
}

#question-text {
  font-size: 1.4em;
  margin-bottom: 28px;
  line-height: 1.45;
  font-weight: 500;
}

#question-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.option-btn {
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.2);
  padding: 16px 20px;
  border-radius: 12px;
  cursor: pointer;
  color: #fff;
  font-size: 1em;
  transition: all 0.15s;
  text-align: left;
}
.option-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.14);
  transform: scale(1.02);
  border-color: rgba(255,255,255,0.4);
}
.option-btn.correct { background: rgba(16,185,129,0.35); border-color: #10b981; box-shadow: 0 0 20px rgba(16,185,129,0.5); }
.option-btn.wrong { background: rgba(239,68,68,0.35); border-color: #ef4444; }
.option-btn:disabled { cursor: not-allowed; opacity: 0.7; }

#question-result {
  font-size: 1.35em;
  font-weight: 700;
  padding: 14px;
  margin-top: 18px;
  border-radius: 12px;
}
.result-correct { background: rgba(16,185,129,0.2); color: #10b981; }
.result-wrong   { background: rgba(239,68,68,0.2); color: #ef4444; }

/* === Timer fuer Frage (22 Sekunden) === */
.question-timer {
  position: relative;
  margin: 14px auto 4px;
  width: 100%;
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  overflow: hidden;
}
.question-timer-bar {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #10b981 0%, #ffbe0b 60%, #ef4444 100%);
  transition: width 1s linear;
}
.question-timer-label {
  display: block;
  text-align: center;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #e8d8b8;
  letter-spacing: 0.5px;
}
.question-timer-label.urgent { color: #ef4444; animation: pulse 0.7s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }

/* === Warten-Overlay fuer Beobachter === */
#waiting-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 4, 2, 0.82);
  backdrop-filter: blur(6px);
}
#waiting-overlay.hidden { display: none; }
.waiting-card {
  max-width: 480px;
  padding: 40px 32px;
  background: linear-gradient(180deg, rgba(40,30,20,0.95) 0%, rgba(25,18,10,0.95) 100%);
  border: 1px solid rgba(255,190,11,0.35);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  text-align: center;
  color: #e8d8b8;
}
.waiting-card .spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border: 4px solid rgba(255,190,11,0.2);
  border-top-color: #ffbe0b;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.waiting-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
  color: #ffbe0b;
}
.waiting-card .waiting-name {
  font-weight: 700;
  font-size: 18px;
  margin: 10px 0 16px;
}
.waiting-card .waiting-category {
  display: inline-block;
  padding: 6px 14px;
  margin-top: 6px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.waiting-card .question-timer { margin-top: 22px; }

#color-picker-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.color-pick-btn {
  height: 90px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  font-size: 1em;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.color-pick-btn:hover {
  transform: scale(1.08);
  border-color: #fff;
  box-shadow: 0 0 25px currentColor;
}

/* Victory */
.modal-content.victory { border-color: #ffbe0b; }
.trophy {
  font-size: 5em;
  margin-bottom: 10px;
  animation: trophyBounce 1.4s ease-in-out infinite;
  filter: drop-shadow(0 0 30px #ffbe0b);
}
@keyframes trophyBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-10px) scale(1.08); }
}
.modal-content.victory h2 {
  font-size: 2.5em;
  background: linear-gradient(45deg, #ffbe0b, #ff006e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}
#victory-text { font-size: 1.2em; margin-bottom: 24px; line-height: 1.5; }

/* === Kategorie-Picker === */
.category-picker {
  margin: 20px 0 16px;
  text-align: left;
}
.category-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
  color: #e8d8b8;
}
.category-picker-header .pick-count {
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(255, 190, 11, 0.18);
  color: #ffd060;
  font-size: 12px;
}
.category-picker-header .pick-count.complete {
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 190, 11, 0.15);
  border-radius: 10px;
}
.cat-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(30, 20, 12, 0.6);
  border: 1px solid rgba(255, 190, 11, 0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
}
.cat-chip:hover {
  background: rgba(50, 34, 20, 0.8);
  border-color: rgba(255, 190, 11, 0.3);
}
.cat-chip input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: #ffbe0b;
  cursor: pointer;
}
.cat-chip:has(input:checked) {
  background: rgba(110, 74, 36, 0.5);
  border-color: rgba(255, 190, 11, 0.55);
  box-shadow: 0 0 10px rgba(255, 190, 11, 0.15);
}
.cat-chip .cat-name { flex: 1; color: #f0e0c0; }
.cat-chip.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* === Multiplayer === */
.mp-buttons { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-secondary {
  flex: 1;
  padding: 10px 14px;
  background: rgba(30, 20, 12, 0.7);
  color: #e8d8b8;
  border: 1px solid rgba(255, 190, 11, 0.3);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.15s;
}
.btn-secondary:hover {
  background: rgba(50, 34, 20, 0.9);
  border-color: rgba(255, 190, 11, 0.55);
}
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.mp-code-box {
  background: rgba(0,0,0,0.4);
  border: 2px solid rgba(255,190,11,0.35);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
  text-align: center;
}
.mp-code-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #a88a60;
  margin-bottom: 8px;
}
.mp-code-value {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ffd060;
  margin-bottom: 12px;
  font-family: monospace;
}
.mp-players-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 280px; overflow-y: auto;
  margin: 16px 0;
}
.mp-player-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: rgba(30, 20, 12, 0.6);
  border: 1px solid rgba(255, 190, 11, 0.15);
  border-radius: 8px;
}
.mp-player-row.host { border-color: rgba(255, 190, 11, 0.5); }
.mp-player-row .avatar { width: 32px; height: 32px; border-radius: 50%; background: #2a1a0a; }
.mp-player-row .name { flex: 1; color: #f0e0c0; font-weight: 600; }
.mp-player-row .host-badge { font-size: 10px; padding: 2px 8px; background: rgba(255,190,11,0.22); color: #ffd060; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.5px; }
.mp-hint { color: #a88a60; font-size: 13px; text-align: center; margin: 10px 0; }

/* === Fixed Spieler 1 (QT-Account) === */
.player-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid rgba(255,190,11,0.45);
  box-shadow: 0 0 10px rgba(255,190,11,0.18);
  object-fit: cover;
  flex-shrink: 0;
}
.player-avatar-placeholder {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(110, 74, 36, 0.5);
  border: 2px solid rgba(255,190,11,0.45);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.player-name-readonly {
  flex: 1;
  padding: 10px 12px;
  background: rgba(110, 74, 36, 0.3);
  border: 1px solid rgba(255, 190, 11, 0.25);
  border-radius: 8px;
  color: #ffd060;
  font-weight: 700;
  font-size: 14px;
}
.player-you-badge {
  font-size: 10px;
  padding: 3px 10px;
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  flex-shrink: 0;
}

/* === Ereigniskarten-Modal === */
#event-card-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.25s ease;
}
#event-card-modal.hidden { display: none; }

.event-card {
  position: relative;
  width: 340px;
  min-height: 460px;
  padding: 28px 24px 26px;
  background: linear-gradient(180deg, #4a1e4e 0%, #2a0e30 100%);
  border: 3px solid #ff2af0;
  border-radius: 14px;
  box-shadow:
    0 0 30px rgba(255, 42, 240, 0.55),
    0 15px 50px rgba(0, 0, 0, 0.75),
    inset 0 0 0 1px rgba(255, 200, 250, 0.15);
  text-align: center;
  color: #ffe8f8;
  animation: eventCardIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes eventCardIn {
  from { transform: rotate(-6deg) scale(0.3); opacity: 0; }
  to   { transform: rotate(0) scale(1); opacity: 1; }
}
.event-card::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 42, 240, 0.35);
  border-radius: 10px;
  pointer-events: none;
}
.event-card-header {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #ffcfe9;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 42, 240, 0.9);
  margin-bottom: 18px;
}
.event-card-diamond {
  font-size: 56px;
  color: #ff69d0;
  text-shadow: 0 0 18px rgba(255, 105, 208, 0.85);
  margin: 10px 0 18px;
  animation: eventDiamondPulse 1.8s ease-in-out infinite;
}
@keyframes eventDiamondPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.1) rotate(3deg); }
}
.event-card-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}
.event-card-desc {
  font-size: 15px;
  color: #f5d5ef;
  line-height: 1.5;
  margin-bottom: 28px;
  min-height: 60px;
  padding: 0 4px;
}
.event-card #event-card-ok {
  background: linear-gradient(45deg, #ff2af0, #ffbe0b);
  padding: 10px 28px;
  font-size: 1em;
  border-radius: 24px;
}

/* Rammschutz-Indikator (ersetzt alten Schutz-Shield-Badge) */
.player-panel.shielded::after { content: ''; }  /* altes ::after aufheben */
.player-panel.rammschutz::after {
  content: '🦺';
  position: absolute;
  right: 10px; top: 10px;
  font-size: 1.1em;
}
.player-panel.skip::after {
  content: '⛏';
  position: absolute;
  right: 10px; top: 10px;
  font-size: 1.1em;
  filter: sepia(0.4);
}

/* === Werbe-Bettlaken-Banner (hängt zwischen den Pflöcken) === */
.ad-banner {
  position: absolute;
  z-index: 45;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px 14px;
  min-height: 72px;
  text-decoration: none;
  transform-origin: top center;
  cursor: pointer;
  overflow: hidden;

  /* Stoff schwarz, leicht körnig */
  background:
    radial-gradient(ellipse at 12% 30%, rgba(255, 255, 255, 0.05) 0 8px, transparent 10px),
    radial-gradient(ellipse at 78% 60%, rgba(255, 255, 255, 0.04) 0 10px, transparent 12px),
    radial-gradient(ellipse at 50% 85%, rgba(255, 255, 255, 0.03) 0 14px, transparent 16px),
    linear-gradient(180deg, #0d0d10 0%, #1a1a1f 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px 8px 6px 10px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 6px 14px rgba(0, 0, 0, 0.6),
    0 10px 22px rgba(0, 0, 0, 0.5);

  /* Gerollte Eselsohren an den Ecken (oben links + rechts) */
  clip-path: polygon(
    2% 0, 98% 0,
    100% 45%, 98% 96%,
    60% 100%, 40% 100%,
    2% 96%, 0 45%
  );

  /* Leicht wellig / hängt durch */
  animation: bannerSway 3.4s ease-in-out infinite;
}
@keyframes bannerSway {
  0%, 100% { transform: translateY(0)    rotate(-0.4deg) skewX(-0.6deg); }
  50%      { transform: translateY(1.5px) rotate( 0.4deg) skewX( 0.6deg); }
}

.ad-banner::before,
.ad-banner::after {
  /* Knoten / Schnur am Pflock — dunkler Punkt oben an der Ecke */
  content: '';
  position: absolute;
  top: -3px;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle, #5a3a18 0%, #2a1808 70%);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.ad-banner::before { left: -1px; }
.ad-banner::after  { right: -1px; }

.ad-banner-label {
  font-family: 'Kalam', 'Patrick Hand', 'Segoe Print', cursive;
  font-size: 12px;
  font-weight: 400;
  color: #ffffff;
  opacity: 0.92;
  letter-spacing: 0.2px;
  transform: rotate(-1deg);
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}
.ad-banner-text {
  font-family: 'Kalam', 'Patrick Hand', 'Segoe Print', cursive;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1px;
  color: #ff2af0;
  text-shadow:
    0 0 3px rgba(255, 42, 240, 0.5),
    0 1px 0 rgba(120, 10, 100, 0.45),
    0 2px 3px rgba(0, 0, 0, 0.45);
  transform: rotate(-0.6deg);
  line-height: 1;
  white-space: nowrap;
}

.ad-banner:hover {
  filter: brightness(1.08) drop-shadow(0 0 8px rgba(255, 42, 240, 0.4));
}

.ad-banner.falling {
  animation: bannerFall 1s cubic-bezier(0.55, 0.1, 0.85, 0.45) forwards;
  pointer-events: none;
}
@keyframes bannerFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  60%  { transform: translateY(34px) rotate(-14deg); opacity: 0.95; }
  100% { transform: translateY(52px) rotate(-22deg); opacity: 0; }
}

/* === Roll-Buttons direkt unter den Würfeltürmen === */
.tower-roll-btn {
  position: absolute;
  z-index: 40;
  padding: 10px 18px;
  min-width: 110px;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(255, 220, 130, 0.25) 0 14px, transparent 16px),
    linear-gradient(135deg, #6e4a24 0%, #3a2010 100%);
  color: #fff7d8;
  border: 2px solid rgba(255, 200, 90, 0.55);
  border-radius: 10px;
  font-family: 'Segoe UI', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 6px 14px rgba(0, 0, 0, 0.5),
    0 0 22px rgba(255, 190, 11, 0.18);
  transition: transform 0.15s, filter 0.15s, box-shadow 0.2s;
  transform-origin: top center;
}
.tower-roll-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.1);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 10px 20px rgba(0, 0, 0, 0.55),
    0 0 32px rgba(255, 190, 11, 0.35);
}
.tower-roll-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
}
.tower-roll-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  filter: grayscale(0.5);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}

/* ================================================================
   v=65 Additions: HUD-Glow, Bot-Row, Teams, Mute, Leaderboard, Daily
   ================================================================ */

/* Mute-Button (fixiert oben rechts, neben dem User-Badge) */
.mute-btn {
  position: fixed;
  top: 16px; right: 220px;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 200, 120, 0.25);
  background: rgba(20, 14, 8, 0.78);
  color: #e8d8b8;
  font-size: 18px;
  cursor: pointer;
  z-index: 11;
  transition: transform 0.15s, background 0.15s;
}
.mute-btn:hover { transform: scale(1.08); background: rgba(40, 30, 18, 0.85); }
.mute-btn.muted { opacity: 0.55; }

/* Teams-Toggle */
.teams-toggle {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  max-width: 540px;
  margin: 14px auto 8px !important;
  padding: 10px 16px;
  background: rgba(255, 190, 11, 0.08);
  border: 1px solid rgba(255, 190, 11, 0.2);
  border-radius: 12px;
  font-size: 0.92em !important;
  opacity: 1 !important;
  cursor: pointer;
  color: #e8d8b8;
}
.teams-toggle input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.teams-toggle.disabled { opacity: 0.35 !important; cursor: not-allowed; }
.teams-toggle.disabled input { cursor: not-allowed; }

/* Bot-Check + Difficulty in Player-Row */
.player-row .bot-check {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85em;
  color: #f0e0c0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}
.player-row .bot-check input { width: 14px; height: 14px; }
.player-row .pr-botdiff {
  padding: 8px 10px;
  font-size: 0.85em;
  max-width: 110px;
}
.player-row .pr-botdiff:disabled { opacity: 0.35; cursor: not-allowed; }
.player-row.bot-row { background: rgba(139, 92, 246, 0.08); border-radius: 10px; padding: 6px 4px; }

/* Bot- und Team-Badges im HUD */
.bot-badge {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.3);
  color: #c4a8ff;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
.team-badge {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
.team-badge.team-0 { background: rgba(239, 68, 68, 0.3); color: #fecaca; }
.team-badge.team-1 { background: rgba(59, 130, 246, 0.3); color: #bfdbfe; }

/* Kugel-Slot Flash + "+1" Overlay (Task 8) */
@keyframes kugelFlash {
  0%   { box-shadow: 0 0 0 0 currentColor, inset 0 0 4px rgba(255,255,255,0.3); transform: scale(1); }
  30%  { box-shadow: 0 0 28px 8px currentColor, inset 0 0 10px rgba(255,255,255,0.7); transform: scale(1.5); }
  100% { box-shadow: 0 0 10px currentColor, inset 0 0 4px rgba(255,255,255,0.3); transform: scale(1); }
}
.kugel-slot.flash { animation: kugelFlash 900ms cubic-bezier(0.2, 0.8, 0.2, 1); position: relative; }
@keyframes kugelPlusOne {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(0.8); }
  20%  { opacity: 1; transform: translate(-50%, -14px) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -40px) scale(1); }
}
.kugel-plus-one {
  position: absolute;
  left: 50%; top: -4px;
  transform: translate(-50%, 0);
  font-weight: 900;
  font-size: 14px;
  text-shadow: 0 0 6px currentColor, 0 1px 2px rgba(0,0,0,0.6);
  pointer-events: none;
  animation: kugelPlusOne 1200ms ease-out forwards;
}

/* Extra-Buttons (Daily + Leaderboard) */
.extra-buttons {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-tertiary {
  background: rgba(255, 255, 255, 0.05);
  color: #e8d8b8;
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-tertiary:hover:not(:disabled) {
  background: rgba(255, 190, 11, 0.15);
  border-color: rgba(255, 190, 11, 0.35);
  transform: translateY(-1px);
}
.btn-tertiary.active { background: rgba(255, 190, 11, 0.2); border-color: rgba(255, 190, 11, 0.5); }

/* Leaderboard-Modal */
.leaderboard-modal {
  max-width: 560px;
  width: 92%;
  padding: 36px 32px 28px;
  position: relative;
}
.leaderboard-close {
  position: absolute;
  top: 12px; right: 16px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  opacity: 0.6;
}
.leaderboard-close:hover { opacity: 1; }
.leaderboard-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}
.lb-tab {
  padding: 8px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e8d8b8;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.15s;
}
.lb-tab:hover { background: rgba(255, 255, 255, 0.1); }
.lb-tab.active { background: rgba(255, 190, 11, 0.25); border-color: rgba(255, 190, 11, 0.5); color: #ffd060; }
.leaderboard-body { max-height: 50vh; overflow-y: auto; margin-top: 12px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 6px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  border-left: 3px solid transparent;
}
.lb-row:nth-child(1) { border-left-color: #ffd700; }
.lb-row:nth-child(2) { border-left-color: #c0c0c0; }
.lb-row:nth-child(3) { border-left-color: #cd7f32; }
.lb-rank { font-weight: 900; color: #ffd060; min-width: 32px; }
.lb-name { flex: 1; color: #fff; font-weight: 600; }
.lb-meta { font-size: 0.85em; opacity: 0.7; }
.lb-empty, .lb-loading { padding: 20px; text-align: center; opacity: 0.6; font-style: italic; }

/* Victory Zusatz-Text (Rang + Zeit) */
.victory-extra {
  margin-top: 10px;
  padding: 8px 14px;
  background: rgba(255, 190, 11, 0.15);
  border-radius: 10px;
  display: inline-block;
  color: #ffd060;
  font-weight: 700;
}

/* Disabled bot-row beim deaktivieren heller markieren */
.player-panel.bot { border-style: dashed; }

/* Skip-Indikator (Stolleneinsturz) */
.player-panel.skip::before { content: '⛏ '; }

/* ================================================================
   v=65 Hotfix: Setup-Screen Scrolling
   Viele neue Elemente (Teams-Toggle, Bot-Checkboxes, Extra-Buttons)
   sprengen den 100vh-Frame — Setup wird jetzt scrollbar, Game bleibt
   weiterhin fix (overflow:hidden wird nur am Game-Screen gebraucht).
   ================================================================ */
html, body { overflow: hidden; }
/* Setup-Screen: KEIN Flex — sonst flexbox-center + overflow-y schneidet oben
   ab (das klassische "top-gets-cut-off"-Bug von align-items:center). Stattdessen
   block-Layout mit normalem Dokument-Scroll. */
#setup-screen.screen {
  display: block !important;
  width: 100vw;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 0 40px;
  -webkit-overflow-scrolling: touch;
}
#setup-screen .setup-box {
  margin: 0 auto;
  padding: 28px 40px 32px;
  max-height: none;
}
/* MP-Lobby ebenfalls scrollbar (sicherheitshalber) */
#mp-lobby-screen.screen {
  display: block !important;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 0 40px;
}
#mp-lobby-screen .setup-box { margin: 0 auto; }
@media (max-height: 740px) {
  #setup-screen .setup-box {
    padding: 20px 28px 26px;
  }
  #setup-screen .setup-box h1 { font-size: 2.1em; margin-bottom: 4px; }
  #setup-screen .subtitle { margin-bottom: 14px; font-size: 0.95em; }
  #setup-screen #player-inputs .player-row { margin: 5px auto; }
  #setup-screen .category-picker { margin-top: 10px; }
  #setup-screen .extra-buttons { margin-top: 8px; }
}
@media (max-width: 520px) {
  #setup-screen .setup-box { padding: 18px 16px 24px; width: 96%; }
  .player-row .bot-check { font-size: 0.75em; padding: 3px 6px; }
  .player-row .pr-botdiff { max-width: 90px; font-size: 0.78em; padding: 6px 8px; }
  .mute-btn { right: 12px; top: 12px; width: 34px; height: 34px; font-size: 15px; }
}

/* === Spectator Mode === */

.mp-spectator-indicator {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.25) 0%, rgba(168, 85, 247, 0.25) 100%);
  border: 1px solid rgba(236, 72, 153, 0.5);
  color: #fbcfe8;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.mp-spectator-indicator.hidden { display: none; }

.mp-code-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}
.mp-code-actions .hidden { display: none; }

.mp-spectators-wrap {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(20, 14, 8, 0.45);
  border: 1px solid rgba(255, 200, 120, 0.18);
  border-radius: 12px;
}
.mp-spectators-wrap.hidden { display: none; }
.mp-spectators-header {
  font-size: 0.85em;
  font-weight: 700;
  color: #c4a8ff;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.mp-spectators-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mp-spectator-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 999px;
  font-size: 0.85em;
  color: #f3e8ff;
}
.mp-spectator-row .spec-icon { font-size: 0.95em; }
.mp-spectator-row .avatar.small {
  width: 22px; height: 22px; border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  background-position: center;
  background-size: cover;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.mp-spectator-row .name { font-weight: 600; }

/* Spectator-Lobby — Start-Button ohnehin versteckt, Hinweis auffälliger */
#mp-lobby-screen.is-spectator h2::after {
  content: " · Zuschauer";
  color: #ec4899;
}

/* Game-Screen Banner (oben mittig) */
.spectator-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translate(-50%, -100%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.92) 0%, rgba(236, 72, 153, 0.92) 100%);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.4);
  z-index: 9000;
  pointer-events: none;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: transform 280ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 280ms;
}
.spectator-banner.show {
  transform: translate(-50%, 0);
  opacity: 1;
}
.spectator-banner .sb-eye {
  font-size: 16px;
  animation: spec-pulse 2s ease-in-out infinite;
}
@keyframes spec-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.85; }
}

/* Spectator-Modus: alle Eingabe-Buttons hart verstecken */
body.is-spectator #roll-btn-left,
body.is-spectator #roll-btn-right,
body.is-spectator #roll-button {
  display: none !important;
}
