:root {
  --enl-green: #28f428;
  --res-blue: #00c4ff;
  --neutral: #cccccc;
  --xf-teal: #14DC94;
  --machina-red: #ff0028;
  --bg-dark: #0a0a0a;
  --text-light: #e0e0e0;
  
  /* Animation timing */
  --pulse-active-duration: 2.3s;
  --pulse-prep-duration: 7s;
  --pulse-red-duration: 3s;
}

body {
  font-family: sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  margin: 0;
  padding: 2em 1em;
} 

h1 {
  color: var(--neutral);
  margin-bottom: 0.5em;
  text-align: center;
}

/* Links */
a {
  text-decoration: none;
  transition: 0.2s ease;
}

a:hover {
  text-decoration: underline;
}

/* Anomaly List Layout */
.anomaly-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5em;
  padding: 1em;
  margin: 0 auto;
}

/* Individual Anomaly Card */
.anomaly {
  flex: 1 1 600px;
  max-width: 500px;
  box-sizing: border-box;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.5em;
  padding: 1.5em;
  border-radius: 20px;
  color: var(--text-light);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--res-blue) 15%, transparent) 0%,
    transparent 15%,
    transparent 85%,
    color-mix(in srgb, var(--enl-green) 15%, transparent) 100%
  );
}

.anomaly-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Faction Logo Sides */
.side {
  flex: 0 0 5em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.faction-logo {
  width: 3.5em;
  height: auto;
  opacity: 0.9;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.4));
}

/* Center Content */
.center-content {
  flex: 1;
  text-align: center;
  padding: 0 1em;
}

.location {
  font-size: 1.4em;
  margin: 0.2em 0;
  opacity: 0.9;
}

.location a {
  color: var(--neutral);
  text-decoration: none;
}

.location a:hover {
  text-decoration: underline;
}

/* Series Information */
.series-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5em;
}

.series {
  font-size: 1.5em;
  color: var(--neutral);
  margin-bottom: 0.2em;
}

.series-badges {
  display: flex;
  gap: 0.6em;
  justify-content: center;
  flex-wrap: wrap;
}

.series-badge {
  height: 1.5em;
  width: 1.5em;
  vertical-align: middle;
}

/* Time Display */
.time-info {
  margin-top: 0.4em;
  font-size: 0.9em;
  opacity: 0.85;
  line-height: 1.4em;
}

.local-time {
  font-size: 1.1em;
  color: var(--text-light);
}

.user-time {
  font-size: 0.8em;
  opacity: 0.8;
}

.anomaly h2 {
  margin: 0 0 0.3em;
  font-size: 1.5em;
  color: var(--neutral);
}

/* Countdown Display */
.countdown {
  font-size: 1.3em;
  margin-top: 0.6em;
  color: var(--machina-red);
}

/* Border States */
.anomaly.border-default {
  box-shadow: 0 0 12px color-mix(in srgb, var(--machina-red) 60%, transparent);
}

.anomaly.border-res {
  box-shadow: 0 0 20px var(--res-blue);
}

.anomaly.border-enl {
  box-shadow: 0 0 20px var(--enl-green);
}

.anomaly.border-redpulse {
  animation: redPulse var(--pulse-red-duration) ease-in-out infinite;
}

.anomaly.border-prep {
  animation: prepPulse var(--pulse-prep-duration) ease-in-out infinite;
}

.anomaly.border-active {
  animation: activePulse var(--pulse-active-duration) ease-in-out infinite;
}

/* Faction Colors */
.enl {
  color: var(--enl-green);
}

.res {
  color: var(--res-blue);
}

/* Error Display */
.error {
  color: var(--machina-red);
  text-align: center;
  margin-top: 2em;
}

/* Series Break */
.series-break {
  flex-basis: 100%;
  height: 1px;
  margin: 1em 0;
  background: linear-gradient(
    to right,
    var(--res-blue),
    var(--xf-teal),
    var(--enl-green)
  );
}

/* Footer */
.feedback {
  text-align: center;
  margin-top: 2em;
  font-size: 0.9em;
}

.feedback a {
  color: #9ba1ff;
  text-decoration: underline;
}

.feedback a:hover {
  filter: brightness(1.3);
}

.feedback .agent-badge a {
  color: var(--enl-green);
  text-decoration: none;
}

/* Animations */
@keyframes activePulse {
  0%, 100% { box-shadow: 0 0 50px color-mix(in srgb, var(--enl-green) 90%, transparent); }
  25%      { box-shadow: 0 0 10px color-mix(in srgb, var(--xf-teal) 70%, transparent); }
  50%      { box-shadow: 0 0 50px color-mix(in srgb, var(--res-blue) 90%, transparent); }
  75%      { box-shadow: 0 0 10px color-mix(in srgb, var(--xf-teal) 70%, transparent); }
}

@keyframes prepPulse {
  0%   { box-shadow: 0 0 15px color-mix(in srgb, var(--neutral) 70%, transparent); }
  12%  { box-shadow: 0 0 5px transparent; }
  25%  { box-shadow: 0 0 25px color-mix(in srgb, var(--enl-green) 70%, transparent); }
  37%  { box-shadow: 0 0 5px transparent; }
  50%  { box-shadow: 0 0 15px color-mix(in srgb, var(--neutral) 70%, transparent); }
  62%  { box-shadow: 0 0 5px transparent; }
  75%  { box-shadow: 0 0 25px color-mix(in srgb, var(--res-blue) 70%, transparent); }
  87%  { box-shadow: 0 0 5px transparent; }
  100% { box-shadow: 0 0 15px color-mix(in srgb, var(--neutral) 70%, transparent); }
}

@keyframes redPulse {
  0%, 100% { box-shadow: 0 0 10px color-mix(in srgb, var(--machina-red) 20%, transparent); }
  50%      { box-shadow: 0 0 25px color-mix(in srgb, var(--machina-red) 80%, transparent); }
}

/* Responsive Design */
@media (max-width: 900px) {
  .anomaly { 
    flex: 1 1 calc(50% - 1.5em);
  }
}

@media (max-width: 600px) {
  .anomaly { 
    flex: 1 1 100%;
    max-width: 100%;
    margin: 1.5em 0;
    padding: 1em;
  }
  
  .side {
    flex: 0 0 3.5em;
  }
  
  .faction-logo {
    width: 2.5em;
  }
}

/* Map-specific styles (if map.html exists) */
body.map-page {
  padding: 0;
  align-items: stretch;
}

.map-page p {
  text-align: center;
  width: 100%;
  margin: 0.5em 0 1.5em 0;
}

.map-page a {
  color: #9ba1ff;
  text-decoration: underline;
}

.map-page a:hover {
  filter: brightness(1.3);
}

#map {
  width: 100%;
  height: 80vh;
  border: 2px solid var(--neutral);
  border-radius: 10px;
  margin-bottom: 2em;
}

.leaflet-container {
  background: #111 !important;
  outline: none;
}

#info-panel {
  position: fixed;
  bottom: 1.5em;
  right: 1.5em;
  background: rgba(0, 0, 0, 0.85);
  padding: 1em 1.2em;
  border: 1px solid var(--neutral);
  border-radius: 8px;
  max-width: 250px;
  font-size: 0.9em;
  z-index: 9999;
  backdrop-filter: blur(3px);
}

#info-panel h3 {
  margin: 0;
  font-size: 1.1em;
  color: var(--neutral);
}

#info-toggle {
  position: absolute;
  top: 5px;
  right: 7px;
  background: none;
  border: none;
  color: var(--neutral);
  font-size: 1.2em;
  cursor: pointer;
}

.info-content {
  margin-top: 0.5em;
}

.map-legend {
  position: fixed;
  top: 12px;
  right: 12px;
  background: rgba(10, 10, 10, 0.85);
  color: var(--text-light);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  max-width: 220px;
  max-height: 40vh;
  overflow-y: auto;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
  z-index: 9999;
}

.map-legend h4 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  border: 1px solid #fff;
  flex-shrink: 0;
}

.legend-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}