:root {
  --bg-0: #07090c;
  --bg-1: #0d1117;
  --bg-2: #12181f;
  --bg-3: #171e27;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e8eef5;
  --muted: #8b9aab;
  --accent: #3ee07f;
  --accent-2: #5cc8ff;
  --accent-3: #c9a227;
  --danger: #ff6b6b;
  --warn: #f0b429;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  background: var(--bg-0);
  color: var(--text);
  min-height: 100vh;
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(62, 224, 127, 0.08), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(92, 200, 255, 0.07), transparent 50%),
    linear-gradient(180deg, #0a0e13 0%, #07090c 100%);
}

.app-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 85%);
  pointer-events: none;
}

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

.app-nav {
  background: rgba(7, 9, 12, 0.78);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

#overview,
#servers,
#detail {
  scroll-margin-top: 84px;
}

.navbar-brand { text-decoration: none; }

.brand-mark {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  line-height: 1;
}

.brand-name {
  display: block;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--text);
}

.brand-sub {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1;
  margin-top: 0.05em;
}

.nav-link {
  color: var(--muted) !important;
  font-size: 0.92rem;
  padding: 0.35rem 0.7rem !important;
  border-radius: 8px;
}

.nav-link.active,
.nav-link:hover {
  color: var(--text) !important;
  background: rgba(255, 255, 255, 0.04);
}

.range-pills {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
}

.range-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
}

.range-btn.active {
  background: rgba(62, 224, 127, 0.14);
  color: var(--accent);
}

.chart-mode-pills .range-btn {
  font-size: 0.7rem;
  padding: 0.28rem 0.55rem;
}

.live-chip,
.clock-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(62, 224, 127, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(62, 224, 127, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(62, 224, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(62, 224, 127, 0); }
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-title {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
}

.section-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-card,
.panel,
.server-card,
.subpanel {
  background: linear-gradient(180deg, rgba(23, 30, 39, 0.92), rgba(13, 17, 23, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 1rem 1.1rem 1.05rem;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.7;
}

.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.stat-value {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.peak-when,
.ver-proto {
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
}

.stat-value .peak-when {
  font-size: 0.78rem;
  margin-left: 0.2rem;
}

.meta-item .v .peak-when,
.metric-tile .v .peak-when,
.ver-proto {
  font-size: 0.68rem;
}

.stat-meta {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.panel { padding: 1.1rem 1.15rem 1.2rem; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.detail-head {
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.detail-identity {
  min-width: 0;
  flex: 1 1 220px;
}

.detail-id-row {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.detail-icon-wrap {
  display: flex;
  flex: 0 0 auto;
}

.detail-id-copy {
  min-width: 0;
}

.detail-motd {
  flex: 0 0 600px;
  width: 600px;
  max-width: 100%;
}

.detail-motd .mc-motd-wrap {
  margin-bottom: 0;
  width: 100%;
}

.panel-title {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0;
}

.panel-sub {
  color: var(--muted);
  font-size: 0.8rem;
}

.chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  background: rgba(92, 200, 255, 0.08);
}

.chart-wrap { position: relative; width: 100%; }
.chart-lg { height: 320px; }
.chart-md { height: 280px; }
.chart-sm { height: 180px; }

.panel-fill {
  display: flex;
  flex-direction: column;
}

.panel-fill .chart-center {
  flex: 1 1 auto;
  height: auto;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-square {
  position: relative;
  height: 100%;
  width: auto;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  margin: 0 auto;
}

.chart-square canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.search-wrap {
  position: relative;
}

.search-wrap i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.85rem;
}

.search-wrap .form-control {
  padding-left: 1.85rem;
  background: var(--bg-2);
  border-color: var(--line);
  min-width: 210px;
  color: var(--text);
}

.btn-filter {
  background: var(--bg-2);
  border-color: var(--line);
  color: var(--muted);
}

.btn-filter.active,
.btn-filter:hover {
  background: rgba(62, 224, 127, 0.12);
  border-color: rgba(62, 224, 127, 0.35);
  color: var(--accent);
}

.server-card {
  padding: 1rem;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  height: 100%;
}

.server-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.server-card.is-active {
  border-color: rgba(62, 224, 127, 0.55);
  box-shadow: 0 0 0 1px rgba(62, 224, 127, 0.25), var(--shadow);
}

.server-card.is-offline {
  opacity: 0.78;
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.server-copy {
  flex: 1;
  min-width: 0;
}

.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0;
}

.rank-badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.12rem 0.4rem;
  margin-right: 0.15rem;
}

.rank-badge.top {
  color: var(--accent);
  border-color: rgba(62, 224, 127, 0.35);
  background: rgba(62, 224, 127, 0.1);
}

.share-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-top: 0.55rem;
  margin-bottom: 0.3rem;
}

.server-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: #04140b;
  background: linear-gradient(135deg, var(--accent), #1f8a4c);
  flex-shrink: 0;
}

.server-icon.offline {
  background: linear-gradient(135deg, #6b7280, #374151);
  color: #e5e7eb;
}

.server-icon.has-favicon {
  padding: 0;
  background: #0b0f14;
  overflow: hidden;
}

.server-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.server-name {
  font-weight: 600;
  margin: 0;
  font-size: 0.98rem;
}

.server-host {
  color: var(--muted);
  font-size: 0.72rem;
  margin: 0.15rem 0 0;
  cursor: pointer;
  width: fit-content;
  max-width: 100%;
}

.server-host:hover {
  color: var(--text);
}

.server-host.is-copied {
  color: var(--accent);
}

.detail-id-copy .server-host {
  font-size: 0.8rem;
}

.status-pill {
  font-family: var(--mono);
  font-size: 0.68rem;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  letter-spacing: 0.04em;
}

.status-pill.online {
  color: var(--accent);
  background: rgba(62, 224, 127, 0.12);
  border: 1px solid rgba(62, 224, 127, 0.25);
}

.status-pill.offline {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.25);
}

.player-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}

.progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.progress-bar {
  background: linear-gradient(90deg, #1f8a4c, var(--accent));
  border-radius: 999px;
}

.progress-bar.warn { background: linear-gradient(90deg, #8a6a12, var(--warn)); }
.progress-bar.hot { background: linear-gradient(90deg, #8a1f1f, var(--danger)); }

.mini-chart {
  height: 54px;
  margin: 0.7rem 0 0.55rem;
  cursor: crosshair;
}

.spark-tooltip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 10px));
  background: #12181f;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: opacity 0.08s ease;
}

.spark-tooltip .t {
  color: var(--muted);
  margin-bottom: 0.12rem;
}

.network-tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  max-height: min(70vh, 440px);
  overflow: auto;
  background: #12181f;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: opacity 0.08s ease;
}

.network-tooltip .t {
  color: var(--muted);
  margin-bottom: 0.28rem;
}

.network-tooltip .r {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  line-height: 1.35;
}

.network-tooltip .n {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.network-tooltip .n i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.network-tooltip .v {
  font-variant-numeric: tabular-nums;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.7rem;
}

.meta-item .k {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.meta-item .v {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.25;
  word-break: break-word;
}

.metric-tile {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
}

.metric-tile .k {
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 0.2rem;
}

.metric-tile .v {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 500;
}

.peak-card::after {
  background: linear-gradient(90deg, var(--accent-2), transparent);
}

.peak-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.7rem;
  margin-top: 0.15rem;
}

.peak-date {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: 0.15rem;
}

.subpanel {
  padding: 0.85rem 0.9rem 0.95rem;
  box-shadow: none;
}

.subpanel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  margin-bottom: 0.4rem;
}

.app-footer {
  border-top: 1px solid var(--line);
  padding: 0.85rem 0 1.2rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.55;
  text-align: center;
}

.footer-lead {
  margin: 0 auto 0.7rem;
  max-width: 52rem;
}

.footer-rule {
  border: 0;
  border-top: 1px solid var(--line);
  opacity: 1;
  margin: 0 0 0.75rem;
}

.footer-meta {
  font-size: 0.78rem;
}

.footer-meta b {
  color: var(--text);
  font-weight: 600;
}

.app-footer a,
.app-footer .footer-top {
  color: var(--accent);
  text-decoration: none;
}

.app-footer a:hover,
.app-footer .footer-top:hover {
  color: #7aefaa;
}

.badge-soft {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
}

.metric-tile .v {
  word-break: break-word;
}

@font-face {
  font-family: "Minecraft";
  src: url("../fonts/better-minecraft.otf") format("opentype");
  unicode-range: U+0020-024F, U+1E00-1EFF, U+2000-206F, U+20A0-20CF;
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "MinecraftUni";
  src: url("../fonts/unifont.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.mc-motd-wrap {
  --mc-line: 20px;
  --mc-pad: 4px;
  --mc-icon: calc(var(--mc-line) * 3 + var(--mc-pad) * 2);
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 0.75rem;
  overflow: hidden;
  text-align: left;
  padding: 0;
  border-radius: 10px;
  background: #20252B;
  border: 1px solid var(--line);
  font-size: 16px;
  line-height: var(--mc-line);
  font-family: "Minecraft", "MinecraftUni", var(--mono);
  color: #fff;
  text-shadow: 1px 1px 0 #3f3f3f;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}

.mc-motd-wrap .server-icon.mc-motd-favicon {
  width: var(--mc-icon);
  height: var(--mc-icon);
  flex: 0 0 var(--mc-icon);
  border-radius: 0;
  margin: 0;
  align-self: stretch;
}

.mc-motd-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding: var(--mc-pad) 10px;
}

.mc-motd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--mc-line);
}

.mc-motd-title {
  display: block;
  min-width: 0;
  flex: 1;
  height: var(--mc-line);
  line-height: var(--mc-line);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-motd-status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mc-motd {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: inherit;
  font-weight: 400;
  line-height: var(--mc-line);
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  text-align: left;
  color: #fff;
  text-shadow: inherit;
  font-kerning: none;
  font-variant-ligatures: none;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}

.mc-signal {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  width: 20px;
}

.mc-signal i {
  display: block;
  width: 3px;
  background: #3f3f3f;
}

.mc-signal i:nth-child(1) { height: 4px; }
.mc-signal i:nth-child(2) { height: 7px; }
.mc-signal i:nth-child(3) { height: 10px; }
.mc-signal i:nth-child(4) { height: 13px; }
.mc-signal i:nth-child(5) { height: 16px; }

.mc-motd-players {
  color: #aaa;
  white-space: nowrap;
  line-height: var(--mc-line);
}

.mc-signal.on-5 i,
.mc-signal.on-4 i:nth-child(-n+4),
.mc-signal.on-3 i:nth-child(-n+3) {
  background: #55ff55;
}

.mc-signal.on-4 i:nth-child(n+5),
.mc-signal.on-3 i:nth-child(n+4) {
  background: #3f3f3f;
}

.mc-signal.on-2 i:nth-child(-n+2),
.mc-signal.on-1 i:nth-child(1) {
  background: #ffaa00;
}

.mc-signal.on-2 i:nth-child(n+3),
.mc-signal.on-1 i:nth-child(n+2) {
  background: #3f3f3f;
}

.mc-signal.is-down i {
  background: #aa0000;
}

.mc-signal.is-down i:nth-child(n+2) {
  background: #3f3f3f;
}

.mc-motd-line {
  display: block;
  height: var(--mc-line);
  line-height: var(--mc-line);
  overflow: hidden;
  white-space: pre;
}

.mc-motd-center,
.mc-motd-center .mc-motd-line {
  text-align: center;
  white-space: pre;
}

.mc-motd-line.mc-motd-split {
  position: relative;
  display: block;
  text-align: center;
}

.mc-motd-split .mc-motd-mid {
  display: block;
  overflow: hidden;
  text-align: center;
  white-space: pre;
}

.mc-motd-split .mc-motd-end {
  position: absolute;
  right: 0;
  top: 0;
  height: var(--mc-line);
  line-height: var(--mc-line);
  white-space: pre;
}

.mc-motd-uni,
.mc-motd-uni span {
  font-family: "MinecraftUni", "Minecraft", var(--mono);
}

.mc-motd span {
  font-weight: 400;
  white-space: pre;
  vertical-align: top;
}

.mc-sp {
  display: inline-block;
  height: 1em;
  vertical-align: bottom;
}

.mc-motd .mc-bold,
.mc-motd [style*="font-weight:700"],
.mc-motd [style*="font-weight: 700"] {
  font-weight: 400 !important;
  letter-spacing: 0;
  text-shadow:
    1px 0 0 currentColor,
    1px 1px 0 #3f3f3f;
}

.mc-motd .mc-italic {
  font-style: italic;
}

.mc-obf {
  display: inline-block;
  overflow: hidden;
  text-align: center;
  vertical-align: bottom;
  min-width: 0;
  font-family: "Minecraft", "MinecraftUni", var(--mono);
}

@media (max-width: 767.98px) {
  .page-title { font-size: 1.3rem; }
  .chart-lg, .chart-md { height: 220px; }
  .section-head { flex-direction: column; align-items: stretch; }
  .search-wrap .form-control { min-width: 100%; }
  .detail-motd { flex-basis: 100%; width: 100%; }
}
