/* pages-hub 应用中枢 —— 深色玻璃拟态 + Metro 磁贴砖块 */

:root {
  --bg: #0a0e17;
  --bg-soft: #10162400;
  --text: #e8edf6;
  --text-dim: #9aa6bb;
  --text-faint: #6b7689;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.08);
  --up: #34d399;
  --down: #f87171;
  --checking: #fbbf24;
  --unknown: #8b96a8;
  --radius: 18px;
  --shadow: 0 10px 28px -12px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 720px at 82% -12%, #16223a 0%, transparent 58%),
    radial-gradient(900px 640px at -10% 110%, #131d30 0%, transparent 55%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 背景氛围 ---------- */

.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.18;
  will-change: transform;
}
.aurora-1 { width: 46vw; height: 46vw; min-width: 320px; min-height: 320px; top: -14%; left: -8%;
  background: radial-gradient(circle, #10b981 0%, transparent 68%); animation: drift1 20s ease-in-out infinite alternate; }
.aurora-2 { width: 50vw; height: 50vw; min-width: 340px; min-height: 340px; top: 26%; right: -16%;
  background: radial-gradient(circle, #ec4899 0%, transparent 68%); opacity: 0.13; animation: drift2 24s ease-in-out infinite alternate; }
.aurora-3 { width: 54vw; height: 54vw; min-width: 360px; min-height: 360px; bottom: -22%; left: 28%;
  background: radial-gradient(circle, #f59e0b 0%, transparent 68%); opacity: 0.1; animation: drift3 28s ease-in-out infinite alternate; }

@keyframes drift1 { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(6vw, 6vh, 0) scale(1.12); } }
@keyframes drift2 { from { transform: translate3d(0, 0, 0) scale(1.05); } to { transform: translate3d(-7vw, 4vh, 0) scale(0.95); } }
@keyframes drift3 { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(4vw, -7vh, 0) scale(1.1); } }

.grid-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.055) 1px, transparent 0);
  background-size: 30px 30px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
}

/* ---------- 顶部栏 ---------- */

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(10, 14, 23, 0.72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
  padding: max(10px, env(safe-area-inset-top)) 0 10px;
}
.header-inner {
  max-width: 1060px; margin: 0 auto; padding: 0 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-logo {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.28), transparent 45%),
    linear-gradient(140deg, #1d2940, #111827);
  border: 1px solid var(--line);
  box-shadow: 0 6px 16px -6px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.18);
  background-image:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.28), transparent 45%),
    linear-gradient(140deg, #1d2940, #111827);
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 8px;
}
.brand-logo::before, .brand-logo::after,
.brand-logo { position: relative; }
.brand-logo { position: relative; }
.brand-logo > i, .brand-logo i { display: none; }
.brand-logo::before {
  content: ""; position: absolute; inset: 7px;
  background-image:
    radial-gradient(circle at 5.5px 5.5px, #10b981 4.5px, transparent 5px),
    radial-gradient(circle at 20.5px 5.5px, #06b6d4 4.5px, transparent 5px),
    radial-gradient(circle at 5.5px 20.5px, #f59e0b 4.5px, transparent 5px),
    radial-gradient(circle at 20.5px 20.5px, #ec4899 4.5px, transparent 5px);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 16.5px; letter-spacing: .5px; }
.brand-text small { color: var(--text-faint); font-size: 11px; font-family: var(--mono); }

.actions { display: flex; align-items: center; gap: 9px; flex: none; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--text-dim);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  white-space: nowrap;
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--unknown); flex: none; }
.status-pill.state-up { color: #a7f3d0; border-color: rgba(52, 211, 153, .35); background: rgba(16, 185, 129, .12); }
.status-pill.state-up .pill-dot { background: var(--up); box-shadow: 0 0 10px rgba(52, 211, 153, .9); animation: pulse-dot 2.2s ease-in-out infinite; }
.status-pill.state-down { color: #fecaca; border-color: rgba(248, 113, 113, .35); background: rgba(239, 68, 68, .12); }
.status-pill.state-down .pill-dot { background: var(--down); box-shadow: 0 0 10px rgba(248, 113, 113, .9); }
.status-pill.state-checking { color: #fde68a; border-color: rgba(251, 191, 36, .3); }
.status-pill.state-checking .pill-dot { background: var(--checking); animation: pulse-dot 1.1s ease-in-out infinite; }

@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--glass); border: 1px solid var(--line);
  color: var(--text-dim); cursor: pointer;
  transition: transform .18s ease, color .18s ease, background .18s ease;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--text); background: var(--glass-strong); transform: rotate(35deg); }
.icon-btn:active { transform: rotate(180deg) scale(.92); }
.icon-btn.spinning svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Hero ---------- */

.container { position: relative; z-index: 1; max-width: 1060px; margin: 0 auto; padding: 0 18px 30px; }

.hero { padding: 30px 2px 20px; }
.hero h1 { margin: 0; font-size: clamp(26px, 5.4vw, 38px); font-weight: 800; letter-spacing: .5px; line-height: 1.2; }
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #34d399, #22d3ee 55%, #a5f3fc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { margin: 9px 0 0; color: var(--text-faint); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; }
.hero-dot { opacity: .5; }

/* ---------- 砖块网格 ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  grid-auto-rows: 182px;
  gap: 14px;
}

/* 大砖 / 宽砖跨格（桌面与移动端均生效） */
.tile.feature { grid-column: span 2; grid-row: span 2; }
.tile.wide { grid-column: span 2; }
/* 普通砖不显示部署时间，避免拥挤；feature 大砖保留 */
.tile:not(.feature) .tile-deploy { display: none; }

.tile {
  --c1: #334155;
  --c2: #1e293b;
  position: relative;
  display: flex; flex-direction: column;
  padding: 15px 15px 13px;
  border-radius: var(--radius);
  text-decoration: none;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(120% 90% at 12% 0%, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 52%),
    linear-gradient(150deg, var(--c1) 0%, var(--c2) 78%);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s ease, filter .25s ease;
  animation: tile-in .55s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes tile-in {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.tile:hover {
  transform: translateY(-5px);
  box-shadow:
    0 20px 40px -14px rgba(0, 0, 0, 0.7),
    0 12px 30px -12px var(--c1),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.tile:active { transform: translateY(-2px) scale(.985); }

/* 扫光 */
.tile-sheen {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.18) 46%, transparent 58%);
  transform: translateX(-130%);
}
.tile:hover .tile-sheen { transform: translateX(130%); transition: transform .75s ease; }

/* 水印大图标 */
.tile-watermark {
  position: absolute; right: -16px; bottom: -18px; z-index: 0;
  width: 108px; height: 108px;
  color: rgba(255, 255, 255, 0.13);
  transition: transform .35s ease, color .35s ease;
}
.tile:hover .tile-watermark { transform: rotate(-8deg) scale(1.08); color: rgba(255, 255, 255, 0.2); }
.tile-watermark svg { width: 100%; height: 100%; }

/* 状态灯 */
.tile-dot {
  position: absolute; top: 13px; right: 13px; z-index: 4;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--unknown);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
}
.tile-dot::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
}
.state-up .tile-dot { background: var(--up); box-shadow: 0 0 12px rgba(52, 211, 153, .95), 0 0 0 2px rgba(0,0,0,.15); }
.state-up .tile-dot::before { border: 2px solid var(--up); animation: dot-ping 2.1s cubic-bezier(0, 0, .2, 1) infinite; }
.state-checking .tile-dot { background: var(--checking); animation: pulse-dot 1s ease-in-out infinite; }
.state-down .tile-dot { background: var(--down); box-shadow: 0 0 12px rgba(248, 113, 113, .95); }
.state-unknown .tile-dot { background: var(--unknown); }
@keyframes dot-ping {
  0% { transform: scale(1); opacity: .9; }
  75%, 100% { transform: scale(2.4); opacity: 0; }
}

.tile.state-down { filter: grayscale(.6) brightness(.62) saturate(.7); }
.tile.state-down:hover { filter: grayscale(.45) brightness(.72); }

/* NEW 角标 */
.tile-new {
  position: absolute; top: 11px; left: 13px; z-index: 4;
  font-size: 9.5px; font-weight: 800; letter-spacing: 1.2px;
  padding: 3px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); color: #111827;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

.tile-icon {
  position: relative; z-index: 2;
  width: 42px; height: 42px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 14px -8px rgba(0,0,0,.5);
  margin-bottom: 10px;
}
.tile-icon svg { width: 23px; height: 23px; }

.tile-main { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 3px; }
.tile-title { font-size: 16px; font-weight: 750; letter-spacing: .3px; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-desc {
  font-size: 11.5px; line-height: 1.35; color: rgba(255, 255, 255, 0.78);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.tile-foot { position: relative; z-index: 2; margin-top: auto; display: flex; flex-direction: column; gap: 7px; padding-top: 9px; }
.tile-host {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10.5px; color: rgba(255, 255, 255, 0.72);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-host svg { width: 10px; height: 10px; flex: none; opacity: .75; }
.tile-tags { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.badge {
  font-size: 9.5px; font-weight: 700; letter-spacing: .6px;
  padding: 2.5px 7px; border-radius: 999px; line-height: 1.4;
}
.badge-type { background: rgba(0, 0, 0, 0.24); border: 1px solid rgba(255, 255, 255, 0.22); color: rgba(255,255,255,.9); }
.badge-ver { background: rgba(255, 255, 255, 0.9); color: #111827; font-family: var(--mono); font-weight: 800; }
.badge-latency { background: rgba(0,0,0,.24); border: 1px solid rgba(255,255,255,.16); color: rgba(255,255,255,.75); font-family: var(--mono); }

.tile-deploy {
  position: relative; z-index: 2;
  font-size: 10px; color: rgba(255, 255, 255, 0.62); margin-top: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* feature 大砖 2x2 */
.tile.feature { padding: 20px; }
.tile.feature .tile-icon { width: 56px; height: 56px; border-radius: 15px; margin-bottom: 14px; }
.tile.feature .tile-icon svg { width: 31px; height: 31px; }
.tile.feature .tile-title { font-size: 23px; -webkit-line-clamp: 2; }
.tile.feature .tile-desc { font-size: 13px; margin-top: 2px; white-space: normal;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile.feature .tile-watermark { width: 190px; height: 190px; right: -30px; bottom: -34px; }
.tile.feature .tile-dot { width: 12px; height: 12px; top: 17px; right: 17px; }
.tile.feature .tile-host { font-size: 12px; }
.tile.feature .badge { font-size: 10.5px; padding: 3px 9px; }
.tile.feature .tile-deploy { font-size: 11.5px; margin-top: 8px; }

/* wide 宽砖 2x1 */
.tile.wide { flex-direction: row; align-items: stretch; gap: 14px; padding: 17px 18px; }
.tile.wide .tile-watermark { width: 150px; height: 150px; right: -24px; bottom: -30px; }
.tile.wide .tile-side { display: flex; align-items: center; flex: none; }
.tile.wide .tile-icon { width: 52px; height: 52px; border-radius: 14px; margin-bottom: 0; }
.tile.wide .tile-icon svg { width: 28px; height: 28px; }
.tile.wide .tile-body-col { display: flex; flex-direction: column; flex: 1; min-width: 0; position: relative; z-index: 2; }
.tile.wide .tile-title { font-size: 19px; white-space: nowrap; }
.tile.wide .tile-desc { font-size: 12px; }
.tile.wide .tile-foot { margin-top: auto; }
.tile.wide .tile-deploy { display: none; }
.tile.wide .tile-main { margin-top: auto; }

/* 骨架屏 */
.tile.skeleton { pointer-events: none; animation: none; }
.tile.skeleton .sk-icon, .tile.skeleton .sk-line, .tile.skeleton .sk-short {
  position: relative; overflow: hidden;
  background: rgba(255, 255, 255, 0.07); border-radius: 8px;
}
.tile.skeleton .sk-icon { width: 42px; height: 42px; border-radius: 12px; margin-bottom: 10px; }
.tile.skeleton .sk-line { height: 13px; width: 78%; margin-bottom: 8px; }
.tile.skeleton .sk-line.s { width: 55%; }
.tile.skeleton .sk-short { position: absolute; bottom: 13px; left: 15px; height: 11px; width: 48%; }
.tile.skeleton .sk-icon::after, .tile.skeleton .sk-line::after, .tile.skeleton .sk-short::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.09), transparent);
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- 错误面板 ---------- */

.error-panel { padding: 40px 0; display: flex; justify-content: center; }
.error-panel[hidden] { display: none; }
.error-card {
  text-align: center; padding: 30px 34px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 18px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  max-width: 420px;
}
.error-card strong { font-size: 16px; }
.error-card p { color: var(--text-dim); font-size: 13px; margin: 8px 0 18px; }
.retry-btn {
  padding: 9px 22px; border-radius: 999px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.1); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .18s ease;
}
.retry-btn:hover { background: rgba(255,255,255,.18); }

/* ---------- 页脚 ---------- */

.site-footer {
  position: relative; z-index: 1;
  max-width: 1060px; margin: 8px auto 0; padding: 22px 18px calc(26px + env(safe-area-inset-bottom));
  text-align: center;
}
.site-footer p { margin: 4px 0; font-size: 11.5px; color: var(--text-faint); line-height: 1.6; }
.site-footer code {
  font-family: var(--mono); font-size: 10.5px;
  background: rgba(255,255,255,.07); padding: 1px 6px; border-radius: 5px;
}
.footer-ver span { font-family: var(--mono); color: var(--text-dim); }

/* ---------- 响应式 ---------- */

@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 172px; gap: 11px; }
  .tile.feature { grid-column: span 2; grid-row: span 2; }
  .tile.wide { grid-column: span 2; }
  .hero { padding: 24px 2px 16px; }
  .brand-text small { display: none; }
  .status-pill { padding: 7px 11px; font-size: 12px; }
  .tile-deploy { display: none; }
  .tile.feature .tile-deploy { display: block; }
}

@media (max-width: 360px) {
  .tiles { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 162px; gap: 9px; }
  .tile { padding: 12px; }
  .tile-title { font-size: 14.5px; }
  .tile-desc { font-size: 10.5px; }
  .tile-icon { width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora span, .tile, .tile-sheen, .state-up .tile-dot::before { animation: none !important; }
  .tile { transition: none; }
}
