* { box-sizing: border-box; font-family: "Trebuchet MS", Impact, sans-serif; }
body {
  margin: 0; background: #111; display: flex; justify-content: center;
  align-items: center; min-height: 100vh; color: #fff; overflow: hidden;
}
.hidden { display: none !important; }

#stage {
  position: relative; width: 1000px; height: 700px; overflow: hidden;
  border: 4px solid #3c4d24; background: #1f2b12; box-shadow: 0 0 40px #000;
}

/* SCREENS */
.screen {
  position: absolute; inset: 0; display: none; flex-direction: column;
  align-items: center; justify-content: center;
  background: radial-gradient(circle at 75% 25%, #d6e8b5 0%, #556b2f 40%, #1d2611 100%);
}
.screen.active { display: flex; }
#screen-game { justify-content: flex-start; background: #000; }

.title {
  font-size: 86px; letter-spacing: 6px; margin: 0 0 14px; color: #9fc454;
  text-shadow: 0 4px 0 #263310, 0 8px 16px #000;
}
.small-title { font-size: 56px; margin-bottom: 10px; }
.panel-row { display: flex; gap: 26px; }
.glass-panel {
  background: rgba(240, 248, 225, 0.84); color: #111; padding: 20px 26px;
  border-radius: 16px; min-width: 280px; box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}
.center-panel { min-width: 460px; text-align: center; }
.lobby-panel { width: 640px; }

.invite-banner {
  background: #f1c40f; color: #111; font-weight: bold; padding: 8px 18px;
  border-radius: 8px; margin-bottom: 12px; box-shadow: 0 3px 10px #000;
}
.form-row { margin: 10px 0 16px; font-size: 18px; }
.form-row input { padding: 8px 12px; font-size: 16px; border-radius: 6px; border: 2px solid #333; width: 220px; }
.divider { border: none; border-top: 2px solid rgba(0,0,0,0.18); margin: 16px 0; }
.private-box { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.join-code-row { display: flex; gap: 8px; }
.join-code-row input { padding: 7px 10px; width: 130px; text-transform: uppercase; font-weight: bold; border-radius: 6px; border: 2px solid #333; }
.error-text { color: #c0392b; font-weight: bold; margin-top: 10px; min-height: 20px; }

.arrow-btn {
  margin-top: 14px; padding: 11px 24px; font-size: 20px; font-weight: bold;
  background: #3d521e; color: #fff; border: 3px solid #cfe89a; border-radius: 10px; cursor: pointer;
}
.arrow-btn:hover { background: #547029; }
.sub-btn {
  padding: 7px 14px; font-size: 14px; font-weight: bold;
  background: #2f3e19; color: #fff; border: 2px solid #a7c96b; border-radius: 7px; cursor: pointer;
}
.sub-btn:hover { background: #465d24; }
.exit-btn {
  padding: 7px 14px; font-size: 13px; font-weight: bold; background: #7f1d1d;
  color: #fff; border: 2px solid #fca5a5; border-radius: 6px; cursor: pointer;
}
.exit-btn:hover { background: #991b1b; }
.small-exit { padding: 3px 8px; font-size: 11px; }

/* LOBBY */
.lobby-top, .lobby-footer, .invite-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.private-controls {
  background: rgba(0,0,0,0.08); padding: 10px 14px; border-radius: 10px; margin: 10px 0;
}
.color-picker { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.color-dots { display: flex; gap: 10px; }
.color-dot {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid #222; cursor: pointer;
  position: relative;
}
.color-dot.selected { border-color: #fff; transform: scale(1.18); box-shadow: 0 0 8px #000; }
.color-dot.locked { opacity: 0.35; cursor: not-allowed; }
.color-dot.locked::after {
  content: "✕"; color: #000; font-weight: bold; font-size: 16px;
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
#lobby-list, #final-standings { list-style: none; padding: 0; margin: 12px 0; text-align: left; font-size: 18px; }
#lobby-list li, #final-standings li {
  display: flex; justify-content: space-between; padding: 8px 12px;
  margin: 6px 0; background: rgba(0,0,0,0.12); border-radius: 8px;
}

/* BLAST DOORS */
.door {
  position: absolute; top: 0; bottom: 0; width: 50%; z-index: 50;
  background: repeating-linear-gradient(135deg, #2d3818 0 18px, #3f4e22 18px 36px, #1f2710 36px 40px);
  border: 6px solid #18200c; transition: transform 0.55s cubic-bezier(0.7, 0, 0.3, 1);
  box-shadow: inset 0 0 40px #000;
}
#door-left { left: 0; transform: translateX(-100%); }
#door-right { right: 0; transform: translateX(100%); display: flex; align-items: flex-end; justify-content: flex-end; padding: 28px; }
.door.closed { transform: translateX(0) !important; }
.door-logo { font-size: 64px; font-weight: 900; color: #b5d66b; text-shadow: 0 4px 10px #000; }

/* HUD */
#hud {
  width: 100%; height: 90px; background: #dceeff; color: #111;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; border-bottom: 2px solid #88a; font-size: 13px;
}
.hud-block { display: flex; flex-direction: column; gap: 4px; }
.hud-right { align-items: flex-end; }
.hud-row { display: flex; align-items: center; gap: 6px; }
.center-row { justify-content: center; margin-top: 12px; }
.bold { font-weight: bold; font-size: 14px; }
.mini-btn {
  padding: 3px 8px; font-size: 11px; font-weight: bold; cursor: pointer;
  border-radius: 4px; border: 1px solid #444; background: #fff;
}
.fire-btn {
  background: #d9381e; color: #fff; font-weight: bold; border: 2px solid #701507;
  padding: 5px 14px; border-radius: 6px; cursor: pointer;
}
.fire-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#scoreboard { font-size: 12px; text-align: right; line-height: 1.25; }

/* BANNERS */
.banner {
  position: absolute; top: 96px; left: 50%; transform: translateX(-50%);
  z-index: 20; padding: 7px 18px; border-radius: 8px; font-weight: bold;
  font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.banner.spectator { background: rgba(20, 20, 25, 0.88); color: #f1c40f; border: 2px solid #f1c40f; }
.banner.teleport { background: rgba(14, 116, 144, 0.92); color: #fff; border: 2px solid #67e8f9; }

#game-canvas { display: block; width: 1000px; height: 540px; }

/* CHAT BAR */
#chat-bar {
  width: 100%; height: 70px; background: #182012; border-top: 2px solid #3c4d24;
  display: flex; padding: 4px 10px; gap: 10px; font-size: 12px;
}
#chat-log {
  flex: 1; overflow-y: auto; background: rgba(0,0,0,0.35); border-radius: 6px;
  padding: 4px 8px; line-height: 1.35;
}
.chat-controls { display: flex; flex-direction: column; justify-content: space-between; width: 340px; }
.quick-btns { display: flex; gap: 4px; }
.qchat {
  flex: 1; font-size: 11px; padding: 3px 4px; background: #2f3e19; color: #e2f5b8;
  border: 1px solid #6b8e23; border-radius: 4px; cursor: pointer;
}
.qchat:hover { background: #465d24; }
#chat-form { display: flex; gap: 4px; }
#chat-input { flex: 1; padding: 4px 8px; border-radius: 4px; border: 1px solid #555; font-size: 12px; }

/* SHOP OVERLAY */
.shop-overlay { z-index: 60; background: rgba(15, 22, 8, 0.78); justify-content: flex-start; padding: 16px 20px; }
.shop-header {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-size: 22px; font-weight: bold; color: #f1c40f;
}
.shop-columns { display: flex; gap: 20px; width: 100%; overflow-y: auto; }
.shop-col { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.shop-item {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,0.92); color: #111; padding: 5px 11px;
  border-radius: 6px; font-size: 13px; cursor: pointer; border: 2px solid #333;
}
.shop-item:hover { background: #e8ffbf; }
