:root {
  color-scheme: dark;
  --bg: #07100e;
  --surface: #0b1714;
  --surface-2: #0f1d19;
  --line: rgba(177, 213, 197, .13);
  --line-bright: rgba(177, 213, 197, .23);
  --text: #edf8f2;
  --muted: #849b91;
  --green: #4ff0a8;
  --green-soft: rgba(79, 240, 168, .12);
  --amber: #f6c85f;
  --red: #ff7272;
  --blue: #69a8ff;
  --purple: #b58cff;
  --radius: 5px;
  font-family: Inter, "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--bg); }
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .28;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}
.shell { width: min(1480px, 100%); margin: 0 auto; padding: 0 clamp(18px, 3vw, 48px); position: relative; }
.topbar { height: 78px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 34px; height: 34px; display: flex; align-items: end; gap: 3px; padding: 8px; border: 1px solid var(--line-bright); }
.brand-mark i { display: block; width: 4px; background: var(--green); }
.brand-mark i:nth-child(1) { height: 7px; opacity: .55; }
.brand-mark i:nth-child(2) { height: 13px; opacity: .75; }
.brand-mark i:nth-child(3) { height: 18px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: .87rem; letter-spacing: .14em; }
.brand span { margin-top: 3px; color: var(--muted); font: 600 .66rem/1.1 ui-monospace, monospace; letter-spacing: .13em; }
.topbar-meta { color: var(--muted); font: 500 .75rem/1 ui-monospace, monospace; display: flex; align-items: center; gap: 15px; }
.live { color: var(--text); display: flex; align-items: center; gap: 8px; }
.live i, .service-summary i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }
.live.error i, .service-summary.error i { background: var(--red); box-shadow: 0 0 12px var(--red); }
.divider { width: 1px; height: 16px; background: var(--line-bright); }
#refresh-button { border: 0; color: var(--muted); background: transparent; width: 34px; height: 34px; padding: 8px; cursor: pointer; }
#refresh-button:hover { color: var(--green); }
#refresh-button.loading svg { animation: spin .8s linear infinite; }
#refresh-button svg { fill: none; stroke: currentColor; stroke-width: 1.7; }

main { padding: clamp(32px, 6vw, 78px) 0 42px; }
.hero-row { display: grid; grid-template-columns: 1.05fr .95fr; align-items: end; gap: clamp(30px, 7vw, 100px); margin-bottom: 48px; }
.eyebrow, .section-label { color: var(--green); font: 700 .68rem/1 ui-monospace, monospace; letter-spacing: .17em; text-transform: uppercase; }
h1 { margin: 14px 0 0; font-size: clamp(2.6rem, 5vw, 5.4rem); line-height: .93; letter-spacing: -.055em; font-weight: 650; }
h1 em { font-style: normal; color: var(--green); }
.network-card { border-left: 1px solid var(--line-bright); padding: 2px 0 3px clamp(24px, 4vw, 58px); }
.network-values { display: grid; grid-template-columns: 1fr 1fr; margin-top: 20px; }
.network-values > div { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: baseline; }
.network-values > div + div { border-left: 1px solid var(--line); padding-left: clamp(18px, 3vw, 42px); }
.network-values strong { font: 520 clamp(1.65rem, 3vw, 2.7rem)/1 ui-monospace, monospace; letter-spacing: -.07em; white-space: nowrap; }
.network-values small { grid-column: 2; color: var(--muted); font: 600 .62rem/1 ui-monospace, monospace; letter-spacing: .12em; margin-top: 9px; }
.arrow { font: 600 1rem/1 ui-monospace, monospace; }
.arrow.down { color: var(--green); }.arrow.up { color: var(--blue); }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); margin-bottom: 18px; }
.metric-card { min-height: 190px; padding: 22px 23px; background: rgba(11, 23, 20, .76); }
.metric-card + .metric-card { border-left: 1px solid var(--line); }
.metric-head { display: flex; justify-content: space-between; color: var(--muted); font: 700 .68rem/1 ui-monospace, monospace; letter-spacing: .13em; }
.mini-state { color: var(--green); font-size: .58rem; letter-spacing: .1em; }
.metric-card.warn .mini-state { color: var(--amber); }.metric-card.critical .mini-state { color: var(--red); }
.metric-main { display: flex; align-items: baseline; margin: 27px 0 20px; }
.metric-main strong { font: 520 2.45rem/1 ui-monospace, monospace; letter-spacing: -.06em; }
.metric-main span { color: var(--muted); font: 600 .85rem/1 ui-monospace, monospace; margin-left: 5px; }
.meter { height: 2px; background: rgba(255,255,255,.07); overflow: hidden; }
.meter i { display: block; width: 0; height: 100%; background: var(--green); box-shadow: 0 0 8px var(--green); transition: width .5s ease; }
.metric-card.warn .meter i { background: var(--amber); }.metric-card.critical .meter i { background: var(--red); }
.metric-card p { margin: 14px 0 0; color: var(--muted); font-size: .75rem; }
.uptime-card { background: linear-gradient(135deg, rgba(79,240,168,.09), rgba(11,23,20,.7)); }
.pulse-icon { width: 20px; border-top: 1px solid var(--green); position: relative; }
.pulse-icon i { width: 5px; height: 5px; border-radius: 50%; position: absolute; right: 0; top: -3px; background: var(--green); }
.uptime-value { margin-top: 32px; min-height: 42px; font: 520 clamp(1.55rem, 2.2vw, 2.25rem)/1 ui-monospace, monospace; letter-spacing: -.06em; }

.data-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, .65fr); gap: 18px; margin-bottom: 18px; }
.panel { border: 1px solid var(--line); background: rgba(11, 23, 20, .76); padding: 23px; }
.panel-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.panel h2 { margin: 9px 0 0; font-size: 1.05rem; letter-spacing: -.015em; }
.range, .unit { color: var(--muted); font: 600 .68rem/1 ui-monospace, monospace; letter-spacing: .1em; }
.legend { min-height: 43px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 15px 0 6px; }
.legend span { color: var(--muted); font: 500 .68rem/1 ui-monospace, monospace; display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 2px; background: var(--color); }
.chart-wrap { position: relative; min-height: 270px; }
#traffic-chart { width: 100%; height: 270px; display: block; }
.tooltip { position: absolute; z-index: 2; pointer-events: none; background: #12231e; border: 1px solid var(--line-bright); padding: 9px 11px; color: var(--text); font: 600 .69rem/1.5 ui-monospace, monospace; box-shadow: 0 10px 30px #0008; }
.empty { position: absolute; inset: 0; place-items: center; color: var(--muted); font-size: .82rem; }
.empty:not([hidden]) { display: grid; }
.ranking { margin-top: 22px; }
.rank-row { margin-bottom: 19px; }
.rank-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; font-size: .77rem; }
.rank-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { color: var(--muted); font: 600 .7rem/1 ui-monospace, monospace; white-space: nowrap; }
.rank-bar { height: 3px; margin-top: 9px; background: rgba(255,255,255,.06); }
.rank-bar i { display: block; height: 100%; background: var(--green); }

.services-panel { padding-bottom: 27px; }
.service-summary { color: var(--muted); font: 600 .7rem/1 ui-monospace, monospace; display: flex; gap: 8px; align-items: center; }
.services { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.service { min-height: 82px; border: 1px solid var(--line); padding: 15px; display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px; align-items: start; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 4px; background: var(--green); box-shadow: 0 0 10px color-mix(in srgb, var(--green), transparent 25%); }
.service.degraded .status-dot { background: var(--amber); }.service.offline .status-dot { background: var(--red); }
.service strong { font-size: .8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.service small { grid-column: 2; color: var(--muted); font: 500 .64rem/1 ui-monospace, monospace; margin-top: 9px; }
.latency { color: var(--muted); font: 600 .64rem/1 ui-monospace, monospace; }
.warning { margin-top: 16px; border-left: 2px solid var(--amber); padding: 12px 15px; background: rgba(246,200,95,.07); color: #d9c895; font-size: .75rem; line-height: 1.5; }
.skeleton { height: 82px; background: linear-gradient(90deg, var(--surface-2), rgba(255,255,255,.035), var(--surface-2)); background-size: 220% 100%; animation: shimmer 1.5s infinite; }
.skeleton.tall { height: 265px; }
footer { height: 65px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: #53665e; font: 600 .62rem/1 ui-monospace, monospace; letter-spacing: .12em; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -220% 0; } }
@media (max-width: 980px) {
  .hero-row { grid-template-columns: 1fr; }
  .network-card { border-left: 0; border-top: 1px solid var(--line); padding: 24px 0 0; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .metric-card:nth-child(4) { border-top: 1px solid var(--line); }
  .data-grid { grid-template-columns: 1fr; }
  .services { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .shell { padding: 0 15px; }
  .topbar { height: 68px; }
  .topbar-meta .divider, #updated-at { display: none; }
  main { padding-top: 38px; }
  .hero-row { margin-bottom: 31px; gap: 29px; }
  h1 { font-size: clamp(2.8rem, 15vw, 4rem); }
  .network-values strong { font-size: clamp(1.25rem, 6vw, 1.7rem); }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 166px; padding: 18px 16px; }
  .metric-main strong { font-size: 2rem; }
  .mini-state { display: none; }
  .uptime-value { font-size: 1.35rem; margin-top: 29px; }
  .panel { padding: 19px 16px; }
  .chart-wrap, #traffic-chart { min-height: 240px; height: 240px; }
  .legend { gap: 10px; }
  .services { grid-template-columns: 1fr; }
  footer { font-size: .56rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
