@import "tailwindcss";

:root {
  --paper: #f7f2e8;
  --paper-deep: #e9dfd0;
  --surface: #fffaf1;
  --surface-warm: #f2e8d9;
  --wine: #7b3345;
  --wine-dark: #5f2433;
  --sage: #718276;
  --sage-dark: #4f6256;
  --ink: #2f332e;
  --muted: #676a65;
  --gold: #bb925a;
  --gold-soft: #ead6ae;
  --focus: #075f9a;
  --line: rgba(47, 51, 46, 0.17);
  --line-strong: rgba(47, 51, 46, 0.36);
  --radius-lg: 24px;
  --radius-md: 17px;
  --radius-sm: 11px;
  --display: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", Georgia, serif;
  --body: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.6; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.app-shell { min-height: 100vh; overflow-x: clip; background: var(--paper); }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px; color: #fff; background: var(--focus); font-weight: 800; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.live-notice { position: fixed; z-index: 30; bottom: 12px; left: 50%; width: min(680px, calc(100vw - 32px)); min-height: 1.2em; margin: 0; transform: translateX(-50%); text-align: center; color: var(--wine-dark); font-size: 0.86rem; font-weight: 700; pointer-events: none; }
.eyebrow { margin: 0 0 8px; color: var(--wine); font-size: 0.71rem; font-weight: 800; letter-spacing: 0.16em; }
.brand-vintage, .brand-master { display: block; letter-spacing: -0.065em; }
.brand-vintage { color: var(--wine); }
.brand-master { color: var(--sage-dark); }
.bt-lab-link { color: var(--wine-dark); font-size: 0.84rem; font-weight: 700; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.bt-lab-link:hover { color: var(--sage-dark); }

/* Home: the three routes are the primary information hierarchy. */
.home-landing { min-height: calc(100vh - 150px); max-width: 1520px; margin: 0 auto; padding: clamp(20px, 4.5vw, 72px); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(460px, 0.9fr); grid-template-areas: "top top" "intro actions" "facts actions" "status actions"; gap: clamp(24px, 4vw, 58px); align-content: center; }
.home-topline { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--muted); font-size: 0.78rem; }
.home-intro { grid-area: intro; max-width: 720px; }
.home-intro > .eyebrow { margin: 0; padding-bottom: clamp(30px, 3vw, 46px); line-height: 1.5; }
.home-brand { margin: 0; display: grid; row-gap: 0.08em; font-family: var(--display); font-size: clamp(4.15rem, 8.6vw, 8.2rem); line-height: 1; font-weight: 500; }
.home-brand .brand-vintage, .home-brand .brand-master { letter-spacing: -0.045em; }
.home-intro > p:last-child { max-width: 625px; margin: 30px 0 0; font-size: clamp(1rem, 1.65vw, 1.28rem); line-height: 1.9; }
.home-intro strong { color: var(--wine-dark); }
.action-paths { grid-area: actions; display: grid; gap: 14px; align-content: center; }
.path-card { min-height: 146px; border: 1px solid var(--line-strong); border-left-width: 8px; border-radius: var(--radius-lg); padding: 22px 26px; display: grid; grid-template-columns: 110px minmax(0, 1fr); column-gap: 15px; text-align: left; color: var(--ink); background: var(--surface); box-shadow: 7px 7px 0 var(--paper-deep); }
.path-card:hover { border-color: var(--wine); box-shadow: 10px 10px 0 var(--gold-soft); transform: translate(-2px, -2px); }
.path-card > span { color: var(--muted); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.path-card strong { align-self: end; font-family: var(--display); font-size: clamp(1.7rem, 3.2vw, 2.45rem); line-height: 1.1; }
.path-card small { grid-column: 2; align-self: end; color: var(--muted); font-size: 0.84rem; line-height: 1.55; }
.path-card.learn { border-left-color: var(--wine); }
.path-card.review { border-left-color: var(--gold); background: #fbf0db; }
.path-card.lookup { border-left-color: var(--sage); background: #edf0e8; }
.home-facts { grid-area: facts; max-width: 720px; display: grid; grid-template-columns: repeat(3, max-content); gap: 20px clamp(26px, 4vw, 52px); align-items: end; border-top: 1px solid var(--line-strong); padding-top: 21px; }
.home-facts > div { display: grid; gap: 2px; }
.home-facts > div > strong { color: var(--wine-dark); font-family: var(--display); font-size: 2rem; line-height: 1; }
.home-facts > div > span { color: var(--muted); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.11em; }
.home-facts > p { grid-column: 1 / -1; max-width: 680px; margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.65; }
.home-transparency { grid-column: 1 / -1; max-width: 720px; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 19px; border-top: 1px solid var(--line); padding-top: 15px; }
.home-transparency > div { min-width: 0; border-left: 2px solid var(--gold); padding-left: 9px; }
.home-transparency > div:nth-child(3), .home-transparency > div:nth-child(4) { grid-column: 1 / -1; }
.home-transparency dt { color: var(--muted); font-size: 0.68rem; font-weight: 800; }
.home-transparency dd { margin: 3px 0 0; color: var(--ink); font-size: 0.78rem; line-height: 1.55; overflow-wrap: anywhere; }
.home-transparency ul { margin: 4px 0 0; padding-left: 16px; display: grid; gap: 5px; }
.home-transparency li { display: grid; gap: 1px; }
.home-transparency li strong { color: var(--wine-dark); font-size: 0.78rem; }
.home-transparency li span { color: var(--muted); font-size: 0.74rem; line-height: 1.4; }
.data-status { grid-area: status; align-self: start; justify-self: start; max-width: 520px; border-left: 3px solid var(--gold); padding: 10px 12px; color: var(--muted); background: var(--surface-warm); font-size: 0.78rem; line-height: 1.45; }
.data-status strong { display: block; }
.data-status .secondary-button { margin-top: 8px; padding: 6px 9px; font-size: 0.74rem; }

/* Shared navigation and page framing. */
.app-context { padding-bottom: 0; }
.vintage-tool-nav { width: min(1380px, calc(100% - 40px)); margin: 0 auto; padding: 9px 0; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 2px; border-bottom: 1px solid var(--line); }
.vintage-tool-nav button { min-height: 44px; border: 1px solid transparent; border-radius: 999px; padding: 8px 13px; color: var(--muted); background: transparent; font-size: 0.84rem; font-weight: 800; }
.vintage-tool-nav button:hover, .vintage-tool-nav button.active { border-color: var(--line-strong); color: var(--wine-dark); background: var(--surface); }
.vintage-tool-nav span { color: var(--wine-dark); }
.site-topbar { position: sticky; z-index: 10; top: 0; min-height: 68px; padding: 12px clamp(16px, 3.6vw, 56px); display: grid; grid-template-columns: max-content 1fr max-content; align-items: center; gap: 22px; border-bottom: 1px solid var(--line); background: rgba(247, 242, 232, 0.96); }
.brand-wordmark { min-height: 44px; border: 0; padding: 0; display: grid; align-content: center; text-align: left; background: transparent; font-family: var(--display); font-size: 1.4rem; line-height: 0.66; }
.brand-suite { margin-bottom: 5px; color: var(--muted); font-family: var(--body); font-size: 0.58rem; font-weight: 800; line-height: 1; letter-spacing: 0.08em; }
.primary-nav { justify-self: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.primary-nav button, .deck-buttons button { min-height: 44px; border: 1px solid transparent; border-radius: 999px; padding: 8px 13px; color: var(--muted); background: transparent; font-size: 0.84rem; font-weight: 800; }
.primary-nav button:hover, .primary-nav button.active, .deck-buttons button:hover, .deck-buttons button.active { border-color: var(--line-strong); color: var(--wine-dark); background: var(--surface); }
.primary-nav span { color: var(--wine-dark); }
.breadcrumb { width: min(1380px, calc(100% - 40px)); margin: 0 auto; padding-top: 15px; color: var(--muted); font-size: 0.76rem; }
.breadcrumb ol { margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 7px; list-style: none; }
.breadcrumb li { display: flex; align-items: center; gap: 7px; }
.breadcrumb li + li::before { content: "/"; color: var(--line-strong); }
.breadcrumb a { color: var(--wine-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.breadcrumb [aria-current="page"] { color: var(--ink); font-weight: 800; }
.system-statuses { width: min(1380px, calc(100% - 40px)); margin: 14px auto 0; display: grid; gap: 8px; }
.system-status { border: 1px solid var(--line-strong); border-left: 5px solid var(--gold); padding: 11px 14px; display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--ink); background: #fbf0db; font-size: 0.82rem; line-height: 1.55; }
.system-status strong { color: var(--wine-dark); }
.system-status.is-offline { border-left-color: var(--sage-dark); background: #edf2e8; }
.system-status.is-save-error { border-left-color: var(--wine); background: #f5e0e3; }
.context-main { width: min(1380px, calc(100% - 40px)); margin: 0 auto; padding: clamp(34px, 5vw, 72px) 0; }
.context-hero { max-width: 760px; margin-bottom: clamp(28px, 4vw, 50px); }
.context-hero h1, .context-hero h2 { margin: 0; font-family: var(--display); color: var(--wine-dark); font-size: clamp(3.1rem, 6vw, 5.6rem); font-weight: 500; line-height: 0.95; }
.context-hero > p:last-child { margin: 16px 0 0; color: var(--muted); line-height: 1.75; }
.primary-button, .secondary-button, .text-button { min-height: 44px; border-radius: var(--radius-sm); font-weight: 800; }
.primary-button { border: 1px solid var(--wine-dark); padding: 11px 15px; color: #fffaf1; background: var(--wine); }
.primary-button:hover { background: var(--wine-dark); }
.secondary-button { border: 1px solid var(--line-strong); padding: 10px 14px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); background: var(--surface); text-decoration: none; }
.secondary-button:hover { border-color: var(--sage-dark); background: #edf0e8; }
.text-button { border: 0; padding: 6px 0; color: var(--wine-dark); background: transparent; text-decoration: underline; text-underline-offset: 3px; }

/* Lookup. */
.lookup-layout { display: grid; grid-template-columns: minmax(250px, 310px) minmax(0, 1fr); gap: clamp(22px, 3.5vw, 52px); align-items: start; }
.filter-panel { position: sticky; top: 92px; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; background: var(--surface-warm); }
.field { min-width: 0; display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 0.73rem; font-weight: 800; letter-spacing: 0.03em; }
.lookup-axis { margin: 0; border: 0; padding: 0; }
.lookup-axis legend { padding: 0; color: var(--muted); font-size: 0.73rem; font-weight: 800; letter-spacing: 0.03em; }
.lookup-axis [role="group"] { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.lookup-axis button { min-height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 5px 4px; color: var(--ink); background: #fffaf3; font-size: 0.72rem; font-weight: 800; }
.lookup-axis button[aria-pressed="true"] { border-color: var(--wine); color: #fff; background: var(--wine); }
.lookup-axis small { color: var(--muted); font-size: 0.72rem; line-height: 1.45; }
.field input, .field select, .compare-picker select, .learn-controls select, .range-answer input { width: 100%; min-width: 0; border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 10px; color: var(--ink); background: #fffaf3; }
.field input:focus, .field select:focus, .compare-picker select:focus, .learn-controls select:focus, .range-answer input:focus { border-color: var(--wine); outline: 2px solid transparent; }
.reset-filter { grid-column: 1 / -1; justify-self: start; margin-top: 3px; }
.results-heading { min-height: 72px; margin-bottom: 18px; display: flex; align-items: end; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); padding-bottom: 15px; }
.results-heading h2 { margin: 0; color: var(--wine-dark); font-family: var(--display); font-size: 2.3rem; font-weight: 500; line-height: 1; }
.results-heading > p { max-width: 400px; margin: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.55; text-align: right; }
.wine-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.wine-card { min-width: 0; min-height: 208px; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; display: flex; flex-direction: column; align-items: stretch; gap: 7px; text-align: left; color: var(--ink); background: var(--surface); }
.wine-card:hover { border-color: var(--wine); background: #fff5e7; transform: translateY(-2px); }
.wine-card-top { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.importance-badge, .confidence-badge { border-radius: 999px; padding: 4px 7px; font-size: 0.67rem; font-weight: 800; white-space: nowrap; }
.importance-badge { color: var(--wine-dark); background: #f2e4ca; }
.confidence-high { color: #254b36; background: #dcebdc; }
.confidence-mid { color: #70531c; background: #faeccb; }
.confidence-check { color: #743846; background: #f2dfe3; }
.wine-card > strong { margin-top: 4px; font-family: var(--display); font-size: 1.18rem; line-height: 1.22; }
.wine-card > span:not(.wine-card-top) { color: var(--muted); font-size: 0.79rem; line-height: 1.35; }
.wine-card dl { margin: auto 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wine-card dl div { min-width: 0; border-top: 1px solid var(--line); padding-top: 7px; }
.wine-card dt { color: var(--muted); font-size: 0.65rem; font-weight: 800; }
.wine-card dd { margin: 2px 0 0; color: var(--wine-dark); font-family: var(--display); font-size: 0.96rem; line-height: 1.15; }
.lookup-results > .secondary-button, .lookup-drill-button { margin-top: 18px; }
.empty-state { border: 1px dashed var(--line-strong); border-radius: var(--radius-md); padding: clamp(24px, 5vw, 54px); text-align: center; background: var(--surface-warm); }
.empty-state h2 { margin: 0; color: var(--wine-dark); font-family: var(--display); font-size: 1.7rem; font-weight: 500; }
.empty-state p { margin: 10px auto 0; max-width: 540px; color: var(--muted); line-height: 1.6; }
.how-to-read { margin-top: clamp(45px, 7vw, 95px); border-top: 2px solid var(--wine); padding-top: 25px; display: grid; grid-template-columns: minmax(180px, 0.45fr) 1fr; gap: 36px; }
.how-to-read h2 { margin: 0; font-family: var(--display); color: var(--wine-dark); font-size: 2rem; font-weight: 500; }
.how-to-read ol { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; list-style: none; counter-reset: guide; }
.how-to-read li { border-left: 1px solid var(--line-strong); padding-left: 13px; counter-increment: guide; }
.how-to-read li::before { content: "0" counter(guide); display: block; margin-bottom: 6px; color: var(--gold); font-family: var(--display); font-size: 1.3rem; }
.how-to-read strong, .how-to-read span { display: block; }
.how-to-read span { margin-top: 5px; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }

/* Comparison. */
.compare-picker { margin-bottom: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.compare-picker label, .learn-controls > label { display: grid; gap: 7px; color: var(--muted); font-size: 0.75rem; font-weight: 800; }
.comparison-board { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--line-strong); background: var(--line-strong); }
.comparison-column { min-width: 0; padding: clamp(22px, 3.5vw, 48px); background: var(--surface); }
.comparison-column:nth-child(2) { background: #f8f0e5; }
.comparison-column h2 { margin: 0; font-family: var(--display); color: var(--wine-dark); font-size: clamp(1.7rem, 3vw, 2.6rem); font-weight: 500; }
.comparison-column > section { border-top: 1px solid var(--line); margin-top: 23px; padding-top: 14px; }
.comparison-column h3 { margin: 0 0 8px; font-size: 0.89rem; }
.comparison-column p { margin: 0; color: var(--muted); font-size: 0.87rem; line-height: 1.65; }
.vintage-pair { margin: 24px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.vintage-pair > section { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: #fffaf3; }
.vintage-pair .vintage-label { color: var(--muted); font-size: 0.68rem; font-weight: 800; }
.vintage-pair > section > strong { display: block; min-height: 1.6em; margin: 5px 0 7px; color: var(--wine-dark); font-family: var(--display); font-size: 1.25rem; }
.vintage-pair > section > small { display: inline-block; border-radius: 99px; padding: 3px 6px; font-size: 0.67rem; }
.vintage-audit { margin: 12px 0 0; display: grid; gap: 7px; }
.vintage-audit > div { border-top: 1px solid var(--line); padding-top: 7px; }
.vintage-audit dt { color: var(--muted); font-size: 0.65rem; font-weight: 800; }
.vintage-audit dd { margin: 2px 0 0; color: var(--ink); font-size: 0.74rem; line-height: 1.48; overflow-wrap: anywhere; }
.source-list { margin: 4px 0 0; padding-left: 16px; display: grid; gap: 4px; }
.source-list a { color: var(--wine-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.quiz-evidence-notes { margin: 6px 0 0; padding-left: 16px; display: grid; gap: 4px; color: var(--muted); }
.anchor-list { margin: 0; padding: 0; display: grid; gap: 8px; list-style: none; }
.anchor-list li { display: grid; grid-template-columns: 48px 1fr; gap: 9px; align-items: start; }
.anchor-list strong { color: var(--wine-dark); font-family: var(--display); font-size: 1.35rem; line-height: 1; }
.anchor-list span { color: var(--ink); font-size: 0.83rem; line-height: 1.45; }
.anchor-list small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.65rem; }
.exception-note { color: var(--wine-dark) !important; }
.comparison-diff { border: 1px solid var(--line-strong); border-top: 0; padding: clamp(20px, 3vw, 36px); background: var(--surface-warm); }
.comparison-diff h2 { margin: 0; font-family: var(--display); color: var(--wine-dark); font-size: 1.7rem; font-weight: 500; }
.comparison-diff dl { margin: 18px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.comparison-diff dl div { border-left: 2px solid var(--gold); padding-left: 10px; }
.comparison-diff dt { color: var(--muted); font-size: 0.7rem; font-weight: 800; }
.comparison-diff dd { margin: 5px 0 0; color: var(--wine-dark); font-family: var(--display); font-size: 1.15rem; }
.scope-note { margin: 0 0 14px; color: var(--muted); font-size: 0.82rem; line-height: 1.6; }

/* Learning. */
.learn-controls { margin-bottom: 22px; display: flex; flex-wrap: wrap; align-items: end; gap: 12px 18px; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.learn-scope-note { max-width: 760px; border-left: 3px solid var(--sage); padding-left: 10px; }
.deck-buttons { display: flex; flex-wrap: wrap; gap: 4px; margin-right: auto; }
.learn-controls > label { width: min(160px, 42vw); }
.review-list { margin: 0 0 22px; border-left: 5px solid var(--gold); padding: 18px 20px; background: #fbf0db; }
.review-list h2 { margin: 0; color: var(--wine-dark); font-family: var(--display); font-size: 1.6rem; font-weight: 500; }
.review-list p { margin: 8px 0 0; color: var(--muted); font-size: 0.86rem; line-height: 1.55; }
.review-list ol { margin: 13px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.review-list li { color: var(--ink); font-size: 0.86rem; }
.review-list li span { display: block; margin-top: 2px; color: var(--muted); font-size: 0.78rem; }
.quiz-card { max-width: 880px; margin: 0 auto; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: clamp(22px, 4vw, 52px); background: var(--surface); }
.quiz-progress { display: flex; justify-content: space-between; gap: 18px; color: var(--muted); font-size: 0.77rem; font-weight: 800; }
.quiz-card > h2 { margin: 10px 0 25px; font-family: var(--display); color: var(--wine-dark); font-size: clamp(1.55rem, 3vw, 2.45rem); font-weight: 500; line-height: 1.42; }
.confidence-choice { margin: 0 0 21px; border: 0; padding: 0; }
.confidence-choice legend { margin-bottom: 8px; color: var(--muted); font-size: 0.76rem; font-weight: 800; }
.confidence-choice button { border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 11px; margin-right: 6px; color: var(--muted); background: transparent; font-size: 0.82rem; font-weight: 800; }
.confidence-choice button.active { border-color: var(--wine); color: #fffaf3; background: var(--wine); }
.quiz-options { display: grid; gap: 10px; }
.quiz-options button { min-height: 61px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 12px 14px; display: grid; gap: 3px; text-align: left; color: var(--ink); background: #fffaf3; }
.quiz-options button:not(:disabled):hover { border-color: var(--wine); background: #fff0e0; }
.quiz-options button.correct { border-color: var(--sage-dark); color: #254b36; background: #e1edde; }
.quiz-options button.incorrect { border-color: var(--wine); color: var(--wine-dark); background: #f5e0e3; }
.quiz-options small { color: var(--muted); font-size: 0.75rem; }
.range-answer { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center; }
.range-answer label { color: var(--muted); font-size: 0.8rem; font-weight: 800; }
.quiz-explanation { margin-top: 22px; border-left: 5px solid var(--gold); padding: 17px 18px 18px; background: var(--surface-warm); }
.quiz-explanation.is-correct { border-left-color: var(--sage-dark); background: #edf2e8; }
.quiz-explanation > p { margin: 0; line-height: 1.65; }
.quiz-explanation dl { margin: 14px 0 17px; display: grid; gap: 10px; }
.quiz-explanation dl div { border-top: 1px solid var(--line); padding-top: 8px; }
.quiz-explanation dt { color: var(--muted); font-size: 0.7rem; font-weight: 800; }
.quiz-explanation dd { margin: 3px 0 0; color: var(--ink); font-size: 0.82rem; line-height: 1.55; overflow-wrap: anywhere; }
.learning-results { max-width: 960px; margin: 0 auto; text-align: center; }
.learning-results h2 { margin: 0; font-family: var(--display); color: var(--wine-dark); font-size: clamp(2rem, 4vw, 3rem); font-weight: 500; }
.result-summary { margin: 28px 0; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-strong); }
.result-summary div { min-height: 135px; padding: 22px; display: grid; align-content: center; gap: 7px; background: var(--surface); }
.result-summary div + div { border-left: 1px solid var(--line); }
.result-summary strong { font-family: var(--display); color: var(--wine-dark); font-size: 2.5rem; line-height: 1; }
.result-summary span { color: var(--muted); font-size: 0.78rem; font-weight: 800; }
.weakness-grid { margin-bottom: 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; text-align: left; }
.weakness-grid section { border-top: 3px solid var(--sage); padding: 14px; background: var(--surface-warm); }
.weakness-grid h3 { margin: 0; color: var(--wine-dark); font-family: var(--display); font-size: 1.2rem; font-weight: 500; }
.weakness-grid ul { margin: 12px 0 0; padding: 0; display: grid; gap: 8px; list-style: none; }
.weakness-grid li { border-top: 1px solid var(--line); padding-top: 7px; }
.weakness-grid strong, .weakness-grid span { display: block; }
.weakness-grid span, .weakness-grid p { margin: 2px 0 0; color: var(--muted); font-size: 0.76rem; line-height: 1.45; }
.next-learning-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* Detail dialog. */
.detail-backdrop { position: fixed; z-index: 40; inset: 0; padding: 20px; display: grid; justify-items: end; background: rgba(47, 51, 46, 0.42); }
.detail-drawer { width: min(760px, 100%); height: 100%; overflow: auto; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: clamp(20px, 3vw, 38px); background: var(--surface); box-shadow: -12px 0 0 rgba(233, 223, 208, 0.72); }
.detail-header { display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); padding-bottom: 17px; }
.detail-header h2 { margin: 0; font-family: var(--display); color: var(--wine-dark); font-size: clamp(2rem, 4vw, 3.3rem); font-weight: 500; line-height: 1; }
.detail-header p:last-child { margin: 8px 0 0; color: var(--muted); }
.icon-button { width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--wine-dark); background: var(--surface-warm); font-size: 1.45rem; line-height: 1; }
.detail-actions { margin: 17px 0; display: flex; flex-wrap: wrap; gap: 9px; }
.detail-section { border-top: 1px solid var(--line); padding: 20px 0; }
.detail-section h3 { margin: 0 0 12px; color: var(--wine-dark); font-family: var(--display); font-size: 1.45rem; font-weight: 500; }
.detail-section > p { margin: 0; color: var(--ink); font-size: 0.9rem; line-height: 1.7; }
.detail-vintage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.detail-vintage-grid article { border: 1px solid var(--line); padding: 13px; background: var(--surface-warm); }
.detail-vintage-grid p { margin: 0; color: var(--muted); font-size: 0.73rem; font-weight: 800; }
.detail-vintage-grid strong { display: block; margin: 6px 0; color: var(--wine-dark); font-family: var(--display); font-size: 1.5rem; line-height: 1.1; }
.detail-vintage-grid span { display: inline-block; border-radius: 999px; padding: 3px 6px; font-size: 0.67rem; font-weight: 800; }
.detail-vintage-grid small { display: block; margin-top: 7px; color: var(--muted); font-size: 0.72rem; line-height: 1.45; }
.detail-vintage-grid .vintage-audit { margin-top: 12px; }
.detail-rationale { margin: 12px 0 0 !important; color: var(--muted) !important; font-size: 0.8rem !important; }
.nearby-list { margin: 0; padding: 0; display: grid; gap: 9px; list-style: none; }
.nearby-list li { border-left: 3px solid var(--sage); padding: 7px 0 7px 11px; }
.nearby-list button { border: 0; padding: 0; color: var(--wine-dark); background: transparent; font-weight: 800; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.nearby-list span { display: block; margin-top: 4px; color: var(--muted); font-size: 0.76rem; }
.detail-definition { margin: 0; display: grid; gap: 10px; }
.detail-definition div { border-left: 2px solid var(--gold); padding-left: 10px; }
.detail-definition dt { color: var(--muted); font-size: 0.72rem; font-weight: 800; }
.detail-definition dd { margin: 3px 0 0; color: var(--ink); font-size: 0.83rem; line-height: 1.55; overflow-wrap: anywhere; }
.detail-definition small { display: block; color: var(--muted); font-size: 0.7rem; }
.detail-definition ul { margin: 5px 0 0; padding-left: 17px; }
.detail-definition a { color: var(--wine-dark); }

.site-footer { border-top: 1px solid var(--line); padding: 28px max(20px, calc((100vw - 1380px) / 2)); display: flex; justify-content: space-between; gap: 24px; color: var(--muted); background: var(--paper-deep); }
.site-footer > div { display: grid; gap: 5px; }
.site-footer strong { color: var(--wine-dark); font-family: var(--display); font-size: 1.05rem; }
.site-footer span { color: var(--ink); font-size: 0.76rem; line-height: 1.5; }
.site-footer nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 10px 18px; }
.site-footer a { min-height: 44px; display: inline-flex; align-items: center; color: var(--wine-dark); font-size: 0.8rem; font-weight: 800; text-decoration-thickness: 1px; text-underline-offset: 3px; }

@media (max-width: 1120px) {
  .home-landing { grid-template-columns: 1fr; grid-template-areas: "top" "intro" "actions" "facts" "status"; align-content: start; }
  .home-intro { max-width: 850px; }
  .action-paths { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .path-card { min-height: 195px; grid-template-columns: 1fr; padding: 18px; }
  .path-card strong { align-self: center; }
  .path-card small { grid-column: 1; }
  .wine-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .site-topbar { grid-template-columns: 1fr auto; gap: 10px; }
  .primary-nav { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; }
  .context-main { width: min(100% - 28px, 1380px); }
  .lookup-layout { grid-template-columns: 1fr; }
  .filter-panel { position: static; }
  .how-to-read { grid-template-columns: 1fr; gap: 20px; }
  .comparison-board { grid-template-columns: 1fr; }
  .comparison-diff dl, .weakness-grid { grid-template-columns: 1fr; }
  .comparison-column:nth-child(2) { border-top: 1px solid var(--line-strong); }
  .site-footer { flex-direction: column; }
  .site-footer nav { justify-content: start; }
}

@media (max-width: 560px) {
  .home-landing { padding: 18px 16px 35px; gap: 30px; }
  .home-topline { align-items: start; flex-direction: column; gap: 7px; }
  .home-brand { row-gap: 0.08em; font-size: clamp(3.35rem, 17.5vw, 5.4rem); line-height: 1; }
  .home-intro > p:last-child { margin-top: 22px; font-size: 0.98rem; }
  .action-paths { grid-template-columns: 1fr; }
  .path-card { min-height: 134px; grid-template-columns: 88px minmax(0, 1fr); }
  .path-card strong { align-self: end; font-size: 1.72rem; }
  .path-card small { grid-column: 2; }
  .home-facts { grid-template-columns: repeat(3, 1fr); gap: 15px; }
  .data-status { justify-self: stretch; max-width: none; }
  .home-facts strong { font-size: 1.68rem; }
  .vintage-tool-nav, .system-statuses { width: min(100% - 28px, 1380px); }
  .vintage-tool-nav { padding-block: 7px; }
  .vintage-tool-nav button { padding: 7px 9px; font-size: 0.76rem; }
  .primary-nav button { padding: 7px 9px; font-size: 0.76rem; }
  .filter-panel { grid-template-columns: 1fr; padding: 15px; }
  .field.full { grid-column: auto; }
  .lookup-axis [role="group"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reset-filter { grid-column: auto; }
  .results-heading { display: block; }
  .results-heading > p { margin-top: 8px; text-align: left; }
  .wine-card-grid { grid-template-columns: 1fr; }
  .wine-card { min-height: 174px; }
  .how-to-read ol { grid-template-columns: 1fr; }
  .compare-picker, .detail-vintage-grid, .vintage-pair { grid-template-columns: 1fr; }
  .learn-controls { align-items: stretch; }
  .deck-buttons { width: 100%; }
  .deck-buttons button { flex: 1 1 auto; padding-inline: 8px; }
  .range-answer { grid-template-columns: 1fr; }
  .result-summary { grid-template-columns: 1fr; }
  .result-summary div + div { border-top: 1px solid var(--line); border-left: 0; }
  .detail-backdrop { padding: 0; }
  .detail-drawer { width: 100%; border: 0; border-radius: 0; box-shadow: none; }
  .next-learning-actions { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .path-card:hover, .wine-card:hover { transform: none !important; }
}
