:root {
  --bg-0: #050c17;
  --bg-1: #07101d;
  --bg-2: #0b1628;

  --panel: rgba(12, 20, 36, 0.80);
  --panel-strong: rgba(10, 18, 32, 0.92);

  --text: #e7f0ff;
  --text-soft: #a8bbd8;
  --text-dim: #6f86ab;

  --accent: #3bd3ff;
  --accent-2: #7a7cff;
  --accent-3: #35e6a7;
  --warn: #ffbc52;
  --danger: #ff5f7d;

  --border: rgba(120, 180, 255, 0.18);
  --border-soft: rgba(255, 255, 255, 0.08);

  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.34);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.20);

  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(circle at 12% 18%, rgba(59, 211, 255, 0.10), transparent 20%),
    radial-gradient(circle at 86% 10%, rgba(122, 124, 255, 0.10), transparent 18%),
    radial-gradient(circle at 52% 100%, rgba(53, 230, 167, 0.08), transparent 25%),
    linear-gradient(180deg, #050c17 0%, #07101d 42%, #091425 100%);
}

* {
  box-sizing: border-box;
}

.app-shell {
  position: relative;
  min-height: 100vh;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.03), rgba(255,255,255,0.00)),
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.012) 0px,
      rgba(255,255,255,0.012) 1px,
      transparent 1px,
      transparent 68px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.010) 0px,
      rgba(255,255,255,0.010) 1px,
      transparent 1px,
      transparent 68px
    );
  mask-image: linear-gradient(to bottom, rgba(255,255,255,0.65), rgba(255,255,255,0.08));
}

.main-wrap {
  max-width: 1900px;
  margin: 0 auto;
  padding: 14px;
}

/* =========================================================
   GENERIC PANELS
   ========================================================= */

.hero-card,
.map-panel,
.detail-panel,
.footer-card,
.metric-card,
.ai-comment-box,
.disclaimer-box,
.usgs-link-box {
  background:
    linear-gradient(180deg, rgba(18, 28, 48, 0.82), rgba(10, 18, 32, 0.88));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.hero-card {
  border-radius: var(--radius-xl);
  padding: 14px 18px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.hero-card::before,
.map-panel::before,
.detail-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 211, 255, 0.45), transparent);
}

.hero-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.hero-logo {
  width: 92px;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
  flex: 0 0 auto;
}

.eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.2px;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.hero-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.03;
  color: var(--text);
  font-weight: 900;
}

.hero-subtitle {
  margin: 3px 0 0 0;
  font-size: 13px;
  line-height: 1.1;
  color: #9fdcff;
  font-weight: 750;
}

.hero-meta {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.35;
}

.hero-right {
  text-align: right;
  min-width: 220px;
  flex: 0 0 auto;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(53, 230, 167, 0.12);
  border: 1px solid rgba(53, 230, 167, 0.30);
  color: var(--accent-3);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 1px;
  animation: pulseGlow 2.1s infinite ease-in-out;
}

.live-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 12px rgba(53, 230, 167, 0.65);
}

.last-update {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 11px;
}

/* =========================================================
   METRICS
   ========================================================= */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric-card {
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  min-height: 88px;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, rgba(59,211,255,0.8), rgba(53,230,167,0.3));
}

.metric-title {
  color: var(--text-soft);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.15px;
  font-weight: 800;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 21px;
  line-height: 1.0;
  font-weight: 900;
  margin-bottom: 6px;
}

.metric-subtitle {
  color: #d8e5fb;
  font-size: 10.8px;
  line-height: 1.35;
}

/* =========================================================
   MAIN LAYOUT
   ========================================================= */

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.95fr) minmax(320px, 0.72fr);
  gap: 12px;
  margin-bottom: 12px;
  align-items: start;
}

.left-stack {
  display: grid;
  grid-template-rows: auto auto;
  gap: 12px;
}

.map-panel,
.detail-panel {
  border-radius: var(--radius-xl);
  padding: 12px 14px;
  position: relative;
  overflow: hidden;
}

.panel-title {
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.9px;
  margin-bottom: 9px;
  text-transform: uppercase;
  opacity: 0.95;
}

.subpanel-title {
  color: #8ccfff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  margin: 10px 0 6px 0;
  text-transform: uppercase;
}

/* =========================================================
   MAP SIZES
   ========================================================= */

.map-graph-main {
  height: 700px;
  border-radius: 16px;
  overflow: hidden;
}

.map-graph-prop {
  height: 620px;
  border-radius: 16px;
  overflow: hidden;
}

.secondary-panel {
  padding-bottom: 12px;
}

/* =========================================================
   RIGHT PANEL BOXES
   ========================================================= */

.usgs-link-box,
.ai-comment-box,
.disclaimer-box {
  margin-top: 10px;
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.usgs-title,
.ai-comment-title,
.disclaimer-title {
  color: #8ccfff;
  font-size: 10px;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.usgs-link {
  display: inline-block;
  color: #d8f2ff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 750;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(57, 208, 255, 0.26);
  background: linear-gradient(180deg, rgba(23, 44, 76, 0.96), rgba(12, 23, 40, 0.96));
  box-shadow: var(--shadow-sm);
  transition: 0.18s ease;
}

.usgs-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
  border-color: rgba(57, 208, 255, 0.55);
  color: #ffffff;
}

.ai-comment-inner,
.disclaimer-inner,
.usgs-note {
  color: #d7e5ff;
  font-size: 11.5px;
  line-height: 1.5;
}

/* =========================================================
   TABLES
   ========================================================= */

.dash-table-container {
  border-radius: 14px;
  overflow: hidden;
}

.dash-table-container .dash-spreadsheet-container {
  border-radius: 14px;
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner td,
.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th {
  transition: background-color 0.15s ease;
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner tr:hover td {
  background-color: rgba(28, 42, 68, 0.95) !important;
}

/* =========================================================
   FOOTER
   ========================================================= */

.footer-card {
  border-radius: var(--radius-lg);
  padding: 11px 14px;
  color: #91a6c7;
  font-size: 10.8px;
  line-height: 1.5;
  text-align: center;
}

/* =========================================================
   JS-INJECTED POPUPS / CONTROL BOX
   ========================================================= */

#alarm-banner {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

#sound-control-box {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#sound-control-box button {
  outline: none;
}

#sound-control-box button:active {
  transform: translateY(1px);
}

/* =========================================================
   ANIMATIONS
   ========================================================= */

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 rgba(53,230,167,0.0);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 18px rgba(53,230,167,0.18);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 rgba(53,230,167,0.0);
    transform: scale(1);
  }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1600px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .hero-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-right {
    text-align: left;
    min-width: auto;
  }

  .map-graph-main {
    height: 580px;
  }

  .map-graph-prop {
    height: 500px;
  }
}

@media (max-width: 900px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-title {
    font-size: 19px;
  }

  .hero-subtitle {
    font-size: 12px;
  }

  .map-graph-main {
    height: 460px;
  }

  .map-graph-prop {
    height: 390px;
  }
}

@media (max-width: 640px) {
  .main-wrap {
    padding: 10px;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .hero-left {
    align-items: flex-start;
  }

  .hero-logo {
    width: 74px;
    height: 52px;
  }

  .hero-title {
    font-size: 17px;
  }

  .metric-value {
    font-size: 19px;
  }

  .map-graph-main {
    height: 380px;
  }

  .map-graph-prop {
    height: 320px;
  }
}
