:root {
  color-scheme: dark;
  --bg: #181818;
  --surface: #1f1f1f;
  --surface-hover: #272727;
  --line: #34322c;
  --text: #f5f0e6;
  --muted: #b8b8b2;
  --accent: #b99a58;
  --accent-strong: #d4b878;
  --on-accent: #181818;
  --shadow: 0 16px 40px rgba(8, 7, 5, .55);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 24px; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: clip; }
main { flex: 1 0 auto; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 4px; border-radius: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.shell { width: min(1240px, calc(100% - 96px)); margin-inline: auto; }

.skip-link { position: fixed; left: 16px; top: 16px; z-index: 20; transform: translateY(-200%); padding: 12px 16px; border-radius: 8px; background: var(--text); color: var(--bg); font-weight: 700; text-decoration: none; }
.skip-link:focus { transform: none; }

/* Top bar */
.topbar { border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; min-height: 44px; font-size: 20px; line-height: 32px; font-weight: 700; text-decoration: none; }
.topbar-title { padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--accent-strong); font-size: 14px; line-height: 24px; font-weight: 700; }

/* Lobby header: deliberately short so games sit in the first screen */
.lobby-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; padding-block: 32px 24px; }
.eyebrow { color: var(--accent); font-size: 14px; line-height: 24px; font-weight: 700; letter-spacing: .04em; }
h1 { font-size: 40px; line-height: 52px; font-weight: 700; letter-spacing: -.01em; text-wrap: balance;
  background: linear-gradient(90deg, var(--text) 30%, var(--accent-strong)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.platform-picker { display: grid; gap: 8px; justify-items: start; }
.picker-label { color: var(--muted); font-size: 14px; line-height: 20px; }
.segmented { display: inline-flex; padding: 4px; gap: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.segmented button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 15px; line-height: 24px; font-weight: 600; transition: background-color .2s, color .2s; }
.segmented button:hover { color: var(--text); background: var(--surface-hover); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.segmented svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.picker-status { min-height: 20px; color: var(--muted); font-size: 14px; line-height: 20px; }

/* Game library */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.card { --game-accent: var(--accent); position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: inherit; text-decoration: none; transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background-color .2s ease; }
.card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--game-accent); z-index: 1; }
.card:hover, .card:focus-visible { transform: translateY(-4px); border-color: var(--game-accent); background: var(--surface-hover); box-shadow: var(--shadow); }
.card:focus-visible { outline-offset: 3px; border-radius: 16px; }
.cover { aspect-ratio: 16 / 10; overflow: hidden; background: #111; }
.cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .cover img, .card:focus-visible .cover img { transform: scale(1.04); }
.card-body { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 16px 20px 20px; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.genre { color: var(--game-accent); font-size: 14px; line-height: 20px; font-weight: 700; }
.chips { display: flex; gap: 6px; }
.chip { padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; line-height: 20px; font-weight: 600; }
.card-title { font-size: 22px; line-height: 32px; font-weight: 700; overflow-wrap: anywhere; text-wrap: balance; }
.card-desc { color: var(--muted); font-size: 15px; line-height: 24px; text-wrap: pretty; }
.cta { display: inline-flex; align-items: center; justify-content: center; gap: 10px; align-self: flex-start; min-height: 44px; margin-top: auto; padding: 10px 20px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 16px; line-height: 24px; font-weight: 700; transition: background-color .2s; }
.card:hover .cta, .card:focus-visible .cta { background: var(--accent-strong); }
.cta-arrow { font-size: 12px; transition: transform .2s; }
.card:hover .cta-arrow, .card:focus-visible .cta-arrow { transform: translateX(3px); }
.cta.is-soon { background: transparent; border: 1px solid var(--line); color: var(--muted); }

/* Featured: on wide screens the first game spans the row as a wide cabinet */
@media (min-width: 1025px) {
  .card.is-featured { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
  .card.is-featured .cover { aspect-ratio: 16 / 9; }
  .card.is-featured .card-body { justify-content: center; gap: 12px; padding: 32px 40px; }
  .card.is-featured .card-title { font-size: 32px; line-height: 44px; }
  .card.is-featured .card-desc { font-size: 16px; line-height: 28px; max-width: 34ch; }
  .card.is-featured .cta { margin-top: 12px; padding: 12px 28px; font-size: 18px; }
}

.empty, .noscript { padding: 24px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); }
.noscript ul { margin: 12px 0 0; padding-left: 20px; }
.noscript a { color: var(--accent-strong); display: inline-block; min-height: 44px; padding-block: 10px; }

/* Other-platform games: informational only, never links */
.elsewhere { display: grid; gap: 16px; padding-block: 48px 8px; }
.elsewhere-head { display: grid; gap: 4px; }
.elsewhere h2 { font-size: 20px; line-height: 32px; font-weight: 700; }
.elsewhere-note { color: var(--muted); font-size: 14px; line-height: 22px; }
.other-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.other { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 12px; border: 1px dashed var(--line); border-radius: 14px; }
.other-cover { aspect-ratio: 16 / 10; overflow: hidden; border-radius: 8px; filter: grayscale(.7) brightness(.7); }
.other-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.other-text { display: grid; min-width: 0; }
.other-name { font-weight: 700; line-height: 26px; overflow-wrap: anywhere; }
.other-meta { color: var(--muted); font-size: 13px; line-height: 20px; }
.other-switch { min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--accent-strong); font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap; }
.other-switch:hover { border-color: var(--accent); background: var(--surface-hover); }

/* Footer */
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; margin-top: 48px; padding-block: 24px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; line-height: 22px; }
.footer-brand { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); font-weight: 700; text-decoration: none; }
.footer-brand:hover { color: var(--accent-strong); }
.footer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; }
.footer-actions a { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 4px; }
.footer-actions a:hover { color: var(--text); }
.footer-note { flex-basis: 100%; font-size: 13px; }
[data-ga-settings] { min-height: 44px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text); font-size: 14px; }
[data-ga-settings]:hover, [data-ga-settings]:focus-visible { border-color: var(--accent); }

/* GA consent dialog (markup comes from analytics.js, unchanged) */
#ga-consent-banner { position: fixed; z-index: 10000; right: 24px; bottom: 24px; width: min(440px, calc(100% - 48px)); padding: 20px; border: 1px solid #45443c; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-size: 14px; line-height: 1.6; }
#ga-consent-banner strong { display: block; font-size: 17px; line-height: 26px; color: var(--accent-strong); }
#ga-consent-banner p { margin: 6px 0; color: var(--muted); }
#ga-consent-banner a { color: var(--accent-strong); }
.ga-consent-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ga-consent-actions button { min-height: 44px; padding: 8px 16px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.ga-consent-actions button + button { background: transparent; color: var(--text); border-color: #5a574d; }
/* Reserve room so the open dialog never permanently covers the footer */
body:has(#ga-consent-banner) { padding-bottom: 240px; }

@media (max-width: 1024px) {
  .shell { width: calc(100% - 48px); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .other-list { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .shell { width: calc(100% - 32px); }
  .lobby-head { padding-block: 20px 16px; }
  h1 { font-size: 30px; line-height: 40px; }
  .platform-picker, .segmented { width: 100%; }
  .segmented button { flex: 1; justify-content: center; padding-inline: 8px; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .eyebrow, .picker-label { display: none; }
  .platform-picker { gap: 4px; }
  .card.is-featured .cover { aspect-ratio: 2 / 1; }
  .other { grid-template-columns: 88px minmax(0, 1fr); }
  .other-switch { grid-column: 1 / -1; }
  #ga-consent-banner { right: 12px; bottom: 12px; width: calc(100% - 24px); padding: 16px; }
  body:has(#ga-consent-banner) { padding-bottom: 300px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .card:hover, .card:focus-visible { transform: none; }
  .card:hover .cover img, .card:focus-visible .cover img { transform: none; }
}
@media print { #ga-consent-banner, [data-ga-settings] { display: none !important; } }
