:root {
  color-scheme: dark;
  --bg: #0b0c13;
  --panel: #151724;
  --ink: #f3f3fb;
  --muted: #b9bfd1;
  --line: #303447;
  --accent: #c0c7ff;
  --mono: ui-monospace, Consolas, monospace;
  font-family: system-ui, "PingFang TC", "Microsoft JhengHei", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.65; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: 86px; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.18; }
p, h1, h2, h3 { overflow-wrap: anywhere; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid #bdc7ff; outline-offset: 4px; }
.page-shell, .header-inner { width: min(1200px, calc(100% - 64px)); margin-inline: auto; }
.skip-link {
  position: fixed; z-index: 10; top: 10px; left: 10px; padding: 10px 16px;
  background: var(--ink); color: var(--bg); transform: translateY(-150%);
}
.skip-link:focus { transform: none; }
.site-header {
  position: sticky; z-index: 5; top: 0; border-bottom: 1px solid var(--line);
  background: #0b0c13ec; backdrop-filter: blur(16px);
}
.header-inner { min-height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: .1em; white-space: nowrap; }
.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: clamp(14px, 2.6vw, 36px); color: var(--muted); font-size: .9rem; }
.site-nav a { padding-block: 11px; }
.site-nav a:hover, .site-footer a:hover { color: var(--accent); }
.menu-toggle { display: none; }
.hero {
  isolation: isolate; position: relative; overflow: hidden;
  background: radial-gradient(ellipse at 74% 40%, #272654, #15182b 41%, var(--bg) 75%);
}
.hero-layout { min-height: clamp(420px, 64svh, 605px); display: grid; align-items: center; }
.hero-copy { width: min(100%, 670px); padding-block: 60px; }
.eyebrow { color: var(--accent); font: 500 .8rem/1.45 var(--mono); letter-spacing: .14em; }
.version { margin-left: .55rem; color: var(--muted); letter-spacing: .03em; }
.hero h1 { margin: 18px 0; font-size: clamp(3rem, 6.2vw, 5.6rem); letter-spacing: -.06em; line-height: 1.08; }
.hero h1 em { color: #c8cdff; font-style: normal; }
.hero-description { max-width: 37ch; color: #d0d5e8; font-size: clamp(1rem, 1.5vw, 1.16rem); }
.hero-actions, .inline-links { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.hero-actions { margin-top: 24px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px;
  border: 1px solid #515674; border-radius: 9px; background: #181b2a;
  font-size: .9rem; font-weight: 650; transition: background .2s, border-color .2s;
}
.button:hover { background: #272c45; border-color: #9aabe2; }
.button-primary { color: #13152a; background: #c7ccff; border-color: #c7ccff; }
.button-primary:hover { background: #e1e4ff; border-color: #e1e4ff; }
.hero-scene {
  position: absolute; z-index: -1; inset: 0 0 0 37%; pointer-events: none;
  background-image: linear-gradient(#9daaff1b 1px, transparent 1px), linear-gradient(90deg, #9daaff1b 1px, transparent 1px);
  background-size: 42px 42px; mask-image: radial-gradient(ellipse, #000 25%, transparent 75%);
}
.hero-scene canvas { width: 100%; height: 100%; }
.summary-band { border-block: 1px solid var(--line); background: #141726; }
.stats-section { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-block: 0; }
.stat-item { display: flex; flex-direction: column-reverse; gap: 5px; padding: 17px clamp(10px, 2.5vw, 32px); border-inline-start: 1px solid var(--line); }
.stat-item:last-child { border-inline-end: 1px solid var(--line); }
.stat-item dd { margin: 0; color: var(--ink); font: 600 clamp(1.6rem, 3.4vw, 2.7rem)/1 var(--mono); }
.stat-item dt { color: var(--muted); font-size: .9rem; }
.page-section { padding-block: clamp(44px, 5.5vw, 78px); }
.section-band { border-block: 1px solid var(--line); background: #0f111c; }
.section-heading { margin-bottom: 24px; }
.section-heading h2 { margin: 9px 0; font-size: clamp(1.8rem, 4.2vw, 3rem); letter-spacing: -.042em; }
.section-heading p:not(.eyebrow), .bento-content p { max-width: 55ch; color: var(--muted); }
.bento, .ecosystem-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.bento-card, .ecosystem-card, .studio .section-heading {
  position: relative; isolation: isolate; min-width: 0; border: 1px solid var(--line);
  border-radius: 14px; background: linear-gradient(135deg, #191c2c, var(--panel));
}
.bento-card::after {
  position: absolute; z-index: -1; inset: 0; content: ""; opacity: 0; border-radius: inherit; transition: opacity .25s;
  background: radial-gradient(340px circle at var(--px, 50%) var(--py, 50%), #777ce634, transparent);
}
.bento-card:hover::after { opacity: 1; }
.labs-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.labs-grid .bento-card { grid-column: span 2; }
.labs-grid .bento-card:nth-child(4n + 1), .labs-grid .bento-card:nth-child(4n) { grid-column: span 3; }
.labs-grid .bento-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.bento-content, .ecosystem-card, .studio .section-heading { padding: clamp(17px, 2.4vw, 28px); }
.bento-content h3, .ecosystem-card h3 { margin-bottom: 8px; font-size: clamp(1.2rem, 2.5vw, 1.5rem); }
.ecosystem-card p, .ecosystem-card li { color: var(--muted); }
.ecosystem-card ul { padding-inline-start: 18px; }
.ecosystem-card a { color: var(--accent); }
.ecosystem-card a:hover { text-decoration: underline; }
.ecosystem-entries { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 12px; }
.text-link, .detail-back { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); text-decoration: underline; text-underline-offset: .28em; }
.text-link:hover, .detail-back:hover { color: var(--ink); }
.bento-content .text-link { margin-top: 6px; }
.live-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.live-grid .project-card { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); padding: 12px; align-items: stretch; }
.live-grid .project-visual { aspect-ratio: 2; height: 100%; }
.live-grid .project-info { align-self: center; padding: clamp(14px, 3vw, 32px); }
.live-grid .project-title-line h3 { font-size: clamp(1.45rem, 3vw, 2.2rem); }
.archive .section-heading { margin-bottom: 18px; }
.featured-section { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.subsection-heading { margin-bottom: 14px; }
.project-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; }
.project-controls input, .project-controls select, .filter-button {
  min-height: 44px; width: 100%; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel); color: var(--ink); font-size: .875rem;
}
.project-controls input::placeholder { color: var(--muted); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.filter-button { width: auto; }
.filter-button span { margin-left: .5em; color: var(--muted); font-family: var(--mono); }
.filter-button:hover, .filter-button.is-active { border-color: #9aa7ed; background: #252c4d; }
.project-results-count, .load-state, .filter-empty { margin: 12px 0; color: var(--muted); }
.load-state:empty, .project-results-count:empty { display: none; }
.project-grid, .related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.project-card {
  min-width: 0; display: flex; flex-direction: column; padding: 8px; border: 1px solid var(--line);
  border-radius: 13px; background: var(--panel); transition: border-color .2s, background .2s;
}
.project-card:hover, .project-card:focus-within { border-color: #727eae; background: #191d2e; }
.project-visual, .detail-visual, .related-visual {
  position: relative; isolation: isolate; display: grid; place-items: center; overflow: hidden; border-radius: 8px;
  background: repeating-linear-gradient(135deg, #929bf414 0 1px, transparent 1px 18px), radial-gradient(ellipse, #2e3266, #16192e);
  aspect-ratio: 2;
}
.project-visual img, .detail-visual img, .related-visual img, .cover-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-art { pointer-events: none; }
.visual-fallback { color: #c8cdff; font: 700 clamp(2rem, 5vw, 4rem) var(--mono); }
.visual-kicker, .visual-index { position: absolute; z-index: 1; color: #e5e8fa; font: .75rem var(--mono); padding: 4px 7px; border-radius: 4px; background: #101224eb; }
.visual-kicker { top: 8px; left: 8px; }
.visual-index { right: 8px; bottom: 8px; }
.project-info { flex: 1; display: flex; flex-direction: column; padding: 14px 8px 5px; }
.project-title-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.project-title-line h3 { font-size: 1.2rem; }
.project-category { color: var(--muted); font: .76rem var(--mono); margin-bottom: 5px; }
.project-arrow { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); }
.project-arrow:hover { background: #272c45; }
.project-description { margin: 9px 0; color: var(--muted); }
.tag-list, .project-meta, .project-actions, .detail-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.project-meta, .project-actions, .detail-actions { margin-top: 10px; }
.project-actions { margin-top: auto; padding-top: 8px; }
.tag-list span, .project-meta > *, .detail-heading .status-badge { border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.status-badge[data-status="開發中"], .status-badge[data-status="已完成"] { color: #9ee5cc; }
.status-badge[data-status="測試中"] { color: #f1cd9c; }
.status-badge[data-status="正式上線"] { color: #9ce6ba; border-color: #486153; background: #192c26; }
.project-action { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 4px; color: var(--accent); }
.project-action:hover { text-decoration: underline; }
.link-pending { color: var(--muted); font-size: .875rem; }
.updates-list, .detail-changelog { padding: 0; margin: 0; list-style: none; }
.update-item, .detail-changelog li { padding: 14px 16px; border-top: 1px solid var(--line); }
.update-item { display: grid; grid-template-columns: 100px minmax(0, 1fr); align-items: baseline; gap: 4px 16px; }
.update-item:last-child, .detail-changelog li:last-child { border-bottom: 1px solid var(--line); }
.update-item a { color: var(--accent); font-weight: 650; }
.update-item a:hover { text-decoration: underline; }
.update-item time, .detail-changelog time { color: var(--muted); font: .82rem var(--mono); }
.update-item p, .detail-changelog p { color: var(--muted); }
.studio { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.studio .section-heading { margin: 0; }
.studio .button { margin-top: 18px; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 70px; }
.detail-main { min-height: 70vh; padding-block: 22px 56px; }
.detail-heading { margin-block: 16px 22px; }
.detail-title { margin: 8px 0; font-size: clamp(2.15rem, 6vw, 4.65rem); letter-spacing: -.045em; }
.detail-summary, .detail-description p, .detail-section p, .detail-section-list { color: var(--muted); }
.detail-summary { margin-top: 10px; }
.detail-visual { width: 100%; aspect-ratio: 3; min-height: 150px; border: 1px solid var(--line); border-radius: 14px; }
.detail-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; margin-top: 16px; }
.detail-body h2, .detail-section h2 { margin-bottom: 12px; font-size: 1.3rem; }
.detail-description p { white-space: pre-line; }
.detail-info, .detail-section {
  min-width: 0; padding: clamp(16px, 2.5vw, 26px); border: 1px solid var(--line);
  border-radius: 13px; background: var(--panel);
}
.detail-section { margin-top: 16px; }
.detail-description .detail-section:first-child { margin-top: 0; }
.detail-body > :only-child { grid-column: 1 / -1; }
.detail-changelog p { margin-top: 6px; }
.detail-subheading { margin-top: 18px; }
.detail-section-list { padding-inline-start: 1.25rem; }
.detail-section-list li + li { margin-top: 6px; }
.detail-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin-block: 0 16px; }
.detail-facts dt { color: var(--muted); }
.detail-facts dd { margin: 0; overflow-wrap: anywhere; }
.detail-gallery, .screenshot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.screenshot-item { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.screenshot-item img { width: 100%; height: auto; }
.screenshot-item figcaption { padding: 8px 12px; color: var(--muted); }
.related-card { min-width: 0; display: grid; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; overflow-wrap: anywhere; }
.related-card:hover { border-color: var(--accent); color: var(--accent); }
.detail-changelog h3 { font-size: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.revealed { animation: reveal .52s both; }
@keyframes reveal { from { opacity: .68; transform: translateY(9px); } }

@media (max-width: 850px) {
  .header-inner, .page-shell { width: min(100% - 36px, 760px); }
  .project-grid, .related-grid, .ecosystem-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .header-inner { flex-wrap: wrap; gap: 0; min-height: 60px; }
  .site-nav { flex-basis: 100%; gap: 4px 18px; }
  .menu-toggle:not([hidden]) { display: grid; place-content: center; gap: 5px; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
  .menu-toggle span { display: block; width: 18px; height: 1px; background: var(--ink); }
  .menu-toggle:not([hidden]) + .site-nav { display: none; }
  .menu-toggle:not([hidden]) + .is-open { display: grid; grid-template-columns: 1fr 1fr; padding-bottom: 10px; }
  .hero-layout { min-height: 470px; align-items: start; }
  .hero-copy { padding-block: 38px 124px; }
  .hero-scene { inset: 30% -14% -14% 16%; opacity: .72; }
  .hero h1 { font-size: clamp(2.55rem, 9.5vw, 4.2rem); }
  .live-grid .project-card, .studio, .detail-body { grid-template-columns: 1fr; }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .labs-grid .bento-card:nth-child(n) { grid-column: auto; }
}
@media (max-width: 490px) {
  .hero-layout { min-height: 404px; }
  .hero-copy { padding-block: 32px 110px; }
  .stats-section { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-item:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .stat-item:nth-child(even) { border-inline-end: 1px solid var(--line); }
  .project-grid, .related-grid, .bento, .ecosystem-grid, .detail-gallery, .screenshot-grid { grid-template-columns: 1fr; }
  .project-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-control { grid-column: 1 / -1; }
  .update-item { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
