/* SnapArcade 站点样式。鲜明但克制的街机风格：深色底，黄色主按钮，珊瑚红点缀。 */

:root {
  --bg: #0f1117;
  --bg-2: #151925;
  --panel: #191e2b;
  --panel-2: #1f2535;
  --line: #2c3346;
  --text: #f5f2ea;
  --muted: #b1b6c4;
  --hot: #ff4f5e;
  --sun: #ffcc3d;
  --sun-ink: #1a1406;
  --mint: #43e3b8;
  --radius: 14px;
  --wrap: 1160px;
  --font: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 16px/1.7 var(--font);
  background:
    radial-gradient(1100px 520px at 88% -8%, rgba(255, 79, 94, .16), transparent 62%),
    radial-gradient(900px 420px at -12% 6%, rgba(67, 227, 184, .07), transparent 60%),
    var(--bg);
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .92em; padding: .1em .35em; border-radius: 5px; background: rgba(255, 255, 255, .07); }

:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; border-radius: 6px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -80px; z-index: 200;
  padding: 10px 16px; border-radius: 10px; background: var(--sun); color: var(--sun-ink);
  font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }
.muted { color: var(--muted); }
.eyebrow {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  color: var(--mint); font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.lead { font-size: clamp(17px, 2vw, 19px); color: var(--muted); max-width: 46em; }

/* ---------- 顶栏与页脚 ---------- */
.topbar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); background: rgba(15, 17, 23, .94); backdrop-filter: blur(8px); }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: .01em; }
.brand__name span { color: var(--hot); }
.logo { flex: none; }
.topnav { display: flex; gap: 4px; }
.topnav a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600;
  min-height: 40px; display: inline-flex; align-items: center;
}
.topnav a:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.topnav a[aria-current="page"] { color: var(--text); background: var(--panel-2); }
.topbar__actions { display: flex; align-items: center; gap: 12px; }
.language-switch { display: inline-flex; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.language-switch a { min-height: 34px; padding: 4px 11px; display: inline-flex; align-items: center; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; }
.language-switch a:hover { color: var(--text); }
.language-switch a[aria-current="true"] { color: var(--sun); background: var(--panel-2); }

.footer { margin-top: 72px; border-top: 1px solid var(--line); background: var(--bg-2); color: var(--muted); font-size: 14px; }
.footer__inner { display: grid; gap: 10px; padding-block: 28px 36px; }
.footer__brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.footer__brand .logo { width: 22px; height: 22px; }
.footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.footer nav a { text-decoration: none; }
.footer nav a:hover { color: var(--text); text-decoration: underline; }

/* ---------- 按钮、标签 ---------- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.actions--center { justify-content: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: 0 20px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { border-color: #46506a; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--sun); border-color: var(--sun); color: var(--sun-ink); box-shadow: 0 4px 0 #a7780b; }
.btn--primary:hover { background: #ffd65f; border-color: #ffd65f; transform: translateY(-1px); }
.btn--primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #a7780b; }
.btn--ghost { background: transparent; }
.btn--lg { min-height: 52px; padding: 0 28px; font-size: 18px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 14px 0 0; }
.tag {
  padding: 2px 12px; border-radius: 999px; font-size: 13px; color: var(--muted);
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
}
.tag--hot { background: var(--hot); border-color: var(--hot); color: #1a0b0e; font-weight: 700; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 6px; background: var(--hot); color: #1a0b0e;
  letter-spacing: .08em; box-shadow: 3px 3px 0 #000;
}

/* ---------- Arcade catalogue ---------- */
.portal-home { --wrap: 1260px; background: var(--bg); }
.portal-heading { padding-block: clamp(20px, 3.8vw, 36px) 22px; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 20px; }
.portal-kicker { display: flex; align-items: center; gap: 7px; color: var(--sun); font-size: 11px; letter-spacing: .16em; font-weight: 800; }
.portal-kicker span { width: 6px; height: 6px; border-radius: 50%; background: var(--sun); }
.portal-heading h1 { font-size: clamp(33px, 4.4vw, 56px); letter-spacing: -.045em; margin: 5px 0; font-weight: 900; }
.portal-lead { color: var(--muted); max-width: 54ch; font-size: 15px; }
.portal-tools { display: flex; align-items: end; gap: 7px; flex-direction: column; width: min(100%, 300px); }
.portal-count { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; white-space: nowrap; }
.portal-count strong { color: var(--sun); font-variant-numeric: tabular-nums; }

.spotlight h2, .catalogue h2 { font-size: clamp(21px, 2.4vw, 28px); font-weight: 850; }
.spotlight__grid { display: grid; grid-template-columns: minmax(0, 1.85fr) repeat(2, minmax(0, 1fr)); grid-auto-rows: clamp(170px, 18.5vw, 246px); gap: 12px; margin-top: 12px; }
.spotlight__tile { position: relative; isolation: isolate; display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; color: #fff; background: var(--panel); text-decoration: none; }
.spotlight__tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .22s ease; }
.spotlight__tile::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, transparent 20%, rgba(9, 10, 15, .94) 100%); }
.spotlight__tile:hover { border-color: var(--sun); }
.spotlight__tile:hover img { transform: scale(1.035); }
.spotlight__info { position: absolute; z-index: 1; left: 0; bottom: 0; right: 0; display: grid; gap: 3px; padding: 14px; }
.spotlight__info strong { font-size: clamp(17px, 2vw, 23px); line-height: 1.2; }
.spotlight__tile--main .spotlight__info { padding: clamp(14px, 2vw, 22px); }
.spotlight__tile--main strong { font-size: clamp(22px, 3vw, 36px); }
.spotlight__category { color: var(--sun); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.spotlight__cta { justify-self: start; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; margin-top: 5px; border-radius: 6px; color: var(--sun-ink); background: var(--sun); font-size: 12px; font-weight: 850; }

.catalogue { margin-top: clamp(26px, 4vw, 44px); scroll-margin-top: 83px; }
.catalogue__head { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 12px; }
.catalogue__head p { color: var(--muted); font-size: 14px; margin-top: 3px; }
.library-search { display: flex; align-items: center; gap: 9px; width: min(100%, 300px); min-height: 42px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 0 11px; }
.library-search:focus-within { border-color: var(--sun); }
.library-search svg { flex: none; }
.library-search input { width: 100%; min-width: 0; padding: 8px 0; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 14px; }
.library-search input:focus-visible { outline: none; }
.catalogue .filters { margin-bottom: 14px; }
.catalogue__empty { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head h2, .more h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 36px; padding: 0 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-weight: 600;
}
.chip span { opacity: .7; font-variant-numeric: tabular-nums; }
.chip:hover { color: var(--text); border-color: #46506a; }
.chip[aria-pressed="true"] { background: var(--sun); border-color: var(--sun); color: var(--sun-ink); }

.grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 18px; }
.portal-home .portal-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.card__link {
  display: flex; flex-direction: column; height: 100%;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--panel); text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card__link:hover { transform: translateY(-3px); border-color: var(--hot); box-shadow: 0 14px 30px rgba(0, 0, 0, .35); }
.card__link:focus-visible { outline-offset: 4px; border-radius: var(--radius); }
.card__art { position: relative; display: block; aspect-ratio: 3 / 2; background: #000; overflow: hidden; }
.card__art img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.card__link:hover .card__art img { transform: scale(1.04); }
.card__arrow { position: absolute; right: 9px; bottom: 9px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--sun-ink); background: var(--sun); font-size: 11px; opacity: 0; transition: opacity .18s ease; }
.card__link:hover .card__arrow, .card__link:focus-visible .card__arrow { opacity: 1; }
.card__body { display: flex; flex-direction: column; gap: 3px; padding: 11px 12px 12px; flex: 1; }
.card__meta { color: var(--muted); font-size: 12px; }
.card__title { font-size: clamp(14px, 1.5vw, 17px); font-weight: 800; overflow-wrap: anywhere; }
.grid--compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.portal-about { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; margin-top: clamp(34px, 5vw, 58px); padding: clamp(18px, 3vw, 30px); border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.portal-about h2 { font-size: 22px; margin-bottom: 8px; }
.portal-about h3 { font-size: 15px; margin-bottom: 4px; }
.portal-about p { color: var(--muted); font-size: 14px; }
.portal-about__notes { display: grid; gap: 10px; }

/* ---------- 详情页、指南 ---------- */
.detail, .guide { padding-top: 22px; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 22px; font-size: 14px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: #5d6479; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.detail__head { display: grid; gap: 10px; margin-bottom: 24px; }
.detail__head h1 { font-size: clamp(30px, 5vw, 50px); font-weight: 900; letter-spacing: -.02em; }
.detail__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: clamp(18px, 3vw, 28px); margin-top: 18px; }
.detail__grid .panel { margin-top: 0; }
.panel h2 { font-size: 21px; font-weight: 800; margin-bottom: 12px; }
.panel p + p { margin-top: 10px; }
.note { margin-top: 14px; color: var(--muted); font-size: 14px; }
.list { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; color: var(--muted); }
.list li::marker { color: var(--hot); }

.controls { margin: 0; display: grid; gap: 0; }
.controls__row { display: grid; grid-template-columns: minmax(8.5em, 40%) 1fr; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.controls__row:first-child { border-top: 0; padding-top: 0; }
.controls dt { font-weight: 700; color: var(--sun); }
.controls dd { margin: 0; color: var(--muted); }

.code {
  display: block; width: 100%; margin-top: 12px; padding: 12px 14px; resize: vertical;
  font: 13px/1.55 var(--mono); color: #e9e6dd; background: #0a0c12;
  border: 1px solid var(--line); border-radius: 10px;
}
.copy-status { color: var(--mint); font-weight: 600; min-height: 1.7em; }
.embed-box summary { cursor: pointer; font-weight: 800; }
.embed-box[open] summary { margin-bottom: 10px; }
.embed-box .actions { margin-top: 14px; }
.more { margin-top: 48px; }
.more h2 { margin-bottom: 18px; }

.empty { padding-block: 80px 40px; display: grid; gap: 12px; }
.empty h1 { font-size: clamp(30px, 5vw, 48px); }

/* ---------- 播放器 ---------- */
.player { margin: 0 0 8px; }
.player__stage {
  position: relative; isolation: isolate; overflow: hidden;
  width: 100%; aspect-ratio: 16 / 10; max-height: min(74vh, 720px); min-height: 300px;
  border: 1px solid var(--line); border-radius: 18px; background: #05060a;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .4);
}
.player__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .6; }
.player__panel {
  position: absolute; inset: 0; z-index: 1; overflow: auto;
  display: grid; place-items: center; padding: clamp(14px, 4vw, 32px); text-align: center;
  background: linear-gradient(180deg, rgba(8, 10, 16, .25), rgba(8, 10, 16, .88));
}
.player__view { width: min(100%, 480px); display: grid; gap: 10px; justify-items: center; }
.player__view .actions { margin-top: 8px; }
.player__title { font-size: clamp(22px, 4vw, 34px); font-weight: 900; text-shadow: 0 2px 0 #000; }
.player__title:focus { outline: none; }
.player__hint { color: #d6d9e2; font-size: 15px; }
.player__language { font-size: 13px; color: var(--sun); }
.player__brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); }
.player__brand .logo { width: 24px; height: 24px; }
.player__credit a { color: var(--muted); font-size: 14px; }
.player__credit a:hover { color: var(--text); }
.player__details { width: 100%; text-align: left; font-size: 13px; color: var(--muted); }
.player__details pre { white-space: pre-wrap; word-break: break-word; margin: 6px 0 0; font-family: var(--mono); }
.player__noscript { margin-top: 10px; color: var(--hot); }
.meter {
  width: 100%; height: 12px; border: 0; border-radius: 999px; overflow: hidden;
  background: #262c3b; accent-color: var(--sun); appearance: none; -webkit-appearance: none;
}
.meter::-webkit-progress-bar { background: #262c3b; border-radius: 999px; }
.meter::-webkit-progress-value { background: linear-gradient(90deg, var(--hot), var(--sun)); border-radius: 999px; }
.meter::-moz-progress-bar { background: linear-gradient(90deg, var(--hot), var(--sun)); border-radius: 999px; }

/* 画布尺寸由 Godot 按 canvasResizePolicy 设置，这里不改宽高。 */
.player__canvas { position: absolute; top: 0; left: 0; display: block; visibility: hidden; outline: none; touch-action: none; }
.player[data-state="running"] .player__canvas,
.player[data-state="ended"] .player__canvas { visibility: visible; }
.player[data-state="running"] .player__poster,
.player[data-state="running"] .player__panel,
.player[data-state="ended"] .player__poster { display: none; }
.player[data-state="error"] .player__canvas { display: none; }

.player__bar {
  position: absolute; top: 8px; left: 8px; z-index: 2; display: flex; gap: 6px;
  opacity: .5; transition: opacity .2s ease;
}
.player__bar:hover, .player__bar:focus-within { opacity: 1; }
.player__bar button {
  min-height: 34px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .28); background: rgba(8, 10, 16, .82); color: #fff;
  font: 600 13px/1 var(--font);
}
.player__bar button:hover { background: rgba(8, 10, 16, .95); border-color: var(--sun); }

/* 详情页开始游戏后：舞台铺满窗口，与原导出的整窗画布一致。 */
body.is-playing { overflow: hidden; overscroll-behavior: none; }
body.is-playing .player__stage {
  position: fixed; inset: 0; z-index: 100; max-height: none; min-height: 0; aspect-ratio: auto;
  border: 0; border-radius: 0; box-shadow: none;
}
.player__stage:fullscreen { max-height: none; min-height: 0; aspect-ratio: auto; width: 100%; height: 100%; border: 0; border-radius: 0; }
.player__stage:-webkit-full-screen { max-height: none; min-height: 0; aspect-ratio: auto; width: 100%; height: 100%; border: 0; border-radius: 0; }

/* 嵌入玩家页：整个 iframe 就是舞台。 */
html:has(body.embed-page) { height: 100%; }
body.embed-page { min-height: 0; height: 100%; overflow: hidden; background: #05060a; }
.embed-page .player { margin: 0; }
.embed-page .player__stage {
  position: fixed; inset: 0; max-height: none; min-height: 0; aspect-ratio: auto;
  border: 0; border-radius: 0; box-shadow: none;
}
.embed-page .player__view { gap: 8px; }
@media (max-height: 360px) {
  .embed-page .player__hint, .embed-page .player__credit { font-size: 13px; }
  .embed-page .btn--lg { min-height: 44px; font-size: 16px; }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 820px) {
  .portal-home .portal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail__grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .portal-tools { width: 100%; align-items: flex-start; }
  .spotlight__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; gap: 8px; }
  .spotlight__tile { aspect-ratio: 3 / 2; }
  .spotlight__tile--main { grid-column: span 2; aspect-ratio: 2 / 1; }
  .portal-home .portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .portal-about { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}
@media (max-width: 520px) {
  .wrap { width: min(100% - 28px, var(--wrap)); }
  .brand { font-size: 18px; }
  .topnav { display: none; }
  .grid:not(.portal-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .library-search { width: 100%; }
  .controls__row { grid-template-columns: 1fr; gap: 2px; }
  .player__stage { aspect-ratio: 4 / 5; max-height: 78vh; }
  .actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .btn, .chip, .player__bar button { border: 1px solid ButtonText; }
}
