:root {
  color-scheme: dark;
  --bg: #100d0b;
  --bg-deep: #0b0908;
  --surface: #17130f;
  --surface-2: #1d1814;
  --surface-3: #241d18;
  --line: #3a3028;
  --line-soft: #2a231e;
  --text: #f4eadf;
  --text-2: #d0c2b5;
  --muted: #a99a8d;
  --accent: #d98745;
  --accent-strong: #ef6f25;
  --accent-soft: #f0bc88;
  --sage: #83a581;
  --purple: #aa81c4;
  --danger: #d07362;
  --serif: "Noto Serif JP", "Yu Mincho", serif;
  --sans: "Inter", "Hiragino Sans", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  --header-h: 78px;
  --radius: 10px;
  --shadow: 0 22px 60px rgba(0, 0, 0, .42);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 50% -25%, #261a12 0, var(--bg) 37%, var(--bg) 100%); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body.has-overlay { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; 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; top: 10px; left: 10px; z-index: 5000; transform: translateY(-150%); padding: 11px 16px; border-radius: 6px; background: var(--accent); color: #160d07; font-weight: 700; text-decoration: none; }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid #f3b375; outline-offset: 3px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 900; height: var(--header-h); border-bottom: 1px solid var(--line); background: rgba(12, 10, 8, .96); backdrop-filter: blur(14px); }
.header-inner { max-width: 1600px; height: 100%; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; gap: 34px; }
.brand { display: inline-flex; align-items: center; gap: 11px; flex: 0 0 auto; color: var(--accent-soft); text-decoration: none; }
.brand-mark { width: 38px; height: 38px; color: #c5a6d3; }
.brand-mark path:first-child { fill: currentColor; stroke: #e5d5ec; }
.brand-mark path:last-child { color: #6f4d7e; stroke-width: 3; }
.brand-copy { font-family: var(--serif); font-size: 15px; line-height: 1.05; letter-spacing: .07em; }
.brand-copy strong { font-weight: 700; }
.primary-nav { align-self: stretch; margin: 0 auto; display: flex; align-items: stretch; gap: 38px; }
.primary-nav a, .primary-nav button { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 4px; border: 0; background: transparent; color: var(--text-2); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; }
.primary-nav a::after, .primary-nav button::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 2px; transform: scaleX(0); background: var(--accent-strong); transition: transform .2s ease; }
.primary-nav a:hover, .primary-nav button:hover, .primary-nav .is-current { color: var(--text); }
.primary-nav a:hover::after, .primary-nav button:hover::after, .primary-nav .is-current::after { transform: scaleX(1); }
.nav-count { margin-left: 5px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: #1b1009; font-size: 10px; }
.header-cta { min-height: 46px; padding: 0 18px; display: inline-flex; align-items: center; gap: 9px; border: 1px solid #f18342; border-radius: 8px; background: linear-gradient(180deg, #e77d37, #d65f24); color: #fff9f2; font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: 0 8px 24px rgba(216, 95, 35, .2); }
.header-cta svg { width: 18px; height: 18px; }
.header-cta:hover { filter: brightness(1.08); }
.menu-toggle { display: none; width: 46px; height: 46px; padding: 12px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; }
.menu-toggle span { display: block; height: 1px; margin: 5px 0; background: var(--text); }

/* Discovery shell */
.discovery { max-width: 1600px; margin: 0 auto; padding: 28px 22px 34px; }
.discovery-heading { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.discovery-heading h1 { margin: 0; font-family: var(--serif); font-size: clamp(30px, 3vw, 46px); font-weight: 600; line-height: 1.25; letter-spacing: .04em; }
.collection-count { margin: 0; display: inline-flex; align-items: center; gap: 9px; color: var(--text-2); font-size: 14px; white-space: nowrap; }
.collection-count svg { width: 20px; height: 20px; }
.discovery-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(390px, 29vw); height: min(720px, calc(100svh - 176px)); min-height: 600px; gap: 12px; }
.map-stage { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 12px; background: #161919; box-shadow: 0 20px 60px rgba(0, 0, 0, .26); }
#map { position: absolute; inset: 0; background: #131716; }
#map.is-unavailable { opacity: .26; }
.map-unavailable { position: absolute; inset: 0; z-index: 700; display: grid; place-content: center; gap: 8px; padding: 30px; text-align: center; background: rgba(16, 13, 11, .82); }
.map-unavailable strong { font-family: var(--serif); font-size: 21px; }
.map-unavailable span { color: var(--text-2); font-size: 13px; }
.map-legend { position: absolute; left: 14px; bottom: 18px; z-index: 500; width: min(310px, calc(100% - 28px)); overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: rgba(20, 16, 13, .94); box-shadow: 0 12px 30px rgba(0, 0, 0, .28); backdrop-filter: blur(8px); }
.legend-toggle { width: 100%; min-height: 40px; padding: 0 13px; border: 0; background: transparent; color: var(--text); text-align: left; font-size: 12px; font-weight: 600; cursor: pointer; }
.legend-toggle::after { content: "⌄"; float: right; color: var(--muted); }
.legend-toggle[aria-expanded="false"]::after { content: "›"; }
.legend-body { padding: 0 13px 12px; }
.legend-list { display: grid; gap: 6px; margin: 0 0 9px; padding: 0; list-style: none; }
.legend-list li { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 11px; }
.dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--accent-soft); }
.dot-robusta { background: var(--sage); }
.dot-liberica { background: var(--purple); }
.dot-star { height: auto; color: var(--accent); background: none; font-size: 13px; }
.legend-body p { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.map-reset { position: absolute; right: 15px; bottom: 18px; z-index: 500; min-height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(20, 16, 13, .92); color: var(--text-2); font-size: 12px; cursor: pointer; backdrop-filter: blur(8px); }
.map-reset svg { width: 18px; height: 18px; }
.map-reset:hover { border-color: #72513a; color: var(--text); }

/* Explorer */
.explorer { min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(180deg, #17130f, #14110e); }
.mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); flex: 0 0 auto; border-bottom: 1px solid var(--line-soft); }
.mode-tabs button { position: relative; min-height: 60px; padding: 0 8px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.mode-tabs button::after { content: ""; position: absolute; right: 12px; bottom: -1px; left: 12px; height: 2px; transform: scaleX(0); background: var(--accent-strong); transition: transform .2s ease; }
.mode-tabs button[aria-selected="true"] { color: var(--accent-soft); }
.mode-tabs button[aria-selected="true"]::after { transform: scaleX(1); }
.mode-tabs svg { width: 19px; height: 19px; }
.explorer-controls { flex: 0 0 auto; padding: 14px 16px 10px; border-bottom: 1px solid var(--line-soft); }
.search-field { position: relative; display: block; }
.search-field > svg { position: absolute; top: 50%; left: 13px; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { width: 100%; height: 46px; padding: 0 42px 0 42px; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: var(--surface-2); color: var(--text); font-size: 13px; }
.search-field input::placeholder { color: #b1a297; opacity: 1; }
.search-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 135, 69, .14); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field input::-ms-clear { display: none; }
.search-clear { position: absolute; top: 50%; right: 6px; width: 34px; height: 34px; transform: translateY(-50%); border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.mode-panel { padding-top: 13px; }
.compact-filters { display: flex; gap: 7px; overflow-x: auto; padding: 1px 1px 5px; scrollbar-width: none; }
.compact-filters::-webkit-scrollbar { display: none; }
.filter-chip, .flavor-grid button { min-height: 34px; padding: 0 11px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--text-2); font-size: 11px; cursor: pointer; }
.filter-chip:hover, .flavor-grid button:hover { border-color: #73513a; color: var(--text); }
.filter-chip.is-on, .flavor-grid button.is-on { border-color: var(--accent); background: rgba(217, 135, 69, .11); color: var(--text); }
.control-hint { margin: 0 0 10px; color: var(--text-2); font-size: 11.5px; }
.flavor-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.text-action { min-height: 34px; margin-top: 7px; padding: 0; border: 0; background: transparent; color: var(--accent-soft); font-size: 11px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.taste-controls { display: grid; gap: 9px; }
.taste-controls label { display: grid; grid-template-columns: 54px 18px minmax(0, 1fr); align-items: center; gap: 8px; color: var(--text-2); font-size: 11px; }
.taste-controls output { color: var(--accent-soft); font-variant-numeric: tabular-nums; }
.taste-controls input { width: 100%; height: 44px; accent-color: var(--accent); }
.estimate-note { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.advanced-filters { margin-top: 8px; border-top: 1px solid var(--line-soft); }
.advanced-filters summary { min-height: 38px; display: flex; align-items: center; justify-content: space-between; color: var(--text-2); font-size: 11.5px; cursor: pointer; list-style: none; }
.advanced-filters summary::-webkit-details-marker { display: none; }
.advanced-filters summary::after { content: "+"; color: var(--muted); font-size: 18px; }
.advanced-filters[open] summary::after { content: "−"; }
.advanced-filters summary span { margin-left: auto; margin-right: 10px; color: var(--accent-soft); font-size: 10px; }
.filter-selects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.filter-selects label { color: var(--muted); font-size: 9px; line-height: 1.5; }
.filter-selects select { width: 100%; height: 36px; margin-top: 3px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--text); font-size: 10px; }
.result-toolbar { min-height: 48px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; border-bottom: 1px solid var(--line-soft); }
.result-toolbar p { margin: 0; color: var(--text-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.mobile-quiz { display: none; min-height: 36px; padding: 0 12px; border: 1px solid var(--accent); border-radius: 7px; background: var(--accent); color: #1b0e06; font-size: 11px; font-weight: 700; }
.origin-list { min-height: 0; margin: 0; padding: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #58473a transparent; list-style: none; }
.origin-list-item { border-bottom: 1px solid var(--line-soft); content-visibility: auto; contain-intrinsic-size: 94px; }
.origin-card { position: relative; width: 100%; min-height: 94px; padding: 13px 32px 12px 16px; display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 0 10px; border: 0; border-left: 2px solid transparent; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.origin-card:hover { background: rgba(255, 255, 255, .025); }
.origin-card.is-active { border-left-color: var(--accent-strong); background: rgba(217, 135, 69, .08); }
.species-dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--species-color); box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
.origin-card-main { min-width: 0; display: block; }
.origin-card-title { display: flex; align-items: center; gap: 6px; }
.origin-card-title strong { overflow: hidden; color: var(--text); font-family: var(--serif); font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.famous-star { color: var(--accent); font-size: 11px; }
.origin-card-country { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.origin-flavors { display: flex; gap: 5px; margin-top: 8px; overflow: hidden; }
.origin-flavors span { padding: 3px 6px; flex: 0 0 auto; border: 1px solid #49372a; border-radius: 4px; color: var(--text-2); font-size: 9px; }
.origin-card-meta { grid-column: 2; margin-top: 7px; display: flex; gap: 10px; color: var(--muted); font-size: 9.5px; }
.card-chevron { position: absolute; top: 50%; right: 10px; width: 17px; height: 17px; transform: translateY(-50%); color: var(--text-2); }
.card-taste { max-width: 270px; margin-top: 8px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 9px; }
.card-taste .taste-row:nth-child(5) { display: none; }
.load-more { width: calc(100% - 32px); min-height: 42px; margin: 10px 16px 14px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--text-2); font-size: 11px; cursor: pointer; }
.load-more:hover { border-color: var(--accent); color: var(--text); }
.empty-state { margin: auto; padding: 34px 24px; text-align: center; }
.empty-state strong { font-family: var(--serif); font-size: 16px; }
.empty-state p { color: var(--muted); font-size: 11px; line-height: 1.7; }
.empty-state button { min-height: 40px; padding: 0 14px; border: 1px solid var(--accent); border-radius: 7px; background: transparent; color: var(--accent-soft); font-size: 11px; cursor: pointer; }

/* Next steps and learning */
.next-steps { margin-top: 14px; padding: 12px 14px 14px; display: grid; grid-template-columns: auto repeat(3, 1fr); gap: 9px; align-items: stretch; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(22, 18, 15, .72); }
.next-steps > p { grid-column: 1 / -1; margin: 0 0 2px; color: var(--text-2); font-size: 10px; }
.next-steps button { min-height: 68px; padding: 10px 14px; display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.next-steps button:hover { border-color: #69503d; background: rgba(255, 255, 255, .018); }
.next-steps button > span { grid-row: 1 / 3; align-self: center; color: var(--accent-soft); font-family: var(--serif); font-size: 24px; text-align: center; }
.next-steps strong { align-self: end; font-family: var(--serif); font-size: 13px; }
.next-steps small { align-self: start; margin-top: 3px; color: var(--muted); font-size: 9.5px; }
.learn { padding: 100px max(24px, calc((100vw - 1250px) / 2)) 110px; border-top: 1px solid var(--line-soft); background: #f0e8de; color: #251d17; }
.section-heading { max-width: 760px; }
.section-heading h2 { margin: 0; font-family: var(--serif); font-size: clamp(30px, 4vw, 52px); line-height: 1.35; }
.section-heading > p { max-width: 620px; margin: 20px 0 54px; color: #6e6259; font-size: 14px; line-height: 1.9; }
.learning-rail { border-top: 1px solid #bcb0a5; }
.learning-rail details { border-bottom: 1px solid #bcb0a5; }
.learning-rail summary { min-height: 78px; display: grid; grid-template-columns: 60px 1fr auto; align-items: center; list-style: none; cursor: pointer; }
.learning-rail summary::-webkit-details-marker { display: none; }
.learning-rail summary span { color: #92775f; font-size: 11px; }
.learning-rail summary strong { font-family: var(--serif); font-size: 19px; }
.learning-rail summary::after { content: "+"; font-size: 22px; font-weight: 300; }
.learning-rail details[open] summary::after { content: "−"; }
.learning-rail details > p { max-width: 800px; margin: -5px 40px 28px 60px; color: #645950; font-size: 13px; line-height: 2; }

/* Taste meters */
.taste-row { min-height: 27px; display: grid; grid-template-columns: 48px minmax(80px, 1fr) 24px; align-items: center; gap: 9px; }
.taste-row > span { color: var(--text-2); font-size: 10.5px; }
.taste-row > b { color: var(--accent-soft); font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }
.taste-track { position: relative; height: 3px; overflow: visible; background: #4a423a; }
.taste-track i { position: absolute; top: 0; bottom: 0; left: 0; display: block; background: var(--accent); }
.taste-track i::after { content: ""; position: absolute; top: 50%; right: -4px; width: 9px; height: 9px; transform: translateY(-50%); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--surface); }
.taste-row.is-compact { min-height: 14px; grid-template-columns: 32px 1fr 16px; gap: 5px; }
.taste-row.is-compact > span, .taste-row.is-compact > b { font-size: 7.5px; }
.taste-row.is-compact .taste-track { height: 2px; }
.taste-row.is-compact .taste-track i::after { width: 5px; height: 5px; right: -2px; box-shadow: none; }

/* Drawer */
.detail-backdrop, .modal-backdrop { position: fixed; inset: 0; z-index: 1200; background: rgba(0, 0, 0, .58); opacity: 0; animation: fade-in .2s forwards; }
.detail-drawer { position: fixed; top: calc(var(--header-h) + 10px); right: 12px; bottom: 12px; z-index: 1300; width: min(520px, calc(100vw - 24px)); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #16130f; box-shadow: var(--shadow); transform: translateX(calc(100% + 30px)); transition: transform .22s ease; }
.detail-drawer.is-open { transform: translateX(0); }
.sheet-handle { display: none; }
.detail-close, .modal-close { position: absolute; top: 12px; right: 12px; z-index: 5; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: rgba(26, 21, 17, .92); color: var(--text); font-size: 27px; font-weight: 200; line-height: 1; cursor: pointer; }
.detail-content { min-height: 0; flex: 1 1 auto; overflow-y: auto; scrollbar-color: #58473a transparent; }
.detail-head { padding: 25px 68px 20px 22px; }
.detail-crumb { margin: 0 0 18px; color: var(--accent-soft); font-size: 11px; }
.detail-crumb span { margin: 0 7px; color: var(--muted); }
.detail-head h2 { margin: 0; font-family: var(--serif); font-size: clamp(28px, 3vw, 39px); font-weight: 600; letter-spacing: .04em; }
.detail-name-en { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.detail-summary { margin: 18px 0 0; color: var(--text-2); font-family: var(--serif); font-size: 13px; line-height: 1.8; }
.detail-tabs { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); background: #16130f; }
.detail-tabs button { position: relative; min-height: 51px; border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.detail-tabs button::after { content: ""; position: absolute; right: 18px; bottom: -1px; left: 18px; height: 2px; transform: scaleX(0); background: var(--accent-strong); }
.detail-tabs button[aria-selected="true"] { color: var(--accent-soft); }
.detail-tabs button[aria-selected="true"]::after { transform: scaleX(1); }
.detail-tab-panel { padding: 20px 20px 2px; }
.detail-facts { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.detail-fact { min-width: 0; padding: 12px 10px; border: 1px solid var(--line); border-radius: 7px; }
.detail-fact dt { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9.5px; }
.detail-fact dt span { color: var(--text-2); }
.detail-fact dd { margin: 9px 0 0; color: var(--text); font-size: 11.5px; line-height: 1.5; }
.detail-section { padding: 21px 0; border-bottom: 1px solid var(--line-soft); }
.detail-section h3, .purchase-section h3, .country-context h3 { margin: 0 0 13px; font-family: var(--serif); font-size: 14px; font-weight: 600; }
.section-label { display: flex; justify-content: space-between; gap: 10px; }
.section-label span { color: var(--muted); font-size: 9px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.detail-tags span { padding: 5px 9px; border: 1px solid #66462f; border-radius: 5px; color: var(--text-2); font-size: 10px; }
.detail-more { width: 100%; min-height: 47px; padding: 0; display: flex; align-items: center; justify-content: space-between; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; color: var(--text-2); font-size: 11px; cursor: pointer; }
.detail-note, .country-context p { margin: 0; color: var(--text-2); font-size: 12px; line-height: 1.9; }
.recommendation-list { margin: 0; }
.recommendation-list div { min-height: 48px; padding: 10px 0; display: grid; grid-template-columns: 70px 1fr; align-items: center; border-bottom: 1px solid var(--line-soft); }
.recommendation-list dt { color: var(--muted); font-size: 10px; }
.recommendation-list dd { margin: 0; color: var(--text); font-size: 12px; }
.country-context { margin: 20px 20px 8px; padding: 18px; border-left: 2px solid var(--sage); background: rgba(131, 165, 129, .06); }
.country-context dl { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 15px 0 0; }
.country-context dl div { display: flex; gap: 7px; }
.country-context dt { color: var(--muted); font-size: 9px; }
.country-context dd { margin: 0; font-size: 10px; }
.purchase-section { margin: 26px 20px 20px; padding: 20px 0 4px; border-top: 1px solid var(--line); }
.purchase-section > p { margin: -4px 0 14px; color: var(--muted); font-size: 10.5px; line-height: 1.65; }
.store-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.store-links a { min-height: 44px; padding: 6px 7px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid #74503a; border-radius: 7px; color: var(--text); font-size: 9.5px; text-align: center; text-decoration: none; }
.store-links a:hover { border-color: var(--accent); background: rgba(217, 135, 69, .08); }
.store-links b { width: 19px; height: 19px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; font-family: var(--serif); }
.purchase-section small { display: block; margin-top: 10px; color: var(--muted); font-size: 8.5px; line-height: 1.5; }
.detail-actions { padding: 12px; display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; flex: 0 0 auto; border-top: 1px solid var(--line); background: #17130f; }
.detail-actions button { min-height: 50px; border-radius: 7px; font-size: 12px; font-weight: 700; cursor: pointer; }
.compare-action { border: 1px solid #76503a; background: transparent; color: var(--text-2); }
.compare-action.is-added { border-color: var(--sage); color: #b9d1b8; }
.buy-action { border: 1px solid var(--accent-strong); background: linear-gradient(180deg, #ef742b, #dd5f22); color: white; }

/* Dialogs */
.modal-backdrop { z-index: 1400; }
.modal { position: fixed; top: 50%; left: 50%; z-index: 1500; width: min(720px, calc(100vw - 32px)); max-height: min(780px, calc(100svh - 32px)); overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: #17130f; box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, calc(-50% + 18px)); transition: opacity .18s ease, transform .18s ease; }
.modal.is-open { opacity: 1; transform: translate(-50%, -50%); }
.compare-dialog { width: min(1120px, calc(100vw - 32px)); }
.quiz-progress { height: 3px; background: var(--line-soft); }
.quiz-progress span { display: block; width: 0; height: 100%; background: var(--accent-strong); transition: width .2s ease; }
.quiz-step, .quiz-result-head, .modal-heading { padding: 52px 58px 28px; }
.quiz-step > p, .quiz-result-head > p, .modal-heading > p { margin: 0 0 14px; color: var(--accent-soft); font-size: 10px; letter-spacing: .16em; }
.quiz-step h2, .quiz-result-head h2, .modal-heading h2 { max-width: 600px; margin: 0; font-family: var(--serif); font-size: clamp(25px, 4vw, 38px); line-height: 1.45; }
.quiz-step > span, .quiz-result-head > span, .modal-heading > p:last-child { display: block; margin-top: 13px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.quiz-options { padding: 4px 58px 24px; display: grid; gap: 9px; }
.quiz-options button { min-height: 56px; padding: 0 17px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); text-align: left; font-size: 13px; cursor: pointer; }
.quiz-options button:hover { border-color: var(--accent); background: rgba(217, 135, 69, .07); }
.quiz-options svg { width: 18px; height: 18px; color: var(--accent-soft); }
.quiz-nav { padding: 0 58px 35px; display: flex; justify-content: space-between; }
.quiz-nav button { min-height: 40px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.quiz-results { margin: 0; padding: 0 58px 20px; list-style: none; }
.quiz-results li { border-top: 1px solid var(--line); }
.quiz-results li:last-child { border-bottom: 1px solid var(--line); }
.quiz-results button { width: 100%; min-height: 105px; padding: 17px 4px; display: grid; grid-template-columns: 40px 1fr 22px; gap: 13px; align-items: center; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.quiz-rank { color: var(--accent); font-family: var(--serif); font-size: 13px; }
.quiz-results strong, .quiz-results small, .quiz-results em { display: block; }
.quiz-results strong { font-family: var(--serif); font-size: 16px; }
.quiz-results small { margin-top: 3px; color: var(--muted); font-size: 9.5px; }
.quiz-results em { margin-top: 8px; color: var(--text-2); font-size: 10.5px; font-style: normal; line-height: 1.55; }
.quiz-results svg { width: 18px; height: 18px; }
.quiz-result-actions { padding: 10px 58px 38px; display: flex; justify-content: flex-end; gap: 9px; }
.quiz-result-actions button, .modal-primary { min-height: 46px; padding: 0 17px; border: 1px solid #7a543b; border-radius: 7px; background: transparent; color: var(--text); font-size: 11px; cursor: pointer; }
.quiz-result-actions button:last-child { border-color: var(--accent); background: var(--accent-strong); color: white; }
.modal-primary { margin: 0 58px 40px; }
.compare-table-wrap { margin: 0 34px 34px; overflow-x: auto; }
.compare-table { width: 100%; min-width: 720px; border-collapse: collapse; table-layout: fixed; }
.compare-table th, .compare-table td { padding: 14px 12px; border: 1px solid var(--line); color: var(--text-2); font-size: 10.5px; line-height: 1.6; text-align: left; vertical-align: top; }
.compare-table thead th { color: var(--text); background: var(--surface-2); }
.compare-table thead th:first-child { width: 120px; }
.compare-table th[scope="row"] { color: var(--muted); font-weight: 500; }
.compare-table th button { width: 100%; padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.compare-table th button small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.compare-taste-row td { min-width: 180px; }

/* Compare tray */
.compare-tray { position: fixed; right: 50%; bottom: 18px; z-index: 1100; width: min(720px, calc(100vw - 28px)); min-height: 58px; padding: 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid #6b4b37; border-radius: 10px; background: rgba(23, 19, 15, .96); box-shadow: var(--shadow); transform: translateX(50%); backdrop-filter: blur(10px); }
#compare-items { min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
#compare-items > span { min-height: 34px; padding: 0 5px 0 10px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--text-2); font-size: 10px; }
#compare-items button { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
#compare-open { min-height: 42px; padding: 0 15px; flex: 0 0 auto; border: 1px solid var(--accent); border-radius: 7px; background: var(--accent); color: #1b0d05; font-size: 11px; font-weight: 700; cursor: pointer; }
#compare-open:disabled { border-color: var(--line); background: var(--surface-3); color: var(--muted); cursor: not-allowed; }

/* Footer */
.site-footer { padding: 54px 24px; border-top: 1px solid var(--line); background: var(--bg-deep); }
.footer-inner { max-width: 1250px; margin: 0 auto; display: grid; grid-template-columns: 260px 1fr; gap: 70px; }
.footer-inner > div:first-child strong { color: var(--accent-soft); font-family: var(--serif); letter-spacing: .08em; }
.footer-inner > div:first-child p { color: var(--text-2); font-size: 11px; line-height: 1.7; }
.footer-notes { display: grid; gap: 10px; }
.footer-notes p { margin: 0; color: #b6a79a; font-size: 10px; line-height: 1.75; }
.footer-notes .footer-meta { color: #a29387; }
.noscript { position: fixed; right: 0; bottom: 0; left: 0; z-index: 5000; padding: 14px; background: var(--danger); color: white; text-align: center; }

/* Leaflet */
.leaflet-control-zoom { overflow: hidden; border: 1px solid var(--line) !important; border-radius: 7px !important; box-shadow: none !important; }
.leaflet-control-zoom a { width: 42px !important; height: 42px !important; border-bottom-color: var(--line) !important; background: rgba(20, 16, 13, .94) !important; color: var(--text) !important; font: 24px/42px var(--sans) !important; }
.leaflet-control-zoom a:hover { background: var(--surface-3) !important; }
.leaflet-control-attribution { background: rgba(12, 10, 8, .75) !important; color: #b5a79a !important; font-size: 8px !important; }
.leaflet-control-attribution a { color: #d9c9ba !important; }
.origin-tip { padding: 5px 8px !important; border: 1px solid #6e4b34 !important; border-radius: 5px !important; background: #17130f !important; color: var(--text) !important; box-shadow: 0 8px 20px rgba(0, 0, 0, .3) !important; font: 10px var(--sans) !important; }
.origin-tip::before { border-top-color: #6e4b34 !important; }

@keyframes fade-in { to { opacity: 1; } }

@media (max-width: 1100px) {
  .primary-nav { gap: 20px; }
  .discovery-shell { grid-template-columns: minmax(0, 1fr) 380px; }
  .filter-selects { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  :root { --header-h: 68px; }
  .site-header { backdrop-filter: blur(9px); }
  .header-inner { padding: 0 16px; gap: 12px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy { font-size: 13px; }
  .header-cta { display: none; }
  .menu-toggle { display: block; margin-left: auto; }
  .primary-nav { position: absolute; top: calc(100% + 1px); right: 10px; left: 10px; height: auto; padding: 8px; display: none; grid-template-columns: 1fr 1fr; gap: 4px; border: 1px solid var(--line); border-radius: 10px; background: #15110e; box-shadow: var(--shadow); }
  .primary-nav.is-open { display: grid; }
  .primary-nav a, .primary-nav button { min-height: 48px; border-radius: 7px; background: var(--surface-2); font-size: 12px; }
  .primary-nav a::after, .primary-nav button::after { display: none; }
  .discovery { padding: 22px 11px 28px; }
  .discovery-heading { min-height: 61px; }
  .discovery-heading h1 { font-size: clamp(25px, 8vw, 34px); letter-spacing: .02em; }
  .collection-count { display: none; }
  .discovery-shell { display: block; height: auto; min-height: 0; }
  .map-stage { height: 40svh; min-height: 285px; max-height: 390px; border-radius: 10px; }
  .map-legend { bottom: 12px; width: 180px; }
  .legend-body { max-height: 160px; overflow-y: auto; }
  .legend-list li { font-size: 9px; }
  .map-reset { right: 10px; bottom: 10px; min-height: 42px; padding: 0 10px; font-size: 0; }
  .map-reset svg { width: 20px; height: 20px; }
  .explorer { margin-top: 9px; overflow: visible; border-radius: 10px; }
  .mode-tabs button { min-height: 50px; font-size: 11px; }
  .mode-tabs svg { width: 17px; height: 17px; }
  .explorer-controls { padding: 12px; }
  .search-field input { height: 48px; font-size: 12px; }
  .filter-chip, .flavor-grid button { min-height: 40px; font-size: 10px; }
  .filter-selects { grid-template-columns: 1fr 1fr 1fr; }
  .filter-selects select { height: 42px; }
  .result-toolbar { min-height: 57px; padding: 0 12px; }
  .mobile-quiz { display: inline-flex; align-items: center; }
  .origin-list { max-height: none; overflow: visible; }
  .origin-card { min-height: 112px; padding: 15px 31px 14px 13px; }
  .origin-card-title strong { font-size: 15px; }
  .origin-card-country { font-size: 10px; }
  .origin-flavors span { font-size: 9px; }
  .next-steps { grid-template-columns: 1fr; padding: 12px; }
  .next-steps > p { grid-column: auto; }
  .next-steps button { min-height: 62px; }
  .learn { padding: 70px 20px 76px; }
  .section-heading > p { margin-bottom: 36px; }
  .learning-rail summary { grid-template-columns: 40px 1fr auto; }
  .learning-rail summary strong { font-size: 16px; }
  .learning-rail details > p { margin: -2px 20px 24px 40px; font-size: 12px; }
  .detail-backdrop { background: rgba(0, 0, 0, .7); }
  .detail-drawer { top: auto; right: 0; bottom: 0; left: 0; width: 100%; height: 92svh; border-right: 0; border-bottom: 0; border-left: 0; border-radius: 22px 22px 0 0; transform: translateY(105%); }
  .detail-drawer.is-open { transform: translateY(0); }
  .sheet-handle { position: absolute; top: 8px; left: 50%; z-index: 5; width: 50px; height: 5px; display: block; transform: translateX(-50%); border-radius: 99px; background: #716960; }
  .detail-close { top: 18px; right: 14px; }
  .detail-head { padding: 35px 62px 18px 18px; }
  .detail-head h2 { font-size: 28px; }
  .detail-tabs button { min-height: 52px; }
  .detail-tab-panel { padding: 17px 14px 2px; }
  .detail-facts { gap: 5px; }
  .detail-fact { padding: 11px 7px; }
  .detail-fact dd { font-size: 10px; }
  .country-context, .purchase-section { margin-right: 14px; margin-left: 14px; }
  .store-links { grid-template-columns: 1fr; }
  .store-links a { font-size: 10.5px; }
  .detail-actions { padding: 10px max(10px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)); }
  .detail-actions button { min-height: 52px; }
  .modal { top: auto; right: 0; bottom: 0; left: 0; width: 100%; max-height: 92svh; border-right: 0; border-bottom: 0; border-left: 0; border-radius: 22px 22px 0 0; transform: translateY(105%); }
  .modal.is-open { transform: translateY(0); }
  .quiz-step, .quiz-result-head, .modal-heading { padding: 48px 20px 22px; }
  .quiz-options { padding: 4px 20px 20px; }
  .quiz-options button { min-height: 58px; }
  .quiz-nav { padding: 0 20px calc(25px + env(safe-area-inset-bottom)); }
  .quiz-results { padding: 0 20px 18px; }
  .quiz-result-actions { padding: 8px 20px calc(28px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr; }
  .quiz-result-actions button { min-height: 48px; }
  .modal-primary { margin: 0 20px 32px; }
  .compare-table-wrap { margin: 0 14px calc(20px + env(safe-area-inset-bottom)); }
  .compare-tray { right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); left: 10px; width: auto; padding: 7px; transform: none; }
  #compare-items { flex-wrap: nowrap; overflow-x: auto; }
  #compare-items > span { white-space: nowrap; }
  .footer-inner { grid-template-columns: 1fr; gap: 25px; }
}

@media (max-width: 480px) {
  .filter-selects { grid-template-columns: 1fr; }
  .origin-card-meta { flex-direction: column; gap: 2px; }
  .detail-facts { grid-template-columns: 1fr 1fr; }
  .detail-fact:last-child { grid-column: 1 / -1; }
  .quiz-results button { grid-template-columns: 32px 1fr 18px; }
  .quiz-results em { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Mobile quality pass: prioritize the first task and keep the page in one scroll context. */
@media (max-width: 820px) {
  html, body { overflow-x: clip; }

  .site-header {
    height: calc(var(--header-h) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }
  .header-inner { height: var(--header-h); }

  .discovery {
    padding: 20px max(12px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .discovery-heading {
    min-height: 0;
    padding: 4px 0 15px;
    align-items: flex-start;
  }
  .discovery-heading h1 {
    max-width: 100%;
    font-size: clamp(25px, 6.9vw, 30px);
    line-height: 1.28;
    letter-spacing: .01em;
    text-wrap: pretty;
  }
  .explorer { margin-top: 11px; }
  .explorer-controls { padding: 10px 10px 8px; }
  .mode-panel { padding-top: 10px; }
  .origin-card {
    min-height: 110px;
    padding: 13px 30px 12px 12px;
    touch-action: manipulation;
  }
  .origin-flavors { margin-top: 6px; }
  .origin-card-meta {
    flex-direction: row;
    flex-wrap: wrap;
    row-gap: 2px;
    column-gap: 9px;
  }
  .next-steps { margin-top: 12px; }
  .detail-head h2 {
    font-size: clamp(25px, 7vw, 30px);
    line-height: 1.32;
    overflow-wrap: anywhere;
  }
  .detail-actions {
    padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
}

/* Mobile interaction contract: page scrolling, full-size touch targets, and no hidden overlay gaps. */
.compare-table-wrap {
  position: relative;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.compare-table thead th:first-child,
.compare-table tbody th[scope="row"] {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #17130f;
  box-shadow: 8px 0 14px rgba(0, 0, 0, .16);
}
.compare-table thead th:first-child { z-index: 3; background: var(--surface-2); }
.compare-swipe-hint { display: none; }
main.has-compare-tray { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

@media (max-width: 820px) {
  html, body { min-width: 0; width: 100%; overflow-x: clip; }
  #main-content, .discovery, .discovery-shell, .explorer, .map-stage { min-width: 0; max-width: 100%; }

  .discovery-heading h1 span { display: block; white-space: nowrap; }
  .map-stage { height: clamp(220px, 30svh, 280px); min-height: 0; max-height: none; }
  .origin-list {
    max-height: none;
    flex: 0 0 auto;
    overflow: visible;
    overscroll-behavior: auto;
    scrollbar-gutter: auto;
  }
  .origin-card { min-height: 110px; }

  .filter-chip, .flavor-grid button,
  .mobile-quiz, .quiz-nav button,
  #compare-open { min-height: 44px; }
  .advanced-filters summary, .text-action { min-height: 44px; }
  .legend-toggle { min-height: 44px; }
  .map-reset { min-width: 44px; min-height: 44px; }
  .search-field input { padding-right: 52px; }
  .search-clear { right: 2px; width: 44px; height: 44px; }
  #compare-items button { width: 44px; height: 44px; }

  .taste-controls label { grid-template-columns: 54px 18px minmax(0, 1fr); }
  .taste-controls input { height: 44px; }

  .compare-swipe-hint {
    display: block;
    margin: -8px 20px 16px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.6;
    text-align: right;
  }
  .compare-table-wrap { margin-right: 10px; margin-left: 10px; padding-bottom: 4px; }
  .compare-table-wrap::after { content: ""; position: sticky; right: 0; float: right; width: 24px; height: 100%; margin-top: -100%; pointer-events: none; background: linear-gradient(90deg, transparent, rgba(18, 15, 12, .92)); }
  .compare-table { min-width: 620px; }
  .compare-table.compare-columns-2 { min-width: 480px; }
  .compare-table thead th:first-child { width: 80px; }

  main.has-compare-tray { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

  .compare-tray {
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: auto;
    width: auto;
    min-height: 0;
    padding: 5px;
    border-radius: 999px;
    transform: none;
  }
  .compare-tray #compare-items { display: none; }
  .compare-tray #compare-open { min-height: 48px; padding: 0 17px; border-radius: 999px; }

  .detail-drawer, .modal {
    top: 0;
    bottom: 0;
    height: 100svh;
    max-height: 100svh;
    padding-top: env(safe-area-inset-top);
    border-radius: 0;
  }
  .sheet-handle { top: calc(8px + env(safe-area-inset-top)); }
  .detail-close, .modal-close { top: calc(14px + env(safe-area-inset-top)); }
  .detail-actions {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

@supports (height: 100dvh) {
  @media (max-width: 820px) {
    .map-stage { height: clamp(220px, 30dvh, 280px); }
    .detail-drawer, .modal { height: 100dvh; max-height: 100dvh; }
  }
}

@media (max-width: 360px) {
  .header-inner { padding-right: 10px; padding-left: 10px; gap: 8px; }
  .brand { gap: 7px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-copy { font-size: 11px; letter-spacing: .04em; }
  .menu-toggle { width: 44px; height: 44px; padding: 10px; }
  .discovery { padding-right: 10px; padding-left: 10px; }
  .discovery-heading h1 { font-size: 25px; letter-spacing: 0; }
  .mode-tabs button { gap: 4px; padding-right: 3px; padding-left: 3px; font-size: 10px; }
  .mode-tabs button::after { right: 6px; left: 6px; }
  .mode-tabs svg { width: 15px; height: 15px; }
  .explorer-controls { padding-right: 9px; padding-left: 9px; }
  .filter-chip, .flavor-grid button { padding-right: 9px; padding-left: 9px; font-size: 10px; }
  .result-toolbar { padding-right: 9px; padding-left: 9px; }
  .mobile-quiz { padding-right: 9px; padding-left: 9px; font-size: 10px; }
  .origin-card { padding-right: 27px; }
  .next-steps button { grid-template-columns: 28px minmax(0, 1fr); column-gap: 7px; padding-right: 10px; padding-left: 10px; }
  .detail-head { padding-right: 56px; }
  .detail-facts { grid-template-columns: 1fr; }
  .detail-fact:last-child { grid-column: auto; }
  .detail-actions { grid-template-columns: 1fr 1fr; gap: 6px; padding-right: 8px; padding-left: 8px; }
  .detail-actions button { padding-right: 8px; padding-left: 8px; font-size: 11px; }
  .compare-tray { gap: 6px; padding-right: 5px; padding-left: 5px; }
  #compare-open { padding-right: 10px; padding-left: 10px; font-size: 10px; }
}
