/* ==========================================================================
   FLYOS: Cinematic 100-Fly Sword Battlefield HUD Stylesheet
   ========================================================================== */

:root {
  --bg-dark: #0d1117;
  --bg-card: rgba(22, 27, 34, 0.94);
  --bg-card-border: #30363d;
  --blue-primary: #388bfd;
  --blue-glow: rgba(56, 139, 253, 0.15);
  --red-primary: #f85149;
  --red-glow: rgba(248, 81, 73, 0.15);
  --gold-objective: #e3b341;
  --gold-glow: rgba(227, 179, 65, 0.15);
  --text-main: #c9d1d9;
  --text-bright: #f0f6fc;
  --text-muted: #8b949e;
  --font-mono: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
}

.battlefield-app {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #8b949e;
}

/* ================= Top Match Bar ================= */
.match-header {
  height: 46px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #f0f6fc;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-sub {
  color: #8b949e;
  font-weight: 600;
}

.brand-badge {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(56, 139, 253, 0.12);
  border: 1px solid rgba(56, 139, 253, 0.3);
  color: #58a6ff;
  letter-spacing: 0.4px;
}

/* Scoreboard Center */
.scoreboard-center {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.team-score-card {
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-score-card.blue {
  color: var(--blue-primary);
}

.team-score-card.red {
  color: var(--red-primary);
  flex-direction: row-reverse;
}

.team-flag {
  font-size: 1.1rem;
}

.team-data {
  display: flex;
  flex-direction: column;
}

.team-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.team-score-card.blue .team-data {
  align-items: flex-start;
}

.team-score-card.red .team-data {
  align-items: flex-end;
}

.team-name {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.score-num {
  font-size: 1.25rem;
  font-weight: 900;
  font-family: var(--font-mono);
  line-height: 1;
}

.flies-alive {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Objective Meter */
.objective-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 150px;
}

.obj-bar-wrapper {
  width: 100%;
  height: 6px;
  background: #1f2430;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  display: flex;
}

.obj-bar-blue {
  height: 100%;
  width: 50%;
  background: var(--blue-primary);
  transition: width 0.2s ease;
}

.obj-bar-red {
  height: 100%;
  width: 50%;
  background: var(--red-primary);
  transition: width 0.2s ease;
}

.obj-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.obj-label {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--gold-objective);
  white-space: nowrap;
}

.match-timer {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-hud {
  background: #21262d;
  border: 1px solid #30363d;
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-hud:hover {
  background: #30363d;
  border-color: #8b949e;
  color: #fff;
}

.btn-hud.active {
  background: rgba(56, 139, 253, 0.18);
  border-color: #388bfd;
  color: #58a6ff;
}

/* ================= 3D Canvas Viewport ================= */
#canvas-viewport {
  flex: 1;
  position: relative;
  width: 100%;
  height: calc(100vh - 48px);
  overflow: hidden;
}

#canvas-viewport > canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
}

/* Unified Top Command Capsule: Match Roster + Camera Preset */
.unified-top-bar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22, 27, 34, 0.94);
  border: 1px solid #30363d;
  border-radius: 20px;
  padding: 3px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(14px);
  z-index: 35;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  max-width: 95vw;
}

.pill-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pill-group-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: #8b949e;
  padding: 0 4px;
  letter-spacing: 0.5px;
}

.pill-divider {
  width: 1px;
  height: 16px;
  background: #30363d;
  margin: 0 4px;
}

.roster-btn, .cam-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #8b949e;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.roster-btn:hover, .cam-btn:hover {
  color: #f0f6fc;
  background: rgba(255, 255, 255, 0.08);
}

.roster-btn.active {
  background: rgba(227, 179, 65, 0.18);
  color: #f0f6fc;
  border-color: #e3b341;
}

.cam-btn.active {
  background: rgba(56, 139, 253, 0.18);
  color: #58a6ff;
  border-color: #388bfd;
}

/* ================= Fly Inspector Card HUD ================= */
.inspector-card {
  position: absolute;
  top: 52px;
  left: 14px;
  width: 320px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(22, 27, 34, 0.94);
  border: 1px solid #30363d;
  border-radius: 10px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  padding: 12px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  pointer-events: auto;
}

.inspector-card.collapsed {
  transform: translateX(-340px);
  pointer-events: none;
  opacity: 0;
}

/* Inspector Tabs */
.inspector-tabs {
  display: flex;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.ins-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #8b949e;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
}

.ins-tab-btn:hover {
  color: #f0f6fc;
}

.ins-tab-btn.active {
  background: #21262d;
  color: #f0f6fc;
  border: 1px solid #30363d;
}

.ins-tab-content {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.ins-tab-content.active {
  display: flex;
}

/* ================= Emotion Radar & Training Panel ================= */
.emotion-map-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.emotion-chips-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.emotion-chip-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 3px 8px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #c9d1d9;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.emotion-chip-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.emotion-chip-btn.active {
  background: rgba(56, 139, 253, 0.25);
  border-color: #58a6ff;
  color: #58a6ff;
  box-shadow: 0 0 8px rgba(56, 139, 253, 0.3);
}

.radar-canvas-container {
  position: relative;
  width: 100%;
  height: 195px;
  background: rgba(8, 12, 20, 0.85);
  border: 1px solid rgba(56, 139, 253, 0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.radar-canvas-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.emotion-metrics-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.65rem;
}

.ems-row {
  display: flex;
  justify-content: space-between;
  color: #8b949e;
}

.ems-row b {
  color: #e6edf3;
  font-family: var(--font-mono);
}

.btn-action-primary {
  background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(46, 160, 67, 0.3);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.btn-action-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(46, 160, 67, 0.5);
}

.btn-action-secondary {
  background: rgba(56, 139, 253, 0.15);
  border: 1px solid rgba(56, 139, 253, 0.4);
  color: #58a6ff;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.btn-action-secondary:hover {
  background: rgba(56, 139, 253, 0.28);
  color: #fff;
}

/* JEV Network Monitor Badge */
.jev-network-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(13, 17, 26, 0.85);
  border: 1px solid rgba(63, 185, 80, 0.35);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: #3fb950;
  cursor: pointer;
}

.jev-network-badge .pulse-green {
  width: 6px;
  height: 6px;
  background: #3fb950;
  border-radius: 50%;
  box-shadow: 0 0 6px #3fb950;
  animation: pulse 1.5s infinite;
}

/* ================= Gladiator Roster Grid ================= */
.squad-selector-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.fly-pill {
  background: rgba(22, 27, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 4px 2px;
  color: #c9d1d9;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.15s ease;
}

.fly-pill:hover {
  transform: translateY(-1px);
  background: rgba(56, 139, 253, 0.18);
  border-color: #58a6ff;
}

.fly-pill.blue-team {
  border-color: rgba(56, 139, 253, 0.35);
  color: #79c0ff;
}

.fly-pill.red-team {
  border-color: rgba(248, 81, 73, 0.35);
  color: #ff7b72;
}

.fly-pill.selected {
  background: rgba(56, 139, 253, 0.35);
  border-color: #58a6ff;
  box-shadow: 0 0 10px rgba(56, 139, 253, 0.5);
  color: #fff;
}

.fly-pill.selected.red-team {
  background: rgba(248, 81, 73, 0.35);
  border-color: #f85149;
  box-shadow: 0 0 10px rgba(248, 81, 73, 0.5);
}

.fly-pill.dead {
  opacity: 0.3;
  text-decoration: line-through;
  filter: grayscale(1);
}

.fly-pill-bar {
  width: 80%;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

.fly-pill-hp {
  height: 100%;
  background: #3fb950;
  border-radius: 2px;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}

.inspector-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fly-tag {
  font-size: 0.92rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.role-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  text-transform: uppercase;
}

.emotion-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Health & Stamina Meters */
.stat-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bar-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.meter-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.meter-fill.health {
  height: 100%;
  background: #2ea043;
  width: 100%;
  transition: width 0.2s;
}

.meter-fill.shield {
  height: 100%;
  background: #388bfd;
  width: 100%;
  transition: width 0.2s;
}

/* Connectome 139k Neuropil Panel */
.connectome-panel {
  background: rgba(10, 15, 24, 0.95);
  border: 1px solid rgba(56, 139, 253, 0.35);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.connectome-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #58a6ff;
  text-transform: uppercase;
}

.neuropil-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 0.68rem;
}

.neuropil-cell {
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 6px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.np-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}

.np-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.np-fill {
  height: 100%;
  background: #58a6ff;
  width: 50%;
  transition: width 0.2s;
}

/* Neuromodulators Row */
.modulators-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.68rem;
}

.mod-pill {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 6px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.mod-pill b {
  font-family: var(--font-mono);
}

/* JEV Decision Stream */
.jev-decision-box {
  background: rgba(9, 13, 20, 0.95);
  border: 1px solid rgba(56, 139, 253, 0.4);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.jev-decision-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--blue-primary);
}

.jev-decision-box.red-agent::before {
  background: var(--red-primary);
}

.jev-decision-box.red-agent {
  border-color: rgba(248, 81, 73, 0.4);
}

.jev-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.jev-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.jev-conf {
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #3fb950;
}

.jev-action-name {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #58a6ff;
  font-family: var(--font-mono);
}

.jev-decision-box.red-agent .jev-action-name {
  color: #ff7b72;
}

.jev-rationale {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #c9d1d9;
  font-style: italic;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 8px;
  border-radius: 4px;
  border-left: 2px solid rgba(255, 255, 255, 0.15);
}

.squad-selector-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 70px;
  overflow-y: auto;
}

.fly-pill {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  cursor: pointer;
}

.fly-pill:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.fly-pill.selected {
  background: var(--blue-primary);
  color: #fff;
  border-color: #fff;
}

.fly-pill.red-team.selected {
  background: var(--red-primary);
}

/* ================= Killfeed ================= */
.killfeed-container {
  position: absolute;
  top: 52px;
  right: 260px;
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 25;
  pointer-events: none;
}

.killfeed-item {
  background: rgba(13, 17, 26, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(8px);
  animation: slideIn 0.25s ease-out;
}

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

.killer-blue { color: #58a6ff; font-weight: 700; }
.killer-red { color: #ff7b72; font-weight: 700; }
.kill-icon { color: #ffe066; font-size: 0.9rem; }
.kill-pattern { color: #8b949e; font-size: 0.65rem; }


/* Match Complete Modal */
.match-complete-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(22, 27, 34, 0.98);
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 28px 36px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75);
  z-index: 100;
  display: none;
  min-width: 360px;
  max-width: 500px;
  backdrop-filter: blur(16px);
}

.match-complete-modal.show {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
  0% { transform: translate(-50%, -50%) scale(0.95); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #21262d;
  border: 1px solid #30363d;
  color: #8b949e;
  font-size: 1rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.modal-close-btn:hover {
  background: #30363d;
  color: #fff;
}

.modal-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #f0f6fc;
}

.modal-winner-banner {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(227, 179, 65, 0.12);
  border: 1px solid rgba(227, 179, 65, 0.35);
  color: var(--gold-objective);
}

.modal-subtitle {
  font-size: 0.88rem;
  color: #8b949e;
  font-family: var(--font-mono);
}

.modal-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 4px;
}

.btn-large {
  background: #238636;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-large:hover {
  background: #2ea043;
}

.btn-modal-rematch {
  background: #388bfd;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-modal-rematch:hover {
  background: #58a6ff;
}

.btn-modal-dismiss {
  background: #21262d;
  color: #c9d1d9;
  border: 1px solid #30363d;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-modal-dismiss:hover {
  background: #30363d;
  color: #fff;
  border-color: #8b949e;
}

/* ================= Arena Roster Toolbar ================= */
.roster-toolbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(13, 17, 26, 0.94);
  border: 1px solid var(--bg-card-border);
  border-radius: 30px;
  padding: 4px 12px;
  backdrop-filter: blur(14px);
  z-index: 30;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.roster-title {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--gold-objective);
  margin-right: 4px;
}

.roster-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #c9d1d9;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.roster-btn:hover {
  background: rgba(56, 139, 253, 0.25);
}

/* ================= 100-Ant Crowd Sentiment HUD ================= */
.crowd-hud-card {
  position: absolute;
  top: 52px;
  right: 14px;
  width: 290px;
  background: rgba(22, 27, 34, 0.94);
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 12px;
  backdrop-filter: blur(16px);
  z-index: 30;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.crowd-hud-card.collapsed {
  transform: translateX(330px);
  pointer-events: none;
  opacity: 0;
}

.crowd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  border-bottom: 1px solid #30363d;
  padding-bottom: 6px;
}

.crowd-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Collapsible Panel Control Buttons */
.btn-toggle-panel {
  background: #21262d;
  border: 1px solid #30363d;
  color: #8b949e;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-toggle-panel:hover {
  background: #30363d;
  color: #fff;
}

.btn-expand-pill {
  position: absolute;
  top: 52px;
  background: rgba(22, 27, 34, 0.92);
  border: 1px solid #30363d;
  color: #c9d1d9;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 16px;
  cursor: pointer;
  z-index: 28;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  transition: all 0.15s ease;
}

.btn-expand-pill:hover {
  background: #30363d;
  border-color: #8b949e;
  color: #fff;
}

.btn-expand-pill.left { left: 14px; }
.btn-expand-pill.right {
  right: 14px;
  border-color: rgba(255, 209, 102, 0.4);
}
.btn-expand-pill.right:hover {
  border-color: #ffd166;
  background: rgba(255, 209, 102, 0.25);
}

.crowd-icon {
  font-size: 1.05rem;
}

.crowd-title {
  font-size: 0.74rem;
  font-weight: 800;
  color: #ffd166;
  letter-spacing: 0.5px;
}

.crowd-decibels {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 800;
  color: #3fb950;
  background: rgba(63, 185, 80, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(63, 185, 80, 0.3);
}

/* ================= Empirical Emotion Census ================= */
.census-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.census-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.64rem;
  font-weight: 800;
  color: #ffd166;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.census-distribution-bar {
  display: flex;
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cdb-seg {
  height: 100%;
  transition: width 0.25s ease;
}
.cdb-seg.cheering { background: #3fb950; }
.cdb-seg.bloodlust { background: #ff2222; }
.cdb-seg.tension { background: #e3b341; }
.cdb-seg.shock { background: #bc8cff; }
.cdb-seg.spectating { background: #58a6ff; }

.census-counts-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.census-cell {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.census-cell .c-emoji { font-size: 0.75rem; }
.census-cell .c-name { font-size: 0.52rem; color: #8b949e; text-transform: uppercase; font-weight: 700; margin-top: 1px; }
.census-cell .c-count { font-size: 0.72rem; font-family: var(--font-mono); color: #fff; font-weight: 800; }
.census-cell.cheering .c-count { color: #3fb950; }
.census-cell.bloodlust .c-count { color: #ff4040; }
.census-cell.tension .c-count { color: #e3b341; }
.census-cell.shock .c-count { color: #bc8cff; }
.census-cell.spectating .c-count { color: #58a6ff; }

/* ================= Colosseum Bleachers Heatmap ================= */
.bleachers-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.bleachers-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  color: #8b949e;
}

.bleachers-canvas {
  display: block;
  position: relative;
  width: 100%;
  height: 90px;
  background: rgba(5, 8, 14, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  cursor: pointer;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

.crowd-status-box {
  background: rgba(22, 27, 34, 0.85);
  border-left: 3px solid #ffd166;
  border-radius: 4px;
  padding: 6px 8px;
}

.status-tag {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #ffd166;
  display: block;
  margin-bottom: 2px;
}

.status-text {
  font-size: 0.66rem;
  color: #e6edf3;
  line-height: 1.35;
}

/* ================= Header Mode Switcher ================= */
.header-mode-switch {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px;
  gap: 3px;
}

.mode-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #8b949e;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.mode-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.mode-tab-btn.active {
  background: rgba(56, 139, 253, 0.25);
  color: #58a6ff;
  border-color: rgba(56, 139, 253, 0.5);
  box-shadow: 0 0 8px rgba(56, 139, 253, 0.25);
}

/* ================= Floating Top Round Banner ================= */
.round-banner {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(22, 27, 34, 0.96);
  border: 1px solid #30363d;
  border-radius: 20px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 36;
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.round-banner.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.round-banner-badge {
  font-size: 0.65rem;
  font-weight: 800;
  color: #e3b341;
  background: rgba(227, 179, 65, 0.15);
  border: 1px solid rgba(227, 179, 65, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.round-banner-text {
  font-size: 0.76rem;
  font-weight: 600;
  color: #f0f6fc;
  white-space: nowrap;
}

.round-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.round-banner-btn {
  background: #21262d;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.round-banner-btn:hover {
  background: #30363d;
  color: #fff;
  border-color: #8b949e;
}

/* ================= Responsive Breakpoints ================= */
@media (max-width: 1200px) {
  .inspector-card {
    width: 250px;
    font-size: 0.9em;
  }
  .crowd-hud-card {
    width: 210px;
    font-size: 0.9em;
  }
  .unified-top-bar {
    top: 8px;
    padding: 2px 6px;
    gap: 3px;
  }
  .roster-btn, .cam-btn {
    padding: 2px 6px;
    font-size: 0.64rem;
  }
}

@media (max-width: 992px) {
  .brand-badge {
    display: none;
  }
  .scoreboard-center {
    gap: 8px;
  }
  .objective-container {
    min-width: 120px;
  }
  .obj-label {
    display: none;
  }
  .unified-top-bar {
    top: 6px;
    max-width: 98vw;
  }
  .inspector-card {
    width: 240px;
  }
  .crowd-hud-card {
    width: 200px;
  }
}

@media (max-width: 768px) {
  .match-header {
    height: 42px;
    padding: 0 8px;
  }
  .brand-title {
    font-size: 0.8rem;
  }
  .header-actions .btn-hud span {
    display: none;
  }
  .unified-top-bar {
    top: 4px;
    border-radius: 14px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .inspector-card {
    width: calc(100vw - 32px);
    left: 16px;
    top: 50px;
    max-height: calc(100vh - 120px);
  }
  .crowd-hud-card {
    width: calc(100vw - 32px);
    right: 16px;
    top: 50px;
    max-height: calc(100vh - 120px);
  }
}

.wotnot-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .75rem;
  padding: .4rem;
  color: #c9d1d9;
  background: #161b22;
  font: .85rem system-ui, sans-serif;
}
.wotnot-links a { color: #9ecbff; }
body { display: flex; flex-direction: column; }
.battlefield-app { flex: 1; min-height: 0; height: auto; }
