/* 在线游戏：列表页与试玩页。只作用于 .games-page / .game-* 与 body.is-game。 */

.games-page { padding: 54px 0 72px; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 420px)); gap: 14px; }

.game-card { position: relative; display: flex; flex-direction: column; min-height: 300px; padding: 27px 29px 24px; background: #f5f5ed; border: 1px solid #e0e4d4; text-decoration: none; color: inherit; transition: background .25s, border-color .25s; }
.game-card:hover, .game-card:focus-visible { background: #e4ebd7; border-color: #c9d5b9; }
.game-card:focus-visible { outline: 2px solid #244c36; outline-offset: 3px; }

.game-badge { position: absolute; top: 18px; right: 22px; display: inline-flex; align-items: center; padding: 4px 11px; font-size: 10px; letter-spacing: .12em; color: #fff; background: var(--ribbon-color, #7aa35c); border-radius: 999px; }

.game-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 10px; letter-spacing: .14em; color: #77866a; }
.game-state { padding: 3px 9px; border: 1px solid #d7ddc9; border-radius: 999px; letter-spacing: .08em; color: #5d6b53; }

.game-card h3 { margin: 18px 0 12px; font-size: 27px; font-weight: 600; line-height: 1.35; letter-spacing: -.03em; }
.game-card p { margin: 0 0 16px; font-size: 12px; line-height: 1.95; color: #6f7a66; }

.game-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.game-tags span { padding: 4px 10px; border: 1px solid #d7ddc9; border-radius: 999px; font-size: 10px; color: #5d6b53; }

.game-link { margin-top: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #244c36; }
.game-card:hover .game-link span { transform: translate(2px, -2px); }
.game-link span { transition: transform .2s; }

.game-footnote { margin: 26px 0 0; font-size: 11px; line-height: 1.9; color: #83907a; }
.game-footnote span { margin-right: 6px; }

@media (max-width: 700px) {
  .games-page { padding: 34px 0 56px; }
  .game-card { min-height: 0; padding: 22px 20px 20px; }
  .game-card h3 { font-size: 23px; }
}

/* ---- 试玩页：整屏交给游戏，站点页头页脚隐藏 ---- */
.is-game { overflow: hidden; }
.is-game .site-header, .is-game #site-footer { display: none; }

.game-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; background: #0e120d; color: #e2e9dc; }

.game-bar { display: flex; align-items: center; gap: 16px; padding: 10px 18px; background: #151c12; border-bottom: 1px solid #263122; font-size: 12px; }
.game-back { flex: none; color: #bfe0a8; text-decoration: none; }
.game-back:hover { text-decoration: underline; }
.game-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; letter-spacing: .01em; }

.game-actions { display: flex; flex: none; gap: 8px; }
.game-button { padding: 7px 14px; font: inherit; color: #d8e3cf; background: #1d2719; border: 1px solid #35452e; border-radius: 999px; cursor: pointer; transition: background .2s, border-color .2s; }
.game-button:hover { background: #26331f; border-color: #4a5f3f; }
.game-button:focus-visible { outline: 2px solid #bfe0a8; outline-offset: 2px; }
.game-button-primary { color: #16200f; background: #bfe0a8; border-color: #bfe0a8; }
.game-button-primary:hover { background: #cfeab9; border-color: #cfeab9; }

.game-frame-wrap { position: relative; flex: 1 1 auto; min-height: 0; }
.game-frame { display: block; width: 100%; height: 100%; border: 0; background: #000; }

.game-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: radial-gradient(60% 60% at 50% 45%, #1a2416 0%, #0e120d 72%); color: #d8e3cf; transition: opacity .45s ease; }
.game-frame-wrap.is-ready .game-loading { opacity: 0; pointer-events: none; }
.game-loading[hidden] { display: none; }
.game-spinner { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #3a4b31; border-top-color: #bfe0a8; animation: game-spin 900ms linear infinite; }
@keyframes game-spin { to { transform: rotate(360deg); } }
.game-loading-text { font-size: 13px; line-height: 1.7; letter-spacing: .02em; }
.game-loading-text small { display: block; margin-top: 6px; font-size: 11px; color: #8ea07e; }
.game-loading-link { font-size: 11px; color: #9fb98f; text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .game-spinner { animation: none; } }

.game-help { position: absolute; left: 14px; bottom: 14px; max-width: min(440px, calc(100% - 28px)); background: #151c12f2; border: 1px solid #2c3a27; border-radius: 10px; font-size: 12px; line-height: 1.8; color: #d3dfc9; }
.game-help summary { padding: 8px 14px; cursor: pointer; list-style: none; color: #bfe0a8; }
.game-help summary::-webkit-details-marker { display: none; }
.game-help summary::before { content: "＋ "; }
.game-help[open] summary::before { content: "－ "; }
.game-help-body { padding: 0 14px 12px; }
.game-help-body p { margin: 0 0 8px; }
.game-help-body p:last-child { margin-bottom: 0; }
.game-help-body strong { display: inline-block; min-width: 34px; margin-right: 6px; color: #9fb98f; font-weight: 600; }
.game-help-body a { color: #bfe0a8; }

@media (max-width: 700px) {
  .game-bar { flex-wrap: wrap; gap: 8px 12px; padding: 9px 14px; padding-top: max(9px, env(safe-area-inset-top)); }
  .game-name { flex: 1 1 100%; order: 3; font-size: 11px; }
  .game-actions { margin-left: auto; }
  .game-button { padding: 6px 12px; }
  /* The joystick sits bottom-left and the fire button bottom-right: keep the help chip out of both. */
  .game-help { left: auto; right: 10px; top: 10px; bottom: auto; max-width: min(230px, calc(100% - 20px)); font-size: 11px; }
  .game-help summary { padding: 6px 10px; }
  /* Landscape phones are short: give the canvas back as much height as possible. */
  .game-bar { min-height: 0; }
  .game-shell { padding-bottom: env(safe-area-inset-bottom); }
}

@media (orientation: portrait) and (max-width: 900px) {
  .game-shell .game-rotate { display: flex; }
}

.game-rotate { display: none; align-items: center; justify-content: center; gap: 12px; padding: 8px 14px; background: #2a2113; border-bottom: 1px solid #4a3a20; color: #f0d9a8; font-size: 12px; }
.game-rotate[hidden] { display: none; }
.game-rotate button { padding: 4px 12px; font: inherit; font-size: 11px; color: #2a2113; background: #f0d9a8; border: 0; border-radius: 999px; cursor: pointer; }
