html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #111;
  color: white;
  font-family: Arial, sans-serif;
  touch-action: none;
  user-select: none;
}

#game-canvas {
  display: none;
  width: 100vw;
  height: 100vh;
  background: #181818;
}

/* ============================================================
   LOBBY / WAITING / MATCH OVER
============================================================ */

#lobby-screen, #waiting-screen, #matchover-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #332222 0%, #110d0d 65%);
  z-index: 10;
  gap: 16px;
  padding: 16px;
  overflow-y: auto;
}

.game-title {
  font-size: 56px;
  letter-spacing: 10px;
  margin: 0;
  color: #f2c94c;
  text-shadow: 0 0 24px rgba(242, 201, 76, 0.35);
}

.tagline {
  margin: -8px 0 8px;
  opacity: 0.65;
  font-size: 14px;
}

#name-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#name-section label {
  opacity: 0.7;
  font-size: 14px;
}

input[type="text"] {
  font-size: 20px;
  padding: 10px 16px;
  border: 2px solid #555;
  border-radius: 8px;
  background: #222;
  color: white;
  text-align: center;
  outline: none;
  width: 180px;
}

input[type="text"]:focus {
  border-color: #f2c94c;
}

#join-code {
  text-transform: uppercase;
  letter-spacing: 4px;
}

#lobby-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#join-section {
  display: flex;
  gap: 8px;
  align-items: center;
}

#solo-role-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#solo-role-buttons {
  display: flex;
  gap: 12px;
}

/* Back/Leave pill — identical to Wizard's Tower's .back-home-link so the
   two dark-palette action games match each other (and the same fixed
   top-left placement as the card games' Leave/Back). */
.back-home-link {
  position: fixed;
  top: 16px;
  left: 16px;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: #222;
  border: 1px solid #444;
  z-index: 20;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.back-home-link:hover {
  background: #333;
  border-color: #666;
}

.link-btn {
  background: none;
  border: none;
  color: #fff;
  opacity: 0.65;
  font-size: 14px;
  padding: 6px 10px;
  cursor: pointer;
  text-decoration: underline;
}
.link-btn:hover { opacity: 1; }
.link-btn.danger { color: #D1453A; }
.link-btn.danger:hover { opacity: 1; color: #ff6b5e; }

button {
  font-size: 20px;
  padding: 12px 28px;
  border: 0;
  border-radius: 10px;
  background: #e4e4e4;
  color: #111;
  cursor: pointer;
  font-weight: bold;
}

button:active { transform: scale(0.96); }

/* ── Custom dialog modal — replaces the browser's native alert()/
   confirm()/prompt(), which render as bare "games.lightlol.com says..."
   OS dialogs. One overlay reused for all three via showDialog() in
   game.js (see that function for how message/buttons/input get filled
   in and how it resolves) — showAlert()/showConfirm() are thin wrappers
   around it, and the invite-link fallback uses it directly with the
   readonly input shown. */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
}
.dialog-box {
  background: #1c1c1c;
  border: 1px solid #444;
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  width: 88%;
  max-width: 340px;
}
.dialog-message { margin: 0 0 16px; color: #fff; line-height: 1.4; font-size: 15px; }
.dialog-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #555;
  background: #111;
  color: #fff;
  font-size: 14px;
  text-align: center;
}
.dialog-actions { display: flex; gap: 10px; justify-content: center; }
.dialog-btn {
  font-size: 15px;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: bold;
}
.dialog-btn.primary { background: #f2c94c; color: #111; }
.dialog-btn.secondary { background: #333; color: #fff; }

#btn-start {
  background: #c94b4b;
  color: white;
}

.error-msg {
  color: #ff6b6b;
  font-size: 14px;
  min-height: 20px;
}

/* ============================================================
   APPEARANCE
============================================================ */

#appearance-section {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 14px 18px;
  max-width: 360px;
}

#appearance-preview {
  width: 96px;
  height: 96px;
  background: radial-gradient(circle at center, #2a2a2a 0%, #161616 70%);
  border-radius: 8px;
  flex-shrink: 0;
  image-rendering: pixelated;
}

#appearance-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.picker-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.6;
  margin: 0;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  opacity: 0.85;
}

.color-row input[type="color"] {
  width: 34px;
  height: 28px;
  padding: 0;
  border: 1px solid #444;
  border-radius: 6px;
  background: none;
  cursor: pointer;
}

@media (max-width: 480px) {
  #appearance-section { flex-direction: column; }
}

/* ============================================================
   WAITING ROOM
============================================================ */

#waiting-screen h2 {
  font-size: 32px;
  letter-spacing: 4px;
  margin: 0;
}

#room-code-display {
  color: #f2c94c;
  font-size: 40px;
}

#player-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  text-align: center;
}

#player-list li {
  font-size: 16px;
  padding: 8px 16px;
  background: #2a2a2a;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.role-badge {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: bold;
  letter-spacing: 0.02em;
}
.role-badge.juggernaut { background: #c94b4b; color: white; }
.role-badge.archer     { background: #3f8f5f; color: white; }

.hint {
  opacity: 0.65;
  font-size: 14px;
  margin: 4px 0;
  text-align: center;
}
.hint.small { font-size: 12px; max-width: 280px; }

#waiting-share-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
#waiting-share-row .hint { margin: 0; }

/* ============================================================
   MATCH OVER
============================================================ */

#matchover-screen h2 {
  font-size: 44px;
  margin: 0 0 8px;
  color: #f2c94c;
}

/* ============================================================
   ROTATE WARNING
============================================================ */

/* Portrait used to be flat-out blocked here (a #rotate-warning overlay
   forced via @media (orientation: portrait)). Removed — the game now
   renders correctly at any aspect ratio (see draw()'s letterboxed
   uniform scale in game.js), so there was nothing left worth blocking. */

/* ============================================================
   WAITING ROOM — host setup (role + bots)
============================================================ */

#host-setup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.setup-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.setup-label { opacity: 0.7; font-size: 14px; min-width: 64px; text-align: right; }
.seg {
  display: inline-flex;
  border: 2px solid #555;
  border-radius: 8px;
  overflow: hidden;
  background: #222;
}
.seg-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 15px;
  padding: 8px 14px;
  cursor: pointer;
  opacity: 0.7;
  min-width: 40px;
}
.seg-btn:hover { opacity: 1; }
.seg-btn.active { background: #f2c94c; color: #1a1414; opacity: 1; font-weight: bold; }
.seg-count { padding: 8px 12px; font-size: 16px; min-width: 20px; text-align: center; color: #f2c94c; font-weight: bold; }
#player-list li .bot-tag { opacity: 0.55; font-size: 12px; margin-left: 6px; }

/* ============================================================
   IN-MATCH — pause button + pause menu
============================================================ */

/* In-match gear — matches the settings gear Wizard's Tower draws on its
   HUD (dark disc, thin light ring, white ⚙), top-right where every other
   game keeps its settings control. */
.settings-gear {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.settings-gear:hover { background: rgba(0, 0, 0, 0.6); }

/* Pause / settings menu — same box and button styles as Wizard's Tower's
   Settings, on top of Hilt's own .dialog-overlay backdrop. */
#pause-menu { z-index: 8; }
.settings-box { max-width: 300px; }
.settings-title { margin: 0 0 12px; color: #fff; font-size: 18px; }
#pause-detail { margin: 0 0 12px; }
#pause-detail:empty { display: none; }
.settings-list { display: flex; flex-direction: column; gap: 10px; }
.settings-btn {
  font-size: 15px;
  padding: 12px 18px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  background: #333;
  color: #fff;
}
.settings-btn.danger { background: #5a1f1f; color: #ff8f80; }
.settings-btn:active { transform: scale(0.97); }
