/* Polaris 游乐场 · 大厅样式（无外部依赖） */

:root {
  --bg: #0b0c14;
  --bg-2: #10121d;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #eef0f8;
  --muted: #a2a8bf;
  --faint: #6f7590;
  --primary: #9aa6ff;
  --primary-ink: #0b0c14;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 40px -24px rgba(0, 0, 0, 0.8);
  --aurora-1: rgba(122, 108, 255, 0.35);
  --aurora-2: rgba(255, 143, 171, 0.22);
  --aurora-3: rgba(76, 201, 240, 0.18);
  --radius: 20px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f6f5f1;
    --bg-2: #ffffff;
    --surface: rgba(255, 255, 255, 0.78);
    --surface-2: #ffffff;
    --border: rgba(23, 26, 43, 0.09);
    --border-strong: rgba(23, 26, 43, 0.2);
    --text: #171a2b;
    --muted: #555b73;
    --faint: #868ca3;
    --primary: #4b55d6;
    --primary-ink: #ffffff;
    --ok: #16a34a;
    --warn: #b45309;
    --danger: #e11d48;
    --shadow: 0 1px 2px rgba(23, 26, 43, 0.06), 0 18px 36px -24px rgba(23, 26, 43, 0.35);
    --aurora-1: rgba(122, 108, 255, 0.2);
    --aurora-2: rgba(255, 143, 171, 0.18);
    --aurora-3: rgba(76, 201, 240, 0.14);
    color-scheme: light;
  }
}
:root[data-theme='light'] {
  --bg: #f6f5f1;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-2: #ffffff;
  --border: rgba(23, 26, 43, 0.09);
  --border-strong: rgba(23, 26, 43, 0.2);
  --text: #171a2b;
  --muted: #555b73;
  --faint: #868ca3;
  --primary: #4b55d6;
  --primary-ink: #ffffff;
  --ok: #16a34a;
  --warn: #b45309;
  --danger: #e11d48;
  --shadow: 0 1px 2px rgba(23, 26, 43, 0.06), 0 18px 36px -24px rgba(23, 26, 43, 0.35);
  --aurora-1: rgba(122, 108, 255, 0.2);
  --aurora-2: rgba(255, 143, 171, 0.18);
  --aurora-3: rgba(76, 201, 240, 0.14);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'HarmonyOS Sans SC', 'MiSans',
    'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
svg { display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 10px; }

/* ------------------------------ 背景极光 ------------------------------ */
.aurora { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 1; }
.aurora i:nth-child(1) { width: 60vmax; height: 60vmax; left: -20vmax; top: -34vmax; background: radial-gradient(closest-side, var(--aurora-1), transparent); animation: drift 22s var(--ease) infinite alternate; }
.aurora i:nth-child(2) { width: 50vmax; height: 50vmax; right: -22vmax; top: -24vmax; background: radial-gradient(closest-side, var(--aurora-2), transparent); animation: drift 28s var(--ease) infinite alternate-reverse; }
.aurora i:nth-child(3) { width: 44vmax; height: 44vmax; left: 30vw; top: 10vmax; background: radial-gradient(closest-side, var(--aurora-3), transparent); animation: drift 34s var(--ease) infinite alternate; }
@keyframes drift { to { transform: translate3d(6vmax, 4vmax, 0) scale(1.08); } }

/* ------------------------------ 顶栏 ------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  /* 背景条铺满整行，内容与下方 1160px 版心对齐 */
  --gutter: max(16px, calc((100% - 1160px) / 2 + 16px));
  padding: max(12px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 12px max(var(--gutter), env(safe-area-inset-left));
  width: 100%;
}
.topbar::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(var(--bg), color-mix(in srgb, var(--bg) 60%, transparent));
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  mask-image: linear-gradient(#000 70%, transparent);
  -webkit-mask-image: linear-gradient(#000 70%, transparent);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: 0.01em; }
.brand-mark { width: 28px; height: 28px; transition: transform 0.6s var(--ease); }
.brand:hover .brand-mark { transform: rotate(45deg); }
.brand-name { font-size: 16px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.btn-icon, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; min-width: 38px; padding: 0 10px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s var(--ease);
}
.btn-ghost { font-size: 13px; padding: 0 12px; }
.btn-icon:hover, .btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-icon:active, .btn-ghost:active { transform: scale(0.94); }
.btn-icon svg, .btn-ghost svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-icon svg .fill { fill: currentColor; stroke: none; }
.btn-icon svg { display: none; }
:root:not([data-theme]) .i-auto, :root[data-theme='light'] .i-light, :root[data-theme='dark'] .i-dark { display: block; }

/* ------------------------------ 主视觉 ------------------------------ */
main { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
.hero { padding: clamp(20px, 6vw, 72px) 0 clamp(28px, 5vw, 56px); text-align: center; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px;
  padding: 5px 12px 5px 10px; border-radius: 999px; font-size: 12.5px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
}
.live-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); position: relative; }
.live-pill.on .dot { background: var(--ok); }
.live-pill.on .dot::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok); opacity: 0; animation: ping 2.2s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(0.5); opacity: 0.7; } 100% { transform: scale(1.6); opacity: 0; } }
.hero h1 {
  margin: 0; font-size: clamp(34px, 9.2vw, 68px); line-height: 1.08; letter-spacing: -0.02em; font-weight: 800;
  text-wrap: balance;
}
.grad {
  background: linear-gradient(100deg, #ffd58f 0%, #ff8fab 45%, #8f9bff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[data-theme='light'] .grad { background-image: linear-gradient(100deg, #d97706 0%, #e11d74 45%, #4b55d6 100%); }
@media (prefers-color-scheme: light) { :root:not([data-theme='dark']) .grad { background-image: linear-gradient(100deg, #d97706 0%, #e11d74 45%, #4b55d6 100%); } }
.tagline { margin: 14px auto 0; max-width: 32em; color: var(--muted); font-size: clamp(14.5px, 3.8vw, 17px); text-wrap: pretty; }

/* ------------------------------ 快速加入 ------------------------------ */
.join { margin: clamp(22px, 5vw, 36px) auto 0; max-width: 520px; text-align: left; }
.join-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 8px 6px; letter-spacing: 0.04em; }
.join-box {
  display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  transition: border-color 0.2s, box-shadow 0.25s;
}
.join-box:focus-within { border-color: color-mix(in srgb, var(--primary) 60%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent), var(--shadow); }
.join.error .join-box { border-color: color-mix(in srgb, var(--danger) 70%, transparent); }
.join.shake .join-box { animation: shake 0.38s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.join-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.join input {
  flex: 1; min-width: 0; height: 44px; border: 0; outline: 0; background: transparent; color: var(--text);
  font: 600 16px/1 ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace; letter-spacing: 0.12em; text-transform: uppercase;
}
.join input::placeholder { font: 400 14.5px/1 inherit; font-family: inherit; letter-spacing: 0; text-transform: none; color: var(--faint); }
.btn-primary {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 18px; border: 0; border-radius: 13px;
  background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: 15px; cursor: pointer;
  transition: transform 0.15s var(--ease), filter 0.2s, opacity 0.2s;
}
.btn-primary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.25s var(--ease); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:hover svg { transform: translateX(3px); }
.btn-primary:active { transform: scale(0.95); }
.btn-primary[aria-busy='true'] { opacity: 0.7; pointer-events: none; }
.join-msg { min-height: 1.6em; margin: 8px 6px 0; font-size: 13px; color: var(--muted); }
.join.error .join-msg { color: var(--danger); }
.join-msg a { color: var(--primary); }

/* ------------------------------ 游戏列表 ------------------------------ */
.games { padding-bottom: 48px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 14px; }
.section-head h2 { margin: 0; font-size: 18px; letter-spacing: 0.01em; }
.section-head .count { color: var(--faint); font-size: 13px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }

.card {
  --accent: #9aa6ff;
  --mx: 50%; --my: 0%;
  position: relative; display: flex; flex-direction: column; overflow: hidden; isolation: isolate;
  text-decoration: none; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform 0.35s var(--ease), border-color 0.3s, box-shadow 0.35s var(--ease);
  animation: rise 0.6s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.card::after {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit; opacity: 0;
  background: radial-gradient(420px circle at var(--mx) var(--my), color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%);
  transition: opacity 0.3s;
}
a.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 24px 48px -26px color-mix(in srgb, var(--accent) 70%, transparent), var(--shadow); }
a.card:hover::after { opacity: 1; }
a.card:active { transform: translateY(-1px) scale(0.985); transition-duration: 0.12s; }
a.card:focus-visible { outline-offset: 4px; border-radius: var(--radius); }

.cover { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: color-mix(in srgb, var(--accent) 20%, var(--bg-2)); }
.cover img, .cover svg { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
a.card:hover .cover img, a.card:hover .cover svg { transform: scale(1.045); }
.cover::after { content: ''; position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(transparent, rgba(0, 0, 0, 0.35)); pointer-events: none; }

.status {
  position: absolute; z-index: 1; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff;
  background: rgba(10, 12, 20, 0.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, 0.14);
}
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; }
.status.online::before { background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.25); }
.status.maintenance::before { background: #fbbf24; }

.body { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 6px; flex: 1; }
.title-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.title-row h3 { margin: 0; font-size: 20px; letter-spacing: 0.01em; }
.title-row .sub { font-size: 12.5px; color: var(--faint); font-weight: 500; letter-spacing: 0.04em; }
.summary { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--text); }
.meta li { display: inline-flex; align-items: center; gap: 6px; }
.meta svg { width: 16px; height: 16px; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 0; padding: 0; list-style: none; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 8px; font-size: 12px; font-weight: 600;
  color: color-mix(in srgb, var(--accent) 75%, var(--text)); background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.tag svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 18px 18px; padding-top: 14px;
  border-top: 1px solid var(--border); font-weight: 700; font-size: 14.5px;
}
.cta .go { display: inline-flex; align-items: center; gap: 6px; color: color-mix(in srgb, var(--accent) 80%, var(--text)); }
.cta svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s var(--ease); }
a.card:hover .cta svg { transform: translateX(4px); }
.cta .rooms { font-weight: 500; font-size: 12.5px; color: var(--faint); }

/* 维护中 */
.card.is-down { cursor: not-allowed; }
.card.is-down .cover img, .card.is-down .cover svg { filter: grayscale(0.85) brightness(0.7); }
.card.is-down .cta .go { color: var(--faint); }
.card.is-down .tag { filter: grayscale(1); opacity: 0.7; }

/* 筹备中 */
.card.soon { border-style: dashed; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; justify-content: center; align-items: center; text-align: center; min-height: 220px; padding: 28px; gap: 10px; color: var(--faint); }
.card.soon .soon-mark { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); }
.card.soon .soon-mark svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.card.soon strong { color: var(--muted); font-size: 15px; }
.card.soon p { margin: 0; font-size: 13px; }

/* 骨架屏 */
.skeleton { animation: none; }
.skeleton .cover { background: var(--surface-2); }
.skeleton .body { padding: 18px; gap: 10px; }
.skeleton .body i { display: block; height: 12px; border-radius: 6px; background: var(--surface-2); }
.skeleton .body i:nth-child(1) { width: 40%; height: 18px; }
.skeleton .body i:nth-child(3) { width: 70%; }
.skeleton .cover, .skeleton .body i { background-image: linear-gradient(90deg, transparent, var(--surface), transparent); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

.load-error { grid-column: 1 / -1; padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.load-error button { margin-top: 10px; }
.noscript { color: var(--muted); }

.footer { text-align: center; color: var(--faint); font-size: 12.5px; padding: 8px 16px max(24px, env(safe-area-inset-bottom)); }
.footer p { margin: 0; }

/* ------------------------------ 小屏细调 ------------------------------ */
@media (max-width: 420px) {
  .join-box { padding-left: 12px; }
  .join-icon { display: none; }
  .btn-primary { padding: 0 14px; }
  .body { padding: 14px 16px 4px; }
  .cta { margin: 8px 16px 16px; }
  .brand-name { font-size: 15px; }
  .card.soon { min-height: 150px; }
}

/* ------------------------------ 减少动画 ------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .aurora i { animation: none !important; }
  .card, a.card:hover, a.card:active { transform: none !important; }
  a.card:hover .cover img, a.card:hover .cover svg, a.card:hover .cta svg, .btn-primary:hover svg, .brand:hover .brand-mark { transform: none !important; }
  .card::after { display: none; }
  .live-pill.on .dot::after { display: none; }
}
