:root {
  --bg: #0b0d10;
  --bg-glow: #16202b;
  --card: #12161b;
  --line: #222932;
  --text: #e8ecf1;
  --muted: #8a94a3;
  --accent: #5eead4;
  --accent-2: #a78bfa;
  --warn: #fbbf24;
  --bad: #fb7185;
  --radius: 20px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  background-color: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 85% -10%, var(--bg-glow), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: .02em;
}

.mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
  color: var(--muted);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}
.live[data-state="ok"] { color: var(--text); }
.live[data-state="ok"] .dot { background: var(--accent); animation: pulse 2s ease-out infinite; }
.live[data-state="down"] .dot { background: var(--bad); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  100% { box-shadow: 0 0 0 9px transparent; }
}

.hero { padding: 56px 0 36px; }
.eyebrow {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 64px);
  line-height: 1.05;
  letter-spacing: -.03em;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.lede { margin: 16px 0 0; font-size: 17px; color: var(--muted); }
.lede strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Grid Layout matching お手本原本 */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (min-width: 760px) {
  .grid {
    grid-template-columns: 1fr 1fr 2fr;
  }
  .wide {
    grid-column: 3;
    grid-row: 1;
  }
  .full {
    grid-column: 1 / -1;
  }
  .stats {
    grid-column: 1 / -1;
  }
}
@media (max-width: 759px) {
  .wide, .full, .stats {
    grid-column: 1 / -1;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}

.card h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .04em;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.badge-public {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  padding: 1px 6px;
  border-radius: 4px;
}

.badge-internal {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-2) 25%, transparent);
  padding: 1px 6px;
  border-radius: 4px;
}

.sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.gauge h2 {
  align-self: flex-start;
}

.ring {
  position: relative;
  width: min(100%, 150px);
  aspect-ratio: 1;
}
.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ring circle {
  fill: none;
  stroke-width: 9;
}
.ring .track {
  stroke: var(--line);
}
.ring .bar {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--value));
  transition: stroke-dashoffset .8s cubic-bezier(.2, .8, .2, 1), stroke .4s;
}
.ring[data-level="warn"] .bar { stroke: var(--warn); }
.ring[data-level="bad"] .bar { stroke: var(--bad); }

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding-top: 36%;
  font-family: var(--mono);
}

.num {
  font-size: clamp(26px, 6vw, 34px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.unit {
  margin-left: 2px;
  font-size: 13px;
  color: var(--muted);
}

.spark {
  display: block;
  width: 100%;
  height: 150px;
  margin-top: 12px;
}

/* まきぐもぼっと (スタッツ + Ping推移スパークライン) */
.maki-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.maki-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: center;
}

@media (min-width: 680px) {
  .maki-grid {
    grid-template-columns: 210px 1fr;
    gap: 32px;
  }
}

.maki-stats {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.maki-stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.maki-stat-item .label {
  font-size: 13px;
  color: var(--muted);
}

.maki-stat-item .val {
  font-size: 13px;
  color: var(--muted);
}

.maki-stat-item .val strong {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-right: 3px;
  line-height: 1.1;
}

.maki-spark-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.maki-spark-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.maki-spark-head .label {
  font-size: 12px;
  color: var(--muted);
}

.spark-maki {
  height: 110px;
  margin-top: 4px;
}




/* くわしく */
.stats dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px 24px;
  margin: 16px 0 0;
}
.stats dt {
  font-size: 12px;
  color: var(--muted);
}
.stats dd {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.foot a {
  color: inherit;
  text-underline-offset: 3px;
}
.foot a:hover {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .ring .bar { transition: none; }
  .bar-fill { transition: none; }
  .live[data-state="ok"] .dot { animation: none; }
}
