/* ========================================================= */
/* STATE: ENGINE CORE (CSS ROOT) */
/* TOWN: Global Body Styling */
/* STREET: body */
/* ========================================================= */
body {
    background: #000000;
    color: #00ff66;
    font-family: monospace;
    margin: 0;
    padding: 0;
    padding-top: 68px;
}

/* -------- STATE: ENGINE CORE */
/* TOWN: Sweep Animation */
/* STREET: @keyframes navSweep -------- */
@keyframes navSweep {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

/* -------- STATE: ENGINE CORE */
/* TOWN: Navigation Panel */
/* STREET: .deck-nav -------- */
.deck-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #1b1f24;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    box-shadow:
        0 1px 3px rgba(0,0,0,0.35),
        0 0 12px rgba(0,255,255,0.25);
}

/* -------- STATE: ENGINE CORE */
/* TOWN: Online Sweep */
/* STREET: .deck-nav::before -------- */
.deck-nav::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 5px;
  background: linear-gradient(90deg, #00f0ff, #00ffa6, #00f0ff);
  background-size: 200% 100%;
  opacity: 0.85;
  animation: navSweep 2.0s linear infinite;
}

/* -------- STATE: ENGINE CORE */
/* TOWN: Offline Sweep */
/* STREET: body.engine-offline .deck-nav::before -------- */
body.engine-offline .deck-nav::before {
  background: linear-gradient(90deg, #ff0033, #ff5577, #ff0033);
  background-size: 200% 100%;
  animation: navSweep 1.5s linear infinite;
}

/* -------- STATE: ENGINE CORE */
/* TOWN: Navigation Bottom Line */
/* STREET: .deck-nav::after -------- */
.deck-nav::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  background: #6fa3c8;
  opacity: 0.9;
}

/* -------- STATE: ENGINE CORE */
/* TOWN: Navigation List */
/* STREET: .deck-nav-list -------- */
.deck-nav-list {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 32px;
  margin: 0;
  padding: 0 0 8px 0;
  list-style: none;
  width: 100%;
}

/* -------- STATE: ENGINE CORE */
/* TOWN: Navigation Links */
/* STREET: .deck-nav a -------- */
.deck-nav a {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: #f2fcff;
  position: relative;
  padding-bottom: 4px;
}

/* -------- STATE: ENGINE CORE */
/* TOWN: Navigation Link Underline */
/* STREET: .deck-nav a::after -------- */
.deck-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: #4ea3ff;
  transition: width 140ms ease-out;
}

.deck-nav a:hover::after {
  width: 100%;
}

/* -------- STATE: ENGINE CORE */
/* TOWN: Navigation Pulse Animation */
/* STREET: @keyframes navPulse -------- */
@keyframes navPulse {
  0%   { opacity: 0.35; }
  50%  { opacity: 1; }
  100% { opacity: 0.35; }
}

/* ========================================================= */
/* STATE: ENGINE TIME STRIP */
/* TOWN: Time Strip Container */
/* STREET: .nav-timestrip */
/* ========================================================= */
.nav-timestrip {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    height: 32px;
    background: #0d1116;
    border-top: 1px solid #6fa3c8;
    border-bottom: 1px solid #1f2a33;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    font-family: monospace;
    font-size: 12px;
    color: #ccffff;
    z-index: 1001;
}

.nav-timestrip .ts-label {
    opacity: 0.65;
    margin-right: 4px;
}

.nav-timestrip .ts-value {
    font-weight: bold;
    margin-right: 12px;
}

/* ========================================================= */
/* STATE: ENGINE PANELS */
/* TOWN: Main Layout */
/* STREET: main */
/* ========================================================= */
main {
    margin-top: 60px;
    padding: 20px;
}

/* TOWN: Panel Block */
/* STREET: .panel-block */
.panel-block {
    border: 1px solid #00ff66;
    padding: 16px;
    margin-bottom: 30px;
    background: #ffffff;
}

/* TOWN: Panel Headers */
/* STREET: h2, h3 */
h2, h3 {
    color: #000000;
    font-weight: bold;
}

/* ========================================================= */
/* STATE: ENGINE STATUS PANEL */
/* TOWN: Data Row */
/* STREET: .data-row */
/* ========================================================= */
.data-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

/* TOWN: Data Block */
/* STREET: .data-block */
.data-block {
    background: #ffffff;
    color: #000000;
    border: 2px solid #00ff66;
    padding: 20px;
    flex: 1;
    height: 150px;
    display: block;
    font-size: 18px;
}

/* ========================================================= */
/* STATE: NETWORK TELEMETRY */
/* TOWN: Metric Label */
/* STREET: .metric .label */
/* ========================================================= */
.metric .label {
    display: block;
    margin-bottom: 0px;
    font-weight: bold;
}

/* TOWN: Metric Block */
/* STREET: .metric */
.metric {
    margin-bottom: 14px;
}

/* ========================================================= */
/* STATE: ENGINE BEHAVIOR (DRIFT) */
/* TOWN: Drift Panel Color Fix */
/* STREET: #drift */
/* ========================================================= */
#drift {
    color: #000000;
}

#drift-value,
#drift-class,
#drift-trend {
    color: #000000;
}

/* ========================================================= */
/* STATE: DRIFT SPACING */
/* TOWN: Drift Content Spacing */
/* STREET: #drift .content div */
/* ========================================================= */
#drift .content div {
    margin-bottom: 10px;
}

#drift strong {
    margin-right: 6px;
}

.leaflet-control-attribution {
    display: none !important;
}

/* ========================================================= */
/* STATE: GEO MAP PANEL */
/* TOWN: Map Canvas */
/* STREET: #geomap-canvas */
/* ========================================================= */
#geomap-canvas {
    width: 100%;
    height: 400px;
    background: #000;
}

/* TOWN: Map Placeholder */
/* STREET: #geomap-canvas (override) */
#geomap-canvas {
    background: #ffffff;
    color: #000000;
    border: 2px solid #00ff66;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    font-size: 20px;
}

/* ========================================================= */
/* STATE: LOG PANEL */
/* TOWN: Log Box */
/* STREET: .log-box */
/* ========================================================= */
.log-box {
    border: 1px solid #00ff66;
    height: 250px;
    overflow-y: auto;
    padding: 10px;
    background: #000000;
    color: #00ffee;
}

#heatmap,
#drift-graph,
#latency-graph {
    color: #000000;
}

/* ========================================================= */
/* STATE: RESOLVER TABLE */
/* TOWN: Resolver Table */
/* STREET: #resolver-table */
/* ========================================================= */
#resolver-table {
    background: #000000;
    color: #000000;
    border: 2px solid #00ff66;
    padding: 20px;
    font-size: 18px;
}

/* ========================================================= */
/* STATE: RESOLVER DETAILS */
/* TOWN: Resolver Details */
/* STREET: #resolver-details */
/* ========================================================= */
#resolver-details {
    background: #000000;
    color: #000000;
    border: 2px solid #00ff66;
    padding: 20px;
    font-size: 18px;
}

/* ========================================================= */
/* STATE: DRIFT HISTORY PANEL */
/* TOWN: Drift History Container */
/* STREET: #drift-history */
/* ========================================================= */
#drift-history {
    background: #d9d9d9;
    color: #000000;
    border: 2px solid #00ff66;
    padding: 20px;
}

/* TOWN: Drift History Content */
/* STREET: #drift-history .content */
#drift-history .content {
    background: #ffffff;
    color: #000000;
    border: 1px solid #00ff66;
    padding: 15px;
    min-height: 150px;
}

/* ========================================================= */
/* STATE: SYSTEM LOG PANEL */
/* TOWN: Log Panel */
/* STREET: #log */
/* ========================================================= */
#log {
    background: #d9d9d9;
    color: #000000;
    border: 2px solid #00ff66;
    padding: 20px;
}

/* ========================================================= */
/* STATE: DRIFT CSS BLOCK */
/* TOWN: Drift Panel Block */
/* STREET: #drift.panel-block */
/* ========================================================= */
#drift.panel-block {
    padding: 12px 16px;
    border: 1px solid #1f1f1f;
    background: #0a0a0a;
    color: #000000;
    font-family: "Consolas", "Courier New", monospace;
}

/* TOWN: Drift Content */
/* STREET: #drift .content div */
#drift .content div {
    margin: 6px 0;
    font-size: 14px;
    line-height: 1.3;
}

/* TOWN: Drift Header */
/* STREET: #drift h2 */
#drift h2 {
    color: #e0e0e0;
    font-size: 18px;
    font-family: inherit;
    font-weight: 600;
}

/* TOWN: Drift Value */
/* STREET: #drift-value */
#drift-value {
    color: #000000;
}

/* TOWN: Classification Token */
/* STREET: #drift-class */
#drift-class {
    font-weight: bold;
}

/* TOWN: Classification Dot */
/* STREET: #drift-class::before */
#drift-class::before {
    content: "● ";
}

/* TOWN: Classification Colors */
/* STREET: #drift-class:contains(...) */
#drift-class:contains("STABLE") { color: #7fff7f; }
#drift-class:contains("MINOR DRIFT") { color: #ffd95e; }
#drift-class:contains("MAJOR DRIFT") { color: #ff9933; }
#drift-class:contains("CRITICAL DRIFT") { color: #ff4d4d; }

/* TOWN: Trend Indicator */
/* STREET: #drift-trend */
#drift-trend { font-weight: bold; }

#drift-trend:contains("UP") { color: #ff9933; }
#drift-trend:contains("DOWN") { color: #7fff7f; }
#drift-trend:contains("FLAT") { color: #c8ffc8; }

/* ========================================================= */
/* STATE: DATA BLOCK FIX */
/* TOWN: Data Block Layout */
/* STREET: .data-block */
/* ========================================================= */
.data-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 6px 20px 12px 20px;
    min-height: 150px;
    height: auto;
}

/* TOWN: Data Value */
/* STREET: .data-block .data-value */
.data-block .data-value {
    margin-top: 2px;
    font-size: 20px;
    font-weight: bold;
}

/* ========================================================= */
/* STATE: DRIFT COLOR */
/* TOWN: Drift Value Color */
/* STREET: #drift .data-value */
/* ========================================================= */
#drift .data-value {
    color: #000000;
}

/* ========================================================= */
/* STATE: RESOLVER GEO-MAP */
/* TOWN: Resolver Geo-Map Panel */
/* STREET: #resolver-geomap-panel */
/* ========================================================= */
#resolver-geomap-panel {
  display: flex;
  flex-direction: column;
}

/* TOWN: Resolver Geo-Map Canvas */
/* STREET: #resolver-geomap-map.geomap-container */
#resolver-geomap-map.geomap-container {
  width: 100%;
  height: 320px;
  background: #0b0f16;
  border: 1px solid #222;
}

/* TOWN: Geo-Map Legend */
/* STREET: .geomap-legend */
.geomap-legend {
  margin-top: 6px;
  font-size: 0.8rem;
}

.geomap-legend .legend-item {
  margin-right: 12px;
  padding-left: 12px;
  position: relative;
}

.geomap-legend .legend-item::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* TOWN: Geo-Map Legend Colors */
/* STREET: .legend-live::before, etc */
.legend-live::before { background: #2ecc71; }
.legend-degraded::before { background: #f1c40f; }
.legend-failed::before { background: #e74c3c; }
.legend-unknown::before { background: #7f8c8d; }

/* ========================================================= */
/* STATE: ENGINE MAP PANEL */
/* TOWN: Engine Map Container */
/* STREET: #engine-map-container */
/* ========================================================= */
#engine-map-container {
    width: 100%;
    height: 480px;
    overflow: hidden !important;
    position: relative;
    background: #ffffff;
}

/* TOWN: Engine Map Interaction Lock */
/* STREET: #engine-map-container * */
#engine-map-container * {
    pointer-events: none !important;
    user-select: none !important;
}

/* TOWN: Engine Map Legend Positioning */
/* STREET: #engine-map-container .legend, etc */
#engine-map-container .legend,
#engine-map-container .map-legend,
#engine-map-container .legend-container {
    position: absolute !important;
    right: 10px;
    top: 10px;
    z-index: 10;
}

/* ========================================================= */
/* STATE: TEACHING PANELS */
/* TOWN: Status Info Blocks */
/* STREET: .status-info */
/* ========================================================= */
.status-info {
    display: none;
    font-size: 0.85rem;
    line-height: 1.25rem;
    padding-top: 0px;
    color: #000000;
}

.status-info.visible {
    display: block;
}

/* TOWN: Condition Panel Info */
/* STREET: #engine-condition .status-info */
#engine-condition .status-info {
    margin-bottom: 12px;
    width: 100%;
}

/* TOWN: Data Block Info */
/* STREET: .data-block .status-info */
.data-block .status-info {
    display: none;
    align-self: flex-start;
    width: 100%;
}

.data-block .status-info.visible {
    display: block;
}

/* TOWN: Status Title */
/* STREET: .status-title */
.status-title {
    position: relative;
    z-index: 2;
    cursor: default;
}

/* TOWN: Ping Info */
/* STREET: #ping-info */
#ping-info {
    width: 100%;
    margin-bottom: 12px;
}

/* ========================================================= */
/* STATE: NETWORK TELEMETRY TILE LAYOUT */
/* TOWN: Data Row Layout */
/* STREET: .data-row */
/* ========================================================= */
.data-row {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
}

/* TOWN: Data Block Layout */
/* STREET: .data-block */
.data-block {
    flex: 1;
    min-width: 200px;
}

/* TOWN: Status Title Layer */
/* STREET: .status-title */
.status-title {
    cursor: default;
    position: relative;
    z-index: 20;
}

/* TOWN: Data Block Layer */
/* STREET: .data-block */
.data-block {
    position: relative;
    z-index: 10;
}

/* TOWN: Status Info */
/* STREET: .status-info */
.status-info {
    display: none;
    margin-top: 8px;
    font-size: 0.9em;
    line-height: 1.4;
}

.status-info.visible {
    display: block;
}
/* =========================================================
   STATE: IP TOKEN PULSE
   TOWN: Engine Token Pulse Styling
   STREET: #token-pulse.OK / WARN / FAIL
   ========================================================= */
#token-pulse {
  font-weight: bold;
}

#token-pulse.OK { color: #00ff66; }
#token-pulse.WARN { color: #ffd95e; }
#token-pulse.FAIL { color: #ff4d4d; }

/* =========================================================
   STATE: UI TOKEN PULSE
   TOWN: Thin-Client Pulse Styling
   STREET: #ui-pulse.OK / WARN / FAIL
   ========================================================= */
.m1-condition-item.value#ui-pulse.OK { color: #00ff66; }
.m1-condition-item.value#ui-pulse.WARN { color: #ffd95e; }
.m1-condition-item.value#ui-pulse.FAIL { color: #ff4d4d; }
