/* Homepage-only Noto Sans TC subsets. Rebuild these when homepage copy changes. */
@font-face { font-family: "Noto Sans TC"; src: url("home-regular.woff?v=20261123-home-refresh-v1") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Noto Sans TC"; src: url("home-bold.woff?v=20261123-home-refresh-v1") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
:root {
  color-scheme: dark;
  --background: #181818;
  --surface: #1f1f1f;
  --surface-hover: #272727;
  --line: #34332e;
  --text: #f5f0e6;
  --muted: #b8b8b2;
  --accent: #b99a58;
  --accent-soft: rgba(185, 154, 88, 0.12);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  background: var(--background);
  color: var(--text);
  scroll-padding-top: 24px;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, summary { font: inherit; cursor: pointer; }
button { color: inherit; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
h1, h2, h3, p { margin: 0; }
.shell { width: min(1280px, calc(100% - 160px)); margin-inline: auto; }

/* Header */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 24px; }
.brand { display: inline-flex; align-items: center; min-height: 44px; font-size: 24px; line-height: 36px; font-weight: 700; }
.desktop-nav { display: flex; align-items: center; gap: 24px; }
.nav-pill { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 8px; font-size: 14px; line-height: 20px; color: var(--muted); }
.nav-pill:hover { background: var(--surface); color: var(--text); }

/* Hero: intro + one small featured game + a three-way jump index */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 32px 48px; align-items: end; padding-block: 48px 56px; }
.hero-intro { display: grid; gap: 16px; }
h1 { font-size: 56px; line-height: 68px; font-weight: 700; text-wrap: balance; }
.eyebrow { color: var(--accent); font-size: 14px; line-height: 24px; font-weight: 700; }
.hero-lead { max-width: 40ch; color: var(--muted); font-size: 18px; line-height: 30px; }

.feature { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; min-width: 0; padding: 16px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: background-color 200ms, border-color 200ms; }
.feature:hover { background: var(--surface-hover); border-color: #4a4639; }
.feature-code { width: 44px; height: 52px; border-radius: 6px; background: repeating-linear-gradient(90deg, var(--accent) 0 3px, transparent 3px 5px, var(--accent) 5px 6px, transparent 6px 9px, var(--accent) 9px 13px, transparent 13px 15px) center / 32px 36px no-repeat, var(--accent-soft); }
.feature-body { display: grid; min-width: 0; }
.feature-tag { color: var(--accent); font-size: 13px; line-height: 20px; font-weight: 700; }
.feature-title { font-size: 20px; line-height: 30px; font-weight: 700; }
.feature-desc { color: var(--muted); font-size: 14px; line-height: 22px; }

.jump { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.jump-link { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 2px; align-items: baseline; min-height: 44px; padding: 16px 20px; transition: background-color 200ms; }
.jump-link + .jump-link { border-left: 1px solid var(--line); }
.jump-link:hover { background: var(--surface); }

.jump-name { font-size: 18px; line-height: 28px; font-weight: 700; }
.jump-list { color: var(--muted); font-size: 14px; line-height: 22px; }

.arrow { color: var(--accent); font-weight: 700; transition: transform 200ms; }
a:hover .arrow { transform: translateX(4px); }

/* Category index: heading column + tools column */
.tool-section { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px 48px; padding-block: 40px; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
.section-head { display: grid; align-content: start; gap: 8px; }

h2 { font-size: 26px; line-height: 38px; font-weight: 700; }
.card-description { color: var(--muted); font-size: 16px; line-height: 28px; }

.tool-card { position: relative; display: grid; align-content: start; gap: 12px; min-width: 0; padding: 28px; border-radius: 16px; background: var(--surface); overflow-wrap: anywhere; transition: background-color 200ms; }
.tool-card:hover, .tool-card:active { background: var(--surface-hover); }
h3 { font-size: 26px; line-height: 38px; font-weight: 700; text-wrap: balance; }
.tool-card > .arrow { position: absolute; top: 28px; right: 28px; font-size: 18px; }
.tool-card .eyebrow { padding-right: 32px; }
.card-action { color: var(--accent); font-size: 16px; line-height: 28px; font-weight: 700; }

.discover-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; }
.tool-card.is-primary { gap: 16px; padding: 32px; background: var(--surface); border: 1px solid #3d3929; }
.tool-card.is-primary:hover { background: var(--surface-hover); }
.tool-card.is-primary h3 { font-size: 34px; line-height: 46px; }

.tool-list { display: grid; margin: 0; padding: 0; list-style: none; }
.tool-list li + li { border-top: 1px solid var(--line); }
.tool-row { display: grid; grid-template-columns: minmax(160px, 220px) minmax(0, 1fr) auto; align-items: center; gap: 8px 24px; min-height: 44px; padding: 18px 16px; border-radius: 12px; overflow-wrap: anywhere; transition: background-color 200ms; }
.tool-row:hover { background: var(--surface); }
.row-text { display: grid; }
.row-meta { color: var(--accent); font-size: 13px; line-height: 20px; font-weight: 700; }
.row-title { font-size: 20px; line-height: 30px; font-weight: 700; }
.row-desc { color: var(--muted); font-size: 15px; line-height: 26px; }

.play-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.tool-card.is-compact { padding: 24px; }
.tool-card.is-compact h3 { font-size: 22px; line-height: 32px; }
.tool-card.is-compact > .arrow { top: 24px; right: 24px; }

/* Footer */
.site-footer { display: grid; gap: 16px; padding-block: 40px; border-top: 1px solid var(--line); }
.footer-brand { display: inline-flex; align-items: center; min-height: 44px; font-size: 20px; line-height: 32px; font-weight: 700; justify-self: start; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 24px; color: var(--muted); font-size: 14px; line-height: 26px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
.footer-links a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }
.footer-note { max-width: 80ch; color: var(--muted); font-size: 14px; line-height: 26px; }

/* Mobile menu (native details, enhanced by home.js) */
.mobile-menu { display: none; position: relative; }
.mobile-menu summary { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border-radius: 8px; font-size: 14px; line-height: 20px; list-style: none; }
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-menu[open] summary { background: var(--surface-hover); }
.menu-panel { position: absolute; right: 0; top: calc(100% + 12px); z-index: 10; display: grid; width: min(288px, calc(100vw - 32px)); gap: 4px; padding: 16px; border: 1px solid #45443c; border-radius: 16px; background: var(--surface); }
.menu-panel a, .menu-panel button { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 8px; }
.menu-panel button[hidden] { display: none; }
.menu-panel a:hover { background: var(--surface-hover); }
.menu-panel button { border: 0; background: transparent; color: var(--accent); text-align: left; }
.skip-link { position: fixed; left: 16px; top: 16px; z-index: 20; transform: translateY(-200%); padding: 12px 16px; background: var(--text); color: var(--background); border-radius: 8px; }
.skip-link:focus { transform: translateY(0); }

@media (max-width: 1000px) {
  .shell { width: calc(100% - 64px); }
  .desktop-nav { gap: 12px; }
  h1 { font-size: 44px; line-height: 56px; }
  .hero { grid-template-columns: minmax(0, 1fr); align-items: start; padding-block: 32px 40px; }
  /* Single column: DOM order (index, then featured game) is the visual order. */
  .feature, .jump { grid-column: auto; grid-row: auto; }
  .feature { max-width: 560px; }
  .tool-section { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .tool-row { grid-template-columns: minmax(140px, 180px) minmax(0, 1fr) auto; }
}
@media (max-width: 700px) {
  .shell { width: calc(100% - 32px); }
  .site-header { padding-block: 16px; }
  .desktop-nav { display: none; }
  .mobile-menu { display: block; }
  .hero { gap: 20px; padding-block: 16px 32px; }
  .hero-intro { gap: 8px; }
  h1 { font-size: 34px; line-height: 46px; }
  h1 span { display: block; }
  .hero-lead { font-size: 16px; line-height: 26px; }
  .feature { padding: 14px 16px; gap: 14px; }
  .feature-code { width: 40px; height: 48px; }
  .jump { grid-template-columns: minmax(0, 1fr); border-bottom: 0; }
  .jump-link { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line); }
  .jump-link + .jump-link { border-left: 0; }

  .jump-name { font-size: 16px; line-height: 26px; }
  .jump-list { justify-self: end; text-align: right; font-size: 13px; }
  .tool-section { padding-block: 32px; }
  h2 { font-size: 24px; line-height: 36px; }
  .discover-grid, .play-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tool-card, .tool-card.is-compact { padding: 20px; }
  .tool-card > .arrow, .tool-card.is-compact > .arrow { top: 20px; right: 20px; }
  .tool-card.is-primary { padding: 24px; }
  .tool-card.is-primary h3 { font-size: 28px; line-height: 40px; }
  h3, .tool-card.is-compact h3 { font-size: 22px; line-height: 32px; }
  .tool-row { grid-template-columns: minmax(0, 1fr) auto; padding: 16px 4px; }
  .row-desc { grid-column: 1; grid-row: 2; }
  .tool-row > .arrow { grid-column: 2; grid-row: 1 / span 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
  a:hover .arrow { transform: none; }
}
@media (forced-colors: active) {
  .tool-card, .feature { border: 1px solid CanvasText; }
  .feature-code { forced-color-adjust: none; }
}
