:root {
  color-scheme: light;
  --paper: #f5f7ef;
  --white: #fff;
  --ink: #18291f;
  --muted: #4b5c51;
  --green: #185840;
  --deep: #18392c;
  --mint: #e7f1de;
  --line: #d7e0d2;
  --radius: 1.15rem;
  font: 100%/1.55 Inter, "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--green); }
a, button, select { touch-action: manipulation; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #a25521; outline-offset: 3px; }
button:disabled { cursor: default; opacity: .52; }
h1, h2, h3, p { margin-top: 0; }
h1 { line-height: 1.15; letter-spacing: -.035em; }
h2, h3 { line-height: 1.32; }
.frame { width: min(100% - 3rem, 72rem); margin-inline: auto; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { display: block; padding: .55rem 1rem; position: absolute; z-index: 2; background: var(--white); }
.site-header { background: #fffefa; border-bottom: 1px solid var(--line); }
.header-inner { min-height: 4.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 760; font-size: 1.16rem; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 1.08rem; height: 1.08rem; display: inline-block; background: #408d51; transform: rotate(45deg); border-radius: .18rem; box-shadow: inset -4px -4px 0 #276745; margin: .2rem; }
.main-nav { display: flex; flex-wrap: wrap; align-items: center; gap: clamp(.5rem, 3.1vw, 1.8rem); }
.main-nav a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.main-nav a[aria-current], .main-nav a:hover { color: var(--green); text-decoration: underline; text-underline-offset: .32em; }
.home { padding-block: 2.2rem 4.2rem; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(13rem, 28%); gap: 2rem; align-items: center; background: var(--deep); color: var(--white); border-radius: 1.5rem; padding: clamp(2rem, 5.7vw, 4.45rem); min-height: 20rem; }
.hero h1 { font-size: clamp(3rem, 7vw, 5rem); margin-bottom: 1rem; }
.hero p { color: #e0ede2; max-width: 34rem; margin-bottom: 1.7rem; font-size: 1.07rem; }
.primary, .subtle-button { min-height: 2.72rem; display: inline-flex; justify-content: center; align-items: center; width: fit-content; border-radius: .55rem; padding: .54rem .9rem; font-weight: 680; text-decoration: none; white-space: nowrap; }
.primary { background: #daf0ad; color: #223725; border: 1px solid transparent; }
.primary:hover { background: #effbd7; }
.subtle-button { background: var(--white); color: var(--green); border: 1px solid #b6cbbd; }
.subtle-button:not(:disabled):hover { background: #edf5e9; border-color: var(--green); }
.hero-card { display: grid; justify-content: center; gap: 1rem; padding: 1.7rem 1rem; min-height: 13rem; border: 1px solid #548066; border-radius: var(--radius); color: #e1edd7; background: #214635; text-align: center; font-size: .76rem; line-height: 1.45; letter-spacing: .15em; }
.hero-card b { color: #e5f5ad; }
.shelf-visual { align-self: end; display: flex; gap: .34rem; justify-content: center; align-items: flex-end; width: 7.2rem; height: 6rem; padding-bottom: .37rem; border-bottom: 2px solid #78a08a; }
.shelf-visual i { width: .82rem; height: 3.8rem; border-radius: .14rem; background: #a6d59e; border-top: .43rem double #214635; border-bottom: .55rem double #214635; }
.shelf-visual i:nth-child(2) { height: 4.4rem; width: 1.03rem; background: #d5ec9f; }
.shelf-visual i:nth-child(3) { height: 3.35rem; width: .96rem; background: #86bc9f; }
.shelf-visual i:nth-child(4) { height: 3.7rem; background: #e7bb82; transform: rotate(-16deg); transform-origin: bottom center; margin-left: .45rem; }
.home-section { margin-top: clamp(2rem, 5vw, 3rem); scroll-margin-top: 1rem; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.section-heading h2, .section-heading p { margin: 0; }
.section-heading h2, .source-note h2 { font-size: clamp(1.32rem, 3vw, 1.65rem); }
.project-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.1rem; padding: 1.15rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); text-decoration: none; color: var(--ink); }
.project-card:hover, .topic-grid a:hover { border-color: #74a586; background: #fcfff7; }
.project-card strong { display: block; font-size: clamp(1.12rem, 3vw, 1.32rem); }
.project-icon { width: 3.7rem; height: 3.7rem; display: grid; place-items: center; border-radius: .78rem; background: var(--mint); color: var(--green); font-weight: 750; font-size: .97rem; letter-spacing: .03em; }
.project-subtitle { display: block; }
.project-subtitle, .topic-grid a span { color: var(--muted); font-size: .95rem; }
.project-action { color: var(--green); font-weight: 650; }
.topic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.topic-grid a { display: grid; gap: .3rem; background: var(--white); border: 1px solid var(--line); padding: .95rem 1.1rem; border-radius: .7rem; text-decoration: none; }
.source-note { padding: 0 0 0 1rem; border-left: 2px solid #9ebe9e; }
.source-note h2 { margin-bottom: .5rem; }
.source-note p { margin-bottom: .4rem; color: var(--muted); }
.site-footer { border-top: 1px solid var(--line); padding: 1.3rem 0; color: var(--muted); font-size: .94rem; }

.catalog { padding-block: 2.6rem 4rem; }
.catalog-hero { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.catalog-hero h1 { font-size: clamp(2rem, 5vw, 3.65rem); margin-bottom: .6rem; overflow-wrap: anywhere; }
.catalog-hero p { margin-bottom: .35rem; color: var(--muted); }
.catalog-hero .catalog-game { color: var(--green); font-size: .92rem; font-weight: 700; margin-bottom: .55rem; }
.catalog-hero .snapshot { font-size: .88rem; }
.filters { display: grid; gap: .85rem; padding: 1.1rem 1.25rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.filters label { display: grid; gap: .26rem; min-width: 0; }
.filters label > span { font-size: .88rem; font-weight: 690; }
.filters input, .filters select { width: 100%; min-width: 0; border: 1px solid #bbcdbc; border-radius: .54rem; min-height: 2.7rem; background-color: #fbfdf9; padding: .48rem .72rem; }
.filters select { appearance: none; padding-right: 1.58rem; background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%), linear-gradient(135deg, var(--green) 50%, transparent 50%); background-position: calc(100% - .83rem) 52%, calc(100% - .57rem) 52%; background-size: .27rem .27rem; background-repeat: no-repeat; }
.filters input::placeholder { color: #56665c; opacity: 1; }
.filter-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; align-items: end; gap: .65rem; }
.results { margin-top: 1.8rem; }
.result-count { font-size: .93rem; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.entry-card { min-width: 0; padding: 1.05rem; background: var(--white); border: 1px solid var(--line); border-radius: .9rem; display: flex; flex-direction: column; align-items: start; overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.badge { padding: .12rem .47rem; background: var(--mint); border-radius: .31rem; font-size: .81rem; line-height: 1.45; color: var(--green); font-weight: 640; }
.badge.theme { background: #f0f2ee; color: #4a574f; }
.badge.retired { background: #f6e9da; color: #6d4319; }
.entry-card h3 { margin: 0; font-size: 1.13rem; }
.english { color: var(--muted); font-size: .85rem; margin: .23rem 0 .55rem; }
.card-summary { font-size: .96rem; margin-bottom: .72rem; }
.entry-link { margin-top: auto; font-size: .91rem; color: var(--green); font-weight: 680; text-underline-offset: .19em; }
.empty-state { background: var(--white); border: 1px dashed #a7bfae; border-radius: var(--radius); padding: 1.6rem 1rem; color: var(--muted); }
.pagination { display: flex; justify-content: center; align-items: center; gap: .8rem; margin-top: 1.25rem; }
.pagination span { color: var(--muted); text-align: center; font-size: .93rem; }

dialog { width: min(41rem, 100% - 1.6rem); max-height: min(50rem, 90vh); padding: 0; background: var(--white); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); overscroll-behavior: contain; }
dialog::backdrop { background: rgb(18 43 29 / .58); }
body:has(dialog[open]) { overflow: hidden; }
.detail-inner { display: flow-root; padding: clamp(1rem, 4vw, 1.7rem); overflow-wrap: anywhere; }
.close-detail { float: right; margin: 0 0 .5rem .65rem; }
.detail-inner h2 { margin-bottom: .3rem; font-size: clamp(1.45rem, 5vw, 2.02rem); }
.detail-inner h3 { margin-bottom: .34rem; font-size: 1.03rem; color: var(--green); }
.detail-inner section { margin-top: 1.1rem; }
.detail-inner section p { margin: 0; }
.entry-meta { display: grid; gap: .4rem; border-block: 1px solid var(--line); padding-block: .7rem; }
.entry-meta div { display: grid; grid-template-columns: 7rem 1fr; gap: .45rem; }
.entry-meta dt, .detail-note { color: var(--muted); }
.entry-meta dd { margin: 0; }
.detail-links { display: flex; gap: .4rem .95rem; flex-wrap: wrap; }
.detail-links a { text-underline-offset: .19em; }
.detail-note { font-size: .89rem; margin: 1.1rem 0 0; }

@media (max-width: 58rem) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 42rem) {
  .frame { width: calc(100% - 2rem); }
  .home { padding-top: 1rem; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding: 2rem 1.35rem; }
  .hero-card { display: none; }
  .topic-grid { grid-template-columns: 1fr; gap: .55rem; }
  .project-card { grid-template-columns: auto 1fr; gap: .7rem; }
  .project-action { display: none; }
  .catalog { padding-top: 1.45rem; }
  .catalog-hero { display: block; }
  .catalog-hero .subtle-button { margin-top: .6rem; }
  .filters { padding: .8rem; }
  .filter-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 32rem) {
  .cards { grid-template-columns: 1fr; }
  .header-inner { align-items: start; flex-direction: column; gap: .42rem; padding-block: .65rem; }
  .main-nav a { min-height: 1.5rem; }
}
