/* 系统字体，不加载外部字体（避免 Google Fonts 的 DSGVO 问题，也更快） */
:root {
  --cobalt: #2541d4;
  --cobalt-deep: #172a99;
  --sun: #ffcf33;
  --bg: #eef0f7;
  --card: #ffffff;
  --ink: #161a33;
  --muted: #5b6185;
  --line: #d5d9ea;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --cobalt: #2a3fb8;
    --cobalt-deep: #18246e;
    --bg: #10132a;
    --card: #1a1e3d;
    --ink: #eceefa;
    --muted: #9aa0c6;
    --line: #2c3263;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }

/* ---------- 首页顶部 ---------- */
.marquee {
  position: relative;
  background: var(--cobalt);
  color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 3.5rem) 1.25rem 3rem;
  overflow: hidden;
}
/* 唯一的装饰：底部一排“灯泡”，像街机厅招牌 */
.marquee::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 10px;
  background: radial-gradient(circle at 10px 5px, var(--sun) 3px, transparent 4px) 0 0 / 20px 10px repeat-x,
              var(--cobalt-deep);
}
.marquee-inner { max-width: 72rem; margin: 0 auto; }
.marquee h1 {
  margin: 0;
  font-size: clamp(3rem, 11vw, 7.5rem);
  font-weight: 900;
  line-height: .9;
  letter-spacing: -.045em;
}
.marquee p { margin: .9rem 0 0; font-size: 1.15rem; opacity: .85; max-width: 32rem; }
.logout {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 1rem); right: 1.25rem;
  font-size: .9rem; opacity: .75; text-decoration: none;
}
.logout:hover { opacity: 1; text-decoration: underline; }

/* ---------- 游戏货架 ---------- */
.shelf { max-width: 72rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

.tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.tag {
  font: inherit; font-size: .95rem;
  padding: .35rem .95rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: transparent; color: var(--ink);
  cursor: pointer;
}
.tag:hover { border-color: var(--muted); }
.tag.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 2.25rem 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
}
.game a { display: block; text-decoration: none; }
.game h2 { margin: .9rem 0 .2rem; font-size: 1.2rem; font-weight: 750; letter-spacing: -.01em; }
.game p { margin: 0; color: var(--muted); font-size: .95rem; max-width: 36ch; }

.cover {
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: hsl(var(--h) 70% 52%);
  display: grid; place-items: center;
  transition: transform .18s ease;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover span {
  font-size: 5.5rem; font-weight: 900; color: hsl(var(--h) 80% 92%);
  letter-spacing: -.05em;
}
.game a:hover .cover, .game a:focus-visible .cover { transform: translateY(-4px) rotate(-.6deg); }

.empty { color: var(--muted); font-size: 1.05rem; }

/* ---------- 游戏页 ---------- */
body.playing {
  background: #090b18; color: #e8eaf6;
  height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}
.bar {
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem;
  border-bottom: 1px solid #22264a;
}
.bar a { text-decoration: none; font-size: .95rem; opacity: .75; }
.bar a:hover { opacity: 1; }
.bar h1 { flex: 1; margin: 0; font-size: 1rem; font-weight: 700; text-align: center;
          white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar button {
  font: inherit; font-size: .9rem;
  background: var(--sun); color: #161a33;
  border: 0; border-radius: 8px; padding: .35rem .8rem; cursor: pointer;
}
.stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 1rem; }
/* 按游戏声明的宽高比，在可用区域里尽量放大 */
.screen {
  aspect-ratio: var(--ar);
  width: min(100%, calc((100dvh - 5rem) * (var(--ar))));
  max-height: 100%;
  background: #000;
  border-radius: 10px; overflow: hidden;
}
.screen:fullscreen { width: 100%; height: 100%; border-radius: 0; }
.screen iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 640px) {
  .stage { padding: 0; }
  .screen { border-radius: 0; }
}

/* ---------- 登录 ---------- */
body.gate { min-height: 100dvh; display: grid; place-items: center; background: var(--cobalt); }
.login {
  width: min(22rem, 92vw);
  background: var(--card); color: var(--ink);
  padding: 2rem; border-radius: 16px;
  display: grid; gap: 1rem;
}
.login h1 { margin: 0 0 .5rem; font-size: 2rem; font-weight: 900; letter-spacing: -.03em; }
.login label { display: grid; gap: .3rem; font-size: .9rem; color: var(--muted); }
.login input {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 8px; padding: .55rem .7rem;
}
.login button {
  font: inherit; font-weight: 700;
  background: var(--ink); color: var(--bg);
  border: 0; border-radius: 8px; padding: .7rem; cursor: pointer;
}
.error { margin: 0; color: #d33a2c; font-size: .9rem; }

@media (prefers-reduced-motion: reduce) {
  .cover { transition: none; }
}
