/* 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 { border-bottom: 1px solid var(--line); background: rgba(15, 17, 23, .82); 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); }

.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;
}

/* ---------- 首页 ---------- */
.intro { padding-block: clamp(36px, 7vw, 72px) 28px; display: grid; gap: 12px; }
.intro h1 { font-size: clamp(32px, 5.4vw, 58px); font-weight: 900; letter-spacing: -.03em; max-width: 14em; }

.feature__card {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
  background: linear-gradient(135deg, var(--panel-2), var(--panel));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35), 8px 8px 0 rgba(255, 79, 94, .18);
}
.feature__art { position: relative; min-height: 280px; background: #000; }
.feature__art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feature__body { padding: clamp(24px, 4vw, 44px); display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.feature__body h2 { font-size: clamp(30px, 4vw, 46px); font-weight: 900; }
.feature__lead { font-size: 18px; }

.games { margin-top: clamp(48px, 7vw, 80px); }
.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: 40px; padding: 0 16px; border-radius: 999px; 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(--text); border-color: var(--text); color: var(--bg); }

.grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 18px; }
.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 { 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__body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; flex: 1; }
.card__meta { color: var(--mint); font-size: 13px; font-weight: 700; }
.card__title { font-size: 19px; font-weight: 800; }
.card__text { color: var(--muted); font-size: 15px; flex: 1; }
.card__foot { color: #8c93a5; font-size: 13px; margin-top: 6px; }
.grid--compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid--compact .card__text { display: none; }

.cta { margin-top: clamp(48px, 7vw, 80px); }
.cta__box {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: clamp(22px, 4vw, 36px); border-radius: 20px; border: 1px dashed #46506a;
  background: repeating-linear-gradient(135deg, rgba(255, 204, 61, .04) 0 12px, transparent 12px 24px), var(--bg-2);
}
.cta__box h2 { font-size: clamp(22px, 3vw, 28px); margin-bottom: 6px; }
.cta__box p { color: var(--muted); }
.cta__box .btn { margin: 0; }

/* ---------- 详情页、指南 ---------- */
.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 .actions { margin-top: 14px; }
.more { margin-top: 48px; }
.more h2 { margin-bottom: 18px; }

.builder fieldset { border: 0; padding: 0; margin: 0 0 24px; }
.builder h2 { font-size: 21px; margin-bottom: 4px; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pick { position: relative; display: block; cursor: pointer; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick__body {
  display: flex; align-items: center; gap: 12px; padding: 8px; min-height: 56px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--panel-2); font-weight: 600;
}
.pick__body img { width: 64px; height: 43px; object-fit: cover; border-radius: 6px; flex: none; }
.pick:hover .pick__body { border-color: #46506a; }
.pick input:checked + .pick__body { border-color: var(--sun); background: rgba(255, 204, 61, .09); }
.pick input:focus-visible + .pick__body { outline: 3px solid var(--sun); outline-offset: 3px; }
.urls { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.urls li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 8px 0; border-top: 1px solid var(--line); }
.urls li:first-child { border-top: 0; }
.urls code { word-break: break-all; }

.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__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) {
  .feature__card { grid-template-columns: 1fr; }
  .feature__art { min-height: 0; aspect-ratio: 3 / 2; }
  .detail__grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .wrap { width: min(100% - 28px, var(--wrap)); }
  .brand { font-size: 18px; }
  .topnav a { padding: 8px 10px; }
  .grid { grid-template-columns: 1fr; }
  .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, .pick__body, .player__bar button { border: 1px solid ButtonText; }
}
