/* EasyTier Dashboard —— Watercolor Style 水彩画风
 * 纸张色背景 #faf8f5 · 蓝灰主色 #4a6fa5 · 水彩色半透明叠加
 * 大圆角 · 柔和低透明度阴影 · 衬线标题 · 液态慢速缓动 · 无硬边框/直角/纯黑
 */
:root {
  --paper: #faf8f5;
  --paper-2: #f0ebe3;
  --panel: #fffdfb;
  --line: rgba(74, 111, 165, 0.18);
  --line-soft: rgba(74, 111, 165, 0.12);
  --ink: #3a3a3a;
  --brand: #4a6fa5;
  --brand-ink: #3d5a85;
  --muted: #6e6e6e;
  --faint: #8a8a8a;

  --peach: #e8a87c;
  --teal: #85cdca;
  --rose: #c38d94;
  --sand: #d4a373;
  --sage: #78a082;
  --gold: #c9a84c;

  --teal-ink: #3f7370;
  --sage-ink: #5b7a60;
  --gold-ink: #96782f;
  --peach-ink: #a96b3d;
  --rose-ink: #a05f68;

  --shadow-sm: 0 2px 10px rgba(74, 111, 165, 0.1);
  --shadow-md: 0 4px 20px rgba(74, 111, 165, 0.12);
  --shadow-lg: 0 8px 30px rgba(74, 111, 165, 0.15);
  --shadow-bloom: 0 10px 40px rgba(74, 111, 165, 0.22);

  --serif: Georgia, "Times New Roman", "STZhongsong", "SimSun", "Noto Serif SC", serif;
  --sans: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;

  --edge-30: #5b9e9b;
  --edge-80: #7ea184;
  --edge-150: #c9a84c;
  --edge-300: #e8a87c;
  --edge-max: #c38d94;
  --edge-dim: rgba(74, 111, 165, 0.35);
  --node-fill-0: rgba(232, 168, 124, 0.2);
  --node-fill-1: rgba(195, 141, 148, 0.18);
  --node-fill-2: rgba(212, 163, 115, 0.2);
  --node-fill-3: rgba(133, 205, 202, 0.18);
  --node-fill-local: rgba(133, 205, 202, 0.32);
  --node-fill-relay: rgba(232, 168, 124, 0.26);
  --node-stroke: rgba(74, 111, 165, 0.32);
  --node-stroke-local: rgba(74, 111, 165, 0.6);
  --node-stroke-relay: rgba(232, 168, 124, 0.8);
}

:root { color-scheme: light; }

/* 水彩夜色:靛蓝夜纸底,水彩色提亮,不用纯黑 */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1f2739;
  --paper-2: #171e2e;
  --panel: #2a344b;
  --line: rgba(151, 173, 210, 0.22);
  --line-soft: rgba(151, 173, 210, 0.12);
  --ink: #e7ecf6;
  --brand: #93b4e0;
  --brand-ink: #aac6ea;
  --muted: #a3aec7;
  --faint: #7e8aa4;
  --teal: #9ad8d5;
  --rose: #d6a3ab;
  --peach: #f0b28c;
  --sand: #e0b58a;
  --sage: #93b89d;
  --gold: #d9bc6a;
  --teal-ink: #93d6d2;
  --sage-ink: #b2d3ba;
  --gold-ink: #e0c98a;
  --peach-ink: #f4c3a0;
  --rose-ink: #e8b3bb;
  --shadow-sm: 0 2px 10px rgba(7, 11, 20, 0.35);
  --shadow-md: 0 4px 20px rgba(7, 11, 20, 0.4);
  --shadow-lg: 0 8px 30px rgba(7, 11, 20, 0.45);
  --shadow-bloom: 0 10px 40px rgba(154, 216, 213, 0.16);
  --edge-30: #7fc7c3;
  --edge-80: #93b89d;
  --edge-150: #d9bc6a;
  --edge-300: #f0b28c;
  --edge-max: #d6a3ab;
  --edge-dim: rgba(151, 173, 210, 0.4);
  --node-fill-0: rgba(240, 178, 140, 0.16);
  --node-fill-1: rgba(214, 163, 171, 0.15);
  --node-fill-2: rgba(224, 181, 138, 0.16);
  --node-fill-3: rgba(154, 216, 213, 0.15);
  --node-fill-local: rgba(154, 216, 213, 0.26);
  --node-fill-relay: rgba(240, 178, 140, 0.2);
  --node-stroke: rgba(151, 173, 210, 0.4);
  --node-stroke-local: rgba(147, 180, 224, 0.75);
  --node-stroke-relay: rgba(240, 178, 140, 0.75);
}

:root[data-theme="dark"] .meta select,
:root[data-theme="dark"] .theme-btn { background: rgba(255, 255, 255, 0.07); }
:root[data-theme="dark"] .badge.net { background: rgba(147, 180, 224, 0.16); border-color: rgba(147, 180, 224, 0.35); }
:root[data-theme="dark"] .badge.local { background: rgba(147, 180, 224, 0.12); border-color: rgba(147, 180, 224, 0.3); }
:root[data-theme="dark"] .badge.p2p { background: rgba(154, 216, 213, 0.16); border-color: rgba(154, 216, 213, 0.35); }
:root[data-theme="dark"] .badge.relay { background: rgba(240, 178, 140, 0.16); border-color: rgba(240, 178, 140, 0.4); }
:root[data-theme="dark"] tbody tr:hover { background: rgba(154, 216, 213, 0.07); }
:root[data-theme="dark"] .banner { background: rgba(214, 163, 171, 0.12); border-color: rgba(214, 163, 171, 0.3); }
:root[data-theme="dark"] .wash-peach { background: rgba(232, 168, 124, 0.13); }
:root[data-theme="dark"] .wash-teal { background: rgba(133, 205, 202, 0.11); }
:root[data-theme="dark"] .wash-rose { background: rgba(195, 141, 148, 0.11); }
:root[data-theme="dark"] .topo-wrap svg {
  background: linear-gradient(135deg, rgba(240, 178, 140, 0.05), rgba(154, 216, 213, 0.06) 45%, rgba(214, 163, 171, 0.05));
}
:root[data-theme="dark"] body::after { opacity: 0.3; }

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 300 14px/1.6 var(--sans);
  transition: background-color 0.5s ease-in-out, color 0.5s ease-in-out;
}

/* 纸张上的水彩晕染色块与微妙纹理 */
.wash {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  z-index: -1;
  pointer-events: none;
}
.wash-peach { top: -140px; left: -100px; width: 460px; height: 460px; background: rgba(232, 168, 124, 0.32); }
.wash-teal  { top: 28%; right: -160px; width: 560px; height: 560px; background: rgba(133, 205, 202, 0.28); }
.wash-rose  { bottom: -180px; left: 20%; width: 500px; height: 500px; background: rgba(195, 141, 148, 0.24); }

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .logo { font-size: 19px; }
.brand h1 {
  font-family: var(--serif);
  font-size: 19px;
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--brand);
}

.meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.green { background: var(--sage); box-shadow: 0 0 10px rgba(120, 160, 130, 0.55); }
.dot.yellow { background: var(--gold); box-shadow: 0 0 10px rgba(201, 168, 76, 0.5); }
.dot.red { background: var(--rose); box-shadow: 0 0 10px rgba(195, 141, 148, 0.55); }

.meta .ctl { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; cursor: pointer; }

.theme-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: box-shadow 0.5s ease-in-out, transform 0.5s ease-in-out, background-color 0.5s ease-in-out;
}
.theme-btn:hover { box-shadow: var(--shadow-md); transform: scale(1.06); }
.theme-btn:active { transform: scale(0.98); }
.meta select {
  background: rgba(255, 255, 255, 0.6);
  color: var(--brand-ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 300;
  font-family: var(--sans);
  cursor: pointer;
  outline: none;
  transition: box-shadow 0.5s ease-in-out, border-color 0.5s ease-in-out, transform 0.5s ease-in-out;
}
.meta select:hover { border-color: rgba(74, 111, 165, 0.4); box-shadow: var(--shadow-md); }
.meta select:active { transform: scale(0.98); }
.meta select:focus { border-color: rgba(74, 111, 165, 0.45); box-shadow: 0 4px 20px rgba(74, 111, 165, 0.15); }

main { max-width: 1180px; margin: 0 auto; padding: 18px 22px 40px; position: relative; z-index: 1; }

.banner {
  background: rgba(195, 141, 148, 0.14);
  border: 1px solid rgba(195, 141, 148, 0.35);
  color: var(--rose-ink);
  padding: 10px 16px;
  border-radius: 18px;
  margin-bottom: 16px;
  font-size: 13px;
}
.banner.hidden { display: none; }
.banner .muted { color: var(--muted); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.5s ease-in-out, background-color 0.5s ease-in-out, transform 0.5s ease-in-out;
}
.card:hover,
.panel:hover { box-shadow: var(--shadow-bloom); }

.card { padding: 14px 18px; }
.card .k { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; }
.card .v { font-family: var(--mono); font-size: 26px; margin-top: 4px; color: var(--ink); }
.card .v.small { font-size: 17px; font-family: var(--serif); letter-spacing: 0.04em; }
.card .s { color: var(--faint); font-size: 12px; margin-top: 3px; }

.panel { padding: 16px 18px 10px; margin-bottom: 18px; }
.panel h2 {
  font-family: var(--serif);
  font-size: 15px;
  margin: 2px 0 12px;
  color: var(--ink);
  font-weight: 400;
  letter-spacing: 0.06em;
}
.panel h2 .hint { color: var(--faint); font-weight: 300; font-size: 12px; font-family: var(--sans); letter-spacing: 0; }

.table-wrap { overflow-x: auto; border-radius: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; transition: background-color 0.5s ease-in-out; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(133, 205, 202, 0.1); }
td.num { font-family: var(--mono); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.em { font-weight: 400; color: var(--ink); }
td .rx { color: var(--sage-ink); }
td .tx { color: var(--brand); }

.badge {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.7;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.net { background: rgba(74, 111, 165, 0.14); color: var(--brand-ink); border-color: rgba(74, 111, 165, 0.25); }
.badge.local { background: rgba(74, 111, 165, 0.1); color: var(--brand-ink); border-color: rgba(74, 111, 165, 0.2); }
.badge.p2p { background: rgba(133, 205, 202, 0.22); color: var(--teal-ink); border-color: rgba(133, 205, 202, 0.45); }
.badge.relay { background: rgba(232, 168, 124, 0.22); color: var(--peach-ink); border-color: rgba(232, 168, 124, 0.45); }

table.matrix th, table.matrix td { text-align: center; }
table.matrix td:first-child, table.matrix th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--panel);
  z-index: 1;
}
table.matrix tbody tr:hover td:first-child { background: var(--panel); }
table.matrix td .sub { color: var(--faint); font-size: 11px; }

.self-detail { padding-bottom: 12px; }
.self-detail .row { display: flex; gap: 10px; padding: 4px 0; font-size: 13px; flex-wrap: wrap; }
.self-detail .row .k { color: var(--muted); min-width: 110px; }
.self-detail details { margin-top: 6px; }
.self-detail summary { cursor: pointer; color: var(--brand-ink); font-size: 12.5px; transition: color 0.5s ease-in-out; }
.self-detail summary:hover { color: var(--brand); }
.self-detail pre {
  margin: 8px 0 0;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 12px;
  overflow-x: auto;
}

/* --- 网络拓扑 --- */
.topo-wrap {
  position: relative;
  height: 430px;
  margin-bottom: 8px;
}
.topo-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
  background: linear-gradient(135deg, rgba(232, 168, 124, 0.08), rgba(133, 205, 202, 0.1) 45%, rgba(195, 141, 148, 0.08));
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  touch-action: none;
}
.topo-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 13px;
  font-family: var(--serif);
  letter-spacing: 0.06em;
}
.topo-empty.hidden { display: none; }

.topo-wrap .node { cursor: grab; }
.topo-wrap .node:active { cursor: grabbing; }
.topo-wrap .node .rbox { fill: var(--node-fill-0); stroke: var(--node-stroke); stroke-width: 1.1; }
.topo-wrap .node.tint1 .rbox { fill: var(--node-fill-1); }
.topo-wrap .node.tint2 .rbox { fill: var(--node-fill-2); }
.topo-wrap .node.tint3 .rbox { fill: var(--node-fill-3); }
.topo-wrap .node.local .rbox { fill: var(--node-fill-local); stroke: var(--node-stroke-local); stroke-width: 1.6; }
.topo-wrap .node.relay .rbox { fill: var(--node-fill-relay); stroke: var(--node-stroke-relay); }
.topo-wrap .node text { pointer-events: none; }
.topo-wrap .node .nname {
  font-family: var(--serif);
  fill: var(--ink);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}
.topo-wrap .node .nnip { fill: var(--muted); font-size: 10.5px; font-family: var(--mono); }

.topo-wrap .edge { fill: none; opacity: 0.55; }
.topo-wrap .flow { pointer-events: none; opacity: 0.9; }
.topo-wrap .elabel {
  font-family: var(--mono);
  font-size: 10px;
  paint-order: stroke;
  stroke: var(--panel);
  stroke-width: 3px;
  pointer-events: none;
}

.topo-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11.5px;
  padding: 0 2px 8px;
}
.topo-legend .sw {
  display: inline-block;
  width: 14px;
  height: 4px;
  border-radius: 999px;
  margin-right: 5px;
  vertical-align: middle;
}
.topo-legend .nd {
  display: inline-block;
  width: 14px;
  height: 11px;
  border-radius: 4px;
  margin-right: 5px;
  vertical-align: middle;
}
.topo-legend .sep { flex: 1; }

footer {
  max-width: 1180px;
  margin: 0 auto 26px;
  padding: 12px 22px;
  color: var(--brand-ink);
  font-size: 12px;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
}

/* 液态缓动:尊重系统减弱动效设置 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
