:root {
  --feature-green: #0b2c1c;
  --feature-warm: #fbfaf6;
  --feature-panel: #f7f6f2;
  --feature-line: #d9ddd3;
}

body { min-width: 320px; overflow: hidden; }
.page-backdrop, .page-scrim { position: fixed; inset: 0; }
.page-backdrop { z-index: 0; background: var(--paper); }
.page-backdrop iframe { display: block; width: 100%; height: 100%; border: 0; pointer-events: none; }
.page-scrim { z-index: 1; background: rgba(11, 39, 24, .48); }
.feature-dialog {
  position: fixed; z-index: 2; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; width: min(1024px, calc(100vw - 40px)); height: min(718px, calc(100dvh - 40px));
  padding: 86px 8.4% 36px; border-radius: 10px; background: var(--white); color: var(--ink); overflow-y: auto;
}
.feature-close { top: 28px; }
.feature-heading { text-align: center; margin: 0 0 26px; }
.feature-heading .eyebrow { display: none; }
.feature-heading h1 { margin: 0; color: var(--ink); font-size: clamp(34px, 4vw, 42px); line-height: 1.12; letter-spacing: -.025em; font-weight: 700; }
.flow-step { flex: 1; min-height: 0; }
.flow-step[hidden] { display: none; }
.flow-step.step-enter { animation: flow-step-enter 320ms cubic-bezier(.2, .75, .25, 1) both; }
@keyframes flow-step-enter {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.step-intro { max-width: 760px; margin: 28px auto 10px; text-align: center; font-size: 14px; line-height: 1.5; }
.book-search-wrap { position: relative; z-index: 2; max-width: 762px; margin: 0 auto; }
.book-search { height: 46px; display: flex; align-items: center; gap: 12px; padding: 0 14px; border-radius: 8px; background: #f5f5f4; }
.book-search:focus-within { outline: 2px solid #76a188; outline-offset: 2px; }
.book-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14px; }
.book-search input::placeholder { color: #707873; }
.book-search button { display: grid; place-items: center; width: 28px; height: 32px; border: 0; background: transparent; cursor: pointer; }
.book-search button img { width: 18px; height: 18px; }
.suggestions { position: absolute; top: calc(100% + 3px); left: 0; right: 0; max-height: min(390px, 48dvh); overflow: auto; padding: 12px 16px; border-radius: 8px; background: var(--feature-warm); box-shadow: 0 8px 24px #0b27181a; }
.suggestions[hidden] { display: none; }
.catalog-count { margin: 0 8px 8px; color: #52615a; font-size: 12px; }
.no-suggestions { margin: 8px; color: #52615a; font-size: 13px; }
.suggestion-option { width: 100%; display: flex; align-items: center; gap: 16px; padding: 9px 12px; border: 0; border-radius: 999px; color: var(--ink); background: transparent; text-align: left; cursor: pointer; }
.suggestion-option:hover, .suggestion-option:focus-visible { background: var(--feature-green); color: white; outline: 0; }
.suggestion-option img { width: 38px; height: 54px; object-fit: cover; border-radius: 2px; }
.suggestion-option small { display: block; margin-top: 2px; opacity: .76; }
.suggestion-option span { min-width: 0; }
.picked-book { max-width: 762px; margin: 10px auto 0; color: var(--ink); }
.picked-book:empty { display: none; }
.picked-book-card { position: relative; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 9px 14px; border-radius: 7px; background: var(--feature-warm); }
.picked-book-card img { width: 37px; height: 54px; border-radius: 2px; object-fit: cover; }
.picked-book-card strong, .picked-book-card small { display: block; }
.picked-book-card strong { font-size: 16px; font-weight: 500; }
.picked-book-card small { margin-top: 3px; color: #52615a; font-size: 13px; }
.picked-book-card > p { flex: 1 0 100%; margin: 0; color: #52615a; font-size: 12px; line-height: 1.4; }
.data-loading { color: #52615a; font-size: 12px; }
.popular-block { margin-top: 34px; }
.section-kicker { margin: 0 0 16px 6px; font-size: 14px; line-height: 20px; }
.popular-books { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; max-width: 720px; margin: 0 auto; }
.popular-universe { display: flex; min-width: 0; align-items: center; flex-direction: column; gap: 8px; padding: 7px; border: 1px solid transparent; border-radius: 8px; color: var(--ink); background: transparent; cursor: pointer; transition: background .16s, border-color .16s, transform .16s; }
.popular-universe:hover, .popular-universe:focus-visible { transform: translateY(-2px); border-color: var(--feature-line); background: var(--feature-warm); outline: 0; }
.universe-cover { display: grid; place-items: center; width: min(100%, 128px); aspect-ratio: .73; overflow: hidden; border-radius: 3px; background: var(--feature-warm); box-shadow: 0 3px 7px #0b27181a; }
.universe-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.universe-name { max-width: 100%; text-align: center; font-size: 13px; font-weight: 600; line-height: 1.25; }
.feature-footer { position: relative; display: flex; justify-content: center; align-items: center; gap: 14px; flex: 0 0 auto; padding-top: 22px; }
.feature-footer button { min-width: 124px; }
.feature-footer button[hidden] { display: none; }
.next-action:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.back-action[hidden] { display: none; }
.preference-step { display: flex; flex-direction: column; align-items: center; }
.selected-book-summary { display: flex; align-items: center; gap: 16px; min-height: 62px; margin: 8px auto 28px; }
.selected-work { max-width: 620px; display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 6px 14px; }
.selected-work > img { width: 48px; height: 68px; object-fit: cover; grid-row: span 3; border-radius: 3px; }
.selected-work > span { align-self: end; }
.selected-work > p, .selected-work .book-tags { grid-column: 2; margin: 0; }
.selected-work > p { color: #52615a; font-size: 12px; line-height: 1.4; }
.book-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.book-tags span { padding: 3px 8px; border-radius: 999px; background: #eff1e8; color: #43584d; font-size: 10px; }
.selected-book-summary img { width: 44px; height: 62px; object-fit: cover; }
.selected-book-summary strong, .selected-book-summary small { display: block; }
.selected-book-summary strong { font-size: 17px; font-weight: 500; }
.selected-book-summary small { margin-top: 4px; color: #52615a; font-size: 14px; }
.preference-step h2, .results-step h2 { margin: 36px 0 30px; color: var(--ink); text-align: center; font-size: clamp(25px, 3vw, 32px); line-height: 1.2; letter-spacing: -.015em; }
.preference-hint { margin: -20px 0 20px; color: #52615a; font-size: 13px; text-align: center; }
.preference-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; max-width: 660px; margin: 0 auto; }
.preference-choice { min-height: 42px; padding: 0 25px; border: 1px solid var(--ink); border-radius: 999px; color: var(--ink); background: var(--feature-warm); box-shadow: 2px 2px 0 var(--ink); cursor: pointer; font-size: 14px; font-weight: 500; }
.preference-choice:hover { background: #eff1e8; }
.preference-choice[aria-pressed="true"] { color: white; background: var(--feature-green); }
.preference-choice:disabled:not([aria-pressed="true"]) { opacity: .45; cursor: not-allowed; }
.recommendation-copy { margin: 12px auto 0; text-align: center; font-size: 17px; line-height: 1.5; }
.recommendation-copy strong { font-weight: 700; }
.results-step h2 { margin: 15px 0 20px; }
.catalog-note { margin: -12px auto 10px; color: #52615a; font-size: 11px; text-align: center; }
.recommendations { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; max-width: 740px; margin: 0 auto; }
.recommendation-card { position: relative; display: flex; min-width: 0; flex-direction: column; color: var(--ink); text-decoration: none; transition: transform .18s ease; }
.recommendation-content { display: flex; min-width: 0; height: 100%; flex-direction: column; color: inherit; }
.recommendation-card .cover { display: grid; place-items: center; height: 216px; border-radius: 7px; background: var(--feature-warm); transition: background-color .18s ease, box-shadow .18s ease; }
.recommendation-card .cover img { max-width: 112px; max-height: 190px; object-fit: contain; transition: transform .18s ease; }
.recommendation-card:hover, .recommendation-card:focus-within { transform: translateY(-4px); }
.recommendation-card:hover .cover, .recommendation-card:focus-within .cover { background: #f0f1e8; box-shadow: 0 8px 18px rgba(11, 39, 24, .12); }
.recommendation-card:hover .cover img, .recommendation-card:focus-within .cover img { transform: scale(1.035); }
.recommendation-card .book-title { margin: 9px 0 2px; font-size: 14px; line-height: 1.25; font-weight: 600; }
.recommendation-card .book-author { color: #52615a; font-size: 11px; }
.recommendation-card .match-reason { margin-top: 6px; color: #52615a; font-size: 10px; line-height: 1.35; }
.results-loading, .results-empty { grid-column: 1 / -1; color: #52615a; text-align: center; font-size: 13px; }
.save-book { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 50%; color: var(--ink); background: var(--white); cursor: pointer; }
.save-book[aria-pressed="true"] { color: #a42f43; }
.is-closed .feature-dialog, .is-closed .page-scrim { display: none; }
.is-closed .page-backdrop iframe { pointer-events: auto; }

@media (max-width: 760px) {
  body { overflow: auto; }
  .page-backdrop { display: none; }
  .page-scrim { background: rgba(11,39,24,.55); }
  .feature-dialog { width: calc(100vw - 20px); height: min(820px, calc(100dvh - 20px)); padding: 62px 20px 22px; }
  .feature-close { top: 19px; }
  .feature-heading { margin-bottom: 14px; }
  .feature-heading h1 { font-size: 32px; }
  .step-intro { margin: 12px auto 14px; font-size: 13px; }
  .popular-block { margin-top: 26px; }
  .section-kicker { font-size: 12px; margin-left: 0; }
  .popular-books { gap: 6px; }
  .popular-universe { gap: 6px; padding: 5px 3px; }
  .universe-cover { width: min(100%, 90px); }
  .universe-name { font-size: 11px; }
  .suggestions { max-height: 42dvh; padding: 8px; }
  .suggestion-option { gap: 10px; padding: 8px; border-radius: 10px; }
  .suggestion-option img { width: 34px; height: 48px; }
  .feature-footer { padding-top: 14px; }
  .feature-footer button { min-width: 112px; }
  .selected-book-summary { margin: 6px auto 20px; }
  .selected-work { grid-template-columns: 40px 1fr; gap: 5px 10px; }
  .selected-work > img { width: 40px; height: 58px; }
  .book-tags span { font-size: 9px; }
  .preference-step h2, .results-step h2 { margin: 18px 0 22px; font-size: 25px; }
  .preference-hint { margin-top: -14px; }
  .preference-choices { gap: 11px; }
  .preference-choice { min-height: 40px; padding: 0 17px; font-size: 13px; }
  .recommendation-copy { margin-top: 4px; font-size: 15px; }
  .results-step h2 { margin: 12px 0 16px; }
  .recommendations { gap: 9px; }
  .recommendation-card .cover { height: 150px; }
  .recommendation-card .cover img { max-width: 88px; max-height: 140px; }
  .recommendation-card .book-title { font-size: 12px; }
  .recommendation-card .book-author { font-size: 10px; }
}

@media (max-width: 390px) {
  .feature-dialog { padding-right: 15px; padding-left: 15px; }
  .popular-books { gap: 2px; }
  .popular-universe { padding: 4px 2px; }
  .universe-name { font-size: 10px; }
  .recommendations { gap: 6px; }
  .recommendation-card .cover { height: 135px; }
  .recommendation-card .cover img { max-width: 76px; max-height: 120px; }
  .recommendation-card .book-title { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .flow-step.step-enter { animation: none; }
  .recommendation-card, .recommendation-card .cover, .recommendation-card .cover img { transition: none; }
}
