/* ================================================================
   游戏大厅 · 090400.xyz
   深色极光主题 / 玻璃拟态卡片 / 页内游戏舞台
   ================================================================ */

:root {
  --bg: #070a14;
  --bg-soft: #0c1120;
  --ink: #e9edf7;
  --ink-dim: #96a2ba;
  --ink-faint: #5d6a85;
  --line: rgba(255, 255, 255, .09);
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .018));
  --amber: #fbbf24;
  --cinnabar: #b3342a;
  --radius: 24px;
  --topbar-h: 56px;
  --ease: cubic-bezier(.22, .68, .26, 1);
}

* { box-sizing: border-box; }

/* hidden 属性优先级最高（.play / .loading 等设置了 display，会覆盖 hidden 的默认 none） */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: rgba(251, 191, 36, .28); }

/* ---------------- 背景极光 ---------------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(63, 81, 181, .16), transparent 60%),
    radial-gradient(1000px 600px at -10% 30%, rgba(180, 83, 9, .10), transparent 60%),
    linear-gradient(180deg, #070a14 0%, #0a0f1e 55%, #070a14 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
  animation: drift 26s ease-in-out infinite alternate;
}
.orb-a { width: 480px; height: 480px; left: -140px; top: -120px; background: rgba(79, 70, 229, .32); }
.orb-b { width: 420px; height: 420px; right: -120px; top: 16%; background: rgba(190, 70, 60, .22); animation-delay: -9s; }
.orb-c { width: 520px; height: 520px; left: 32%; bottom: -240px; background: rgba(14, 116, 144, .26); animation-delay: -17s; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(60px, 44px, 0) scale(1.12); }
}

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 22%, rgba(255,255,255,.34), transparent 100%),
    radial-gradient(1px 1px at 28% 64%, rgba(255,255,255,.22), transparent 100%),
    radial-gradient(1.2px 1.2px at 44% 12%, rgba(255,255,255,.28), transparent 100%),
    radial-gradient(1px 1px at 58% 48%, rgba(255,255,255,.18), transparent 100%),
    radial-gradient(1.6px 1.6px at 72% 18%, rgba(255,255,255,.30), transparent 100%),
    radial-gradient(1px 1px at 84% 58%, rgba(255,255,255,.22), transparent 100%),
    radial-gradient(1.3px 1.3px at 92% 30%, rgba(255,255,255,.26), transparent 100%),
    radial-gradient(1px 1px at 8% 80%, rgba(255,255,255,.20), transparent 100%),
    radial-gradient(1.2px 1.2px at 36% 88%, rgba(255,255,255,.18), transparent 100%),
    radial-gradient(1px 1px at 66% 78%, rgba(255,255,255,.22), transparent 100%);
  animation: twinkle 7s ease-in-out infinite alternate;
}

@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }

/* ---------------- 视图切换 ---------------- */

.view { animation: viewIn .55s var(--ease) both; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------------- 大厅：Hero ---------------- */

.lobby {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero { text-align: center; padding: clamp(56px, 9vh, 104px) 0 44px; }

.overline {
  margin: 0 0 18px;
  font-size: 12px;
  letter-spacing: .42em;
  text-indent: .42em;
  color: var(--amber);
  font-weight: 600;
}

.title {
  margin: 0;
  font-size: clamp(46px, 7.5vw, 84px);
  font-weight: 800;
  letter-spacing: .10em;
  text-indent: .10em;
  line-height: 1.08;
  background: linear-gradient(100deg, #ffffff 12%, #c9d4ff 46%, #fbd38d 88%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 10px 34px rgba(99, 102, 241, .28));
}

.subtitle {
  margin: 20px auto 0;
  max-width: 560px;
  color: var(--ink-dim);
  font-size: clamp(14px, 1.6vw, 16px);
  letter-spacing: .06em;
  line-height: 1.9;
}

.hero-stats {
  margin-top: 30px;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 12px 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  backdrop-filter: blur(10px);
}

.hero-stats .stat { font-size: 13px; color: var(--ink-dim); letter-spacing: .05em; white-space: nowrap; }
.hero-stats b { color: var(--ink); font-size: 16px; margin-right: 6px; font-weight: 700; }
.hero-stats i { width: 1px; height: 14px; background: var(--line); }

/* ---------------- 大厅：卡片 ---------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 26px;
  align-items: stretch;
}

.card {
  --gc: #6366f1; /* 每张卡片覆盖为自己的主题色 */
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card-bg);
  overflow: hidden;
  cursor: pointer;
  transition: transform .4s var(--ease), border-color .4s, box-shadow .4s;
  animation: cardIn .6s var(--ease) both;
}
.card:nth-child(2) { animation-delay: .08s; }
.card:nth-child(3) { animation-delay: .16s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: none; }
}

.card::before {
  /* 悬浮时的主题色描边光晕 */
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--gc) 70%, transparent), transparent 42%, color-mix(in srgb, var(--gc) 45%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity .4s;
  pointer-events: none;
  z-index: 2;
}

.card:hover, .card:focus-visible {
  transform: translateY(-8px);
  box-shadow: 0 30px 70px -24px color-mix(in srgb, var(--gc) 42%, transparent),
              0 12px 30px -14px rgba(0, 0, 0, .6);
  outline: none;
}
.card:hover::before, .card:focus-visible::before { opacity: 1; }

.card:focus-visible { border-color: transparent; }

/* --- 卡片主视觉 --- */

.art {
  position: relative;
  aspect-ratio: 16 / 8.6;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.art svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transition: transform .6s var(--ease);
}

.card:hover .art svg { transform: scale(1.045); }

.art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 62%, rgba(7, 10, 20, .55));
  pointer-events: none;
}

.badge {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--ink);
  background: rgba(9, 12, 22, .55);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gc); box-shadow: 0 0 10px var(--gc); }

/* --- 卡片内容 --- */

.card-body {
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.name-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.name-row h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .05em;
}

.name-row .en {
  font-size: 11px;
  letter-spacing: .24em;
  color: color-mix(in srgb, var(--gc) 78%, #fff 22%);
  font-weight: 600;
  text-transform: uppercase;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--ink-dim);
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .028);
}

.desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-dim);
  flex: 1;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px dashed rgba(255, 255, 255, .10);
}

.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 22px;
  border: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--btn-ink, #0a0d18);
  background: linear-gradient(120deg, color-mix(in srgb, var(--gc) 82%, #fff 18%), var(--gc));
  box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--gc) 70%, transparent);
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s, filter .25s;
  font-family: inherit;
}
.card:hover .play-btn { transform: translateX(2px); }
.play-btn:hover { filter: brightness(1.1); box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--gc) 85%, transparent); }
.play-btn:active { transform: scale(.97); }
.play-btn svg { width: 13px; height: 13px; }

.ext-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink-faint);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
  transition: color .25s, background .25s;
}
.ext-link:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
.ext-link svg { width: 12px; height: 12px; }

/* ---------------- 大厅：页脚 ---------------- */

.foot {
  margin-top: auto;
  padding: 52px 0 8px;
  text-align: center;
}
.foot p { margin: 0; font-size: 12.5px; letter-spacing: .08em; color: var(--ink-faint); }
.foot a { color: var(--ink-dim); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.18); transition: color .2s; }
.foot a:hover { color: var(--amber); }

/* ---------------- 游戏舞台视图 ---------------- */

.play {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 14, 26, .86);
  backdrop-filter: blur(14px);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s, background .2s, border-color .2s, transform .2s;
  font-family: inherit;
  white-space: nowrap;
}
.back:hover { color: var(--ink); background: rgba(255, 255, 255, .09); transform: translateX(-2px); }

.tabs {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.tab {
  --gc: #6366f1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: color .25s, background .25s, border-color .25s, box-shadow .25s;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
}
.tab .t-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gc); opacity: .55; transition: opacity .25s, box-shadow .25s; flex: 0 0 auto; }
.tab:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }

.tab.active {
  color: var(--btn-ink, #0a0d18);
  background: linear-gradient(120deg, color-mix(in srgb, var(--gc) 82%, #fff 18%), var(--gc));
  box-shadow: 0 6px 20px -6px color-mix(in srgb, var(--gc) 75%, transparent);
}
.tab.active .t-dot { background: #0a0d18; opacity: .9; box-shadow: none; }

.open-new {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  font-size: 12.5px;
  letter-spacing: .05em;
  color: var(--ink-dim);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);
  transition: color .2s, background .2s;
  white-space: nowrap;
}
.open-new:hover { color: var(--ink); background: rgba(255, 255, 255, .09); }

/* --- 舞台与 iframe --- */

.stage { position: relative; flex: 1; min-height: 0; background: #0a0e1a; }

.frame {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, visibility .35s;
}

.frame.active { opacity: 1; visibility: visible; }

.frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0a0e1a;
}

.loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  color: var(--ink-faint);
  font-size: 13px;
  letter-spacing: .22em;
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .10);
  border-top-color: var(--amber);
  animation: spin .9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

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

@media (max-width: 900px) {
  .lobby { padding: 0 18px 32px; }
  .hero { padding-top: 52px; }
  .hero-stats { gap: 12px; padding: 10px 18px; }
}

@media (max-width: 640px) {
  .back span { display: none; }
  .back { padding: 9px 13px; }
  .open-new span { display: none; }
  .tab { padding: 8px 13px; font-size: 12.5px; letter-spacing: .03em; }
  .tab .t-emoji { display: none; }
  .topbar { gap: 8px; padding: 0 10px; }
  .card-body { padding: 18px 18px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
