/* JK Game DOS Arcade — 站台樣式（2026-09-17 重整）
 *
 * 三套字體、三個崗位，不互相搶：
 *   --font-ui    Noto Sans TC   所有內文、按鍵、導覽、標題。一個 7 級尺度（11–24px）＋ display。
 *   --font-pixel Press Start 2P 只做「標籤」：品牌名、卡片小標、eyebrow、數字。最小 10px，永不進按鍵。
 *   --font-term  VT323          只在 CRT 螢幕與跑馬燈裡，最小 19px（它的 x-height 很矮）。
 * 之前 19 種字體×字級組合、Press Start 2P 壓到 7px、VT323 混中文字退回 Noto 造成大小不一，
 * 全部收回到這裡的變數。按鍵只有一套（.btn / .btn-ghost / .btn-sm / .btn-danger）。 */
:root {
  --bg: #07060f;
  --bg-2: #110b1f;
  --panel: rgba(18, 10, 36, 0.78);
  --panel-2: #140c24;
  --ink: #f6f3ff;
  --ink-2: rgba(246, 243, 255, 0.84);
  --muted: #9a91b8;
  --line: rgba(139, 92, 246, 0.32);
  --line-2: rgba(139, 92, 246, 0.6);
  --jk-purple: #8b5cf6;
  --jk-cyan: #22f0ff;
  --jk-pink: #ff3cac;
  --jk-gold: #ffe566;
  --phosphor: #b7ffd8;
  --phosphor-dim: #6f8f7c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font-pixel: "Press Start 2P", "Noto Sans TC", "PingFang TC", sans-serif;
  --font-term: "VT323", "Noto Sans TC", "PingFang TC", monospace;
  --font-ui: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  /* 字級尺度：內文只准用這幾個 */
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 17px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-display: clamp(30px, 3.6vw, 46px);
  --label-size: 10px;
  --max: 1240px;
  --gutter: 24px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body.jkdos {
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: 1.7;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(139, 92, 246, 0.26), transparent 55%),
    radial-gradient(900px 500px at 110% 8%, rgba(255, 60, 172, 0.16), transparent 50%),
    radial-gradient(800px 500px at 50% 120%, rgba(34, 240, 255, 0.1), transparent 45%),
    var(--bg);
  overflow-x: hidden;
}

body.jkdos.play-page { background: #05040b; }
.play-page .ticker { display: none; }
.play-page .fx-scan { opacity: 0.1; }

a { color: var(--jk-cyan); text-decoration: none; }
a:hover { color: var(--jk-gold); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; }

/* 標籤：像素字唯一的崗位 */
.label,
.eyebrow,
.hud-card h2,
.footer-col h2,
.section-head .kicker,
.crt-badge {
  font-family: var(--font-pixel);
  font-size: var(--label-size);
  font-weight: normal;
  letter-spacing: 0.14em;
  line-height: 1.6;
  text-transform: uppercase;
  color: var(--jk-cyan);
}

.skip-link {
  position: absolute; left: -999px; top: 8px;
  background: var(--jk-gold); color: #111; padding: 8px 12px; z-index: 100;
}
.skip-link:focus { left: 8px; }

/* ---- 背景效果（星、掃描線、暗角）：比之前淡，內文要讀得清 ------------------- */
.fx-stars, .fx-scan, .fx-vignette { pointer-events: none; position: fixed; inset: 0; }

.fx-stars {
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 12% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 68%, #22f0ff 50%, transparent 51%),
    radial-gradient(1px 1px at 48% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 44%, #ff3cac 50%, transparent 51%),
    radial-gradient(1px 1px at 81% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 91% 72%, #8b5cf6 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 88%, #fff 50%, transparent 51%);
  animation: twinkle 5.5s steps(2) infinite;
  opacity: 0.6;
}

.fx-scan {
  z-index: 40;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, rgba(0, 0, 0, 0.16) 3px);
  mix-blend-mode: multiply;
  opacity: 0.2;
}

.fx-vignette { z-index: 41; box-shadow: inset 0 0 160px rgba(0, 0, 0, 0.5); }

.site { position: relative; z-index: 2; min-height: 100vh; display: flex; flex-direction: column; }

/* ---- 頂欄 ------------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  min-height: 64px; padding: 8px var(--gutter);
  background: rgba(7, 6, 15, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-2);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.25);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); flex-shrink: 0; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 40px; height: 40px; image-rendering: pixelated; flex-shrink: 0; }

.brand-name {
  display: block;
  font-family: var(--font-pixel);
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-shadow: 2px 0 var(--jk-pink), -2px 0 var(--jk-cyan);
  animation: chroma 3.2s steps(2) infinite;
}

.brand-sub {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: var(--jk-cyan);
  margin-top: 3px;
}

.nav-links { display: flex; align-items: center; gap: 2px; margin-left: 4px; }

.nav-links a {
  position: relative;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--ink-2);
  padding: 8px 12px;
  transition: color 0.12s ease;
}

.nav-links a::after {
  content: "";
  position: absolute; left: 12px; right: 12px; bottom: 2px;
  height: 2px; background: var(--jk-cyan);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.16s ease;
}

.nav-links a:hover { color: var(--ink); }
.nav-links a.is-active { color: var(--jk-cyan); }
.nav-links a:hover::after, .nav-links a.is-active::after { transform: scaleX(1); }

.search-form { margin-left: auto; display: flex; flex: 0 1 380px; min-width: 0; }

.search-form input,
.catalog-filters input[type="search"],
.catalog-tools input {
  flex: 1; min-width: 0;
  height: 40px;
  background: #120a22;
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  padding: 0 12px;
  outline: none;
}

.search-form input:focus,
.catalog-filters input[type="search"]:focus,
.catalog-tools input:focus {
  border-color: var(--jk-cyan);
  box-shadow: 0 0 0 3px rgba(34, 240, 255, 0.18);
}

.search-form button { margin-left: -1px; }

.nav-toggle {
  display: none;
  margin-left: auto;
  background: transparent;
  color: var(--jk-cyan);
  border: 1px solid var(--line-2);
  width: 40px; height: 40px;
  font-size: 20px;
  cursor: pointer;
}

/* ---- 按鍵：全站唯一一套 ---------------------------------------------------- */
.btn,
.search-form button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  color: #07060f;
  background: var(--jk-cyan);
  border: 1px solid var(--jk-cyan);
  box-shadow: 3px 3px 0 var(--jk-pink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.btn:hover, .search-form button:hover {
  color: #07060f;
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--jk-pink);
}

.btn:active, .search-form button:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--jk-pink); }

.btn:focus-visible, .search-form button:focus-visible {
  outline: 2px solid var(--jk-gold); outline-offset: 2px;
}

.btn-ghost {
  color: var(--ink);
  background: rgba(139, 92, 246, 0.08);
  border-color: var(--line-2);
  box-shadow: none;
}

.btn-ghost:hover {
  color: var(--jk-cyan);
  border-color: var(--jk-cyan);
  background: rgba(34, 240, 255, 0.07);
  box-shadow: none;
  transform: none;
}

.btn-ghost:active { transform: translateY(1px); box-shadow: none; }
.btn-ghost.is-active, .btn-ghost[aria-pressed="true"] { color: var(--jk-cyan); border-color: var(--jk-cyan); background: rgba(34, 240, 255, 0.12); }

.btn-sm,
.search-form button {
  height: 34px; padding: 0 12px;
  font-size: var(--fs-sm);
}

.search-form button { letter-spacing: 0.08em; }

.btn-danger { background: var(--jk-pink); border-color: var(--jk-pink); color: #12081f; box-shadow: 3px 3px 0 #7a1350; }
.btn-danger:hover { box-shadow: 4px 4px 0 #7a1350; }

.btn[disabled], .btn:disabled {
  opacity: 0.4; cursor: not-allowed;
  transform: none !important; box-shadow: none !important;
}

/* ---- 跑馬燈 ---------------------------------------------------------------- */
.ticker {
  overflow: hidden;
  border-bottom: 1px solid rgba(34, 240, 255, 0.2);
  background: rgba(255, 60, 172, 0.06);
}

.ticker-track {
  display: flex; width: max-content; gap: 48px;
  animation: marquee 32s linear infinite;
  font-family: var(--font-term);
  font-size: 19px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: rgba(255, 229, 102, 0.85);
  padding: 8px 0;
  white-space: nowrap;
}

/* ---- Hero：左文案、右 CRT 示範機 ------------------------------------------ */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 44px;
  align-items: center;
  padding: 44px var(--gutter) 24px;
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
}

.hero-copy .eyebrow { display: block; margin-bottom: 18px; }

.hero-copy h1 {
  font-size: var(--fs-display);
  font-weight: 900;
  line-height: 1.16;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  text-wrap: balance;
}

.hero-copy .lede {
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: 1.8;
  margin: 0 0 26px;
  max-width: 34em;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 28px;
  max-width: 460px;
}

.stat {
  border: 1px solid var(--line);
  padding: 12px 14px 10px;
  background: var(--panel);
}

.stat b {
  display: block;
  font-family: var(--font-pixel);
  font-size: 16px;
  line-height: 1.3;
  color: var(--jk-gold);
  margin-bottom: 6px;
}

.stat span { display: block; font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }

/* CRT 示範機 */
.demo { min-width: 0; }

.crt {
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 16 / 10;
  min-height: 340px;
  background: #04030a;
  border: 3px solid #2a1b4a;
  box-shadow:
    0 0 0 3px var(--jk-purple),
    0 0 48px rgba(34, 240, 255, 0.22),
    inset 0 0 80px rgba(34, 240, 255, 0.07);
  padding: 18px 22px 18px;
  overflow: hidden;
}

.crt::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: linear-gradient(180deg, rgba(34, 240, 255, 0.07), transparent 18%, transparent 82%, rgba(255, 60, 172, 0.08));
}

.crt-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.crt-badge { color: var(--jk-cyan); }

.crt-led {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-pixel); font-size: var(--label-size); letter-spacing: 0.12em;
  color: var(--phosphor-dim);
}

.crt-led i { width: 8px; height: 8px; background: var(--phosphor); box-shadow: 0 0 8px var(--phosphor); animation: blink 1.6s steps(1) infinite; }

.boot {
  font-family: var(--font-term);
  font-size: 24px;
  line-height: 1.35;
  color: var(--phosphor);
}

.boot .dim { color: var(--phosphor-dim); }
.boot[hidden] { display: none; }

.cursor {
  display: inline-block; width: 12px; height: 22px;
  background: var(--phosphor); margin-left: 2px;
  animation: blink 1s steps(1) infinite;
  vertical-align: text-bottom;
}

.screens { position: relative; flex: 1; min-height: 0; }
.screens[hidden] { display: none; }

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease;
}

.screen.is-on { opacity: 1; visibility: visible; }

.screen .cmd {
  font-family: var(--font-term);
  font-size: 24px;
  line-height: 1.3;
  color: var(--phosphor);
  margin-bottom: 14px;
  white-space: nowrap;
  overflow: hidden;
}

.screen .cmd .cursor { height: 20px; }

.screen-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
  padding: 0 2px;
}

/* 程式畫面用 UI 字：中文不會退回別的字體而忽大忽小 */
.screen .ui {
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--phosphor);
}

.screen .ui b { font-weight: 700; color: #fff; }
.screen .ui.dim { color: var(--phosphor-dim); }

.screen .cap {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed rgba(183, 255, 216, 0.22);
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--muted);
  display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
}

.screen .cap a { white-space: nowrap; font-weight: 700; }

.screen .is-live-only { opacity: 0; }
.screen.is-live .is-live-only { opacity: 1; }

/* 01 雲端存檔：進度條跑滿 → 三部裝置亮起 */
.prog {
  height: 14px; border: 1px solid rgba(183, 255, 216, 0.4);
  padding: 2px; max-width: 420px;
}

.prog span { display: block; height: 100%; width: 0; background: var(--phosphor); }
.screen.is-live .prog span { animation: fill 1.8s steps(18) forwards; }

.devices { display: flex; gap: 10px; flex-wrap: wrap; }

.devices span {
  font-size: var(--fs-xs); font-weight: 700;
  padding: 4px 10px;
  border: 1px solid rgba(183, 255, 216, 0.35);
  color: var(--phosphor-dim);
}

.screen.is-live .devices span { animation: light 0.3s steps(1) forwards; }
.screen.is-live .devices span:nth-child(1) { animation-delay: 1.9s; }
.screen.is-live .devices span:nth-child(2) { animation-delay: 2.15s; }
.screen.is-live .devices span:nth-child(3) { animation-delay: 2.4s; }
.screen.is-live .sync-ok { animation: fadein 0.2s 1.9s forwards; opacity: 0; }

/* 02 改檔庫：列表逐行亮起 */
.rows { display: flex; flex-direction: column; gap: 4px; max-width: 440px; }

.row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  font-size: var(--fs-sm); font-weight: 700;
  color: var(--phosphor);
  border: 1px solid transparent;
}

.row i { font-style: normal; width: 1em; color: var(--jk-gold); opacity: 0; }
.row .tag { margin-left: auto; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.08em; padding: 2px 8px; background: var(--phosphor); color: #04030a; opacity: 0; }
.screen.is-live .row { animation: rowhi 6s steps(1) infinite; }
.screen.is-live .row:nth-child(2) { animation-delay: 2s; }
.screen.is-live .row:nth-child(3) { animation-delay: 4s; }
.screen.is-live .row i, .screen.is-live .row .tag { animation: rowhi-part 6s steps(1) infinite; }
.screen.is-live .row:nth-child(2) i, .screen.is-live .row:nth-child(2) .tag { animation-delay: 2s; }
.screen.is-live .row:nth-child(3) i, .screen.is-live .row:nth-child(3) .tag { animation-delay: 4s; }

/* 03 存檔編輯器：一行 hex，某幾格從舊值翻成新值 */
.hexline {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  font-family: var(--font-term); font-size: 22px; line-height: 1.2; color: var(--phosphor);
  max-width: 460px;
}

.hexline .addr { color: var(--phosphor-dim); }
.hexline .bytes { display: flex; gap: 8px; }
.hexline .bytes span { min-width: 2ch; text-align: center; }
.hexline .val { font-family: var(--font-ui); font-size: var(--fs-sm); font-weight: 700; color: var(--jk-gold); white-space: nowrap; }
.hexline .bytes span.chg { position: relative; color: var(--jk-pink); }
.screen.is-live .hexline .bytes span.chg { animation: hexflip 4s steps(1) 0.8s infinite; }
.screen.is-live .hexline.new { animation: hexnew 4s steps(1) 0.8s infinite; opacity: 0; }

/* 04 劇院：畫面撐開 */
/* 畫面用 transform 放大而不是改寬度：排版尺寸不變，不會撞到下面的說明；比例 4:3 也不變。 */
.theater-demo { display: flex; align-items: center; gap: 18px; height: 140px; }
.mini { flex: 0 0 auto; height: 100%; aspect-ratio: 4 / 3; border: 2px solid var(--phosphor); background: repeating-linear-gradient(0deg, rgba(183, 255, 216, 0.08) 0 2px, transparent 2px 4px); transform: scale(0.5); transform-origin: left center; }
.screen.is-live .mini { animation: grow 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.6s forwards; }
.keycap { font-family: var(--font-term); font-size: 22px; line-height: 1; color: var(--phosphor); border: 1px solid var(--phosphor); padding: 6px 10px; }
.screen.is-live .keycap { animation: press 0.4s steps(1) 0.4s; }

/* 05 手掣：搖桿＋三個鍵 */
.pad-demo { display: flex; align-items: center; gap: 22px; }
.stick { position: relative; width: 84px; height: 84px; border-radius: 50%; border: 2px solid rgba(183, 255, 216, 0.4); flex: none; }
.stick::after { content: ""; position: absolute; left: 50%; top: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px; border-radius: 50%; background: var(--phosphor); box-shadow: 0 0 12px var(--phosphor); }
.screen.is-live .stick::after { animation: stick 3.2s ease-in-out infinite; }
.padkeys { display: flex; gap: 8px; flex-wrap: wrap; }
.padkeys span { font-family: var(--font-term); font-size: 20px; line-height: 1; padding: 8px 12px; border: 1px solid var(--phosphor); color: var(--phosphor); }
.screen.is-live .padkeys span { animation: padpress 3.2s steps(1) infinite; }
.screen.is-live .padkeys span:nth-child(2) { animation-delay: 1.1s; }
.screen.is-live .padkeys span:nth-child(3) { animation-delay: 2.2s; }

/* 分頁：五個功能，每格自己帶進度條 */
.demo-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.demo-tab {
  position: relative;
  text-align: left;
  padding: 12px 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-2);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.demo-tab::before {
  content: "";
  position: absolute; left: 0; top: 0; height: 2px; width: 100%;
  background: var(--jk-cyan);
  transform: scaleX(0); transform-origin: left;
}

.demo-tab i { display: block; font-family: var(--font-pixel); font-size: var(--label-size); font-style: normal; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 8px; }
.demo-tab b { display: block; font-size: var(--fs-sm); font-weight: 700; line-height: 1.35; }
.demo-tab:hover { border-color: var(--line-2); color: var(--ink); }
.demo-tab[aria-selected="true"] { border-color: var(--jk-cyan); background: rgba(34, 240, 255, 0.07); color: var(--ink); }
.demo-tab[aria-selected="true"] i { color: var(--jk-cyan); }
.demo-tab[aria-selected="true"]::before { animation: fill-x var(--demo-ms, 6500ms) linear forwards; }
.demo.is-paused .demo-tab[aria-selected="true"]::before { animation-play-state: paused; }
.demo-tab:focus-visible { outline: 2px solid var(--jk-gold); outline-offset: 2px; }

.demo-hint { margin-top: 8px; font-size: var(--fs-2xs); color: var(--muted); letter-spacing: 0.04em; }

/* ---- 區段 ------------------------------------------------------------------ */
.section { max-width: var(--max); margin: 0 auto; padding: 24px var(--gutter) 56px; width: 100%; }

.section-head {
  display: flex; align-items: end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap;
  margin: 8px 0 20px;
}

.section-head h2 { font-size: var(--fs-xl); font-weight: 800; line-height: 1.3; letter-spacing: -0.01em; }
.section-head p { color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }
.section-head .kicker { color: var(--jk-gold); }

/* ---- 封面卡 ---------------------------------------------------------------- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }

.game-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--panel-2);
  border: 1px solid #3a2468;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45);
  color: var(--ink);
  overflow: hidden;
  transform: translateZ(0);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  animation: rise 0.55s ease both;
}

.game-card:nth-child(1) { animation-delay: 0.02s; }
.game-card:nth-child(2) { animation-delay: 0.05s; }
.game-card:nth-child(3) { animation-delay: 0.08s; }
.game-card:nth-child(4) { animation-delay: 0.11s; }
.game-card:nth-child(5) { animation-delay: 0.14s; }
.game-card:nth-child(6) { animation-delay: 0.17s; }
.game-card:nth-child(7) { animation-delay: 0.2s; }
.game-card:nth-child(8) { animation-delay: 0.23s; }

.game-card:hover { transform: translate(-3px, -3px); border-color: var(--jk-cyan); box-shadow: 8px 8px 0 var(--jk-pink); color: var(--ink); }
.game-card .cover { aspect-ratio: 3 / 4; background: #090614; overflow: hidden; }
.game-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s steps(6); }
.game-card:hover .cover img { transform: scale(1.08); }

.game-card .insert {
  position: absolute; left: 8px; top: 8px; z-index: 1;
  font-family: var(--font-pixel); font-size: var(--label-size); letter-spacing: 0.1em;
  background: var(--jk-gold); color: #1a1020; padding: 6px 8px;
  opacity: 0; transform: translateY(-6px); transition: 0.16s ease;
}

.game-card:hover .insert { opacity: 1; transform: none; }
.game-card .title { padding: 10px 12px 12px; font-size: 14px; font-weight: 700; line-height: 1.45; }

.more-card {
  min-height: 220px; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, rgba(139, 92, 246, 0.35), rgba(34, 240, 255, 0.12));
  border: 1px dashed var(--jk-cyan);
  color: var(--ink);
}

.more-card:hover { color: var(--ink); }
.more-card strong { font-family: var(--font-pixel); font-size: 12px; line-height: 1.6; letter-spacing: 0.08em; margin-bottom: 10px; }
.more-card span { font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.7; }

/* ---- 總表 ------------------------------------------------------------------ */
.catalog-tools { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.catalog-count { font-size: var(--fs-sm); color: var(--jk-cyan); white-space: nowrap; }

.catalog-filters { display: flex; gap: 8px; margin: 0 0 14px; flex-wrap: wrap; }
.catalog-filters input[type="search"] { flex: 1; min-width: 220px; height: 40px; }

.catalog-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }

.catalog-chips .chip,
.mods-chip {
  display: inline-flex; gap: 6px; align-items: baseline;
  height: 32px; padding: 0 11px; align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 700;
  white-space: nowrap;
}

.catalog-chips .chip b, .mods-chip b { color: var(--muted); font-weight: 400; font-size: var(--fs-xs); }
.catalog-chips .chip:hover, .mods-chip:hover { border-color: var(--jk-cyan); color: var(--jk-cyan); }
.catalog-chips .chip.is-on { border-color: var(--jk-cyan); color: var(--jk-cyan); background: rgba(34, 240, 255, 0.08); }
.catalog-chips .chip.is-on b { color: var(--jk-cyan); }
.chip-sep { flex: 1; min-width: 8px; }

.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); }

.catalog-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: rgba(14, 9, 28, 0.96);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.catalog-item:hover { background: rgba(34, 240, 255, 0.08); color: var(--jk-cyan); }
.catalog-item .year { color: var(--muted); font-size: var(--fs-xs); font-weight: 400; }
.catalog-item .catalog-tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.catalog-item .tag { font-size: var(--fs-2xs); font-weight: 400; color: var(--muted); border: 1px solid var(--line); padding: 1px 6px; line-height: 1.5; }
.catalog-item .tag-mod { color: var(--jk-gold); border-color: rgba(255, 229, 102, 0.5); }
.catalog-item.is-hidden { display: none; }

.empty-state { padding: 40px 12px; text-align: center; color: var(--muted); font-size: var(--fs-base); }

.catalog-pages, .mods-pages { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 24px 0 0; }
.catalog-pages span, .mods-pages span { color: var(--muted); font-size: var(--fs-sm); }

/* ---- 麵包屑 ---------------------------------------------------------------- */
.crumbs {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  max-width: var(--max); width: 100%;
  margin: 0 auto; padding: 14px var(--gutter) 0;
  font-size: var(--fs-sm); color: var(--muted);
}

.crumbs a { color: var(--muted); border-bottom: 1px solid transparent; }
.crumbs a:hover { color: var(--ink); border-bottom-color: currentColor; }
.crumbs [aria-current] { color: var(--ink); }

/* ---- 遊戲頁 ---------------------------------------------------------------- */
.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px var(--gutter) 56px;
  width: 100%;
}

.arcade {
  background: linear-gradient(#171029, #0b0716);
  border: 2px solid #3c2468;
  box-shadow: 0 0 0 2px var(--jk-pink), 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: 14px 14px 16px;
  align-self: start;
}

.arcade-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 2px 4px 12px; }
.arcade-top h1 { font-size: var(--fs-lg); font-weight: 800; line-height: 1.3; }
.notice { font-size: var(--fs-xs); color: var(--muted); letter-spacing: 0.04em; }

.bezel { background: #000; border: 2px solid #22183a; position: relative; }
#screen_container { background: #000; }
canvas.emscripten { border: 0 none; background: #000; width: 100%; display: block; image-rendering: auto !important; }

.play-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.hud { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.hud-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px 18px 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
}

.hud-card h2 { margin: 0 0 12px; }
.hud-card p { margin: 0 0 8px; }
.hud-card p:last-child { margin-bottom: 0; }
.hud-card > div { margin-bottom: 6px; }

.hud-card kbd {
  display: inline-block; min-width: 1.8em; text-align: center;
  padding: 1px 7px; margin: 0 6px 4px 0;
  background: #1d1433; border: 1px solid var(--line-2);
  font-family: var(--font-ui); font-size: var(--fs-xs); font-weight: 700; color: var(--ink);
}

.hud-card code { color: var(--jk-gold); font-family: var(--font-ui); font-weight: 700; }

/* ---- 頁尾（同時是網站地圖）------------------------------------------------ */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line-2);
  padding: 32px var(--gutter) 36px;
  background: rgba(5, 4, 12, 0.9);
  font-size: var(--fs-sm);
}

.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 20px 24px; max-width: var(--max); margin: 0 auto; }
.footer-col h2 { margin: 0 0 10px; }
.footer-col a { display: block; color: var(--muted); font-size: var(--fs-sm); line-height: 2.1; }
.footer-col a:hover { color: var(--jk-cyan); }

.footer-about { max-width: var(--max); margin: 26px auto 0; padding-top: 18px; border-top: 1px solid var(--line); }
.footer-about p { margin: 0 0 6px; font-size: var(--fs-sm); line-height: 1.8; color: var(--muted); }
.footer-about strong { color: var(--ink); }
.footer-credit a { color: var(--jk-gold); }

/* ---- 全螢幕 ---------------------------------------------------------------- */
.html-fullscreen {
  position: fixed; left: 0; top: 0;
  max-width: 100%; max-height: 100%; height: 100%; width: 100%;
  z-index: 2000; object-fit: contain;
}

.exit_fullscreen { position: fixed; right: 1rem; bottom: 1rem; opacity: 0.18; z-index: 3000; display: none; }
.exit_fullscreen_show { display: block !important; }
.exit_fullscreen_show:hover { opacity: 1; }

/* ---- 劇院模式（YouTube theater 那種）-------------------------------------- */
body.theater .play-layout { grid-template-columns: minmax(0, 1fr); max-width: none; gap: 0; padding: 0 0 32px; }
body.theater .ticker { display: none; }
body.theater .arcade { border-left: 0; border-right: 0; box-shadow: 0 0 0 2px var(--jk-pink); padding: 8px 0 10px; }

body.theater .arcade-top,
body.theater .play-actions,
body.theater .hud {
  max-width: var(--max); margin-left: auto; margin-right: auto;
  padding-left: var(--gutter); padding-right: var(--gutter); width: 100%;
}

body.theater .hud { margin-top: 18px; }
body.theater .bezel { border-left: 0; border-right: 0; display: flex; justify-content: center; align-items: center; }
body.theater #screen_container { display: flex; justify-content: center; width: 100%; }

/* 尺寸由 game.js 算好寫進變數；!important 是因為 em-dosbox 會覆寫 canvas 的 inline style。 */
body.theater canvas.emscripten:not(.html-fullscreen) {
  width: var(--theater-w, 100%) !important;
  height: var(--theater-h, auto) !important;
  margin: 0 auto;
}

/* ---- 語言切換 -------------------------------------------------------------- */
.lang-switch { display: inline-flex; border: 1px solid var(--line); flex-shrink: 0; }
.lang-switch a { padding: 0 9px; height: 30px; display: inline-flex; align-items: center; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
.lang-switch a + a { border-left: 1px solid var(--line); }
.lang-switch a:hover { color: var(--jk-cyan); }
.lang-switch a.is-on { background: var(--jk-cyan); color: #07060f; }

/* ---- 站內對話框與提示（ui-dialog.js）-------------------------------------- */
body.dlg-open { overflow: hidden; }

.dlg {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(7, 6, 15, 0.9);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}

.dlg[hidden] { display: none; }

.dlg-box {
  background: var(--bg-2);
  border: 1px solid var(--jk-purple);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.22), var(--shadow);
  width: min(440px, 100%);
  padding: 22px 24px 20px;
  animation: dlg-in 0.16s ease-out;
}

.dlg-msg { margin: 0 0 18px; font-size: var(--fs-base); line-height: 1.8; color: var(--ink); }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 5100;
  max-width: min(420px, calc(100vw - 32px));
  background: var(--bg-2);
  border: 1px solid var(--jk-cyan);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-size: var(--fs-sm); line-height: 1.7; color: var(--ink);
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.is-in { opacity: 1; transform: none; }
.toast-warn { border-color: var(--jk-gold); }
.toast-error { border-color: var(--jk-pink); }

/* ---- 動畫 ------------------------------------------------------------------ */
@keyframes twinkle { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.85; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes chroma {
  0%, 92%, 100% { text-shadow: 2px 0 var(--jk-pink), -2px 0 var(--jk-cyan); }
  93% { text-shadow: -4px 0 var(--jk-pink), 4px 0 var(--jk-cyan); }
  96% { text-shadow: 2px 0 var(--jk-cyan), -2px 0 var(--jk-gold); }
}
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fill { to { width: 100%; } }
@keyframes fill-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fadein { to { opacity: 1; } }
@keyframes light { to { color: #04030a; background: var(--phosphor); border-color: var(--phosphor); } }
@keyframes rowhi {
  0%, 32% { background: rgba(183, 255, 216, 0.14); border-color: var(--phosphor); color: #fff; }
  33%, 100% { background: transparent; border-color: transparent; color: var(--phosphor); }
}
@keyframes rowhi-part { 0%, 32% { opacity: 1; } 33%, 100% { opacity: 0; } }
@keyframes hexflip { 0%, 44% { color: var(--jk-pink); } 45%, 100% { color: var(--jk-gold); } }
@keyframes hexnew { 0%, 44% { opacity: 0; } 45%, 100% { opacity: 1; } }
@keyframes grow { to { transform: scale(1); } }
@keyframes press { 0%, 100% { background: transparent; color: var(--phosphor); } 50% { background: var(--phosphor); color: #04030a; } }
@keyframes stick {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(18px, 0); }
  40% { transform: translate(0, -18px); }
  60% { transform: translate(-18px, 0); }
  80% { transform: translate(0, 18px); }
}
@keyframes padpress { 0%, 8% { background: var(--phosphor); color: #04030a; } 9%, 100% { background: transparent; color: var(--phosphor); } }

/* ---- 響應式 ---------------------------------------------------------------- */
@media (max-width: 1120px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .search-form { order: 5; flex-basis: 100%; margin-left: 0; }
  .lang-switch { margin-left: auto; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; margin-left: 0; }
  .nav-links { display: none; order: 6; width: 100%; flex-direction: column; align-items: stretch; margin-left: 0; padding: 4px 0 6px; }
  .nav-links a { padding: 10px 8px; border-bottom: 1px solid var(--line); }
  .nav-links a::after { display: none; }
  .topbar.is-open .nav-links { display: flex; }
}

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 32px; }
  .hero-copy .lede { max-width: none; }
  .play-layout { grid-template-columns: 1fr; }
  .demo-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .demo-tab { padding: 10px 8px; }
  .demo-tab b { font-size: var(--fs-xs); }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; --fs-display: 30px; }
  .crt { aspect-ratio: auto; min-height: 380px; padding: 14px 16px 16px; }
  .boot, .screen .cmd { font-size: 21px; }
  .demo-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .demo-tab i { display: none; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .stat { padding: 10px 10px 8px; }
  .stat b { font-size: 13px; }
  .brand-name { font-size: 11px; }
  .brand-sub { display: none; }
  /* 手機：頂欄只留一行（品牌、語言、選單）；搜尋收進選單裡，sticky 才不會吃掉四分一個螢幕 */
  .topbar { min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
  .search-form { display: none; }
  .topbar.is-open .search-form { display: flex; order: 7; margin-top: 4px; }
  .hero { padding-top: 24px; }
  .hero-copy .eyebrow .eyebrow-more { display: none; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .toast { left: 16px; right: 16px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-stars, .ticker-track, .brand-name, .cursor, .game-card, .game-card .cover img, .crt-led i,
  .screen *, .demo-tab::before {
    animation: none !important;
    transition: none !important;
  }
  .fx-scan { display: none; }
  .screen .is-live-only, .screen .sync-ok, .screen .hexline.new { opacity: 1; }
  .screen .prog span { width: 100%; }
  .screen .row:first-child { background: rgba(183, 255, 216, 0.14); border-color: var(--phosphor); }
  .screen .row:first-child i, .screen .row:first-child .tag { opacity: 1; }
}
