:root {
  color-scheme: light dark;
  --bg-color: #0d1117;
  --surface-color: rgba(13, 17, 23, 0.88);
  --surface-border: rgba(240, 246, 252, 0.08);
  --accent: #00d1b2;
  --accent-soft: rgba(0, 209, 178, 0.15);
  --text-primary: #f0f6fc;
  --text-secondary: #9da7b3;
  --text-muted: #7d8590;
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  font-family: "Segoe UI", "Noto Sans TC", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(0, 209, 178, 0.12), transparent 55%),
              radial-gradient(circle at 20% 80%, rgba(0, 122, 255, 0.18), transparent 55%),
              var(--bg-color);
  color: var(--text-primary);
}

.page {
  margin: 0 auto;
  padding: 3rem clamp(1.5rem, 5vw, 4rem) 5rem;
  max-width: 1440px;
}

/* 超寬桌機再放寬一點 */
@media (min-width: 1600px) {
  .page { max-width: 1600px; }
}


.page__header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.page__title {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  letter-spacing: 0.02em;
}

.page__subtitle {
  margin-top: 0.75rem;
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: 18px;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.controls__group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: min(230px, 100%);
}

.controls__group--search {
  flex: 1 1 260px;
}

.controls__group--countries {
  flex: 1 1 100%;
  gap: 0.6rem;
}

.controls__label {
  font-size: 0.95rem;
  color: var(--text-muted);
}
/* 操作按鈕群組（最佳伺服器 / 重置篩選） */
.controls__group--actions {
  display: block;            /* 改為 block，使用 text-align 置中更穩定 */
  width: 100%;
  text-align: center;        /* 置中內部 inline/inline-flex 元素 */
  margin-top: 0.25rem;
}
/* 兩顆按鈕間距 */
.controls__group--actions .action-button + .action-button {
  margin-left: 0.6rem;
}

/* 通用操作按鈕樣式 */
.action-button {
  border-radius: 12px;
  border: 1px solid rgba(0, 209, 178, 0.35);
  background: rgba(6, 13, 20, 0.95);
  color: var(--text-primary);
  padding: 0.6rem 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.action-button:hover {
  border-color: rgba(0, 209, 178, 0.8);
  background: rgba(0, 209, 178, 0.14);
}
.action-button:active {
  transform: translateY(1px);
}
.action-button:focus-visible {
  outline: 2px solid rgba(0, 209, 178, 0.8);
  outline-offset: 2px;
}


.controls__select,
.controls__search {
  border-radius: 12px;
  border: 1px solid rgba(0, 209, 178, 0.25);
  padding: 0.65rem 0.85rem;
  background: rgba(13, 17, 23, 0.95);
  color: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.controls__select option {
  background-color: #0d1117;
  color: var(--text-primary);
}

.controls__select:focus,
.controls__search:focus {
  border-color: rgba(0, 209, 178, 0.8);
  outline: none;
  background: rgba(6, 13, 20, 0.95);
  transform: translateY(-1px);
}

.controls__search::placeholder {
  color: var(--text-muted);
}

.country-filter__toggle {
  border-radius: 12px;
  border: 1px solid rgba(0, 209, 178, 0.35);
  background: rgba(6, 13, 20, 0.95);
  color: var(--text-primary);
  padding: 0.6rem 0.85rem;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.country-filter__toggle::after {
  content: "\25BC";
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.country-filter__toggle[aria-expanded="true"] {
  border-color: rgba(0, 209, 178, 0.8);
  background: rgba(0, 209, 178, 0.14);
}

.country-filter__toggle[aria-expanded="true"]::after {
  transform: rotate(-180deg);
}

.country-filter__toggle:focus-visible {
  outline: 2px solid rgba(0, 209, 178, 0.8);
  outline-offset: 2px;
}

.country-filter__toggle-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.country-filter {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  max-height: 200px;
  overflow: auto;
  padding: 0.55rem 0.65rem;
  border-radius: 14px;
  background: rgba(4, 8, 12, 0.9);
  border: 1px solid rgba(240, 246, 252, 0.08);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.country-filter--open {
  display: grid;
  opacity: 1;
  transform: translateY(0);
}

.country-filter__option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.country-filter__option:hover,
.country-filter__option:focus-within {
  background: rgba(0, 209, 178, 0.18);
  transform: translateY(-1px);
}

.country-filter__checkbox {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.country-filter__label {
  flex: 1;
}

.country-filter__count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.table-wrapper {
  border-radius: 22px;
  /* 桌機放寬內容寬度，避免裁切；不顯示水平捲動 */
  overflow-x: hidden;
  overflow-y: hidden;
  position: relative;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow);
}

.status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}

.status-table thead {
  background: rgba(240, 246, 252, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
}

.status-table th,
.status-table td {
  padding: 0.95rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid rgba(240, 246, 252, 0.08);
}

/* 不換行：位置(第1欄)與供應商(第2欄) */
.status-table th:nth-child(1),
.status-table td:nth-child(1),
.status-table th:nth-child(2),
.status-table td:nth-child(2) {
  white-space: nowrap;
}


/* 表頭不換行：所有 th */
.status-table th {
  white-space: nowrap;
}


.status-table th[data-sort-key] {
  cursor: pointer;
  position: relative;
  user-select: none;
}

/* 右側圓角安全邊界：最後一欄增加右內距避免被圓角切到 */
.status-table th:last-child,
.status-table td:last-child {
  padding-right: 1.6rem;
}



.status-table th[data-sort-key]::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-top-color: transparent;
  border-bottom-color: rgba(240, 246, 252, 0.45);
  opacity: 0.3;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.status-table th[data-sort-key].is-desc::after {
  border-bottom-color: transparent;
  border-top-color: rgba(240, 246, 252, 0.65);
  transform: translateY(-50%) rotate(180deg);
  opacity: 0.85;
}

.status-table th[data-sort-key].is-asc::after {
  opacity: 0.85;
}

.status-table tbody tr {
  transition: background 0.25s ease, transform 0.2s ease;
  cursor: default; /*   SID   */
}

.status-table tbody tr:hover,
.status-table tbody tr:focus-visible {
  background: rgba(0, 209, 178, 0.12);
  transform: translateY(-2px);
  outline: none;
}
/* 位置欄位：最長 15 字元寬度，超出以省略號顯示 */
.status-table td.region-cell .truncate-15ch {
  display: inline-block;
  max-width: 15ch;           /* 以 15 個字元寬度為上限 */
  white-space: nowrap;        /* 單行顯示 */
  overflow: hidden;           /* 超出隱藏 */
  text-overflow: ellipsis;    /* 以省略號顯示 */
  vertical-align: bottom;
}


/* 只在 SID 欄位可點擊：
   調整游標與連結樣式 */
.status-table tbody tr { cursor: default !important; }
.status-table td.sid-cell a.sid-link {
  color: var(--text-primary);
  text-decoration: underline;
  cursor: pointer;
}
.status-table td.sid-cell a.sid-link:hover {
  color: var(--accent);
}


.status-table__placeholder {
  text-align: center;
  color: var(--text-muted);
}

.hover-card__spinner {
  display: none;
  margin: 0 auto 0.75rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-top-color: #4b9cff;
  animation: hover-card-spinner 0.8s linear infinite;
}

.hover-card--loading .hover-card__spinner {
  display: inline-block;
}

.hover-card--loading .hover-card__details {
  opacity: 0.6;
}

@keyframes hover-card-spinner {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.cell {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.cell__primary {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.cell__secondary {
  display: none;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.metric-cell {
  min-width: 120px;
}






\.metric-cell__placeholder {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.metric-value {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.metric-value--network {
  min-width: 5ch;
}






.metric-thumb {
  width: 120px;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(240, 246, 252, 0.08);
  background: rgba(0, 0, 0, 0.25);
}






.hover-card {
  position: fixed;
  pointer-events: none;
  min-width: 260px;
  max-width: 360px;
  background: rgba(13, 17, 23, 0.93);
  border-radius: 18px;
  border: 1px solid rgba(240, 246, 252, 0.1);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  padding: 1.1rem 1.2rem;
  line-height: 1.5;
  z-index: 1000;
  backdrop-filter: blur(12px);
  transition: opacity 0.15s ease;
}

.hover-card[hidden] {
  opacity: 0;
}

.hover-card__header {
  margin-bottom: 0.75rem;
}

.hover-card__title {
  margin: 0;
  font-size: 1.15rem;
}

.hover-card__subtitle {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.hover-card__details {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.75rem;
  row-gap: 0.5rem;
  font-size: 0.9rem;
}

.hover-card__details dt {
  color: var(--text-muted);
  font-weight: 500;
}

.hover-card__details dd {
  margin: 0;
  color: var(--text-primary);
  white-space: pre-line;
}

.hover-card__details dd img {
  display: block;
  max-width: 320px; /* 放寬一點，與卡片 max-width 協調 */
  width: 100%;      /* 依容器寬度縮放 */
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(240, 246, 252, 0.08);
  background: rgba(0, 0, 0, 0.35);
}

/* 可選：長圖時避免卡片寬度被撐破 */
.hover-card {
  overflow: hidden; /* 確保內容不外溢出卡片圓角 */
}

.hover-card__footer {
  margin-top: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.page__footer {
  margin-top: 3rem;
  background: rgba(13, 17, 23, 0.65);
  border-radius: 18px;
  border: 1px solid var(--surface-border);
  padding: 1.5rem 1.8rem;
  box-shadow: var(--shadow);
}

.page__footer h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

.page__footer ul {
  margin: 0.8rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

@media (max-width: 1024px) {
  .metric-cell {
  min-width: 120px;
}





/* e
 a a a */
.status-table tbody tr { cursor: pointer; }

}

@media (max-width: 900px) {
  .status-table th,
  .status-table td {
    padding: 0.85rem 0.9rem;
  }
}

@media (max-width: 768px) {
  .controls {
    flex-direction: column;
  }

  .country-filter {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }

  .hover-card {
    max-width: calc(100vw - 2rem);
  }
}

@media (max-width: 640px) {
  .status-table th:nth-child(3),
  .status-table td:nth-child(3) {
    display: none;
  }

  .cell__secondary {
    display: inline;
  }

  .metric-thumb {
  width: 120px;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(240, 246, 252, 0.08);
  background: rgba(0, 0, 0, 0.25);
}





}








test
.controls__group--load {
  flex: 1 1 100%;
}

.load-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.load-filter__field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.load-filter__input {
  width: 5.5rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 209, 178, 0.25);
  padding: 0.45rem 0.55rem;
  background: rgba(13, 17, 23, 0.95);
  color: inherit;
}

.load-filter__input:focus {
  border-color: rgba(0, 209, 178, 0.8);
  outline: none;
}

/* ========== Map Page Styles ========== */
.page--map {
  padding-bottom: 5rem;
}

.map-shell {
  margin-top: 2.4rem;
  padding: clamp(1.4rem, 3vw, 2.1rem);
  border-radius: 22px;
  border: 1px solid var(--surface-border);
  background: linear-gradient(130deg, rgba(12, 20, 30, 0.92), rgba(8, 14, 22, 0.9));
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.9fr);
  gap: clamp(1.3rem, 3vw, 2.2rem);
  align-items: stretch;
}

.map-shell__main {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.map-shell__top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: stretch;
}

.map-status {
  flex: 1 1 240px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  background: rgba(13, 22, 35, 0.7);
  border: 1px solid rgba(94, 234, 212, 0.22);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  line-height: 1.5;
}

.map-status--ready {
  color: var(--text-primary);
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(13, 22, 35, 0.82);
}

.map-status--error {
  color: #fda4af;
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(69, 10, 10, 0.65);
}

.map-legend {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(94, 234, 212, 0.22);
  background: rgba(13, 22, 35, 0.7);
  min-width: 210px;
}

.map-legend__title {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-secondary);
}

.map-legend__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.map-legend__swatch {
  display: inline-flex;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 0.45rem;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.5);
}

.map-legend__swatch--normal { background: #22c55e; }
.map-legend__swatch--congested { background: #facc15; }
.map-legend__swatch--error { background: #f97316; }
.map-legend__swatch--unknown { background: #9ca3af; }

.map-view {
  position: relative;
  height: clamp(420px, 65vh, 720px);
  min-height: 380px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(3, 7, 18, 0.55);
  border: 1px solid rgba(94, 234, 212, 0.18);
}

.map-shell__sidebar {
  background: rgba(13, 17, 23, 0.82);
  border-radius: 18px;
  border: 1px solid rgba(94, 234, 212, 0.16);
  padding: 1rem 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  box-shadow: inset 0 0 0 1px rgba(10, 148, 125, 0.12);
}

.map-sidebar__header {
  display: grid;
  gap: 0.5rem;
}

.map-sidebar__title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.map-sidebar__subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.map-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.map-list::-webkit-scrollbar {
  width: 8px;
}

.map-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
}

.map-list__placeholder {
  padding: 1.2rem 0.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.map-list__item {
  position: relative;
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 0.75rem 0.95rem 0.85rem 1.2rem;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.45);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.map-list__item:hover {
  border-color: rgba(94, 234, 212, 0.35);
  background: rgba(15, 23, 42, 0.65);
  transform: translateY(-1px);
}

.map-list__item.is-active {
  border-color: rgba(94, 234, 212, 0.55);
  background: rgba(8, 145, 178, 0.22);
  box-shadow: 0 12px 30px rgba(13, 148, 136, 0.25);
}

.map-list__indicator {
  position: absolute;
  left: 0.55rem;
  top: 0.9rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.6);
}

.map-list__item--normal .map-list__indicator { background: #22c55e; }
.map-list__item--congested .map-list__indicator { background: #facc15; }
.map-list__item--error .map-list__indicator { background: #f97316; }
.map-list__item--unknown .map-list__indicator { background: #9ca3af; }

.map-list__body {
  display: grid;
  gap: 0.5rem;
  width: 100%;
}

.map-list__name {
  font-weight: 600;
  font-size: 1rem;
}

.map-list__meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.map-list__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.map-list__chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(148, 163, 184, 0.18);
  color: rgba(226, 232, 240, 0.92);
}

.map-list__chip--more {
  background: rgba(94, 234, 212, 0.22);
  color: rgba(165, 243, 252, 0.9);
}

.server-marker {
  --marker-color: #22c55e;
  --marker-accent: rgba(34, 197, 94, 0.28);
  position: relative;
  font-family: inherit;
}

.server-marker--congested {
  --marker-color: #facc15;
  --marker-accent: rgba(250, 204, 21, 0.3);
}

.server-marker--error {
  --marker-color: #f97316;
  --marker-accent: rgba(249, 115, 22, 0.3);
}

.server-marker--unknown {
  --marker-color: #9ca3af;
  --marker-accent: rgba(156, 163, 175, 0.3);
}

.server-marker__badge {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translate(-50%, -35%);
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--marker-color);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.45);
}

.server-marker__dot {
  position: relative;
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--marker-color);
  border: 2px solid rgba(15, 23, 42, 0.65);
  margin: 14px auto 0;
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.6);
  overflow: visible;
  animation: markerGlow 3.2s ease-in-out infinite;
}

.leaflet-container {
  font-family: inherit;
  background: rgba(8, 14, 22, 0.85);
}

.leaflet-bar a,
.leaflet-bar a:hover {
  background: rgba(13, 22, 35, 0.78);
  color: var(--text-primary);
  border-bottom: 1px solid rgba(94, 234, 212, 0.2);
}

.leaflet-bar a:last-child {
  border-bottom: none;
}

.leaflet-control-attribution {
  background: rgba(13, 22, 35, 0.78);
  color: var(--text-muted);
}

.leaflet-control-attribution a {
  color: rgba(94, 234, 212, 0.85);
}

.leaflet-popup-content-wrapper {
  background: rgba(13, 17, 23, 0.92);
  border-radius: 16px;
  border: 1px solid rgba(94, 234, 212, 0.18);
  box-shadow: 0 25px 55px rgba(2, 6, 14, 0.55);
}

.leaflet-popup-tip {
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(94, 234, 212, 0.18);
}

.popup {
  color: var(--text-primary);
  max-width: 320px;
}

.popup__header {
  margin-bottom: 0.65rem;
}

.popup__title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.popup__subtitle {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.popup__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.popup-server {
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(96, 165, 250, 0.12);
  display: grid;
  gap: 0.4rem;
}

.popup-server--congested {
  background: rgba(250, 204, 21, 0.18);
  border-color: rgba(250, 204, 21, 0.45);
}

.popup-server--error {
  background: rgba(248, 113, 113, 0.22);
  border-color: rgba(248, 113, 113, 0.45);
}

.popup-server--unknown {
  background: rgba(148, 163, 184, 0.18);
  border-color: rgba(148, 163, 184, 0.3);
}

.popup-server__header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  font-weight: 600;
  color: var(--text-primary);
}

.popup-server__provider {
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(96, 165, 250, 0.85);
  background: rgba(59, 130, 246, 0.18);
  border-radius: 6px;
  padding: 0.12rem 0.4rem;
}

.popup-server__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  font-size: 0.78rem;
  color: rgba(226, 232, 240, 0.85);
}

.popup-server__status {
  font-weight: 600;
  color: rgba(125, 211, 252, 0.95);
}

.popup-server__congestion {
  color: rgba(203, 213, 225, 0.85);
}

@media (max-width: 1100px) {
  .map-shell {
    grid-template-columns: 1fr;
  }

  .map-shell__sidebar {
    order: 2;
  }

  .map-shell__main {
    order: 1;
  }

  .map-view {
    height: clamp(360px, 62vh, 640px);
  }
}

@media (max-width: 768px) {
  .map-shell {
    padding: clamp(1.1rem, 5vw, 1.6rem);
  }

  .map-shell__top {
    flex-direction: column;
  }

  .map-legend {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .map-legend__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-shell__sidebar {
    padding: clamp(0.95rem, 4vw, 1.4rem);
  }
}

@media (max-width: 640px) {
  .map-list__item {
    padding-left: 1rem;
  }

  .map-list__chips {
    gap: 0.3rem;
  }

  .map-list__chip {
    font-size: 0.7rem;
    padding: 0.18rem 0.45rem;
  }
}
.server-marker__dot::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: var(--marker-color);
  opacity: 0.28;
  animation: markerPulse 2.8s ease-out infinite;
}

.server-marker.is-active .server-marker__dot {
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.24), 0 14px 24px rgba(15, 23, 42, 0.6);
  animation-duration: 2.4s;
}

.server-marker.is-active .server-marker__dot::after {
  opacity: 0.45;
  animation-duration: 2s;
}

.server-marker.is-active .server-marker__badge {
  background: var(--marker-accent);
  border-color: rgba(15, 23, 42, 0.65);
  color: #0f172a;
}

.map-selection {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(94, 234, 212, 0.18);
  background: rgba(8, 20, 33, 0.55);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.map-selection[data-status="normal"] {
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 8px 22px rgba(13, 148, 136, 0.2);
}

.map-selection[data-status="congested"] {
  border-color: rgba(250, 204, 21, 0.5);
  box-shadow: 0 8px 22px rgba(250, 204, 21, 0.22);
}

.map-selection[data-status="error"] {
  border-color: rgba(249, 115, 22, 0.55);
  box-shadow: 0 8px 22px rgba(249, 115, 22, 0.25);
}

.map-selection[data-status="unknown"] {
  border-color: rgba(148, 163, 184, 0.4);
}

.map-selection__label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.map-selection__count {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.map-city-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.map-city-list::-webkit-scrollbar {
  width: 8px;
}

.map-city-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
}

.map-city-list__placeholder {
  padding: 1.2rem 0.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.map-city {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.8rem 1rem 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(18, 44, 62, 0.65);
  border-top-color: rgba(94, 234, 212, 0.35);
  background: rgba(13, 23, 37, 0.72);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: inset 0 1px 0 rgba(94, 234, 212, 0.14), 0 10px 24px rgba(10, 19, 30, 0.42);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.map-city:hover {
  border-color: rgba(94, 234, 212, 0.32);
  transform: translateY(-1px);
  text-decoration: none;
}

.map-city__indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 0.35rem;
  box-shadow: 0 0 0 4px rgba(7, 11, 17, 0.82);
}

.map-city--normal .map-city__indicator {
  background: #22c55e;
}

.map-city--congested .map-city__indicator {
  background: #facc15;
}

.map-city--error .map-city__indicator {
  background: #f97316;
}

.map-city--unknown .map-city__indicator {
  background: #9ca3af;
}

.map-city__header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.map-city__name {
  font-weight: 600;
  font-size: 0.96rem;
  color: var(--text-primary);
}

.map-city__provider {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}

.map-city__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.map-city__status {
  font-weight: 600;
}

.map-city--normal .map-city__status {
  color: #4ade80;
}

.map-city--congested .map-city__status {
  color: #facc15;
}

.map-city--error .map-city__status {
  color: #fb923c;
}

.map-city--unknown .map-city__status {
  color: #cbd5f5;
}

.map-count-popup-shell .leaflet-popup-content-wrapper {
  background: rgba(11, 24, 38, 0.94);
  color: var(--text-primary);
  border-radius: 14px;
  border: 1px solid rgba(94, 234, 212, 0.4);
  box-shadow: 0 12px 30px rgba(8, 145, 178, 0.25);
}

.map-count-popup-shell .leaflet-popup-content {
  margin: 0;
}

.map-count-popup-shell .leaflet-popup-tip {
  background: rgba(11, 24, 38, 0.94);
  border: 1px solid rgba(94, 234, 212, 0.35);
}

.map-count-popup {
  padding: 0.65rem 0.85rem;
  display: grid;
  gap: 0.3rem;
}

.map-count-popup__country {
  font-weight: 600;
  font-size: 0.9rem;
}

.map-count-popup__count {
  font-size: 1.05rem;
  font-weight: 600;
}

@keyframes markerGlow {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.6);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.55);
  }
}

@keyframes markerPulse {
  0% {
    transform: scale(0.55);
    opacity: 0.45;
  }
  70% {
    transform: scale(1.4);
    opacity: 0;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.map-city__body {
  display: grid;
  gap: 0.45rem;
}

.map-city__sid {
  font-variant-numeric: tabular-nums;
}

.map-city__congestion {
  color: var(--text-muted);
}




.map-city-list__pagination {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(15, 23, 42, 0.45);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.map-city-list__pagination-summary {
  white-space: nowrap;
}

.map-city-list__pagination-controls {
  display: inline-flex;
  gap: 0.5rem;
}

.map-city-list__pagination-btn {
  min-width: 72px;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.25);
  background: rgba(12, 22, 34, 0.6);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.map-city-list__pagination-btn:hover:not(:disabled) {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(12, 22, 34, 0.9);
}

.map-city-list__pagination-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ===== Modal 樣式 ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.2s ease-out;
}

.modal[hidden] {
  display: none;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal__container {
  position: relative;
  z-index: 1001;
  width: 90%;
  max-width: 480px;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--surface-border);
}

.modal__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.modal__body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal__field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.modal__label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.modal__input {
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.modal__input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.4);
}

.modal__input::placeholder {
  color: var(--text-muted);
}

.modal__footer {
  display: flex;
  gap: 0.75rem;
  padding: 1.25rem 1.75rem;
  border-top: 1px solid var(--surface-border);
  justify-content: flex-end;
}

.modal__button {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: inherit;
}

.modal__button--primary {
  background: var(--accent);
  color: #0d1117;
}

.modal__button--primary:hover {
  background: #00f0c8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 209, 178, 0.3);
}

.modal__button--secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--surface-border);
}

.modal__button--secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.modal__button--danger {
  background: transparent;
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.modal__button--danger:hover {
  background: rgba(255, 107, 107, 0.1);
  color: #ff8787;
  border-color: #ff6b6b;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
}

@media (max-width: 640px) {
  .modal__container {
    width: 95%;
    max-width: none;
  }

  .modal__header,
  .modal__body,
  .modal__footer {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .modal__footer {
    flex-direction: column;
  }

  .modal__button {
    width: 100%;
  }
}

/* Modal 訊息顯示模式 */
.modal__message {
  padding: 1.5rem;
  border-radius: 12px;
  font-size: 1rem;
  line-height: 1.6;
}

.modal__message p {
  margin: 0 0 0.5rem 0;
}

.modal__message p:last-child {
  margin-bottom: 0;
}

.modal__message--success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.modal__message--error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.modal__message--info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}
