/* mcweb — 明亮卡通主题（俏皮可爱）
   背景是手写 SVG 场景（/bg.svg），零外部依赖、无版权风险、随分辨率无损缩放。 */

:root {
  --text: #2b3445;
  --muted: #6d7c93;
  --panel: rgba(255, 255, 255, .84);
  --panel-strong: rgba(255, 255, 255, .95);
  --border: rgba(150, 180, 215, .38);
  --border-strong: rgba(150, 180, 215, .6);
  --accent: #16a34a;
  --accent-2: #22c55e;
  --accent-soft: rgba(34, 197, 94, .14);
  --info: #0ea5e9;
  --warn: #f59e0b;
  --danger: #ef4444;
  --pink: #f472b6;
  --purple: #a78bfa;
  --shadow-sm: 0 4px 16px rgba(90, 120, 170, .10);
  --shadow: 0 10px 30px rgba(90, 120, 170, .14);
  --shadow-lg: 0 18px 48px rgba(90, 120, 170, .20);
  --radius: 18px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #eaf4ff;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: #0d8ecf; text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ==================== 卡通背景层 ==================== */
.scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.scene-img {
  position: absolute;
  inset: 0;
  background: url("/bg.svg") center bottom / cover no-repeat;
}
/* 极淡的白纱，让密集的场景不至于抢主体内容；
   底部加重一点，因为底边那一排卡通方块会长期停在视口下方（背景是固定不动的） */
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
              rgba(255, 255, 255, .30) 0%,
              rgba(255, 255, 255, .10) 42%,
              rgba(255, 255, 255, .20) 78%,
              rgba(255, 255, 255, .42) 100%);
}

/* 飘动的云（纯 CSS，不用图片） */
.drift {
  position: absolute;
  background: #fff;
  border-radius: 100px;
  opacity: .8;
  box-shadow: 0 10px 28px rgba(120, 160, 210, .14);
}
.drift::before,
.drift::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.drift::before { width: 62%; height: 138%; left: 6%; top: -66%; }
.drift::after  { width: 46%; height: 116%; right: 9%; top: -50%; }

.drift-1 { width: 152px; height: 46px; top: 11%; animation: drift-x 140s linear infinite; }
.drift-2 { width: 108px; height: 33px; top: 27%; opacity: .62; animation: drift-x 185s linear infinite; animation-delay: -52s; }
.drift-3 { width: 196px; height: 58px; top: 5%;  opacity: .5;  animation: drift-x 225s linear infinite; animation-delay: -128s; }

@keyframes drift-x {
  0%   { transform: translateX(-24vw); }
  100% { transform: translateX(118vw); }
}

/* 一闪一闪的小星星 */
.twinkle {
  position: absolute;
  width: 20px;
  height: 20px;
  background: #fff6c9;
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
  animation: twinkle 3.4s ease-in-out infinite;
}
.twinkle-1 { top: 16%; left: 22%; animation-delay: 0s; }
.twinkle-2 { top: 9%;  left: 62%; width: 15px; height: 15px; animation-delay: .9s; }
.twinkle-3 { top: 34%; left: 84%; width: 17px; height: 17px; animation-delay: 1.7s; }
.twinkle-4 { top: 42%; left: 12%; width: 13px; height: 13px; animation-delay: 2.4s; }

@keyframes twinkle {
  0%, 100% { opacity: .2; transform: scale(.65) rotate(0deg); }
  50%      { opacity: .95; transform: scale(1) rotate(45deg); }
}

@media (prefers-reduced-motion: reduce) {
  .drift, .twinkle, .status-pill.is-online .dot { animation: none; }
  html { scroll-behavior: auto; }
}

/* ==================== 顶部导航 ==================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .80);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; }
.brand:hover { text-decoration: none; }
.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  image-rendering: pixelated;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.brand-name { white-space: nowrap; }
.nav-links { display: flex; gap: 18px; margin-left: auto; font-size: 14px; }
.nav-links a { color: var(--muted); font-weight: 600; }
.nav-links a:hover { color: var(--accent); text-decoration: none; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: #fff;
  padding: 5px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.status-pill.is-online { color: #15803d; border-color: rgba(34, 197, 94, .5); background: #f0fdf4; }
.status-pill.is-online .dot { background: var(--accent-2); animation: pulse 2s infinite; }
.status-pill.is-offline { color: #b91c1c; border-color: rgba(239, 68, 68, .45); background: #fef2f2; }
.status-pill.is-offline .dot { background: var(--danger); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); }
  70%  { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ==================== Hero ==================== */
.hero { position: relative; }
.hero-bg { display: none; }        /* 背景已由 .scene 承担 */
.hero-inner {
  display: grid;
  /* 这里写 minmax(0, 1fr) 而不是裸 1fr，属于防御性写法：
     裸 1fr 等价于 minmax(auto, 1fr)，auto 最小值 = 内容的 min-content 宽度，
     窄屏下万一内部有元素撑不下，整列会被撑开、导致整页横向溢出。
     加 0 下限就永远不会发生这种事。（当前内容在 360px 下实测不溢出，
     但地址框那一行以后变长就可能踩到，先钉死。） */
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 30px;
  align-items: start;
  padding-top: 44px;
  padding-bottom: 40px;
}
.hero-left, .hero-right { min-width: 0; }
.hero-left {
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: 26px;
  padding: 32px 32px 28px;
  box-shadow: var(--shadow-lg);
}
.tagline {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #a21caf;
  background: linear-gradient(135deg, #fce7f3, #ede9fe);
  border: 1px solid rgba(244, 114, 182, .45);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}
/* 站名：小标签，不抢焦点。页面主角是下面由游戏服实时提供的服务器名（MOTD） */
.site-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 0 0 6px;
}
/* MOTD = 服务器自己的名字，页面最大的那行字。
   用服务器原始配色，后端会把过亮的颜色自动压暗，保证浅底可读。
   clamp 让它在窄屏上缩到 20px，避免「▁▂▄▆█」这类宽字符把卡片撑破。 */
.motd {
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 700;
  margin: 0 0 18px;
  line-height: 1.4;
  min-height: 1.4em;
  word-break: break-word;
}
.motd .obf { opacity: .38; }
.hero-intro { color: var(--muted); margin: 0 0 24px; white-space: pre-line; max-width: 46em; }

.address-box {
  background: linear-gradient(135deg, #f0fdf4, #ecfeff);
  border: 1px solid rgba(34, 197, 94, .35);
  border-radius: 16px;
  padding: 16px 18px;
  max-width: 100%;
}
.address-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .1em;
  margin-bottom: 8px;
}
.address-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.address-row code {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: #14532d;
  background: #fff;
  border: 1px solid rgba(34, 197, 94, .4);
  border-radius: 12px;
  padding: 9px 15px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm);
}
.address-note { font-size: 12px; color: var(--muted); margin-top: 9px; }

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  transition: transform .14s, box-shadow .14s, background .14s;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border-color: transparent;
}
.btn-primary:hover { filter: brightness(1.06); }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.meta {
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid rgba(150, 180, 215, .4);
  border-radius: 999px;
  padding: 4px 13px;
}

/* 在线人数卡 */
.online-card {
  background: linear-gradient(160deg, #ffffff, #f0f9ff);
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: 26px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.online-card::before {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 232, .7), transparent 70%);
}
.online-label { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .1em; }
.online-value {
  font-family: var(--mono);
  font-size: 48px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.15;
  margin: 6px 0 4px;
}
.online-sep { color: #cbd5e1; margin: 0 4px; font-size: 30px; }
#onlineMax { font-size: 26px; color: var(--muted); }
.online-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin: 14px 0 10px;
}
.online-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4ade80, #38bdf8);
  transition: width .5s ease;
}
.online-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.announce { max-width: 1080px; margin: 0 auto; padding: 0 20px 4px; font-size: 14px; }
.announce > div {
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: 14px;
  padding: 12px 18px;
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.announce.is-warn > div { border-left-color: var(--warn); background: #fffbeb; }
.announce.is-danger > div { border-left-color: var(--danger); background: #fef2f2; }
.announce.is-success > div { border-left-color: var(--accent); background: #f0fdf4; }

/* ==================== 通用 section ==================== */
.section { padding: 60px 0; }
.section.alt {
  background: rgba(255, 255, 255, .34);
  border-top: 1px solid rgba(255, 255, 255, .6);
}
.section-title {
  font-size: 26px;
  margin: 0 0 6px;
  letter-spacing: -.01em;
  font-weight: 800;
}
.section-title::after {
  content: "";
  display: block;
  width: 52px;
  height: 5px;
  margin-top: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #4ade80, #38bdf8, #c084fc);
}
.section-sub { color: var(--muted); font-size: 14px; margin: 14px 0 26px; font-weight: 600; }

/* ==================== 数据卡 ==================== */
.stat-grid {
  display: grid;
  /* 280px 让 6 张卡在桌面端排成整齐的 3×2；168px 会排成 5+1 很难看 */
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .16s, box-shadow .16s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.stat-value { font-family: var(--mono); font-size: 28px; font-weight: 800; line-height: 1.25; color: #0f172a; }
.stat-value.small { font-size: 18px; }
.stat-value .unit { font-size: 14px; color: var(--muted); margin-left: 3px; font-weight: 600; }
.stat-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px 22px;
  box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h3 { font-size: 16.5px; margin: 0; font-weight: 800; }
.range-tabs {
  margin-left: auto;
  display: flex;
  gap: 4px;
  background: #eef4fb;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px;
}
.range-tabs button {
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: .14s;
}
.range-tabs button.active { background: #fff; color: var(--accent); box-shadow: var(--shadow-sm); }

.chart-wrap { position: relative; height: 240px; }
#chart { width: 100%; height: 100%; display: block; }
.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  padding: 0 20px;
}
/* 关键：CSS 的 display 会盖掉 HTML 的 hidden 属性（UA 的 [hidden]{display:none} 优先级更低），
   不写这一条的话 JS 里 empty.hidden = true 根本不生效，提示会一直压在图表上。 */
.chart-empty[hidden] { display: none; }

/* ==================== 玩家 ==================== */
.player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.player {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 14px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
.player img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  image-rendering: pixelated;
  background: #eef4fb;
  flex: none;
  box-shadow: var(--shadow-sm);
}
.player-name { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-note {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, .6);
  border: 2px dashed var(--border-strong);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  /* 空状态是 grid 里的唯一一项，必须跨满整行，否则会被压成一列宽 */
  grid-column: 1 / -1;
}

/* ==================== 特色 ==================== */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 16px; }
.feature {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .16s, box-shadow .16s;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature-icon {
  font-size: 26px;
  margin-bottom: 10px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  background: linear-gradient(135deg, #f0fdf4, #eff6ff);
  box-shadow: var(--shadow-sm);
}
.feature h3 { font-size: 16px; margin: 0 0 7px; font-weight: 800; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }

/* ==================== 步骤 ==================== */
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li {
  counter-increment: step;
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 18px 64px;
  box-shadow: var(--shadow-sm);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 18px;
  top: 18px;
  width: 30px;
  height: 30px;
  border-radius: 11px;
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(34, 197, 94, .4);
}
.steps h3 { font-size: 15.5px; margin: 0 0 5px; font-weight: 800; }
.steps p { margin: 0; color: var(--muted); font-size: 14px; }

/* ==================== 规则 ==================== */
.rules { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.rules li {
  position: relative;
  padding: 13px 18px 13px 44px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 14.5px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.rules li::before {
  content: "✓";
  position: absolute;
  left: 17px;
  top: 12px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
}

/* ==================== 社群 ==================== */
.community-box {
  background: linear-gradient(135deg, rgba(255, 255, 255, .92), rgba(240, 249, 255, .92));
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: 22px;
  padding: 26px;
  display: flex;
  gap: 28px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.community-qr {
  width: 150px;
  height: 150px;
  border-radius: 14px;
  background: #fff;
  object-fit: contain;
  padding: 7px;
  box-shadow: var(--shadow-sm);
}
.community-text { flex: 1 1 260px; }
.community-text h3 { margin: 0 0 8px; font-size: 18px; font-weight: 800; }
.community-text p { margin: 0 0 14px; color: var(--muted); font-size: 14px; font-weight: 600; }
.community-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.qq-number {
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: .04em;
}

/* ==================== 页脚 ==================== */
.footer {
  border-top: 1px solid var(--border);
  padding: 30px 0;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(10px);
}
.footer-inner { display: flex; gap: 20px; justify-content: space-between; flex-wrap: wrap; align-items: flex-end; }
.footer-name { font-weight: 800; margin-bottom: 4px; }
.footer-note, .footer-powered, .footer-icp { font-size: 12.5px; color: var(--muted); }
.footer-right { text-align: right; }

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(8px);
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 11px 24px;
  border-radius: 999px;
  z-index: 100;
  opacity: 0;
  transition: .22s;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==================== 响应式 ==================== */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 26px; padding-bottom: 28px; }
  .motd { font-size: 22px; }
  .hero-left { padding: 24px 20px; border-radius: 22px; }
  .online-value { font-size: 40px; }
  .nav-links { display: none; }
  .section { padding: 44px 0; }
  .section-title { font-size: 22px; }
  .chart-wrap { height: 200px; }
  .community-box { gap: 20px; padding: 20px; }
  .community-qr { width: 120px; height: 120px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-right { text-align: left; }
  .drift-3 { display: none; }
}
