:root {
  --bg-color: #000000;
  --card-bg: rgba(12, 12, 14, 0.9);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-main: #f4f4f5;
  --text-muted: #71717a;
  --accent-green: #22c55e;
  --accent-green-glow: rgba(34, 197, 94, 0.45);

  /* CS2 Player Colors */
  --cs-blue: #68a3e5;
  --cs-green: #109856;
  --cs-yellow: #e6f13d;
  --cs-orange: #ffffff;
  --cs-purple: #803ca1;

  /* Team Colors */
  --cs-t-side: #d97706;
  --cs-ct-side: #2563eb;

  /* CS Glow Effects */
  --cs-orange-glow: rgba(255, 255, 255, 0.35);
  --cs-blue-glow: rgba(255, 255, 255, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
}

@media (min-width: 901px) {
  html:has(#lobby-view:not(.hidden)) {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
  }
}


body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.07) 0%, transparent 65%),
    radial-gradient(circle at 100% 100%, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 0% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 45%);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  scrollbar-gutter: stable;
  overflow-x: clip;
}

body:has(#lobby-view:not(.hidden)) {
  padding: 0;
  overflow: visible;
  overflow-x: clip;
}

body:has(#team-hub-view:not(.hidden)),
body:has(#profile-view:not(.hidden)),
body:has(#lobby-access-view:not(.hidden)) {
  padding: 0 !important;
  overflow: hidden !important;
}

/* ==========================================================================
   Global Header Standard
   Site navigation takes the full width and scrolls with the page.
   The desktop tactic header uses its own compact layout.
   ========================================================================== */
#react-database-root,
#app-root,
#root {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
}

header.top-bar,
.top-bar,
body > header,
#root > header,
#react-database-root header:not(.create-strat-desktop-header),
#app-root > header {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

body:has(#team-hub-view:not(.hidden)) .top-bar,
body:has(#profile-view:not(.hidden)) .top-bar,
body:has(#lobby-access-view:not(.hidden)) .top-bar {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 8px 16px;
  height: 48px;
  max-height: 48px;
  box-sizing: border-box !important;
  z-index: 9000;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

body:has(#team-hub-view:not(.hidden)) .app-container,
body:has(#profile-view:not(.hidden)) .app-container,
body:has(#lobby-access-view:not(.hidden)) .app-container {
  width: 100% !important;
  max-width: none !important;
  gap: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  height: calc(100vh - 48px) !important;
  height: calc(100dvh - 48px) !important;
  max-height: calc(100vh - 48px) !important;
  max-height: calc(100dvh - 48px) !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

body:has(#team-hub-view:not(.hidden)) .site-footer,
body:has(#profile-view:not(.hidden)) .site-footer,
body:has(#lobby-access-view:not(.hidden)) .site-footer {
  display: none !important;
}

#team-hub-view,
#profile-view {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px 32px 20px;
  -webkit-overflow-scrolling: touch;
}

#lobby-access-view {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 20px;
  -webkit-overflow-scrolling: touch;
}

.app-container {
  width: 100%;
  max-width: 1500px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 16px 24px 16px;
  box-sizing: border-box;
}

body:has(#lobby-view:not(.hidden)) .app-container {
  max-width: 100%;
  gap: 0;
  padding: 0;
}

.hidden { display: none !important; }

/* Strategy screens share the persistent shell without inheriting home spacing. */
body[data-app-view="create-strat"] > .app-container,
body[data-app-view="database"] > .app-container {
  width: 100%;
  max-width: none;
  padding: 0;
  gap: 0;
}
body[data-app-view="create-strat"] .site-footer,
body[data-app-view="database"] .site-footer { display: none; }
#strategy-workspace-view { width: 100%; min-width: 0; min-height: 0; }
#strategy-workspace-view[hidden], #strategy-workspace-view.hidden { display: none !important; }
body[data-app-view="database"] { display: block; background: #080b0a; }
@media (min-width: 901px) {
  body[data-app-view="create-strat"] > header.top-bar { display: none !important; }
  #strategy-header-slot > header.top-bar { display: flex !important; }
}

.mini-btn {
  background-color: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f4f4f5;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mini-btn:hover {
  background-color: #27272a;
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.mini-btn.danger {
  background-color: #7f1d1d;
  border-color: #b91c1c;
  color: #fff;
}

/* Styled Room Number / Status Badge */
.status-badge {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  background: linear-gradient(135deg, #18181b 0%, #09090b 100%);
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.12);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}


#main-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.database-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Shared authentication modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 420px;
  background: linear-gradient(180deg, #121215 0%, #09090b 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 255, 255, 0.04);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

.modal-close-btn:hover {
  color: #ffffff;
}

.modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
}

.modal-header h2 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #ffffff;
}

.modal-body-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.modal-steam-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, #27272a 0%, #18181b 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.modal-steam-login-btn:hover {
  background: linear-gradient(180deg, #3f3f46 0%, #27272a 100%);
  border-color: #ffffff;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.modal-actions .modal-cancel-btn {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--text-muted) !important;
  padding: 8px !important;
  font-weight: 600 !important;
}

.modal-cancel-btn:hover { color: #ffffff !important; }

.leave-confirm-btn {
  background: linear-gradient(180deg, #27272a 0%, #18181b 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  transition: all 0.2s ease;
}

.leave-confirm-btn:hover {
  background: linear-gradient(180deg, #3f3f46 0%, #27272a 100%);
  border-color: #ffffff;
  color: #ffffff;
}

/* Universal Custom Modal Dialogs (Alert / Confirm / Prompt) */
.custom-modal-content {
  max-width: 440px;
  background: linear-gradient(180deg, #121215 0%, #09090b 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 8px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.9), 0 0 24px rgba(255, 255, 255, 0.05);
  padding: 24px;
  text-align: left;
  gap: 16px;
}

.custom-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 12px;
}

.custom-modal-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #ffffff;
  text-transform: uppercase;
}

.custom-modal-body {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.custom-modal-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.custom-modal-input {
  width: 100%;
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.custom-modal-input:focus {
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
}

.custom-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-modal-btn {
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 80px;
  text-align: center;
}

.custom-modal-btn.primary {
  background: linear-gradient(180deg, #ffffff 0%, #e4e4e7 100%);
  border: 1px solid #ffffff;
  color: #000000;
  font-weight: 800;
}

.custom-modal-btn.primary:hover {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.45);
  color: #000000;
}

.custom-modal-btn.danger {
  background: #991b1b;
  border: 1px solid #dc2626;
  color: #ffffff;
}

.custom-modal-btn.danger:hover {
  background: #b91c1c;
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.custom-modal-btn.cancel {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
}

.custom-modal-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #8b949e;
  color: #ffffff;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
  body {
    padding: 0;
  }

  .app-container {
    gap: 10px;
    padding: 0 8px 16px 8px;
  }

  body:has(#lobby-view:not(.hidden)) .app-container {
    gap: 0;
    padding: 0;
  }

  .modal-content {
    width: 95%;
    max-width: 380px;
    padding: 18px 14px;
  }

  .status-badge {
    font-size: 0.72rem;
    padding: 4px 10px;
  }
}

/* Multi-Level Radar Layer Switcher (Nuke, Vertigo, etc.) */
.map-layer-toggle {
  display: inline-flex;
  align-items: center;
  background: rgba(18, 21, 27, 0.9);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 3px;
  gap: 3px;
  backdrop-filter: blur(8px);
  z-index: 15;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  user-select: none;
}

.map-layer-toggle.hidden {
  display: none !important;
}

.layer-toggle-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.layer-toggle-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.layer-toggle-btn.active {
  background: var(--cs-blue);
  color: #ffffff;
  border-color: rgba(104, 163, 229, 0.5);
  box-shadow: 0 0 8px rgba(104, 163, 229, 0.4);
}

/* Page-specific placement */
.lobby-layer-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 15;
}

.modal-layer-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 15;
}

.demo-radar-layer-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 15;
}

/* Modal Tactical Phase Filters & Badges */
.modal-phase-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 15;
  display: flex;
  gap: 4px;
  background: rgba(13, 17, 23, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 3px 4px;
  backdrop-filter: blur(4px);
}

.phase-pill-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.phase-pill-btn:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.phase-pill-btn.active[data-phase="all"] {
  background: rgba(255, 255, 255, 0.2);
  border-color: #ffffff;
  color: #ffffff;
}

.phase-pill-btn.active.setup,
.phase-pill-btn.setup:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
}

.phase-pill-btn.active.execute,
.phase-pill-btn.execute:hover {
  background: rgba(237, 163, 56, 0.22);
  border-color: #eda338;
  color: #eda338;
}

.phase-pill-btn.active.post,
.phase-pill-btn.post:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #10b981;
}

.phase-task-badge {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: 4px;
  width: 64px;
  box-sizing: border-box;
  text-align: center;
  display: inline-block;
  flex-shrink: 0;
  line-height: 1.25;
}

.phase-task-badge.setup {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.phase-task-badge.execute {
  background: rgba(237, 163, 56, 0.12);
  border: 1px solid rgba(237, 163, 56, 0.35);
  color: #eda338;
}

.phase-task-badge.post {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.phase-task-line {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: start;
  gap: 10px;
  font-size: 0.76rem;
  color: #cbd5e1;
  line-height: 1.45;
  margin-bottom: 4px;
}

.phase-task-line:last-child {
  margin-bottom: 0;
}

.phase-task-line.mini {
  grid-template-columns: 46px 1fr;
  gap: 6px;
  font-size: 0.70rem;
  line-height: 1.35;
  margin-bottom: 2px;
}

.phase-task-line.mini .phase-task-badge {
  font-size: 0.52rem;
  width: 46px;
  padding: 1px 3px;
  letter-spacing: 0.3px;
}

.roster-player-phases {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
}

.roster-player-phases .task-desc-text.mini {
  font-size: 0.70rem;
  color: #94a3b8;
  font-style: italic;
}

/* Custom app modal high z-index overlay */
#app-custom-modal,
.custom-modal-overlay {
  z-index: 10001 !important;
}

/* Modern Sleek Dark Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Header must form a stacking context so its menus stay above page content */
html body header.top-bar:not(#_a):not(#_b) {
  position: relative !important;
  z-index: 9000 !important;
}

/* Radar PNGs already have transparent empty space. Keep the grid underneath
   the original map/canvas coordinates in every tactic view. */
html .radar-grid-background {
  background-color: #0a0d13;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.1) 1px, transparent 1px),
    linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
  background-size: 160px 160px, 160px 160px, 32px 32px, 32px 32px;
  background-position: 0 0;
}

