html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0b1020;
  color: #e6ecff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, sans-serif;
}
#scene {
  width: 100vw;
  height: 100vh;
  display: block;
}
#hud {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  display: flex;
  gap: 12px;
}
.panel {
  background: rgba(14, 20, 40, 0.7);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  backdrop-filter: blur(4px);
}
.help h3 {
  margin: 0 0 6px 0;
  font-size: 14px;
}
.help ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.4;
}

/* Bottom score panels for P1/P2 */
.scorePanel.panel { padding: 12px 16px; border-radius: 12px; }
.scorePanel { position: fixed; bottom: 12px; z-index: 20; display: flex; align-items: baseline; gap: 10px; }
.scorePanel.left { left: 12px; }
.scorePanel.right { right: 12px; }
/* Bigger numbers */
#score1, #score2 { font-size: clamp(28px, 4.2vw, 56px); font-weight: 800; line-height: 1; letter-spacing: 0.5px; }
.scorePanel strong { font-size: clamp(13px, 1.3vw, 18px); opacity: 0.9; }
/* Team accents */
#scoreP1 { border-color: rgba(216, 110, 110, 0.6); box-shadow: 0 8px 24px rgba(0,0,0,0.25), inset 0 0 0 1px rgba(216,110,110,0.35); }
#scoreP2 { border-color: rgba(79, 115, 230, 0.6); box-shadow: 0 8px 24px rgba(0,0,0,0.25), inset 0 0 0 1px rgba(79,115,230,0.35); }

/* Ducko coin row */
.coinRow {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.coinCanvas {
  width: 42px;
  height: 42px;
  display: block;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
}
.coinText { font-size: clamp(14px, 1.6vw, 18px); font-weight: 700; letter-spacing: 0.4px; }
.coinLabel { opacity: 0.85; margin-right: 6px; font-weight: 600; }

/* MENU OVERLAY */
#menuOverlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 50;
  background: var(--menu-bg, #a9e8fb);
  overflow: hidden; /* Prevent traitor duck from causing scrollbars */
}

.menuContent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: min(600px, 90vw);
  animation: fadeIn 0.6s ease-out;
  position: relative;
  z-index: 2;
}

.duckCaricature {
  position: absolute;
  width: 150px;
  height: 150px;
  top: -100px;
  z-index: 1;
}

.duckCaricature svg circle[fill="#f1c40f"] {
  fill: var(--duck-color, #f1c40f);
}

.duckCaricature.left {
  left: -100px;
  transform: rotate(-15deg);
}

.duckCaricature.right {
  right: -100px;
  transform: rotate(15deg) scaleX(-1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.gameTitle {
  font-size: clamp(48px, 10vw, 84px);
  font-weight: 900;
  margin: 0;
  color: var(--title-color, #2c3e50);
  text-shadow: 6px 6px 0px var(--title-shadow, #ffffff);
  letter-spacing: 4px;
  text-align: center;
  font-style: italic;
  text-transform: uppercase;
  z-index: 2;
}

#menuOverlay .menuButtons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}

#menuOverlay .menuButtons::-webkit-scrollbar {
  width: 8px;
}
#menuOverlay .menuButtons::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.05);
}
#menuOverlay .menuButtons::-webkit-scrollbar-thumb {
  background: var(--btn-bg, #2c3e50);
}

#menuOverlay .menuButtons button {
  font-size: clamp(16px, 1.8vw, 20px);
  letter-spacing: 1.5px;
  font-weight: 800;
  color: #ffffff;
  background: var(--btn-bg, #2c3e50);
  border: 4px solid var(--btn-border, #1a252f);
  border-radius: 0px;
  padding: 14px 20px;
  cursor: pointer;
  transition: all 0.1s steps(4);
  text-transform: uppercase;
  box-shadow: 6px 6px 0px var(--btn-border, #1a252f);
  flex-shrink: 0;
}

#menuOverlay .menuButtons button:hover {
  background: #34495e;
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0px var(--btn-border, #1a252f);
}

/* Sub-Panels (HowTo, Shop, Settings, Credits) */
.menuSubPanel {
  position: relative;
  inset: auto;
  background: transparent; /* Panel selbst ist durchsichtig, Hintergrundfarbe kommt vom Overlay */
  z-index: 10;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible; /* kein eigenes Scrollen im Untermenü */
  animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.menuSubPanel h2 {
  font-size: clamp(32px, 5vw, 48px);
  color: var(--title-color, #2c3e50);
  text-shadow: 4px 4px 0px #fff;
  margin-bottom: 30px;
  text-transform: uppercase;
  font-style: italic;
}
/* Hoher Kontrast für Buttons in Untermenüs (z. B. Einstellungen) */
.menuSubPanel button {
  color: #ffffff;
  background: #2c3e50;
  border: 4px solid #1a252f;
}

.menuSubPanel .closeSubPanel {
  margin-top: auto;
  background: #e74c3c;
  border: 4px solid #c0392b;
  color: white;
  padding: 12px 30px;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 4px 4px 0px #c0392b;
}

.menuSubPanel .closeSubPanel:hover {
  background: #ff5e4d;
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px #c0392b;
}

/* HowTo Styles */
.howToContent {
  width: 100%;
  max-width: 800px;
  text-align: left;
  color: #2c3e50;
}

.howToSection {
  background: rgba(255,255,255,0.5);
  border: 3px solid #2c3e50;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 6px 6px 0px #2c3e50;
}

.howToSection h3 { margin-top: 0; text-transform: uppercase; border-bottom: 2px solid #2c3e50; padding-bottom: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Shop Styles */
.shopBalance {
  font-size: 24px;
  font-weight: 900;
  background: #f1c40f;
  padding: 10px 20px;
  border: 3px solid #2c3e50;
  box-shadow: 4px 4px 0px #2c3e50;
  margin-bottom: 30px;
}

.shopGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 700px;
}

.shopItem {
  background: #fff;
  border: 3px solid #2c3e50;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 6px 6px 0px #2c3e50;
}

.itemIcon { font-size: 48px; margin-bottom: 10px; }
.itemName { font-weight: 800; text-transform: uppercase; margin-bottom: 5px; }
.itemPrice { color: #27ae60; font-weight: 700; margin-bottom: 10px; }

.buyBtn {
  background: #27ae60;
  border: 2px solid #219150;
  color: white;
  padding: 8px 15px;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
}

.buyBtn:disabled { background: #95a5a6; border-color: #7f8c8d; cursor: not-allowed; }

/* Settings Styles */
.settingsContent {
  width: 100%;
  max-width: 700px;
  color: #2c3e50; /* bessere Lesbarkeit */
}

.settingRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: #ffffff; /* keine Transparenz, maximaler Kontrast */
  border: 3px solid #2c3e50;
  margin-bottom: 15px;
  box-shadow: 6px 6px 0px #2c3e50;
  font-weight: 700;
}

.settingRow input[type="checkbox"] {
  width: 30px;
  height: 30px;
  cursor: pointer;
}

/* Credits Styles */
.creditsContent {
  text-align: center;
  color: #2c3e50;
}
.creditsGallery {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 900px;
  margin: 10px auto 20px;
}
.creditsGallery img {
  height: 250px;
  width: auto;
  display: block;
  border: 4px solid #2c3e50;
  box-shadow: 6px 6px 0 #2c3e50;
  background: #fff;
}

.creditEntry { margin-bottom: 20px; }
.creditRole { font-weight: 600; font-size: 0.9em; opacity: 0.8; }
.creditName { font-weight: 900; font-size: 1.8em; text-transform: uppercase; }
.duckCaricature.tiny { position: relative; width: 60px; height: 60px; margin: 20px auto; top: 0; left: 0; right: 0; }

#menuOverlay .menuButtons button:active {
  transform: translate(4px, 4px);
  box-shadow: 0px 0px 0px var(--btn-border, #1a252f);
}

/* Spezielle Akzentfarbe für Play Button */
#playBtn {
  background: var(--accent-bg, #e67e22) !important;
  border-color: var(--accent-border, #d35400) !important;
  box-shadow: 8px 8px 0px var(--accent-border, #d35400) !important;
}

#playBtn:hover {
  filter: brightness(1.1);
  box-shadow: 10px 10px 0px var(--accent-border, #d35400) !important;
}

#playBtn:active {
  box-shadow: 0px 0px 0px var(--accent-border, #d35400) !important;
}

/* Multiplayer Panels im Menü-Kontext */
#menuOverlay .panel {
  margin-top: 20px;
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  border: 4px solid var(--btn-bg, #2c3e50);
  border-radius: 0;
  color: var(--btn-bg, #2c3e50);
  backdrop-filter: none;
}

/* Match end panels (shared styles with MP end) */
#matchEnd.panel, #mpEnd.panel {
  background: #ffffff;
  border: 4px solid #2c3e50;
  color: #2c3e50;
  border-radius: 0;
  box-shadow: 10px 10px 0px rgba(0,0,0,0.2);
  z-index: 100;
}

/* Hide HUD & scores while in menu or match end */
body.inMenu #hud,
body.inMenu #scoreP1,
body.inMenu #scoreP2,
body.inMenu #skillsP1,
body.inMenu #skillsP2 { display: none; }

.moorhuhnDuck {
  pointer-events: auto;
  cursor: crosshair;
}

.moorhuhnDuck svg:hover {
  filter: brightness(1.2);
}

#moorhuhnHud {
  pointer-events: none;
  user-select: none;
}

/* Skill Panels */
.skillPanel {
  position: fixed;
  z-index: 25;
  width: 100px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.skillPanel.left { left: 12px; }
.skillPanel.right { right: 12px; }
.skillRow {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
}
.skillRow span {
  color: #4f73e6;
}
.skillRow span.ready {
  color: #5fb76e;
}
.skillRow span.cooldown {
  color: #d86e6e;
}
.skillRow span.active {
  color: #ffd700;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}
/* Hide menu overlay during gameplay */
body:not(.inMenu) #menuOverlay { display: none; }

/* Wenn ein Untermenü geöffnet ist: dunklerer Hintergrund und breiteres Layout + Scroll auf dem Overlay */
#menuOverlay.submenuOpen {
  background: #7ec8dc; /* dunkler als #a9e8fb */
  overflow-y: auto; /* Scrollen auf dem Hauptmenü */
}
#menuOverlay.submenuOpen .menuContent {
  width: min(900px, 96vw);
}

/* Room list panel: larger and clearer when opened */
#roomList.panel {
  width: min(520px, 92vw);
}
#roomList.panel.open {
  max-height: 70vh !important;
  width: min(640px, 96vw);
  padding: 14px 16px;
}
#roomList .header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
#roomList strong { font-size: 16px; }
#roomsUl { list-style: none; padding: 0; margin: 0; }
#roomsUl li { margin: 8px 0; }
#roomsUl li button {
  width: 100%;
  text-align: left;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e6ecff;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
}
#roomsUl li button:hover { background: rgba(255,255,255,0.12); }
#roomsEmpty { opacity: 0.85; margin-top: 10px; }

#roomList.panel button#refreshRoomsBtn,
#roomList.panel button#hideRoomsBtn {
  background: rgba(255,255,255,0.12);
  color: #e6ecff;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
}
#roomList.panel button#refreshRoomsBtn:hover,
#roomList.panel button#hideRoomsBtn:hover { background: rgba(255,255,255,0.16); }
