﻿html,
body {
  height: 100%;
  margin: 0;
}

body.anomaly-page {
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #1d2a36;
  background:
    radial-gradient(circle at top left, rgba(242, 247, 235, 0.88), transparent 28%),
    radial-gradient(circle at top right, rgba(234, 240, 247, 0.9), transparent 30%),
    linear-gradient(160deg, #edf4f0 0%, #f8fbfd 58%, #e8eff6 100%);
}

.anomaly-shell {
  width: min(1360px, calc(100% - 24px));
  margin: 0 auto;
  padding: 10px 0 28px;
}

.anomaly-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(124, 145, 166, 0.18);
  border-radius: 20px;
  box-shadow: 0 18px 44px rgba(37, 60, 84, 0.12);
  backdrop-filter: blur(10px);
}

.anomaly-loading-mask {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(223, 229, 235, 0.62);
  z-index: 2100;
  font-size: 16px;
  font-weight: 700;
  color: #28445f;
}

.anomaly-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.95fr) 300px;
  gap: 10px;
  align-items: stretch;
  min-height: calc(100dvh - 118px);
  margin-bottom: 12px;
}

.anomaly-map-card {
  position: relative;
  padding: 8px;
  min-height: clamp(540px, calc(100dvh - 132px), 920px);
}

#map {
  width: 100%;
  height: clamp(524px, calc(100dvh - 148px), 900px);
  border-radius: 18px;
  overflow: hidden;
}

.anomaly-floating-panel {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 1200;
  width: min(420px, calc(100% - 36px));
  padding: 14px 14px 12px;
  border-radius: 18px;
  background: rgba(245, 249, 252, 0.82);
  border: 1px solid rgba(120, 139, 158, 0.2);
  box-shadow: 0 14px 28px rgba(26, 43, 60, 0.14);
  backdrop-filter: blur(10px);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.anomaly-floating-panel.is-dragging {
  cursor: grabbing;
}

.anomaly-panel-title {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #28445f;
}

.anomaly-control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.anomaly-control {
  display: grid;
  gap: 4px;
}

.anomaly-control span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #5e7285;
}

.anomaly-control select {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(119, 138, 156, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.84);
  color: #1f3142;
  padding: 6px 10px;
}

.anomaly-threshold-wrap {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(137, 156, 175, 0.16);
}

.anomaly-threshold-wrap .noUi-target {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(173, 188, 203, 0.34);
  box-shadow: none;
}

.anomaly-threshold-wrap .noUi-connect:nth-child(1) {
  background: #1976d2;
}

.anomaly-threshold-wrap .noUi-connect:nth-child(2) {
  background: #2e7d32;
}

.anomaly-threshold-wrap .noUi-connect:nth-child(3) {
  background: #d32f2f;
}

.anomaly-threshold-wrap .noUi-handle {
  width: 22px;
  height: 22px;
  right: -11px;
  top: -7px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.96);
  background: #1d547a;
  box-shadow: 0 8px 18px rgba(29, 84, 122, 0.3);
}

.anomaly-threshold-wrap .noUi-handle:before,
.anomaly-threshold-wrap .noUi-handle:after {
  display: none;
}

.anomaly-threshold-label {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #45586a;
}

.anomaly-threshold-values {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.anomaly-threshold-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(233, 239, 244, 0.88);
  border: 1px solid rgba(137, 156, 175, 0.2);
  font-size: 12px;
  font-weight: 700;
  color: #365065;
}

.anomaly-detail-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px 16px;
  max-height: clamp(540px, calc(100dvh - 132px), 920px);
  overflow: auto;
}

.anomaly-detail-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #5a7187;
}

.anomaly-detail-header h1 {
  margin: 0;
  font-size: clamp(24px, 2.2vw, 30px);
  line-height: 1.12;
  color: #18324a;
}

.anomaly-detail-header p {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: #4f6274;
}

.anomaly-detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.anomaly-detail-list div {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(241, 245, 249, 0.82);
  border: 1px solid rgba(135, 154, 172, 0.18);
}

.anomaly-detail-list dt {
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #5c7388;
}

.anomaly-detail-list dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: #1f3142;
}

.anomaly-note-card {
  padding: 18px 20px;
}

.anomaly-note-detail summary {
  cursor: pointer;
  font-weight: 800;
  color: #18324a;
}

.anomaly-legend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.anomaly-legend-block {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(244, 247, 250, 0.84);
  border: 1px solid rgba(135, 154, 172, 0.18);
}

.anomaly-legend-block h2 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #18324a;
}

.anomaly-legend-block table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
}

.anomaly-legend-block td {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  text-align: center;
}

.anomaly-note-copy {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.anomaly-note-copy p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: #4d6072;
}

@media (max-width: 960px) {
  .anomaly-top-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .anomaly-map-card {
    min-height: auto;
  }

  #map {
    height: clamp(360px, calc(100dvh - 218px), 620px);
  }

  .anomaly-detail-card {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .anomaly-shell {
    width: min(100%, calc(100% - 12px));
    padding-top: 6px;
  }

  .anomaly-map-card {
    padding: 6px;
  }

  #map {
    height: calc(100dvh - 108px);
    min-height: 560px;
    max-height: none;
    border-radius: 16px;
  }

  .anomaly-floating-panel {
    right: 10px;
    left: 10px;
    bottom: 12px;
    width: auto;
    padding: 8px;
    border-radius: 16px;
  }

  .anomaly-control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .anomaly-control:nth-child(3) {
    grid-column: 1 / -1;
  }

  .anomaly-legend-grid {
    grid-template-columns: 1fr;
  }

  .anomaly-control select {
    min-height: 34px;
    padding: 5px 8px;
  }

  .anomaly-threshold-wrap {
    margin-top: 8px;
    padding: 8px 10px;
  }

  .anomaly-threshold-label {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.4;
  }

  .anomaly-threshold-values {
    gap: 6px;
    margin-top: 8px;
  }

  .anomaly-threshold-chip {
    min-height: 26px;
    padding: 4px 8px;
    font-size: 11px;
  }
}
