/* ----------------------------------------------------
   ApexFan Design System v2
   Aesthetic: World Cup Broadcast · Emerald Glassmorphism
   ---------------------------------------------------- */

:root {
  --bg-dark: #040b08;
  --bg-card: rgba(8, 26, 18, 0.6);
  --border-glass: rgba(16, 185, 129, 0.18);
  --border-focus: rgba(16, 185, 129, 0.5);

  --emerald-glow: #10b981;
  --emerald-deep: #064e3b;
  --emerald-light: #34d399;
  --gold: #fbbf24;
  --gold-soft: rgba(251, 191, 36, 0.16);

  --text-primary: #eaf7f0;
  --text-secondary: #a3c9b8;
  --text-muted: #6b8f7d;

  --font-sans: 'Outfit', sans-serif;
  --font-mono: 'Space Mono', monospace;

  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --card-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 60px rgba(16, 185, 129, 0.05);
}

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

html {
  scroll-behavior: smooth;
}

body.apex-dark {
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(ellipse at 15% -10%, rgba(6, 78, 59, 0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 110%, rgba(16, 185, 129, 0.14) 0%, transparent 55%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding: 1.5rem;
  position: relative;
}

/* ---- Ambient background: drifting glow orbs + pitch lines ---- */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

.orb-1 {
  width: 480px;
  height: 480px;
  top: -160px;
  left: -120px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.22), transparent 70%);
  animation: orb-drift-1 26s ease-in-out infinite alternate;
}

.orb-2 {
  width: 560px;
  height: 560px;
  bottom: -220px;
  right: -160px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.1), rgba(16, 185, 129, 0.12) 55%, transparent 75%);
  animation: orb-drift-2 32s ease-in-out infinite alternate;
}

.bg-pitch-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(16, 185, 129, 0.025) 0 1px, transparent 1px 90px);
  mask-image: radial-gradient(ellipse at 50% 30%, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, black 0%, transparent 75%);
}

/* Stack content above ambient layers */
.hackathon-banner,
.apex-header,
.kpi-strip,
.apex-grid,
.judge-section,
.apex-footer {
  position: relative;
  z-index: 1;
}

/* ---- Hackathon banner ---- */
.hackathon-banner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(6, 78, 59, 0.75), rgba(8, 47, 36, 0.6) 50%, rgba(6, 78, 59, 0.75));
  color: var(--emerald-light);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 1.1rem;
  padding: 0.5rem 1rem;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.12);
}

.hackathon-banner code {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-glass);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  color: var(--gold);
}

.banner-trophy {
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.6));
}

/* ---- Header ---- */
.apex-header {
  margin-bottom: 1.25rem;
  width: 100%;
  animation: rise 0.6s var(--ease-spring) both;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 1rem;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pulse-emerald {
  width: 12px;
  height: 12px;
  background-color: var(--emerald-glow);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--emerald-glow);
  animation: pulse 2s infinite;
}

.logo-text {
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: 0.06em;
  line-height: 1;
}

.logo-text span {
  background: linear-gradient(120deg, var(--emerald-light) 10%, var(--emerald-glow) 50%, var(--gold) 110%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px rgba(16, 185, 129, 0.45));
}

.badge-tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-left: 2px solid var(--emerald-glow);
  padding-left: 0.6rem;
  margin-left: 0.35rem;
}

.host-flags {
  font-size: 1rem;
  letter-spacing: 0.2em;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

/* ---- Buttons ---- */
.header-actions {
  display: flex;
  gap: 0.75rem;
}

button {
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald-glow), #059669);
  color: #fff;
  border: none;
  padding: 0.65rem 1.3rem;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 0 18px rgba(16, 185, 129, 0.35);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 50%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  animation: shimmer 3.2s ease-in-out infinite;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 6px 26px rgba(16, 185, 129, 0.55);
}

.btn-secondary {
  background: rgba(16, 185, 129, 0.04);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  padding: 0.65rem 1.3rem;
}

.btn-secondary:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--emerald-glow);
  transform: translateY(-2px);
}

/* ---- KPI strip ---- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  margin-bottom: 1.5rem;
  padding: 0.9rem 0.5rem;
  animation: rise 0.6s var(--ease-spring) 0.08s both;
}

.kpi-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  border-right: 1px solid rgba(16, 185, 129, 0.12);
}

.kpi-item:last-child {
  border-right: none;
}

.kpi-num {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--emerald-light);
  text-shadow: 0 0 18px rgba(16, 185, 129, 0.45);
  line-height: 1;
}

.kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.kpi-live-item {
  justify-content: center;
}

.kpi-live-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--emerald-glow);
  box-shadow: 0 0 14px var(--emerald-glow);
  animation: pulse 1.6s infinite;
  margin-bottom: 0.3rem;
}

@media (max-width: 900px) {
  .kpi-strip {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 0.9rem;
  }
  .kpi-item:nth-child(3n) {
    border-right: none;
  }
}

/* ---- Glassmorphism ---- */
.glassmorphic {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 30%),
    var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.glassmorphic:hover {
  border-color: var(--border-focus);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 16px 48px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(16, 185, 129, 0.09);
}

/* ---- Main grid ---- */
.apex-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  flex: 1;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .apex-grid {
    grid-template-columns: 1fr;
  }
}

.grid-card {
  display: flex;
  flex-direction: column;
  padding: 1.35rem;
  height: clamp(560px, 74vh, 720px);
}

.chat-card {
  animation: rise 0.65s var(--ease-spring) 0.14s both;
}

.map-card {
  animation: rise 0.65s var(--ease-spring) 0.22s both;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(16, 185, 129, 0.1);
  padding-bottom: 0.75rem;
}

.card-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.engine-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: linear-gradient(135deg, var(--emerald-deep), #043527);
  color: var(--emerald-light);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-glass);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}

.section-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---- Chat ---- */
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}

.chat-history::-webkit-scrollbar,
.proximity-cards-list::-webkit-scrollbar {
  width: 6px;
}

.chat-history::-webkit-scrollbar-thumb,
.proximity-cards-list::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.3);
  border-radius: 3px;
}

.chat-message {
  margin-bottom: 1rem;
  line-height: 1.55;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  max-width: 85%;
  animation: msg-in 0.35s var(--ease-spring) both;
}

.chat-message.system {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-left: 3px solid var(--emerald-glow);
  color: var(--text-primary);
  max-width: 100%;
}

.chat-message.user {
  background: linear-gradient(135deg, #0a8a63, var(--emerald-deep));
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #fff;
  align-self: flex-end;
  margin-left: auto;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 18px rgba(6, 78, 59, 0.45);
}

.chat-message.agent {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  position: relative;
  align-self: flex-start;
  margin-left: 2.6rem;
  border-bottom-left-radius: 4px;
}

.chat-message.agent::before {
  content: '⚽';
  position: absolute;
  left: -2.6rem;
  top: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a3528, #041d14);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

/* ---- Suggestion chips ---- */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.suggest-btn {
  background: rgba(16, 185, 129, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border-glass);
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
}

.suggest-btn:hover {
  background: var(--emerald-deep);
  color: #fff;
  border-color: var(--emerald-glow);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

/* ---- Tool execution stream ---- */
.tool-stream {
  background:
    linear-gradient(180deg, rgba(16, 185, 129, 0.04), transparent),
    rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.65rem;
  margin-bottom: 1rem;
}

.tool-stream-header {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.flash-text {
  animation: flash 1.5s infinite alternate;
}

.chips-container {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.no-tools-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tool-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px dashed var(--emerald-glow);
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  animation: chip-in 0.3s var(--ease-spring) both;
}

.tool-chip-name {
  color: var(--emerald-glow);
  font-weight: 700;
}

.tool-chip-action {
  color: var(--text-secondary);
}

/* ---- Chat input ---- */
.chat-input-form {
  display: flex;
  gap: 0.5rem;
}

.chat-input-form input {
  flex: 1;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  padding: 0.75rem 1.15rem;
  font-size: 0.95rem;
  transition: all 0.3s;
}

.chat-input-form input::placeholder {
  color: var(--text-muted);
}

.chat-input-form input:focus {
  outline: none;
  border-color: var(--emerald-glow);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15), 0 0 18px rgba(16, 185, 129, 0.2);
}

.send-btn {
  background: linear-gradient(135deg, var(--emerald-glow), #059669);
  color: #fff;
  border: none;
  font-weight: 700;
  padding: 0 1.4rem;
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.3);
}

.send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.5);
}

/* ---- Radar map canvas ---- */
.stadium-projection-canvas {
  height: 250px;
  background:
    radial-gradient(circle at center, rgba(10, 50, 35, 0.85) 0%, rgba(4, 11, 8, 0.95) 75%);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: 0 0 40px rgba(16, 185, 129, 0.06) inset;
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(16, 185, 129, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 185, 129, 0.07) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 95%);
  -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 95%);
}

.radar-sweep {
  position: absolute;
  width: 150%;
  aspect-ratio: 1;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, transparent 300deg, rgba(16, 185, 129, 0.16) 348deg, rgba(52, 211, 153, 0.3) 360deg);
  animation: radar-rotate 6s linear infinite;
  pointer-events: none;
}

.range-rings {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.range-rings span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(16, 185, 129, 0.14);
  border-radius: 50%;
}

.range-rings span:nth-child(1) { width: 90px;  height: 90px; }
.range-rings span:nth-child(2) { width: 170px; height: 170px; border-style: dashed; }
.range-rings span:nth-child(3) { width: 260px; height: 260px; border-color: rgba(16, 185, 129, 0.08); }

.map-coordinates {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 0.72rem;
  color: var(--emerald-light);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  z-index: 5;
}

.map-scan-tag {
  position: absolute;
  bottom: 0.65rem;
  left: 0.75rem;
  font-size: 0.66rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.45);
  border: 1px dashed rgba(16, 185, 129, 0.3);
  border-radius: 6px;
  padding: 0.18rem 0.45rem;
  z-index: 5;
  animation: flash 2s infinite alternate;
}

.map-canvas-inner {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 2;
}

.stadium-visual-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 3;
}

.stadium-dot {
  font-size: 1.6rem;
  filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.7));
}

.pulse-ring {
  border: 3px solid var(--emerald-glow);
  border-radius: 50%;
  height: 38px;
  width: 38px;
  position: absolute;
  top: -3px;
  animation: map-pulse 1.8s ease-out infinite;
  opacity: 0;
}

.stadium-name-label {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(4, 11, 8, 0.9);
  border: 1px solid var(--border-focus);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
}

.mall-marker-dot {
  position: absolute;
  font-size: 1.15rem;
  cursor: pointer;
  animation: float 3.4s ease-in-out infinite;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
  transition: transform 0.25s;
  z-index: 4;
}

.mall-marker-dot:nth-child(2) { animation-delay: 0.6s; }
.mall-marker-dot:nth-child(3) { animation-delay: 1.2s; }

.mall-marker-dot:hover {
  transform: scale(1.25);
}

.mall-marker-dot .tooltip {
  display: none;
  position: absolute;
  top: -1.9rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--bg-dark);
  border: 1px solid var(--emerald-glow);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.mall-marker-dot:hover .tooltip {
  display: block;
}

/* ---- Venue selector ---- */
.stadium-selector-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  margin-bottom: 1rem;
}

.stadium-selector-bar label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.styled-select {
  flex: 1;
  min-width: 0;
  background: var(--bg-dark);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.styled-select:hover {
  border-color: var(--border-focus);
}

.styled-select:focus {
  outline: none;
  border-color: var(--emerald-glow);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* ---- Proximity cards ---- */
.proximity-cards-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.prox-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 3px solid rgba(16, 185, 129, 0.35);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.25s var(--ease-spring);
  animation: msg-in 0.4s var(--ease-spring) both;
}

.prox-card:nth-child(1) { animation-delay: 0.02s; }
.prox-card:nth-child(2) { animation-delay: 0.07s; }
.prox-card:nth-child(3) { animation-delay: 0.12s; }
.prox-card:nth-child(4) { animation-delay: 0.17s; }
.prox-card:nth-child(5) { animation-delay: 0.22s; }

.prox-card:hover {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.3);
  border-left-color: var(--emerald-glow);
  transform: translateX(4px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}

.prox-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.prox-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.prox-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.prox-tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  border: 1px solid rgba(163, 201, 184, 0.18);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.prox-tag.surge-high {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.18);
}

.prox-tag.surge-medium {
  color: #fde68a;
  border-color: rgba(234, 179, 8, 0.32);
  background: rgba(113, 63, 18, 0.16);
}

.prox-tag.surge-low {
  color: var(--emerald-light);
  border-color: rgba(52, 211, 153, 0.25);
  background: rgba(16, 185, 129, 0.08);
}

.prox-tag.vip {
  color: #fef3c7;
  border-color: rgba(251, 191, 36, 0.4);
  background: var(--gold-soft);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.12);
}

.prox-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background-color: var(--emerald-deep);
  color: var(--emerald-light);
  border: 1px solid var(--border-glass);
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
}

.prox-metric {
  text-align: right;
  flex-shrink: 0;
}

.prox-distance {
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--emerald-glow);
  text-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
  margin-top: 0.2rem;
}

.prox-rating {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ---- Judge / verification center ---- */
.judge-section {
  display: none;
  margin-bottom: 2rem;
  padding: 1.5rem;
  width: 100%;
}

.judge-section.active {
  display: block;
  animation: rise 0.5s var(--ease-spring) both;
}

.judge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.75rem;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.75rem;
  color: var(--text-muted);
}

.btn-close:hover {
  color: var(--emerald-glow);
  transform: rotate(90deg);
}

.judge-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 800px) {
  .judge-grid {
    grid-template-columns: 1fr;
  }
}

.tabs-playbook {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
  margin-bottom: 0.8rem;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
}

.tab-btn:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--emerald-deep);
  color: #fff;
  border-color: var(--emerald-glow);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.playbook-code-block {
  background: #020705;
  border: 1px solid var(--border-glass);
  padding: 1rem;
  border-radius: 10px;
  font-size: 0.75rem;
  color: var(--emerald-light);
  overflow-x: auto;
  max-height: 200px;
  line-height: 1.45;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.05) inset;
}

/* ---- Diagnostics ---- */
.status-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.8rem;
  margin-bottom: 1.25rem;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: border-color 0.25s, transform 0.25s;
}

.status-item:hover {
  border-color: var(--border-glass);
  transform: translateX(3px);
}

.status-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.status-val {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.status-val.pass {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.status-val.warn {
  background-color: rgba(234, 179, 8, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(234, 179, 8, 0.35);
}

.compliance-box {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.03));
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 0.9rem;
  border-radius: 10px;
}

.compliance-box h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--emerald-glow);
  margin-bottom: 0.25rem;
}

.compliance-box p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ---- Footer ---- */
.apex-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(16, 185, 129, 0.1);
  padding-top: 1.1rem;
  margin-top: auto;
}

.stack-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.stack-chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  transition: all 0.25s;
}

.stack-chip:hover {
  color: var(--emerald-light);
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

/* ---- Utilities ---- */
.font-mono {
  font-family: var(--font-mono);
}

/* ---- Typing indicator ---- */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0.65rem 1rem !important;
  width: fit-content;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--emerald-glow);
  border-radius: 50%;
  opacity: 0.4;
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ---- Markdown helpers ---- */
.inline-code {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--emerald-light);
}

.md-heading {
  display: block;
  font-weight: 700;
  font-size: 1.05em;
  margin-bottom: 0.2rem;
}

.md-bullet {
  display: block;
  padding-left: 0.25rem;
  line-height: 1.7;
}

/* ---- CRUD button ---- */
.crud-btn {
  background: rgba(52, 211, 153, 0.12);
  color: var(--emerald-light);
  border: 1px solid var(--emerald-glow);
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  animation: crud-glow 2s infinite alternate;
}

.crud-btn:hover {
  background: var(--emerald-deep);
  color: #fff;
  transform: translateY(-2px);
}

.no-prox-msg {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
  border: 1px dashed var(--border-glass);
  border-radius: 10px;
}

/* ---- Animations ---- */
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes chip-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  0%   { left: -80%; }
  55%  { left: 130%; }
  100% { left: 130%; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes radar-rotate {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes orb-drift-1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(70px, 50px) scale(1.12); }
}

@keyframes orb-drift-2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-60px, -45px) scale(1.08); }
}

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

@keyframes crud-glow {
  from { box-shadow: 0 0 6px rgba(16, 185, 129, 0.3); }
  to   { box-shadow: 0 0 16px rgba(16, 185, 129, 0.7); }
}

@keyframes pulse {
  0%   { transform: scale(1); box-shadow: 0 0 12px var(--emerald-glow); }
  50%  { transform: scale(1.15); box-shadow: 0 0 20px var(--emerald-glow); }
  100% { transform: scale(1); box-shadow: 0 0 12px var(--emerald-glow); }
}

@keyframes map-pulse {
  0%   { transform: scale(0.6); opacity: 0; }
  50%  { opacity: 0.5; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes flash {
  0%   { opacity: 0.4; }
  100% { opacity: 1; }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
