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

/* ── Search players found label ──────────────────── */
.search-players {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.search-players-count {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.8);
}
.search-players-label {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.75);
  text-shadow: 0 1px 6px rgba(0,0,0,0.7);
}

/* ── Page Loading Screen ─────────────────────────── */
#page-loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1b0d;
  z-index: 2000;
  transition: opacity 0.25s ease;
}
#page-loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}
.page-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.page-loading-title {
  font-size: 2.8rem;
  font-weight: 900;
  color: #a8e063;
  letter-spacing: 4px;
  font-family: monospace;
}
.page-loading-dots {
  display: flex;
  gap: 14px;
}
.page-loading-dots span {
  width: 13px;
  height: 13px;
  background: #a8e063;
  border-radius: 50%;
  animation: page-dot-pulse 1.2s ease-in-out infinite;
}
.page-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.page-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes page-dot-pulse {
  0%, 100% { opacity: 0.2; transform: scale(0.75); }
  50%       { opacity: 1;   transform: scale(1.2);  }
}

/* ── Name Entry Screen ───────────────────────────── */
#name-entry-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1b0d;
  z-index: 1000;
}
#name-entry-screen.hidden { display: none; }
.name-entry-box {
  background: #1a2a1a;
  border: 2px solid #4a7c3f;
  border-radius: 16px;
  padding: 40px 50px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  min-width: 280px;
}
.name-entry-title {
  font-size: 2rem;
  font-weight: 900;
  color: #a8e063;
  letter-spacing: 2px;
  font-family: monospace;
}
.name-entry-sub {
  font-size: 1rem;
  color: #c8d8b0;
}
#name-input, #password-input,
#login-name-input, #login-password-input,
#register-name-input, #register-password-input {
  background: #0d1b0d;
  border: 2px solid #4a7c3f;
  border-radius: 8px;
  color: #e8f5d0;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 10px 16px;
  text-align: center;
  width: 220px;
  outline: none;
  font-family: monospace;
}
#name-input:focus, #password-input:focus,
#login-name-input:focus, #login-password-input:focus,
#register-name-input:focus, #register-password-input:focus { border-color: #a8e063; }
.name-entry-hint {
  color: #889;
  font-size: 0.8rem;
  font-family: monospace;
  margin-top: -6px;
  text-align: center;
}
.name-entry-error {
  color: #e74c3c;
  font-size: 0.9rem;
  font-family: monospace;
  margin-top: -6px;
  min-height: 1em;
  text-align: center;
}
/* Neutral "checking…" feedback (not an error) shown while the server validates */
.name-entry-error.auth-checking {
  color: #a8e063;
}

/* ── Animated app background (Frontier Dusk) ─────── */
/* Sits behind all content; visible wherever the foreground is translucent
   (login/register + lobby). Hidden during gameplay so its CSS animations
   don't compete with the 60Hz game canvas. */
#app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: #0b0f24;
}
#app-bg.hidden { display: none; }

/* ── Login / Register Screens ────────────────────── */
/* Translucent so the Frontier Dusk backdrop shows through; the centered box
   stays opaque and readable. */
#login-screen, #register-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 4vh, 28px);
  padding: 20px;
  overflow-y: auto;
  background: rgba(8,10,20,0.55);
  z-index: 1000;
}
#login-screen.hidden, #register-screen.hidden { display: none; }
/* Standalone game logo above the auth box (pulled out of the box so the
   form popup can never overlap it). */
.auth-logo {
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  text-shadow: 3px 3px 0 #e74c3c, 6px 6px 0 rgba(0,0,0,0.35);
  flex-shrink: 0;
}
/* On short viewports (landscape phones) the centered logo + box can overflow
   and push the logo off the top. Top-align and scroll so it stays visible. */
@media (max-height: 600px) {
  #login-screen, #register-screen {
    justify-content: flex-start;
    gap: 10px;
    padding: 12px;
  }
  .auth-logo {
    font-size: clamp(1.5rem, 6vw, 2.1rem);
    text-shadow: 2px 2px 0 #e74c3c, 4px 4px 0 rgba(0,0,0,0.3);
  }
}
.btn-auth-link {
  background: none;
  border: none;
  color: #a8e063;
  font-size: 0.9rem;
  font-family: monospace;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-auth-link:hover { color: #c8f08a; }
.auth-lang-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.auth-lang-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(168,224,99,0.3);
  border-radius: 8px;
  color: #c8d8b0;
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.auth-lang-btn.active {
  background: rgba(168,224,99,0.15);
  border-color: #a8e063;
  color: #a8e063;
  font-weight: 700;
}
.auth-lang-btn:hover:not(.active) { background: rgba(255,255,255,0.1); }

/* ── Hamburger Button ────────────────────────────── */
.hamburger-btn {
  position: fixed;
  top: 14px; right: 16px;
  z-index: 150;
  background: #e74c3c;
  border: none;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: background 0.2s;
}
.hamburger-btn:hover { background: #c0392b; }
.hamburger-btn span {
  display: block;
  width: 22px; height: 2px;
  background: #fff;
  border-radius: 2px;
}

/* ── Quick-chat emotes (in-game) ─────────────────── */
#emote-btn {
  position: fixed;
  bottom: 270px;
  right: 36px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.45);
  font-size: 30px;
  line-height: 1;
  z-index: 60;
  cursor: pointer;
}
#emote-btn:active { background: rgba(255,255,255,0.15); }
#emote-popover {
  position: fixed;
  bottom: 344px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0,0,0,0.7);
  border-radius: 12px;
  padding: 10px 12px;
  z-index: 61;
}
.emote-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
#emote-popover button {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
}
#emote-popover button:active { transform: scale(1.25); }
#emote-popover .emote-text-btn {
  font-family: "Arial Black", "Verdana", sans-serif;
  font-weight: 900;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  color: #ffd23e;
  text-shadow: 1px 1px 0 #1a1a2e, -1px 1px 0 #1a1a2e, 1px -1px 0 #1a1a2e, -1px -1px 0 #1a1a2e;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 6px 9px;
  transform: rotate(-2deg);
}
#emote-popover .emote-text-btn:active { transform: rotate(-2deg) scale(1.15); }

/* Lobby variant: same popover, anchored to the lobby emote button */
#emote-popover.lobby-pos {
  bottom: 96px;
  right: 18px;
}
.lobby-emote-btn {
  position: fixed;
  bottom: 22px;
  right: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.45);
  font-size: 26px;
  line-height: 1;
  z-index: 140;
  cursor: pointer;
}
.lobby-emote-btn:active { background: rgba(255,255,255,0.15); }

/* Floating quick-chat bubble above a lobby card */
.lobby-emote {
  position: fixed;
  z-index: 400;
  pointer-events: none;
  transform: translate(-50%, -100%);
  animation: lobby-emote-float 2.5s ease-out forwards;
}
.lobby-emote-emoji { font-size: 34px; }
.lobby-emote-text {
  font-family: "Arial Black", "Verdana", sans-serif;
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  color: #ffd23e;
  text-shadow: 2px 2px 0 #1a1a2e, -2px 2px 0 #1a1a2e, 2px -2px 0 #1a1a2e, -2px -2px 0 #1a1a2e;
  transform: rotate(-3deg);
  display: inline-block;
}
@keyframes lobby-emote-float {
  0%   { opacity: 0; margin-top: 8px; }
  10%  { opacity: 1; margin-top: 0; }
  80%  { opacity: 1; }
  100% { opacity: 0; margin-top: -14px; }
}

/* ── Team roster HUD (team knockout modes) ───────── */
.team-roster {
  position: fixed;
  top: 10px;
  z-index: 90;
  display: flex;
  gap: 6px;
  pointer-events: none;
}
#team-roster-left  { left: 12px; }
#team-roster-right { right: 12px; }
.roster-head {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(0,0,0,0.45);
  border: 2px solid #2ecc71;
}
#team-roster-right .roster-head { border-color: #e74c3c; }
.roster-head.roster-me { border-color: #f5a623; box-shadow: 0 0 6px rgba(245,166,35,0.7); }
/* Player/bot name inside the circle */
.roster-name {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.1;
  color: #eee;
  word-break: break-word;
  overflow: hidden;
}
.roster-head.dead .roster-name { color: #777; }
.roster-x {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: #ff3b30;
  font-weight: 900;
  font-size: 42px;
  line-height: 1;
  text-shadow: 0 0 5px #000;
}
.roster-head.dead .roster-x { display: flex; }
#kill-feed.below-roster { top: 78px; }

/* ── Kill Feed (in-game, top right) ──────────────── */
#kill-feed {
  position: fixed;
  top: 12px; right: 12px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  pointer-events: none;
}
.kill-feed-entry {
  background: rgba(0,0,0,0.55);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: #ddd;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.6s;
}
.kill-feed-entry.fading { opacity: 0; }
.kf-friend { color: #2ecc71; font-weight: 700; }
.kf-enemy  { color: #e74c3c; font-weight: 700; }
.kf-me     { text-decoration: underline; }

/* ── Chat banner (incoming message, panel closed) ── */
#chat-banner {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translate(-50%, 0);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(480px, 88vw);
  background: rgba(10, 10, 22, 0.92);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 9px 14px;
  cursor: pointer;
  animation: chat-banner-in 0.25s ease-out;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}
#chat-banner::before { content: '💬'; font-size: 1rem; }
#chat-banner.hidden { display: none; }
#chat-banner-from {
  color: #f5a623;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}
#chat-banner-from::after { content: ':'; }
#chat-banner-text {
  color: #eee;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes chat-banner-in {
  from { transform: translate(-50%, -140%); }
  to   { transform: translate(-50%, 0); }
}

/* ── Group Chat (button + drawer) ────────────────── */
.chat-btn {
  position: fixed;
  top: 14px; right: 70px;
  z-index: 150;
  background: #2980b9;
  border: none;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-btn:hover { background: #216a94; }
#chat-unread-dot {
  position: absolute;
  top: -4px; right: -4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #e74c3c;
  border: 2px solid #12121f;
}
/* Group action buttons normally sit at right:70px — shift them left while the
   chat button occupies that spot (body.in-group is maintained by ui.js). */
body.in-group #brawler-group-actions { right: 124px; }

#chat-drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(420px, 95vw);
  height: 100%;
  background: #12121f;
  border-left: 1px solid rgba(255,255,255,0.07);
  z-index: 310;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
#chat-drawer.drawer-open { transform: translateX(0); }
#chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-empty-hint {
  color: #666;
  font-size: 0.85rem;
  text-align: center;
  margin-top: 20px;
}
.chat-msg {
  max-width: 85%;
  align-self: flex-start;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 6px 10px;
}
.chat-msg-own {
  align-self: flex-end;
  background: rgba(41,128,185,0.35);
}
.chat-msg-from {
  font-size: 0.7rem;
  font-weight: 700;
  color: #f5a623;
  margin-bottom: 2px;
}
.chat-msg-own .chat-msg-from { color: #7fc4ee; }
.chat-msg-text {
  font-size: 0.9rem;
  color: #eee;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: #12121f;
  flex-shrink: 0;
}
.chat-input-row input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #eee;
  padding: 8px 10px;
  font-size: 0.9rem;
  outline: none;
}
.chat-input-row input:focus { border-color: #2980b9; }

/* ── Side Drawer ─────────────────────────────────── */
#drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
}
#side-drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(640px, 95vw);
  height: 100%;
  background: #12121f;
  border-left: 1px solid rgba(255,255,255,0.07);
  z-index: 310;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  /* Whole drawer scrolls as one unit (no nested scroll areas) */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
#side-drawer.drawer-open { transform: translateX(0); }
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  /* Stays visible while the drawer content scrolls underneath */
  position: sticky;
  top: 0;
  background: #12121f;
  z-index: 2;
  flex-shrink: 0;
}
.drawer-title {
  font-family: monospace;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: #f5a623;
  text-transform: uppercase;
}
.drawer-close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.drawer-close-btn:hover { color: #eee; background: rgba(255,255,255,0.08); }
.drawer-section {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.drawer-section:last-child {
  border-bottom: none;
}
.drawer-section-title {
  font-size: 0.68rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #666;
  font-family: monospace;
  font-weight: 700;
}
.drawer-profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.drawer-profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.drawer-username {
  font-family: monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #c8d8b0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-trophies {
  font-family: monospace;
  font-size: 0.85rem;
  color: #f5c518;
}
/* Friends inside drawer (reuse existing friend-row styles, override list max-height) */
#side-drawer #friends-list {
  max-height: none;
  flex: 1;
}

/* ── Profil-Screen (fullscreen) ─────────────────── */
#account-modal, #friend-profile-modal {
  position: fixed;
  inset: 0;
  background: #0c0c16;
  z-index: 200;
  overflow: hidden;
}
/* Bulletproof layout: header is absolutely positioned at the top with a
 * known height; content fills the rest and has its own scrollbar. No flex
 * height plumbing — works on iOS Safari even with the dynamic toolbar. */
.account-modal-card {
  position: absolute;
  inset: 0;
  background: #12121f;
}
.account-modal-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 56px;           /* fixed so content offset is predictable */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.25);
  z-index: 1;
}
.account-modal-back {
  justify-self: start;
  background: none;
  border: none;
  color: #c8d8b0;
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 14px 8px 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, color 0.15s;
}
.account-modal-back:hover { background: rgba(255,255,255,0.06); color: #fff; }
.account-back-arrow {
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 900;
}
.account-modal-header-spacer { /* keeps title centered via grid */ }
.account-modal-title {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #f5a623;
  margin: 0;
  text-align: center;
  justify-self: center;
}
.account-modal-content {
  position: absolute;
  top: 56px;              /* matches header height */
  left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 28px 24px max(32px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 24px;
  /* center the column on wide screens via padding instead of width+margin
   * (auto-margin on a position:absolute element doesn't center). */
  align-items: stretch;
  box-sizing: border-box;
}
.account-modal-content > * {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}
@media (max-width: 480px) {
  .account-back-text { display: none; }
  .account-modal-back { padding: 8px 10px; }
  .account-modal-title { font-size: 1.15rem; letter-spacing: 1.5px; }
  .account-modal-content { padding: 20px 16px 28px; gap: 20px; }
}
/* Landscape phone: shrink header so more content fits in the scroll area */
@media (max-height: 500px) and (orientation: landscape) {
  .account-modal-header { height: 42px; }
  .account-modal-content { top: 42px; padding: 14px 16px max(20px, env(safe-area-inset-bottom)); gap: 16px; }
  .account-modal-title { font-size: 1rem; }
  .account-back-text { display: none; }
}
.account-modal-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.account-modal-label {
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #666;
  font-family: monospace;
}
.account-modal-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.account-modal-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #eee;
  font-size: 1rem;
  padding: 7px 12px;
  font-family: monospace;
  outline: none;
  transition: border-color 0.15s;
}
.account-modal-input:focus { border-color: #a8e063; }
.account-modal-feedback {
  font-size: 0.8rem;
  min-height: 1em;
  font-family: monospace;
}
.account-trophy-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.account-block-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.account-block-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(231, 76, 60, 0.10);
  border: 1px solid rgba(231, 76, 60, 0.25);
  border-radius: 7px;
  padding: 7px 12px;
  font-family: monospace;
  font-size: 0.95rem;
}
.account-block-row-name { color: #ffb0a8; }
.account-block-empty {
  font-size: 0.85rem;
  color: #556;
  text-align: center;
  padding: 6px 0;
}
.account-trophy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.04);
  border-radius: 7px;
  padding: 9px 14px;
  font-family: monospace;
  font-size: 1rem;
}
.account-trophy-row-name { color: #c8d8b0; }
.account-trophy-row-val  { color: #f5c518; font-weight: 700; }
.account-trophy-row-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.account-trophy-row-stats {
  font-size: 0.72rem;
  color: #889;
  font-weight: 400;
}
.account-trophy-total-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 10px;
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: #eee;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 2px;
  padding-top: 6px;
}
.account-modal-danger { border-top-color: rgba(231,76,60,0.2); }
.btn-danger {
  background: rgba(231,76,60,0.15);
  border: 1px solid rgba(231,76,60,0.4);
  color: #e74c3c;
}
.btn-danger:hover { background: rgba(231,76,60,0.28); }
.account-reset-warning {
  font-size: 0.85rem;
  color: #e74c3c;
  margin: 0;
  font-family: monospace;
}

/* ── Brawler Trophy Badge ────────────────────────── */
.brawler-trophy-badge {
  font-size: 0.72rem;
  color: #f5c518;
  margin-top: 3px;
  font-family: monospace;
}

/* ── GameOver Trophy Delta ───────────────────────── */
#gameover-trophy-delta {
  font-size: 1.6rem;
  font-weight: 900;
  text-align: center;
  margin: 2px 0 6px;
  font-family: monospace;
  letter-spacing: 1px;
}
.trophy-pos  { color: #f5c518; }
.trophy-neg  { color: #e74c3c; }
.trophy-zero { color: #888; }

body {
  background: #1a1a2e;
  color: #eee;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
  width: 100vw;
  min-height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
}

.hidden { display: none !important; }

/* ---- LOBBY ---- */
#lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: clamp(10px, 3vw, 20px);
  padding-bottom: max(clamp(10px, 3vw, 20px), env(safe-area-inset-bottom));
  gap: clamp(8px, 1.5vh, 15px);
}

.title {
  font-size: clamp(1.6em, 7vw, 3em);
  color: #f5a623;
  text-shadow: 3px 3px 0 #e74c3c, 6px 6px 0 rgba(0,0,0,0.3);
  letter-spacing: clamp(2px, 1vw, 4px);
  margin-bottom: 4px;
}

#connection-status {
  color: #aaa;
  font-size: 1.1em;
}

/* Floating mode-change button (bottom-right of lobby) */
.btn-mode-change {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  background: #2c3e50;
  border: 2px solid #f5a623;
  border-radius: 12px;
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: white;
  cursor: pointer;
  min-width: 200px;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-mode-change:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 166, 35, 0.4);
}
.btn-mode-label { font-size: 0.7rem; opacity: 0.7; letter-spacing: 1px; text-transform: uppercase; }
#btn-mode-current { font-size: 1.05rem; font-weight: bold; color: #f5a623; margin-top: 2px; }
.btn-mode-change.disabled { opacity: 0.5; cursor: default; border-color: #555; pointer-events: none; }
.btn-mode-change.disabled #btn-mode-current { color: #bbb; }

/* Mode-select screen with rectangular tiles */
#mode-select-screen {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#mode-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 20px 0;
  width: 100%;
}
.mode-tile {
  background: linear-gradient(135deg, #2c3e50, #34495e);
  border: 3px solid #f5a623;
  border-radius: 14px;
  padding: 20px;
  text-align: left;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}
.mode-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(245, 166, 35, 0.4);
}
.mode-tile.selected {
  background: linear-gradient(135deg, #f5a623, #e87e22);
  color: #1a1a2e;
}
.mode-tile-name {
  font-size: 1.3rem;
  font-weight: bold;
  color: #f5a623;
  margin-bottom: 8px;
}
.mode-tile.selected .mode-tile-name { color: #1a1a2e; }
.mode-tile-desc { font-size: 0.9rem; opacity: 0.85; line-height: 1.4; }

/* Group Actions */
.group-buttons {
  display: flex;
  gap: clamp(8px, 2vw, 15px);
  flex-wrap: wrap;
  justify-content: center;
  margin: 4px 0;
}

/* Lobby home: group buttons live top-right next to the hamburger so the
   stage below gets more vertical room for the brawler sprites */
#brawler-group-actions {
  position: fixed;
  top: 14px;
  right: 70px;
  z-index: 150;
  margin: 0;
  flex-wrap: nowrap;
  gap: 8px;
}
#brawler-group-actions .btn-group {
  padding: 9px 14px;
  font-size: 0.8em;
  white-space: nowrap;
}
@media (max-width: 600px) {
  #brawler-group-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }
  #brawler-group-actions .btn-group {
    padding: 7px 10px;
    font-size: 0.72em;
  }
}

/* Group Info Bar */
.group-info-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #16213e;
  border: 2px solid #f5a623;
  border-radius: 10px;
  padding: 8px 16px;
  margin-bottom: 12px;
  font-size: 1em;
}

.group-info-box strong {
  color: #f5a623;
  letter-spacing: 3px;
}

.btn-small {
  padding: 4px 12px;
  font-size: 0.85em;
}

.btn-leave {
  background: #888;
}

.btn-leave:hover {
  background: #aaa;
}

.btn-group {
  background: #2c3e80;
}

.btn-group:hover {
  background: #3a50a0;
}

/* Room Code */
.room-code-text {
  font-size: 3em;
  font-weight: bold;
  letter-spacing: 12px;
  color: #f5a623;
  background: #16213e;
  padding: 15px 30px;
  border-radius: 12px;
  border: 3px solid #f5a623;
  margin: 10px 0;
  text-align: center;
}

#room-code-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#code-input {
  font-size: 2em;
  font-weight: bold;
  letter-spacing: 10px;
  text-align: center;
  width: 200px;
  padding: 10px;
  background: #16213e;
  color: #f5a623;
  border: 3px solid #333;
  border-radius: 12px;
  text-transform: uppercase;
}

#code-input:focus {
  border-color: #f5a623;
  outline: none;
}

/* Back button */
.btn-back {
  background: #555;
  font-size: 0.9em;
  padding: 8px 20px;
  margin-top: 10px;
}

.btn-back:hover {
  background: #777;
}

/* Mode Display Badge (inside brawler-select) */
.mode-display {
  font-size: 0.85em;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: 20px;
  padding: 6px 18px;
  text-align: center;
}

.mode-waiting {
  color: #888;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.mode-selected {
  color: #f5a623;
  background: rgba(245, 166, 35, 0.1);
  border: 1px solid rgba(245, 166, 35, 0.35);
  text-shadow: 0 0 10px rgba(245,166,35,0.4);
}

/* Brawler Select */
#brawler-select {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.brawler-card {
  background: #16213e;
  border: 3px solid #333;
  border-radius: 12px;
  padding: clamp(8px, 1.5vw, 12px);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.brawler-card:hover {
  border-color: #f5a623;
  transform: scale(1.05);
}

.brawler-card.selected {
  border-color: #f5a623;
  background: #1a3a5e;
  box-shadow: 0 0 15px rgba(245, 166, 35, 0.4);
}

.brawler-preview {
  display: block;
  width: clamp(60px, 12vw, 96px);
  height: clamp(60px, 12vw, 96px);
  margin: 0 auto 6px;
}

.slot-brawler {
  display: flex;
  align-items: center;
  gap: 6px;
}

.slot-brawler-icon {
  display: block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.brawler-name {
  font-weight: bold;
  font-size: clamp(0.8em, 2.5vw, 1em);
  margin-bottom: 2px;
}

.brawler-desc {
  font-size: clamp(0.65em, 1.8vw, 0.75em);
  color: #aaa;
}

.brawler-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 6px;
  font-size: clamp(0.6em, 1.6vw, 0.7em);
  color: #ccc;
}

/* Player Slots */
.player-slots {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.5vw, 12px);
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 520px;
}

.player-slot {
  background: #16213e;
  border: 2px solid #333;
  border-radius: 12px;
  padding: clamp(8px, 1.5vw, 12px) clamp(10px, 2.5vw, 18px);
  text-align: center;
  min-width: clamp(80px, 20vw, 110px);
  flex: 1;
  max-width: 160px;
}

.player-slot.my-slot {
  border-color: #f5a623;
  box-shadow: 0 0 10px rgba(245, 166, 35, 0.3);
}

.player-slot .slot-label {
  font-weight: bold;
  margin-bottom: 5px;
  font-size: 0.9em;
}

.player-slot .slot-brawler {
  color: #f5a623;
  font-size: 1em;
}

.player-slot .slot-ready {
  margin-top: 5px;
  font-size: 0.8em;
  color: #e74c3c;
}

.player-slot .slot-ready.is-ready {
  color: #2ecc71;
}

.player-slot .slot-kick-btn {
  margin-top: 6px;
  padding: 2px 8px;
  font-size: 0.72em;
}

/* Buttons */
.btn {
  background: #e74c3c;
  color: white;
  border: none;
  padding: clamp(10px, 1.5vh, 12px) clamp(18px, 4vw, 30px);
  font-size: clamp(0.95em, 2.5vw, 1.1em);
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn:hover { background: #c0392b; }

.btn:disabled {
  opacity: 0.55;
  cursor: progress;
  background: #7f8c8d;
}
.btn:disabled:hover { background: #7f8c8d; }

.btn-ready {
  background: #2ecc71;
  font-size: clamp(1.1em, 3vw, 1.3em);
  padding: clamp(12px, 1.8vh, 15px) clamp(30px, 8vw, 50px);
}

.btn-ready:hover { background: #27ae60; }
.btn-ready.is-ready { background: #e74c3c; }
.btn-ready.is-ready:hover { background: #c0392b; }

/* ===== Wave Difficulty Selector ===== */
#wave-difficulty {
  text-align: center;
  margin: 6px 0 12px;
}
.difficulty-label {
  font-size: 0.75rem;
  color: #8ca87e;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.difficulty-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.btn-diff {
  padding: 6px 20px;
  border: 2px solid #4a7c3f;
  border-radius: 8px;
  background: transparent;
  color: #c8d8b0;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.5px;
}
.btn-diff.active {
  background: #4a7c3f;
  color: #fff;
}
.btn-diff:hover:not(.active):not(:disabled) {
  background: rgba(74,124,63,0.35);
}
.btn-diff.readonly,
.btn-diff:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Fill Toggle */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 1em;
  color: #ccc;
}

.toggle-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #f5a623;
  cursor: pointer;
}

#waiting-msg {
  color: #f5a623;
  font-size: 1.2em;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---- GAME ---- */
#game {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  position: relative;
  touch-action: none;
  overflow: hidden;
}

#gameCanvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  max-width: 100vw;
  max-height: 100vh;
  touch-action: none;
}

#countdown-img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(240px, 45vmin, 440px);
  height: clamp(240px, 45vmin, 440px);
  pointer-events: none;
  z-index: 50;
  image-rendering: auto;
  overflow: visible;
}

#hud {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

#wave-info {
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 1.2em;
  color: #f5a623;
}

/* ---- GAME OVER ---- */
#gameover {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 20px 0;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(3px);
  z-index: 100;
}

.gameover-card {
  background: rgba(18, 18, 34, 0.97);
  border: 1px solid rgba(245, 166, 35, 0.2);
  border-radius: 18px;
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 520px;
  width: 92%;
  box-shadow: 0 0 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  margin: auto;
}

#gameover-title {
  font-size: 2.8em;
  letter-spacing: 3px;
  color: #f5a623;
  margin: 0;
}

.gameover-placement {
  font-size: 1.05em;
  color: #f5a623;
  letter-spacing: 2px;
  background: rgba(245, 166, 35, 0.08);
  border: 1px solid rgba(245, 166, 35, 0.2);
  border-radius: 8px;
  padding: 6px 20px;
  text-align: center;
}

.gameover-placement.place-1 {
  color: #f5a623;
  border-color: rgba(245, 166, 35, 0.5);
  background: rgba(245, 166, 35, 0.15);
}

#gameover-msg {
  font-size: 1em;
  color: #888;
  margin: 0;
}

/* Stats Table */
.gameover-stats {
  width: 100%;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.stats-table .col-brawler { text-align: left; min-width: 110px; }
.stats-table .col-stat { text-align: center; min-width: 70px; }

.stats-table thead tr {
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.stats-table thead th {
  color: #666;
  font-size: 0.8em;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 6px 8px 8px;
  font-weight: normal;
  white-space: nowrap;
}

.stats-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.stats-table tbody tr:last-child { border-bottom: none; }

.stats-table tbody td {
  padding: 9px 8px;
  text-align: center;
  color: #aaa;
}

.stats-table tbody td.col-brawler {
  text-align: left;
  color: #ddd;
  font-weight: 500;
}

.stats-table tbody tr.stats-me { background: rgba(245, 166, 35, 0.06); }
.stats-table tbody tr.stats-me td.col-brawler {
  color: #f5a623;
  font-weight: bold;
}

.stat-kills  { color: #2ecc71 !important; font-weight: bold; }
.stat-deaths { color: #e74c3c !important; }
.stat-damage { color: #f5a623 !important; }
.stat-taken  { color: #888    !important; }

/* ---- JOYSTICK OVERLAY ---- */
#joystickCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 50;
  display: none;
}

#ult-btn {
  display: none;
  position: fixed;
  bottom: 140px;
  right: 30px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid #f5a623;
  background: rgba(245, 166, 35, 0.3);
  color: #f5a623;
  font-size: 16px;
  font-weight: bold;
  z-index: 60;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  text-shadow: 0 0 4px rgba(0,0,0,0.8);
}

#ult-btn.ult-ready {
  background: rgba(245, 166, 35, 0.8);
  color: #fff;
  border-color: #fff;
  box-shadow: 0 0 20px rgba(245, 166, 35, 0.6);
  animation: ult-pulse 1s infinite;
}

#ult-btn.ult-armed {
  background: rgba(255, 60, 30, 0.9);
  color: #fff;
  border-color: #ff4444;
  box-shadow: 0 0 25px rgba(255, 60, 30, 0.8);
  animation: none;
  transform: scale(1.1);
}

#ult-btn.ult-disabled {
  background: rgba(100, 100, 100, 0.3);
  border-color: #555;
  color: #666;
}

#spectate-leave-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 60;
}

@keyframes ult-pulse {
  0%, 100% { box-shadow: 0 0 15px rgba(245, 166, 35, 0.5); transform: scale(1); }
  50% { box-shadow: 0 0 30px rgba(245, 166, 35, 0.8); transform: scale(1.08); }
}

/* ---- SEARCHING SCREEN ---- */
#searching-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: #09091a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  overflow: hidden;
}
#loading-screen-root {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pulsing radar rings */
.search-rings {
  position: absolute;
  top: 50%; left: 50%;
  pointer-events: none;
}
.search-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(245, 166, 35, 0.4);
  transform: translate(-50%, -50%);
}
.search-ring.r1 { animation: ring-pulse 3.6s ease-out infinite 0s; }
.search-ring.r2 { animation: ring-pulse 3.6s ease-out infinite 0.9s; }
.search-ring.r3 { animation: ring-pulse 3.6s ease-out infinite 1.8s; }
.search-ring.r4 { animation: ring-pulse 3.6s ease-out infinite 2.7s; }

@keyframes ring-pulse {
  0%   { width: 80px;  height: 80px;  opacity: 0.9; border-color: rgba(245,166,35,0.7); }
  100% { width: 700px; height: 700px; opacity: 0;   border-color: rgba(245,166,35,0); }
}

/* Main content */
.search-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 30px 20px;
}

.search-icon {
  font-size: 3.2em;
  filter: drop-shadow(0 0 14px rgba(245, 166, 35, 0.8));
  animation: icon-float 3s ease-in-out infinite;
}
@keyframes icon-float {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50%       { transform: translateY(-8px) rotate(8deg); }
}

.search-title {
  font-size: 3.4em;
  color: #f5a623;
  letter-spacing: 6px;
  text-shadow:
    3px 3px 0 #c0392b,
    0 0 25px rgba(245,166,35,0.6),
    0 0 60px rgba(245,166,35,0.25);
  animation: title-glow 2.5s ease-in-out infinite alternate;
}
@keyframes title-glow {
  from { text-shadow: 3px 3px 0 #c0392b, 0 0 20px rgba(245,166,35,0.4); }
  to   { text-shadow: 3px 3px 0 #c0392b, 0 0 50px rgba(245,166,35,0.9), 0 0 90px rgba(245,166,35,0.4); }
}

.search-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, #f5a623, #e74c3c, #f5a623, transparent);
  border-radius: 2px;
  animation: divider-glow 2s ease-in-out infinite alternate;
}
@keyframes divider-glow {
  from { width: 160px; opacity: 0.5; }
  to   { width: 280px; opacity: 1; }
}

.search-subtitle {
  color: #888;
  letter-spacing: 5px;
  font-size: 0.78em;
  text-transform: uppercase;
}

/* Bouncing dots */
.search-dots {
  display: flex;
  gap: 10px;
  margin: 2px 0;
}
.search-dots span {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #f5a623;
  animation: dot-bounce 1.3s ease-in-out infinite;
}
.search-dots span:nth-child(2) { animation-delay: 0.22s; }
.search-dots span:nth-child(3) { animation-delay: 0.44s; }
@keyframes dot-bounce {
  0%, 75%, 100% { transform: translateY(0);    opacity: 0.35; background: #f5a623; }
  38%            { transform: translateY(-14px); opacity: 1;    background: #fff; }
}

/* Timer box */
.search-timer-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(245,166,35,0.25);
  border-radius: 14px;
  padding: 18px 40px 14px;
  min-width: 230px;
  text-align: center;
  box-shadow: 0 0 30px rgba(245,166,35,0.08), inset 0 1px 0 rgba(255,255,255,0.06);
}
.search-timer-label {
  font-size: 0.72em;
  color: #666;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.search-timer-value {
  font-size: 3em;
  font-weight: bold;
  color: #f5a623;
  line-height: 1;
  text-shadow: 0 0 25px rgba(245,166,35,0.55);
  font-variant-numeric: tabular-nums;
  transition: color 0.4s;
}
.search-timer-value.urgent { color: #e74c3c; text-shadow: 0 0 25px rgba(231,76,60,0.6); }
.search-timer-bar {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}
.search-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, #2ecc71, #f5a623, #e74c3c);
  border-radius: 2px;
  width: 100%;
  transition: width 0.95s linear;
}

/* Players found */
/* Footer status bar */
.search-footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: rgba(0,0,0,0.5);
  border-top: 1px solid rgba(245,166,35,0.12);
}
.search-footer-left {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #777;
  font-size: 0.88em;
}
.search-dot-indicator {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 7px #2ecc71;
  flex-shrink: 0;
  animation: status-blink 1.6s ease-in-out infinite;
}
@keyframes status-blink {
  0%, 100% { opacity: 1; box-shadow: 0 0 7px #2ecc71; }
  50%       { opacity: 0.25; box-shadow: none; }
}
.search-animated-dots span {
  animation: dot-fade 1.8s ease-in-out infinite;
  opacity: 0;
}
.search-animated-dots span:nth-child(1) { animation-delay: 0s; }
.search-animated-dots span:nth-child(2) { animation-delay: 0.6s; }
.search-animated-dots span:nth-child(3) { animation-delay: 1.2s; }
@keyframes dot-fade {
  0%, 100% { opacity: 0; }
  50%       { opacity: 1; }
}
.search-footer-right {
  color: #f5a623;
  font-weight: bold;
  font-size: 0.95em;
  letter-spacing: 1px;
}

/* ---- RESPONSIVE ---- */

/* Small phones: iPhone SE / 8 / 12 mini (≤390px wide, ≤750px tall) */
@media (max-width: 430px), (max-height: 750px) {
  #lobby { gap: 6px; padding: 8px; }
  .title { font-size: 1.5em; margin-bottom: 0; }
  #connection-status { font-size: 0.85em; }
  .group-info-box { padding: 5px 10px; font-size: 0.85em; gap: 8px; margin-bottom: 6px; }
  h2 { font-size: 1em; }

  /* Mode tiles: tighter on mobile */
  #mode-tiles { grid-template-columns: 1fr; gap: 10px; }
  .mode-tile { padding: 14px; }
  .mode-tile-name { font-size: 1.1rem; }
  .btn-mode-change { min-width: 160px; padding: 8px 14px; right: 12px; bottom: 12px; }
  #btn-mode-current { font-size: 0.95rem; }
  .mode-icon { font-size: 1.2em; }
  .mode-name { font-size: 0.8em; }

  /* Group buttons */
  .group-buttons { gap: 8px; margin: 2px 0; }
  .btn { padding: 9px 16px; font-size: 0.9em; }

  /* Brawler grid (scoped to legacy .brawler-card — must NOT shrink the
     lobby stage or brawler-select sprites, which size via clamp()) */
  .brawler-card { padding: 7px; border-width: 2px; overflow: hidden; }
  .brawler-card .brawler-preview { width: 48px !important; height: 48px !important; margin-bottom: 4px; }
  .slot-brawler-icon { width: 22px; height: 22px; }
  .brawler-name { font-size: 0.72em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brawler-desc { display: none; }
  .brawler-stats { display: none; }
  .btn-back { padding: 7px 14px; font-size: 0.8em; margin-top: 6px; }

  /* Player slots */
  .player-slots { gap: 5px; }
  .player-slot { padding: 6px 8px; min-width: 70px; font-size: 0.85em; }
  .player-slot .slot-label { font-size: 0.8em; }

  /* Ready + fill */
  .btn-ready { font-size: 1em; padding: 11px 28px; }
  .toggle-label { font-size: 0.85em; }
  #waiting-msg { font-size: 1em; }

  /* Room code */
  .room-code-text { font-size: 1.8em; letter-spacing: 6px; padding: 10px 16px; }
  #code-input { font-size: 1.5em; width: 170px; }

  /* Searching screen */
  .search-title { font-size: 2em; letter-spacing: 3px; }
  .search-icon { font-size: 2em; }
  .search-content { gap: 8px; padding: 16px 12px; }
  .search-timer-box { padding: 12px 24px 10px; min-width: 180px; }
  .search-timer-value { font-size: 2.2em; }
  .search-subtitle { font-size: 0.7em; letter-spacing: 3px; }
  .search-footer { padding: 10px 16px; font-size: 0.78em; }

  /* Gameover card */
  .gameover-card { padding: 20px 16px; gap: 10px; }
  #gameover-title { font-size: 2em; }
  .gameover-placement { font-size: 0.9em; padding: 5px 14px; }
  .stats-table { font-size: 0.78em; }
  .stats-table .col-stat { min-width: 48px; }
  .stats-table .col-brawler { min-width: 80px; }
  .stats-table thead th { padding: 4px 4px 6px; font-size: 0.72em; }
  .stats-table tbody td { padding: 6px 4px; }
}

/* iPad and large phones (431–900px wide) */
@media (min-width: 431px) and (max-width: 900px) {
  #mode-tiles { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .gameover-card { max-width: 460px; }
  .stats-table .col-stat { min-width: 60px; }
}

/* Landscape phones: very limited height */
@media (max-height: 500px) and (orientation: landscape) {
  #lobby { justify-content: flex-start; padding-top: 8px; }
  .title { font-size: 1.2em; margin-bottom: 0; }
  /* Keep buttons fixed so they don't push lobby content down; move them
     just below the hamburger on the right so they don't cover the title */
  #brawler-group-actions {
    top: 50px;
    right: 12px;
    flex-direction: column;
    gap: 4px;
    margin: 0;
  }
  #mode-tiles { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .mode-tile { padding: 10px; }
  .mode-tile-name { font-size: 0.95rem; margin-bottom: 4px; }
  .mode-tile-desc { font-size: 0.75rem; }
  .search-content { gap: 5px; padding: 8px; }
  .search-icon, .search-dots, .search-subtitle { display: none; }
  .search-timer-box { padding: 8px 20px 6px; }
  .search-timer-value { font-size: 1.8em; }
  .search-footer { padding: 8px 16px; }
}


/* ===== PvP Team Configurator ===== */
#pvp-config {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
#pvp-config h2 { text-align: center; margin: 0; }
.pvp-hint {
  text-align: center;
  font-size: 0.85rem;
  color: #aaa;
  min-height: 1.2em;
}
.pvp-teams {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.pvp-team {
  padding: 12px;
  border: 2px solid;
  border-radius: 12px;
  background: rgba(0,0,0,0.25);
}
.pvp-team[data-team='0'] { border-color: #e74c3c; }
.pvp-team[data-team='1'] { border-color: #3498db; }
.pvp-team[data-team='2'] { border-color: #2ecc71; }
.pvp-team[data-team='3'] { border-color: #f1c40f; }
.pvp-team-header {
  text-align: center;
  font-weight: bold;
  margin-bottom: 10px;
  font-size: 1rem;
}
.pvp-team[data-team='0'] .pvp-team-header { color: #ff7a6c; }
.pvp-team[data-team='1'] .pvp-team-header { color: #6dbbff; }
.pvp-team[data-team='2'] .pvp-team-header { color: #52d97a; }
.pvp-team[data-team='3'] .pvp-team-header { color: #f4dc4d; }
.pvp-slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pvp-slot {
  padding: 9px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  transition: background 0.15s, border-color 0.15s;
}
.pvp-slot:hover { background: rgba(255,255,255,0.10); }
.pvp-slot.filled-human { border-style: solid; border-color: #2ecc71; background: rgba(46,204,113,0.10); }
.pvp-slot.filled-bot   { border-style: solid; border-color: #95a5a6; background: rgba(149,165,166,0.10); }
.pvp-slot.my-slot      { box-shadow: 0 0 0 2px #f5a623; }
.pvp-slot.readonly     { cursor: default; opacity: 0.85; }
.pvp-slot.readonly:hover { background: rgba(255,255,255,0.05); }
.pvp-slot .slot-ready { font-size: 0.75rem; color: #ccc; }
.pvp-slot .slot-ready.is-ready { color: #2ecc71; }
.pvp-unassigned {
  font-size: 0.8rem;
  color: #aaa;
  text-align: center;
  min-height: 1em;
}
.pvp-slot-menu {
  position: absolute;
  background: #1a1a2e;
  border: 1px solid #555;
  border-radius: 10px;
  padding: 6px;
  z-index: 1000;
  min-width: 180px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.pvp-slot-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.85rem;
}
.pvp-slot-menu button:hover { background: rgba(255,255,255,0.10); }

@media (max-width: 600px) {
  .pvp-teams { grid-template-columns: 1fr; gap: 10px; }
}


.pvp-respawn-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: normal;
  color: #ccc;
  cursor: pointer;
}
.pvp-respawn-row input { margin: 0; cursor: pointer; }
.pvp-respawn-row input:disabled { cursor: not-allowed; }

/* ===== Mid-game Reconnect Overlay ===== */
#reconnect-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  z-index: 50;
  pointer-events: none;
}
#reconnect-cancel-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  pointer-events: auto;
  background: #2c2c2c;
  color: #ccc;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
#reconnect-cancel-btn:hover { background: #3a3a3a; color: #fff; }
#reconnect-lobby-cancel-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #2c2c2c;
  color: #ccc;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 100;
}
#reconnect-lobby-cancel-btn:hover { background: #3a3a3a; color: #fff; }
#reconnect-overlay.hidden { display: none; }

/* Lobby/menu-context reconnect overlay (created dynamically in main.js) */
#lobby-reconnect-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  z-index: 500;
}
#lobby-reconnect-overlay.hidden { display: none; }
.reconnect-box {
  background: #1a2a1a;
  border: 2px solid #4a7c3f;
  border-radius: 14px;
  padding: 28px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.reconnect-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid #4a7c3f;
  border-top-color: #a8e063;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.reconnect-text {
  color: #c8d8b0;
  font-size: 1rem;
  font-weight: 700;
  white-space: pre-line;
}

/* ── Friends Panel ────────────────────────────────── */
.friends-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.friends-title {
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #888;
  font-weight: 700;
}
.friends-add-row {
  display: flex;
  gap: 8px;
}
.friends-add-row input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #eee;
  font-size: 0.88rem;
  padding: 5px 10px;
  font-family: monospace;
  outline: none;
}
.friends-add-row input:focus { border-color: #a8e063; }
#friends-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.friends-section-label {
  font-size: 0.68rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #556;
  padding: 6px 4px 2px;
}
.friend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 0.88rem;
}
.friend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.friend-dot-online  { background: #2ecc71; }
.friend-dot-offline { background: #444; }
.friend-name {
  flex: 1 1 0;
  min-width: 0;            /* let the flex item shrink so word-break works */
  color: #c8d8b0;
  /* No truncation — name must always be fully visible. If the username is
   * very long it wraps to the next line; the row height grows accordingly. */
  word-break: break-word;
  overflow-wrap: anywhere;
}
.friend-actions { display: flex; gap: 4px; flex-shrink: 0; }
.friend-status-label {
  font-size: 0.72rem;
  color: #666;
  margin-left: auto;
}
.friends-empty {
  font-size: 0.8rem;
  color: #556;
  text-align: center;
  padding: 10px 4px;
  line-height: 1.5;
}
.friend-row-pending .friend-name { color: #f5c518; }

/* ── Toast Notifications ─────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  z-index: 500;
  pointer-events: none;
  width: min(420px, 94vw);
}
.toast {
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px 16px;
  font-family: monospace;
  font-size: 0.88rem;
  color: #eee;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-info    { border-color: rgba(168,224,99,0.3); }
.toast-error   { border-color: rgba(231,76,60,0.4); color: #e74c3c; }
.toast-friend-request { border-color: rgba(245,197,24,0.4); }
.toast-group-invite   { border-color: rgba(46,204,113,0.4); }
.toast-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Confirm Modal */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.confirm-modal-box {
  background: #1a1a2e;
  border: 2px solid #f5a623;
  border-radius: 12px;
  padding: 24px 32px;
  text-align: center;
  min-width: 280px;
  max-width: 360px;
}
.confirm-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn-success { background: #2ecc71; }
.btn-success:hover { background: #27ae60; }

.slot-menu-btn {
  background: #e74c3c;
  border: none;
  border-radius: 8px;
  padding: 6px 9px;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  transition: background 0.2s;
}
.slot-menu-btn:hover { background: #c0392b; }
.slot-menu-btn span {
  display: block;
  width: 16px; height: 2px;
  background: #fff;
  border-radius: 2px;
}
/* Inside a member card: pin to top-right */
.lobby-member-card .slot-menu-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 4px 6px;
}

/* ─── Lobby Stage ─────────────────────────────────────────── */
#lobby-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 3vw, 32px);
  padding: 16px 0 8px;
  width: 100%;
}

.lobby-self-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.lobby-self-slot canvas.brawler-preview {
  width: clamp(150px, 38vmin, 280px);
  height: clamp(150px, 38vmin, 280px);
  image-rendering: auto;
  border-radius: 16px;
  background: rgba(245, 166, 35, 0.08);
  box-shadow: 0 0 20px rgba(245, 166, 35, 0.18);
  transition: box-shadow 0.2s;
}
.lobby-self-slot:hover canvas.brawler-preview {
  box-shadow: 0 0 30px rgba(245, 166, 35, 0.4);
}
.lobby-self-placeholder {
  width: clamp(150px, 38vmin, 280px);
  height: clamp(150px, 38vmin, 280px);
  border-radius: 16px;
  border: 3px dashed #555;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(2.5rem, 8vmin, 5rem);
  color: #555;
}
.lobby-self-label {
  font-size: 0.95em;
  margin-top: 8px;
  color: #f5a623;
  font-weight: bold;
}
.lobby-self-hint {
  font-size: 0.7em;
  color: #777;
  margin-top: 2px;
}

.lobby-members {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.lobby-member-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}
.lobby-member-card canvas.brawler-preview {
  width: clamp(85px, 20vmin, 140px);
  height: clamp(85px, 20vmin, 140px);
  image-rendering: auto;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}
.lobby-ready-badge {
  font-size: 0.8em;
  font-weight: 900;
  letter-spacing: 1px;
  color: #a8e063;
  text-shadow: 0 1px 6px rgba(0,0,0,0.7);
  text-transform: uppercase;
}
.lobby-reconnecting-badge {
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #f39c12;
  text-shadow: 0 1px 6px rgba(0,0,0,0.7);
  text-transform: uppercase;
  animation: status-blink 1.4s ease-in-out infinite;
}
.lobby-member-card.lobby-member-disconnected {
  opacity: 0.5;
  filter: grayscale(0.6);
}
.lobby-member-placeholder {
  width: clamp(70px, 16vmin, 110px);
  height: clamp(70px, 16vmin, 110px);
  border-radius: 12px;
  border: 2px dashed #444;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  color: #444;
}
.lobby-member-name  { font-size: 0.7em; color: #ccc; text-align: center; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-member-ready { font-size: 0.65em; color: #4caf50; }
.lobby-member-wait  { font-size: 0.65em; color: #888; }

/* ─── Fullscreen Brawler Grid ─────────────────────────────── */
#bsc-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: #0a0e1a;
  display: flex; flex-direction: column;
  overflow: hidden;
}
#bsc-overlay.hidden { display: none; }

.bsc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}
.bsc-header h2 { margin: 0; font-size: 1.2em; text-align: center; flex: 1; }
.bsc-header-spacer { flex: 0 0 auto; visibility: hidden; }
.bsc-header-spacer::after { content: '← Zurück'; font-size: 0.9em; padding: 6px 12px; }

#bsc-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 2.5vw, 20px);
  padding: clamp(12px, 3vw, 24px);
  align-content: start;
}

.bsc-tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  background: #16213e;
  border: 2px solid #333;
  border-radius: 14px;
  padding: clamp(12px, 2.5vw, 20px) 8px clamp(10px, 2vw, 16px);
  cursor: pointer;
  min-width: 0;
  transition: border-color 0.15s, transform 0.15s;
}
.bsc-tile:hover   { border-color: #f5a623; transform: scale(1.03); }
.bsc-tile.selected { border-color: #f5a623; background: #1a3a5e; box-shadow: 0 0 14px rgba(245,166,35,0.4); }
.bsc-tile canvas.brawler-preview {
  /* Size to the tile (never wider) so 3 columns always fit on narrow phones */
  width: 100%;
  max-width: 190px;
  height: auto;
  aspect-ratio: 1;
  image-rendering: auto;
  flex-shrink: 0;
}
.bsc-tile-name {
  font-size: clamp(0.85em, 2.8vw, 1.1em);
  font-weight: bold;
  text-align: center;
}

/* ─── Brawler Detail View ─────────────────────────────────── */
#bdet-overlay {
  position: fixed; inset: 0; z-index: 110;
  background: #0a0e1a;
  display: flex; flex-direction: column;
  align-items: center;
  overflow: hidden;
}
#bdet-overlay.hidden { display: none; }

.bdet-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}
#bdet-title {
  font-size: 1.3em;
  font-weight: bold;
}

.bdet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 80px;
}

.bdet-showcase {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 10px;
  width: 100%;
}
.bdet-showcase-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
/* Combat demo pinned to the bottom-right corner of the screen */
.bdet-showcase-right {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
}
.bdet-demo-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#bdet-demo-close { display: none; }
/* Expanded: tutorial demo as centered popup with dark backdrop */
.bdet-showcase-right.expanded {
  inset: 0;
  right: 0;
  bottom: 0;
  justify-content: center;
  background: rgba(0,0,0,0.78);
  z-index: 250;
}
.bdet-showcase-right.expanded #bdet-canvas-demo {
  width: min(82vmin, 560px);
  height: min(82vmin, 560px);
  cursor: default;
  border-color: rgba(255,255,255,0.18);
}
.bdet-showcase-right.expanded #bdet-demo-close {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: -16px;
  right: -16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  background: #1a2a1a;
  color: #c8d8b0;
  font-size: 1.05rem;
  cursor: pointer;
  z-index: 1;
}
.bdet-showcase-right.expanded #bdet-demo-close:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
#bdet-canvas {
  width: clamp(200px, 52vmin, 360px);
  height: clamp(200px, 52vmin, 360px);
  image-rendering: auto;
  display: block;
  cursor: pointer;
}
#bdet-canvas-demo {
  width: clamp(100px, 22vmin, 170px);
  height: clamp(100px, 22vmin, 170px);
  image-rendering: auto;
  display: block;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
}
.bdet-demo-label {
  font-size: 0.62rem;
  color: rgba(200,216,176,0.5);
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

#bdet-info {
  width: 100%;
  max-width: 500px;
  padding: 10px 20px;
  flex-shrink: 0;
}
#bdet-desc  { font-size: 1em; color: #ccc; margin-bottom: 6px; }
#bdet-stats { font-size: 0.82em; color: #888; }
#bdet-gamestats {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 6px 0 2px;
  flex-wrap: wrap;
}
.bdet-gamestats-trophies { color: #f5c518; font-weight: 700; font-size: 1em; }
.bdet-gamestats-record   { color: #9aa6b2; font-size: 0.82em; }
#bdet-select {
  position: absolute;
  bottom: 18px;
  left: 20px;
  padding: 12px 40px;
  font-size: 1.05em;
  background: #2ecc71;
  color: #0a0e1a;
  font-weight: 800;
  letter-spacing: 0.5px;
}
#bdet-select:hover { background: #27ae60; }

/* Brawler level badge on grid tile */
.bsc-tile-level {
  position: absolute;
  bottom: 28px;
  left: 6px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  pointer-events: none;
}

/* Upgrade section in brawler detail */
#bdet-upgrade {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #2a3550;
}
.bdet-upgrade-level {
  font-size: 0.9em;
  color: #e0c84a;
  font-weight: 700;
  margin-bottom: 8px;
  margin-right: 16px;
  display: inline-block;
}
.bdet-upgrade-level.bdet-upgrade-pop {
  animation: kf-upgrade-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes kf-upgrade-pop {
  0%   { transform: scale(1);    color: #e0c84a; }
  40%  { transform: scale(1.35); color: #6ee87a; }
  100% { transform: scale(1);    color: #e0c84a; }
}
.bdet-upgrade-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #2ecc71;
  color: #0a0e1a;
  font-weight: 800;
  padding: 9px 20px;
  font-size: 0.95em;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.bdet-upgrade-btn:hover:not(:disabled) { background: #27ae60; }
.bdet-upgrade-btn:active:not(:disabled) { transform: scale(0.93); }
.bdet-upgrade-btn:disabled { background: #2a3550; color: #6b7488; cursor: not-allowed; }
.bdet-upgrade-btn.bdet-upgrade-press {
  animation: kf-upgrade-press 0.35s ease;
}
@keyframes kf-upgrade-press {
  0%   { transform: scale(0.93); box-shadow: 0 0 0 0 rgba(46,204,113,0.6); }
  50%  { transform: scale(1.04); box-shadow: 0 0 0 8px rgba(46,204,113,0); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}
.bdet-upgrade-price {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 800;
}
.bdet-coin-icon {
  width: 17px;
  height: 17px;
  display: inline-block;
  vertical-align: middle;
}
.bdet-upgrade-btn:disabled .bdet-coin-icon { filter: grayscale(0.7) opacity(0.6); }
.bdet-upgrade-hint {
  font-size: 0.78em;
  color: #e0894a;
  margin-top: 6px;
}

/* Session kicked overlay */
#session-kicked-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
}
#session-kicked-overlay.hidden { display: none; }
.session-kicked-box {
  background: #1a1a2e;
  border: 2px solid #e74c3c;
  border-radius: 16px;
  padding: 36px 32px;
  text-align: center;
  max-width: 400px;
  width: 90%;
}
.session-kicked-box h2 {
  color: #e74c3c;
  margin: 0 0 12px;
  font-size: 1.2em;
}
.session-kicked-box p {
  color: #aaa;
  margin: 0 0 24px;
  font-size: 0.95em;
}
.session-kicked-box .btn {
  padding: 12px 40px;
  font-size: 1.05em;
}

/* ── Currency Bar ─────────────────────────────────── */
.currency-bar {
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 100;
  display: flex;
  gap: 6px;
  pointer-events: none;
}
.currency-item {
  background: rgba(10, 14, 26, 0.78);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 0.82em;
  font-weight: 700;
  color: #e8e8e8;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.currency-gems  { border-color: rgba(0,229,255,0.28); }
.currency-coins { border-color: rgba(255,213,0,0.28); }
.currency-tokens{ border-color: rgba(168,99,255,0.28); }

/* ── Trophy Path Button ──────────────────────────── */
.btn-trophy-path {
  position: fixed;
  left: 16px;
  bottom: max(16px, env(safe-area-inset-bottom, 16px));
  z-index: 50;
  padding: 10px 18px;
  background: linear-gradient(135deg, #f5a623 0%, #e8621a 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 0.9em;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn-trophy-path:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

/* ── Trophy Path Overlay ─────────────────────────── */
/* ── New elaborate Trophy Path overlay ─────────────────────────────────── */
#trophy-path-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #07090f;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#trophy-path-overlay.hidden { display: none; }

#trophy-path-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0,0,0,0.75);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  z-index: 10;
}
.tp-back-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.9em;
  cursor: pointer;
}
.tp-back-btn:hover { background: rgba(255,255,255,0.15); }

#trophy-path-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3em;
  letter-spacing: 3px;
  color: #ffc857;
  text-shadow: 0 0 20px rgba(255,200,87,0.5);
  flex: 1;
  text-align: center;
}

#tp-trophy-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  font-size: 1.05em;
  color: #ffc857;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,200,87,0.35);
  border-radius: 8px;
  padding: 6px 12px;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(255,200,87,0.4);
}

#trophy-path-scroll-stage {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  justify-content: center;
}

/* Match the original demo (Trophy Path.html): wrap is plain block, scaler
   only has transform-origin. No will-change, no translateZ — those create
   a huge GPU layer (≈50 MB) that on weaker devices forces software fallback
   and tanks the scroll. fitCanvas (in ui.js) sets wrap width + height. */
/* In landscape we deliberately scale the path bigger than the screen so the
   colourful biome edge decorations are pushed off-screen. The scaler must
   stay at its natural canvas width (720) so the transform-origin (top center)
   gives symmetric overflow on both sides. Wrap centers it horizontally. */
#trophy-path-scaler-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
#trophy-path-scaler { transform-origin: top center; flex-shrink: 0; }

#trophy-path-root {
  display: flex;
  justify-content: center;
}

#trophy-path-locate {
  position: fixed;
  bottom: 22px;
  right: 18px;
  z-index: 210;
  background: rgba(255,200,87,0.92);
  border: none;
  color: #1a0e05;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1em;
  letter-spacing: 1px;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255,200,87,0.45);
}
#trophy-path-locate:hover { background: #ffd570; }

/* Milestone toast (success color) */
.toast-success {
  border-left: 3px solid #2ecc71;
  background: #0d1f14;
}

/* ── Searching screen corner buttons ─────────────────────────
   Fixed to screen corners with safe-area insets for iPhone notch/home-bar. */
.search-corner-btn {
  position: fixed;
  bottom: max(24px, calc(env(safe-area-inset-bottom, 0px) + 20px));
  z-index: 210;
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  letter-spacing: 1px;
  font-family: inherit;
}
.search-corner-btn-left {
  left: max(16px, env(safe-area-inset-left, 16px));
  background: #f5a623;
  color: #1a1a2e;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.search-corner-btn-right {
  right: max(16px, env(safe-area-inset-right, 16px));
  background: #c0392b;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
@media (max-width: 430px), (max-height: 750px) {
  .search-corner-btn { padding: 10px 22px; font-size: 0.9rem; }
}

/* Reconnect status text above the loading bar */
.search-reconnect-text {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 211;
  text-align: center;
  pointer-events: none;
  width: 90%;
  max-width: 520px;
  font-weight: 800;
  font-size: 1.25rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
  line-height: 1.3;
}

/* Search players found label (absolute positioning) */
.search-players-found-abs {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 210;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}

/* ── Language selector in account modal ──────────────────── */
.account-lang-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.account-lang-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  color: #c8d8b0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.account-lang-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.account-lang-btn.active {
  background: rgba(168,224,99,0.15);
  border-color: #a8e063;
  color: #a8e063;
  font-weight: 700;
}


/* ── Skin Picker Overlay ──────────────────────────── */
#skin-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
#skin-picker-overlay.hidden { display: none; }

#skin-picker-panel {
  background: #1a2a1a;
  border: 2px solid #4a7c3f;
  border-radius: 16px;
  padding: 20px;
  width: min(640px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#skin-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#skin-picker-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #a8e063;
  letter-spacing: 1px;
}
#skin-picker-close {
  background: none;
  border: none;
  color: #c8d8b0;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
#skin-picker-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

#skin-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  overflow-y: auto;
  padding: 2px;
}

.skin-card {
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 10px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.skin-card:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); }
.skin-card.active {
  border-color: #a8e063;
  background: rgba(168,224,99,0.1);
}
.skin-card.locked { cursor: default; }

.skin-card-preview {
  display: block;
  border-radius: 6px;
}

.skin-card-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #c8d8b0;
  text-align: center;
  line-height: 1.2;
}

.skin-card-active-badge {
  font-size: 0.65rem;
  font-weight: 800;
  color: #a8e063;
  letter-spacing: 0.5px;
}

.skin-card-buy-btn {
  font-size: 0.78rem;
  padding: 4px 8px;
  margin-top: 2px;
}

.skin-card-cant-afford {
  opacity: 0.45;
  cursor: not-allowed;
}

.skin-card-hint {
  font-size: 0.62rem;
  color: #e74c3c;
  text-align: center;
}

/* ── Skin Badge under bdet-canvas ────────────────── */
.skin-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 6px;
  cursor: pointer;
  user-select: none;
}
.skin-badge-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #a8e063;
}
.skin-badge-hint {
  font-size: 0.68rem;
  color: rgba(200,216,176,0.6);
}

/* Push notification opt-in button in friends panel */
.push-enable-btn {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #2a2a4a;
  border: 1px solid rgba(255,160,30,0.4);
  border-radius: 8px;
  color: #ffa01e;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: center;
}
.push-enable-btn:hover {
  background: rgba(255,160,30,0.15);
}

/* ── Push opt-in banner ────────────────────────────────── */
#push-prompt-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 9000;
  background: #1e1e3a;
  border: 1px solid rgba(255,160,30,0.45);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 420px;
  width: calc(100vw - 48px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
#push-prompt-banner.push-prompt-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.push-prompt-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.push-prompt-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.push-prompt-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.push-prompt-text strong {
  color: #fff;
  font-size: 0.9rem;
}
.push-prompt-text span {
  color: #aaa;
  font-size: 0.75rem;
  line-height: 1.3;
}
.push-prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.push-prompt-actions button {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
#push-prompt-yes {
  background: #ffa01e;
  color: #1a1a2e;
}
#push-prompt-yes:hover { background: #ffb347; }
#push-prompt-no {
  background: transparent;
  color: #888;
  border: 1px solid #444 !important;
}
#push-prompt-no:hover { color: #ccc; }
