:root {
  --paper: #f1eddf;
  --paper-deep: #ddd4bf;
  --ink: #20201d;
  --blue: #1f4488;
  --blue-dark: #153260;
  --red: #b3412d;
  --yellow: #f2c84b;
  --line: rgba(32, 32, 29, .22);
  --heading-serif: "Chiron Sung HK", "Noto Serif TC", "Source Han Serif TC", serif;
  --serif: "Noto Sans TC", "Source Han Sans TC", "PingFang TC", -apple-system, "system-ui", sans-serif;
  --sans: "Noto Sans TC", "Source Han Sans TC", "PingFang TC", -apple-system, "system-ui", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(rgba(31,68,136,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(31,68,136,.035) 1px, transparent 1px);
  background-size: 24px 24px;
  font-family: var(--sans);
  font-synthesis: none;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; }
a { color: inherit; }
button, summary { cursor: pointer; }

.visually-hidden, .skip-link:not(:focus) {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; z-index: 100; top: 12px; left: 12px;
  padding: 10px 16px; color: white; background: var(--blue-dark);
}
:focus-visible { outline: 3px solid var(--blue-dark); outline-offset: 3px; }
.results :focus-visible, .evidence :focus-visible, .closing :focus-visible, footer :focus-visible { outline-color: var(--yellow); }

.site-header {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 76px;
  padding: max(12px, env(safe-area-inset-top)) max(clamp(20px, 4vw, 64px), env(safe-area-inset-right)) 12px max(clamp(20px, 4vw, 64px), env(safe-area-inset-left));
  border-bottom: 1px solid var(--ink); background: rgba(241, 237, 223, .94);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .08em; text-decoration: none; }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.site-header nav { display: flex; align-items: center; gap: clamp(18px, 3vw, 42px); font-size: 13px; font-weight: 700; }
.site-header nav a { text-underline-offset: 5px; }
.nav-cta { padding: 8px 14px; color: white; background: var(--blue); text-decoration: none; box-shadow: 3px 3px 0 var(--ink); }

.hero {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, .88fr) minmax(520px, 1.12fr);
  min-height: calc(100vh - 76px); border-bottom: 1px solid var(--ink); overflow: hidden;
}
.hero > *, .library > *, .library__catalog > *, .guide > *, .closing > * { min-width: 0; }
.hero::before {
  content: "貓取名"; position: absolute; z-index: -1; left: -7px; bottom: 16px;
  color: rgba(31,68,136,.09); font-size: clamp(70px, 12vw, 190px); font-weight: 700;
  letter-spacing: -.08em; line-height: .7; white-space: nowrap;
}
.hero__sun {
  position: absolute; z-index: -1; top: 9%; left: 39%; width: clamp(110px, 14vw, 210px); aspect-ratio: 1;
  border-radius: 50%; background: var(--red); opacity: .92;
  transform: translate3d(0, var(--hero-sun-y, 0px), 0); will-change: transform;
}
.hero__copy {
  position: relative; display: flex; flex-direction: column; justify-content: center;
  min-height: 760px; padding: 70px clamp(26px, 5vw, 90px) 90px;
}
.kicker { display: flex; gap: 14px; margin: 0 0 32px; font-size: 11px; font-weight: 700; letter-spacing: .2em; }
.kicker span:first-child { color: var(--red); }
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 30px; font-family: var(--heading-serif); font-size: clamp(58px, 7vw, 112px);
  font-weight: 900; letter-spacing: -.075em; line-height: .95;
}
h1 em { position: relative; color: var(--blue); font-style: normal; }
h1 em::after { content: ""; position: absolute; left: 2%; right: -5%; bottom: 2px; height: 10px; background: var(--yellow); z-index: -1; transform: rotate(-1.5deg); }
.hero__lead { margin-bottom: 14px; font-family: var(--serif); font-size: clamp(20px, 2vw, 29px); font-weight: 700; }
.hero__body { max-width: 590px; margin-bottom: 30px; font-size: 16px; }
.hero__facts { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.hero__facts span::before { content: "■"; margin-right: 7px; color: var(--red); font-size: 8px; }
.hero__cats { position: relative; height: 116px; margin-top: 38px; }
.hero__cats img { position: absolute; width: 150px; height: auto; filter: drop-shadow(3px 4px 0 rgba(31,68,136,.16)); animation: cat-breathe 3.4s ease-in-out infinite; }
.hero__cats img:nth-child(1) { left: 0; bottom: 0; transform: rotate(-6deg); }
.hero__cats img:nth-child(2) { left: 112px; bottom: 9px; animation-delay: -.9s; }
.hero__cats img:nth-child(3) { left: 227px; bottom: -2px; transform: rotate(5deg); animation-delay: -1.8s; }

.generator {
  align-self: center; width: min(680px, calc(100% - 52px)); margin: 52px auto;
  padding: clamp(24px, 4vw, 48px); border: 1px solid var(--ink); background: #faf7ed;
  box-shadow: 12px 12px 0 var(--blue);
}
.generator__heading { position: relative; padding-right: 70px; padding-bottom: 22px; border-bottom: 3px double var(--ink); }
.generator__heading h2 { margin-bottom: 4px; font-family: var(--heading-serif); font-size: clamp(27px, 3vw, 38px); line-height: 1.25; }
.generator__heading p { margin: 0; color: #595750; font-size: 13px; }
.generator__number { position: absolute; right: 0; top: 5px; color: var(--red); font-size: 11px; font-weight: 700; letter-spacing: .12em; writing-mode: vertical-rl; }
fieldset { min-width: 0; margin: 0; padding: 21px 0; border: 0; border-bottom: 1px solid var(--line); }
legend { padding: 0; margin-bottom: 12px; font-family: var(--serif); font-size: 16px; font-weight: 700; }
legend span { display: inline-grid; place-items: center; width: 25px; height: 25px; margin-right: 8px; color: white; background: var(--blue); font-family: var(--sans); font-size: 10px; }
.choice-grid { display: grid; gap: 7px; }
.choice-grid--four { grid-template-columns: repeat(4, 1fr); }
.choice-grid--three { grid-template-columns: repeat(3, 1fr); }
.choice-grid label { min-width: 0; }
.choice-grid input { position: absolute; opacity: 0; pointer-events: none; }
.choice-grid span {
  display: grid; place-items: center; gap: 2px; min-height: 48px; padding: 7px 8px;
  border: 1px solid var(--line); background: transparent; font-size: 12px; font-weight: 500;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.choice-grid span small { font-size: 9px; font-weight: 400; opacity: .6; line-height: 1.2; }
.choice-grid span:hover { border-color: var(--blue); transform: translateY(-2px); }
.choice-grid input:checked + span { color: white; border-color: var(--blue); background: var(--blue); box-shadow: inset 0 0 0 2px #faf7ed; }
.choice-grid input:checked + span small { opacity: .7; }
.choice-grid input:focus-visible + span { outline: 3px solid var(--blue-dark); outline-offset: 2px; }

/* 「其他／不確定」選項 */
.choice-other { display: block; margin-top: 8px; }
.choice-other input { position: absolute; opacity: 0; pointer-events: none; }
.choice-other span {
  display: grid; place-items: center; gap: 2px; text-align: center; padding: 9px 12px;
  border: 1px dashed var(--line); font-size: 11px; font-weight: 500; color: #6c685f;
  transition: border-color .16s ease, color .16s ease;
}
.choice-other span small { font-size: 9px; font-weight: 400; opacity: .7; line-height: 1.2; }
.choice-other input:checked + span { color: var(--blue); border-color: var(--blue); border-style: solid; }
.choice-other input:focus-visible + span { outline: 3px solid var(--blue-dark); outline-offset: 2px; }
.generate-button {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 64px;
  margin-top: 24px; padding: 12px 20px; color: white; border: 1px solid var(--ink); background: var(--red);
  box-shadow: 5px 5px 0 var(--ink); font-weight: 700; transition: transform .16s ease, box-shadow .16s ease;
}
.generate-button:hover { transform: translate(2px, 2px); box-shadow: 3px 3px 0 var(--ink); }
.generate-button span:last-child { font-size: 11px; letter-spacing: .18em; }
.generator__privacy { margin: 14px 0 0; color: #6c685f; text-align: center; font-size: 11px; }

.section-tag { color: var(--red); font-size: 11px; font-weight: 700; letter-spacing: .22em; }
.results { scroll-margin-top: 24px; padding: clamp(70px, 9vw, 130px) clamp(22px, 6vw, 90px); color: white; background: var(--blue-dark); border-bottom: 1px solid var(--ink); }
.results__heading { display: grid; grid-template-columns: 1.2fr .8fr; align-items: end; gap: 30px; margin: 16px 0 48px; }
.results__heading h2 { margin-bottom: 0; font-family: var(--heading-serif); font-size: clamp(40px, 5vw, 72px); line-height: 1.1; }
.results__heading p { max-width: 440px; margin: 0; color: #d6e4ed; }
.results__heading > div > p { margin-bottom: 8px; color: var(--yellow); font-size: 13px; }
.result-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.result-card {
  position: relative; min-height: 330px; padding: 26px; color: var(--ink); border: 1px solid var(--ink);
  background: var(--paper); box-shadow: 6px 6px 0 var(--yellow); animation: ticket-in .5s both; animation-delay: var(--delay);
}
.result-card::after { content: "候選名字"; position: absolute; right: 17px; bottom: 20px; color: rgba(201,79,53,.22); font-family: var(--serif); font-size: 25px; font-weight: 900; transform: rotate(-12deg); }
.result-card__rank { display: block; margin-bottom: 28px; color: var(--red); font-size: 11px; font-weight: 700; letter-spacing: .16em; }
.result-card h3 { margin-bottom: 4px; font-family: var(--serif); font-size: clamp(47px, 5vw, 76px); line-height: 1; letter-spacing: -.08em; }
.result-card__reading { margin-bottom: 22px; color: var(--blue); font-size: 12px; letter-spacing: .12em; }
.result-card__note { max-width: 300px; font-size: 14px; }
.result-card__call { position: absolute; left: 26px; right: 26px; bottom: 18px; margin: 0; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 11px; }
.results__actions { display: flex; gap: 12px; margin-top: 34px; }
.results__actions button { min-height: 48px; padding: 10px 18px; color: white; border: 1px solid rgba(255,255,255,.55); background: transparent; }
.results__actions button:first-child { color: var(--ink); background: var(--yellow); border-color: var(--yellow); }
.page-error {
  position: fixed; z-index: 90; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 36px)); margin: 0; padding: 14px 18px;
  color: var(--ink); border: 1px solid var(--ink); background: var(--yellow); box-shadow: 5px 5px 0 var(--ink);
  font-size: 14px; font-weight: 700;
}

.library { padding: clamp(80px, 11vw, 160px) clamp(22px, 6vw, 90px); border-bottom: 1px solid var(--ink); }
.library__catalog { display: grid; grid-template-columns: minmax(270px, .75fr) 1.25fr; gap: clamp(40px, 8vw, 130px); }
.library__intro { position: sticky; top: 30px; align-self: start; }
.library h2, .guide h2, .faq h2 { margin: 17px 0 30px; font-family: var(--heading-serif); font-size: clamp(42px, 5vw, 72px); line-height: 1.08; letter-spacing: -.05em; }
.library__intro p { max-width: 440px; font-size: 15px; }
.name-shelves { border-top: 1px solid var(--ink); }
.name-shelves article { display: grid; grid-template-columns: 35px 140px 1fr; gap: 16px; align-items: start; padding: 26px 0; border-bottom: 1px solid var(--ink); }
.name-shelves article > span { color: var(--red); font-size: 11px; font-weight: 700; }
.name-shelves h3 { margin: 0; font-family: var(--serif); font-size: 19px; }
.name-shelves p { margin: 0; font-size: 15px; }
.name-shelves small { grid-column: 3; color: #625e56; font-size: 11px; }

.database, .evidence { margin-top: clamp(50px, 8vw, 110px); }
.database { padding-top: 42px; border-top: 3px double var(--ink); }
.database__heading { display: grid; grid-template-columns: 1fr 1.2fr; gap: 30px; align-items: end; margin-bottom: 32px; }
.database__heading h3, .evidence h3 { margin: 10px 0 8px; font-family: var(--serif); font-size: clamp(28px, 4vw, 46px); line-height: 1.2; }
.database__heading p { margin: 0; color: #6b675e; font-size: 13px; }
.database__filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.database__filters label { color: #625e56; font-size: 11px; font-weight: 700; }
.database__filters input, .database__filters select {
  width: 100%; min-height: 48px; margin-top: 6px; padding: 10px 12px;
  color: var(--ink); border: 1px solid var(--ink); border-radius: 0; background: #faf7ed;
  font-size: 16px;
}
.database__list { display: grid; grid-template-columns: repeat(6, 1fr); border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.database-name { position: relative; min-height: 124px; padding: 16px 12px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); background: rgba(250,247,237,.72); }
.database-name h4 { margin: 9px 0 3px; font-family: var(--serif); font-size: 25px; line-height: 1.2; }
.database-name p { margin: 0; color: #6d685e; font-size: 10px; }
.database-name__tier { color: var(--red); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.database-name__sources { position: absolute; right: 9px; bottom: 8px; color: var(--blue); font-size: 10px; }
.database__empty { grid-column: 1 / -1; margin: 0; padding: 42px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); text-align: center; }
.database__more { display: block; min-height: 48px; margin: 24px auto 0; padding: 10px 20px; border: 1px solid var(--ink); background: var(--yellow); box-shadow: 4px 4px 0 var(--ink); font-weight: 700; }
.evidence { padding: clamp(36px, 5vw, 64px); color: white; background: var(--blue-dark); box-shadow: 10px 10px 0 var(--red); }
.evidence .section-tag { color: var(--yellow); }
.evidence__tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 30px; background: rgba(255,255,255,.3); }
.evidence__tiers article { padding: 24px; background: var(--blue-dark); }
.evidence__tiers article > span { color: var(--yellow); font-family: var(--serif); font-size: 28px; font-weight: 900; }
.evidence__tiers h4 { margin: 4px 0 10px; font-family: var(--serif); font-size: 17px; }
.evidence__tiers p { margin: 0; color: #d6dfed; font-size: 12px; }
.evidence__tiers .evidence-case {
  position: relative; isolation: isolate; display: flex; flex-direction: column; overflow: hidden;
  min-height: 216px; color: var(--ink); background: var(--yellow);
}
.evidence-case::before {
  content: ""; position: absolute; z-index: -1; top: -62px; right: -42px;
  width: 150px; aspect-ratio: 1; border: 1px solid rgba(31,68,136,.24); border-radius: 50%;
  box-shadow: 0 0 0 22px rgba(31,68,136,.08), 0 0 0 44px rgba(31,68,136,.05);
}
.evidence-case__meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.evidence-case__meta strong { color: var(--blue-dark); font-size: 11px; letter-spacing: .15em; }
.evidence-case__meta small { color: var(--red); font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.evidence-case h4 { max-width: 360px; margin: 0 0 7px; color: var(--ink); font-size: 20px; line-height: 1.45; }
.evidence-case p { max-width: 420px; color: #49463f; }
.evidence-case__player {
  display: grid; grid-template-columns: 34px 44px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  width: 100%; min-height: 52px; margin-top: auto; padding: 7px 10px; color: white;
  border: 1px solid var(--ink); border-radius: 0; background: var(--blue-dark); box-shadow: 4px 4px 0 var(--red);
  text-align: left; transition: transform .16s ease, box-shadow .16s ease;
}
.evidence-case__player:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--red); }
.evidence-case__player > b:not(.evidence-case__wave) { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.evidence-case__player > small { color: #d6dfed; font-size: 9px; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.evidence-case__icon { position: relative; width: 32px; height: 32px; border: 1px solid rgba(255,255,255,.62); border-radius: 50%; }
.evidence-case__icon::after {
  content: ""; position: absolute; top: 9px; left: 12px;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 9px solid white;
}
.evidence-case__player.is-playing .evidence-case__icon::before,
.evidence-case__player.is-playing .evidence-case__icon::after {
  content: ""; position: absolute; top: 9px; width: 3px; height: 12px; border: 0; background: white;
}
.evidence-case__player.is-playing .evidence-case__icon::before { left: 11px; }
.evidence-case__player.is-playing .evidence-case__icon::after { left: 17px; }
.evidence-case__wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 24px; }
.evidence-case__wave i { width: 2px; height: var(--wave-height); background: var(--yellow); transform-origin: center; }
.evidence-case__wave i:nth-child(1), .evidence-case__wave i:nth-child(5) { --wave-height: 8px; }
.evidence-case__wave i:nth-child(2), .evidence-case__wave i:nth-child(4) { --wave-height: 15px; }
.evidence-case__wave i:nth-child(3) { --wave-height: 22px; }
.evidence-case__player.is-playing .evidence-case__wave i { animation: case-wave .7s ease-in-out infinite alternate; }
.evidence-case__player.is-playing .evidence-case__wave i:nth-child(2) { animation-delay: -.45s; }
.evidence-case__player.is-playing .evidence-case__wave i:nth-child(3) { animation-delay: -.2s; }
.evidence-case__player.is-playing .evidence-case__wave i:nth-child(4) { animation-delay: -.6s; }
.evidence-case__note { margin-top: 12px !important; font-size: 9px !important; line-height: 1.5; }
.evidence-case__submit {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 9px; align-items: center;
  width: 100%; min-height: 44px; margin-top: 8px; padding: 7px 9px; overflow: hidden;
  color: var(--blue-dark); border: 1px solid rgba(31,68,136,.35);
  background: rgba(255,255,255,.18); text-decoration: none;
  transition: background .16s ease, transform .16s ease;
}
.evidence-case__submit svg { display: block; width: 22px; max-width: none; height: 22px; }
.evidence-case__submit > span {
  display: grid; min-width: 0; color: var(--blue-dark); font-family: var(--sans);
  font-size: initial; font-weight: 400; line-height: 1.35;
}
.evidence-case__submit strong { font-size: 10px; line-height: 1.35; }
.evidence-case__submit small { color: #565149; font-size: 9px; line-height: 1.35; }
.evidence-case__submit:hover { background: rgba(255,255,255,.36); transform: translateY(-1px); }
.evidence-case__submit:focus-visible { outline: 2px solid var(--blue-dark); outline-offset: 3px; }
.source-notes {
  margin-top: 26px; border-color: rgba(255,255,255,.45);
  font-family: var(--sans); font-size: 9px; line-height: 1.65;
}
.source-notes summary { font-family: inherit; font-size: 10px; }
.source-notes > div { max-width: 850px; padding-bottom: 10px; }
.source-notes p { margin: 8px 0 0; color: #d6dfed; }
.source-notes a { color: var(--yellow); text-underline-offset: 3px; }

.guide { display: grid; grid-template-columns: .75fr 1.25fr; gap: clamp(40px, 8vw, 130px); padding: clamp(80px, 11vw, 150px) clamp(22px, 6vw, 90px); color: white; background: var(--red); border-bottom: 1px solid var(--ink); }
.guide .section-tag { color: var(--paper); }
.guide ol { margin: 0; padding: 0; list-style: none; }
.guide li { display: grid; grid-template-columns: 70px 1fr; gap: 22px; padding: 30px 0; border-top: 1px solid rgba(255,255,255,.5); }
.guide li > span { font-family: var(--serif); font-size: 43px; line-height: 1; }
.guide li h3 { margin-bottom: 8px; font-family: var(--serif); font-size: 24px; }
.guide li p { margin: 0; max-width: 600px; }
.guide aside { grid-column: 2; padding: 22px; color: var(--ink); background: var(--yellow); transform: rotate(-1deg); }
.guide aside p { margin-bottom: 4px; font-size: 10px; font-weight: 700; letter-spacing: .14em; }
.guide aside strong { font-family: var(--serif); font-size: 18px; }

.faq { display: grid; grid-template-columns: minmax(250px, .72fr) minmax(0, 1.28fr); gap: clamp(44px, 8vw, 120px); padding: clamp(80px, 10vw, 140px) clamp(22px, 8vw, 130px); background: linear-gradient(90deg, rgba(222,64,55,.06) 1px, transparent 1px) 0 0 / 34px 34px, var(--paper); }
.faq__heading { position: sticky; top: 30px; align-self: start; }
.faq h2 { max-width: 620px; margin-bottom: 24px; font-size: clamp(38px, 4.4vw, 66px); }
.faq__heading > p { max-width: 450px; color: #56534c; font-size: 15px; }
.faq__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; counter-reset: faq; }
.faq details { position: relative; min-height: 190px; padding: 20px 20px 22px; border: 1px solid var(--ink); background: var(--paper); box-shadow: 5px 5px 0 var(--ink); counter-increment: faq; }
.faq details:nth-child(3n + 1) { box-shadow: 5px 5px 0 var(--red); }
.faq details:nth-child(3n + 2) { box-shadow: 5px 5px 0 var(--yellow); }
.faq summary { position: relative; padding: 45px 40px 0 0; font-family: var(--serif); font-size: 19px; font-weight: 700; line-height: 1.55; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "0" counter(faq); position: absolute; left: 0; top: 0; color: var(--blue); font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 36px; color: var(--red); font-family: var(--sans); font-size: 26px; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin-top: 16px; padding-top: 16px; color: #56534c; border-top: 1px solid var(--line); font-size: 14px; }

.closing { display: grid; grid-template-columns: minmax(220px, 420px) minmax(0, 650px); align-items: center; justify-content: center; gap: clamp(20px, 6vw, 90px); padding: 80px 24px; color: white; background: var(--blue); }
.closing img { width: 100%; height: auto; filter: drop-shadow(7px 9px 0 rgba(21,50,96,.55)); }
.closing p { color: var(--yellow); font-size: 13px; font-weight: 700; letter-spacing: .08em; }
.closing h2 { margin-bottom: 30px; font-family: var(--heading-serif); font-size: clamp(35px, 5vw, 64px); line-height: 1.15; }
.closing a { display: inline-block; padding: 13px 20px; color: var(--ink); background: var(--yellow); box-shadow: 4px 4px 0 var(--ink); font-weight: 700; text-decoration: none; }

footer { display: grid; grid-template-columns: 1fr auto; gap: 10px 30px; align-items: center; padding: 35px clamp(22px, 6vw, 90px); color: white; background: var(--ink); font-size: 12px; }
footer .brand img { filter: brightness(0) invert(1); }
footer p { margin: 0; color: #aaa89f; text-align: right; }
footer > div { grid-column: 1 / -1; display: flex; gap: 20px; justify-content: flex-end; color: #aaa89f; }

@keyframes cat-breathe { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
@keyframes ticket-in { from { opacity: 0; transform: translateY(34px) rotate(-1deg); } to { opacity: 1; transform: none; } }
@keyframes case-wave { from { transform: scaleY(.45); } to { transform: scaleY(1); } }
@keyframes scroll-depth-in {
  from { opacity: .16; translate: var(--scroll-shift, 0 48px); scale: var(--scroll-scale, .985); }
  to { opacity: 1; translate: none; scale: 1; }
}
/* 讓長頁面有一致的捲動景深；沒有支援 view timeline 時維持原始靜態版面。 */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .library__intro,
    .name-shelves article,
    .database,
    .guide__heading,
    .guide li,
    .guide aside,
    .faq details,
    .closing > * {
      animation-name: scroll-depth-in;
      animation-duration: auto;
      animation-timing-function: linear;
      animation-fill-mode: both;
      animation-timeline: view();
      animation-range: entry 7% cover 32%;
    }

    .library__intro { --scroll-shift: -48px 20px; }
    .name-shelves article { --scroll-shift: 52px 0; }
    .name-shelves article:nth-child(odd) { --scroll-shift: -52px 0; }
    .database { --scroll-shift: 0 72px; --scroll-scale: .965; animation-range: entry 5% cover 28%; }
    .guide__heading { --scroll-shift: -52px 22px; }
    .guide li { --scroll-shift: 64px 0; }
    .guide li:nth-child(2) { --scroll-shift: 78px 0; }
    .guide li:nth-child(3) { --scroll-shift: 92px 0; }
    .guide aside { --scroll-shift: 0 54px; --scroll-scale: .97; }
    .faq details { --scroll-shift: -18px 52px; --scroll-scale: .975; }
    .faq details:nth-child(even) { --scroll-shift: 18px 52px; animation-range: entry 12% cover 37%; }
    .closing > img { --scroll-shift: -72px 12px; --scroll-scale: .96; }
    .closing > div { --scroll-shift: 72px 12px; }

    @media (max-width: 700px) {
      .library__intro,
      .database,
      .guide__heading,
      .guide li,
      .guide li:nth-child(2),
      .guide li:nth-child(3),
      .guide aside,
      .faq details,
      .faq details:nth-child(even),
      .closing > img,
      .closing > div { --scroll-shift: 0 36px; }

      /* 手機橫向卡片改跟著左右滑動進場，不把整頁撐出畫面。 */
      .name-shelves article,
      .name-shelves article:nth-child(odd),
      .name-shelves article:nth-child(even) {
        --scroll-shift: 32px 0;
        animation-timeline: view(inline);
        animation-range: entry 7% cover 42%;
      }
      .name-shelves article:nth-child(even) { --scroll-shift: -32px 0; }
    }
  }
}

@media (min-width: 981px) {
  .hero__lead { font-size: clamp(16px, 1.5vw, 22px); }
  .library h2 { font-size: clamp(36px, 4vw, 56px); }
  .guide__heading { position: sticky; top: 30px; align-self: start; }
}

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero__copy { min-height: auto; padding-bottom: 30px; }
  .hero__sun { top: 7%; left: auto; right: 8%; }
  .generator { margin-top: 0; }
  .library__catalog, .guide { grid-template-columns: 1fr; }
  .library__intro { position: static; }
  .guide aside { grid-column: 1; }
  .database__list { grid-template-columns: repeat(4, 1fr); }
}

/* 橫向捲動容器共用：兩側漸層淡出，暗示可滑 */
.scroll-x {
  display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 10px; margin: 0 -6px; padding-inline: 6px;
  -webkit-mask-image: linear-gradient(to right, transparent, black 18px, black calc(100% - 18px), transparent);
  mask-image: linear-gradient(to right, transparent, black 18px, black calc(100% - 18px), transparent);
  scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > * { flex: 0 0 auto; scroll-snap-align: start; }

@media (max-width: 700px) {
  .site-header { min-height: 64px; }
  .site-header nav a:not(.nav-cta) { display: none; }
  .brand span { font-size: 12px; }
  .hero__copy { padding: 48px 18px 20px; }
  .hero__sun { display: none; }
  .kicker { flex-direction: column; gap: 2px; }
  h1 { font-size: clamp(48px, 16vw, 72px); }
  .hero__cats img { width: 110px; height: auto; }
  .hero__cats img:nth-child(2) { left: 78px; }
  .hero__cats img:nth-child(3) { left: 156px; }

  /* Generator 減肥 */
  .generator { position: relative; z-index: 1; width: calc(100% - 24px); margin-bottom: 40px; padding: 20px 14px; box-shadow: 5px 5px 0 var(--blue); }
  .generator::before {
    content: ""; position: absolute; z-index: -2;
    top: -55px; right: 24px; width: 110px; aspect-ratio: 1;
    border-radius: 50%; background: var(--red); opacity: .92;
    clip-path: inset(0 0 50% 0); pointer-events: none;
  }
  .generator__heading { padding-right: 28px; padding-bottom: 16px; }
  .generator__heading h2 { font-size: clamp(17px, 5.1vw, 20px); letter-spacing: -.04em; white-space: nowrap; }
  fieldset { padding: 16px 0; }

  /* 保留標題原本的兩段節奏，但避免每段在手機上再次折行 */
  .library h2 { font-size: clamp(24px, 7.7vw, 32px); white-space: nowrap; }

  /* 所有 choice-grid 改橫向捲動 + fade edge */
  .choice-grid--four, .choice-grid--three {
    display: flex; gap: 8px;
    overflow-x: auto; scroll-snap-type: x mandatory;
    overscroll-behavior-inline: contain; touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px; margin: 0 -4px; padding-inline: 4px;
    -webkit-mask-image: linear-gradient(to right, transparent, black 14px, black calc(100% - 14px), transparent);
    mask-image: linear-gradient(to right, transparent, black 14px, black calc(100% - 14px), transparent);
    scrollbar-width: none;
  }
  .choice-grid--four::-webkit-scrollbar, .choice-grid--three::-webkit-scrollbar { display: none; }
  .choice-grid--four label, .choice-grid--three label {
    flex: 0 0 auto; scroll-snap-align: start; width: 84px;
  }
  .choice-grid--four span, .choice-grid--three span { font-size: 12px; }

  /* Result：橫向票根展示 */
  .results__heading { grid-template-columns: 1fr; }
  .results__heading h2 { font-size: clamp(27px, 8vw, 34px); white-space: nowrap; }
  .result-list {
    display: flex; gap: 14px;
    overflow-x: auto; scroll-snap-type: x mandatory;
    overscroll-behavior-inline: contain; touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    margin: 0 -18px; padding-inline: 18px; padding-bottom: 12px;
    -webkit-mask-image: linear-gradient(to right, transparent, black 18px, black calc(100% - 18px), transparent);
    mask-image: linear-gradient(to right, transparent, black 18px, black calc(100% - 18px), transparent);
    scrollbar-width: none;
  }
  .result-list::-webkit-scrollbar { display: none; }
  .result-card { flex: 0 0 85vw; scroll-snap-align: center; min-height: 280px; }
  .results__actions { flex-direction: column; }
  .results__actions button { width: 100%; }

  /* name-shelves：橫向卡片輪播 */
  .name-shelves {
    display: flex; gap: 14px;
    overflow-x: auto; scroll-snap-type: x mandatory;
    overscroll-behavior-inline: contain; touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    border-top: none; margin: 0 -18px; padding-inline: 18px; padding-bottom: 12px;
    -webkit-mask-image: linear-gradient(to right, transparent, black 18px, black calc(100% - 18px), transparent);
    mask-image: linear-gradient(to right, transparent, black 18px, black calc(100% - 18px), transparent);
    scrollbar-width: none;
  }
  .name-shelves::-webkit-scrollbar { display: none; }
  .name-shelves article {
    flex: 0 0 78vw; scroll-snap-align: center;
    grid-template-columns: 28px 1fr; gap: 10px;
    padding: 20px 4px; border-bottom: none; border-right: 1px solid var(--ink);
  }
  .name-shelves article p, .name-shelves small { grid-column: 2; }

  /* database 搜尋結果：橫向 */
  .database__heading, .database__filters { grid-template-columns: 1fr; }
  .database__list {
    display: flex; gap: 12px;
    overflow-x: auto; scroll-snap-type: x mandatory;
    overscroll-behavior-inline: contain; touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    border-top: none; border-left: none;
    margin: 0 -18px; padding-inline: 18px; padding-bottom: 12px;
    -webkit-mask-image: linear-gradient(to right, transparent, black 18px, black calc(100% - 18px), transparent);
    mask-image: linear-gradient(to right, transparent, black 18px, black calc(100% - 18px), transparent);
    scrollbar-width: none;
  }
  .database__list::-webkit-scrollbar { display: none; }
  .database-name { flex: 0 0 72vw; scroll-snap-align: center; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }

  /* evidence tiers：橫向紙卡 */
  .evidence { padding: 30px 18px 34px; box-shadow: 6px 6px 0 var(--red); }
  .evidence h3 { max-width: 300px; font-size: clamp(28px, 9vw, 34px); }
  .evidence__tiers {
    display: flex; align-items: stretch; gap: 12px;
    overflow-x: auto; scroll-snap-type: x mandatory;
    overscroll-behavior-inline: contain; touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    margin: 24px -18px 0; padding: 0 18px 10px;
    background: transparent; scroll-padding-inline: 18px;
    -webkit-mask-image: none; mask-image: none;
    scrollbar-width: none;
  }
  .evidence__tiers::-webkit-scrollbar { display: none; }
  .evidence__tiers article {
    display: flex; flex: 0 0 min(78vw, 300px); flex-direction: column;
    min-width: min(78vw, 300px); min-height: 210px; padding: 22px;
    color: var(--ink); border: 1px solid var(--ink); background: var(--paper);
    box-shadow: 5px 5px 0 var(--yellow); scroll-snap-align: start;
  }
  .evidence__tiers article > span { color: var(--blue); font-size: 32px; line-height: 1.15; }
  .evidence__tiers h4 { margin: 12px 0 10px; color: var(--ink); font-size: 19px; line-height: 1.45; }
  .evidence__tiers p { color: #56534c; font-size: 13px; line-height: 1.75; }

  .faq { grid-template-columns: 1fr; background-size: 26px 26px; }
  .faq__heading { position: static; }
  .faq__grid { grid-template-columns: 1fr; }
  .faq details { min-height: 0; }
  .closing { grid-template-columns: 1fr; text-align: center; }
  .closing img { width: min(280px, 80vw); margin: 0 auto; }
  .closing h2 { font-size: clamp(28px, 8vw, 35px); }
  footer { grid-template-columns: 1fr; text-align: left; }
  footer p { text-align: left; }
  footer > div { justify-content: flex-start; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .library__intro,
  .name-shelves article,
  .database,
  .guide__heading,
  .guide li,
  .guide aside,
  .faq details,
  .closing > * { animation: none !important; opacity: 1; translate: none; scale: 1; }
  .evidence-case__player.is-playing .evidence-case__wave i { animation: none; }
}
