:root {
  --bg: #f5f7f4; --panel: #ffffff; --panel-2: #eef3ee; --text: #15201a; --muted: #5b685f;
  --line: #dde4dd; --accent: #1f7a4d; --accent-strong: #165c3a; --accent-text: #ffffff;
  --accent-soft: #e3f2e9; --gold: #9a6a00; --gold-soft: #fff4d6; --warn: #9a4a00;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 5%);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1411; --panel: #171e1a; --panel-2: #1d2621; --text: #e6ece8; --muted: #98a69d;
    --line: #2a332e; --accent: #45b37f; --accent-strong: #5fc893; --accent-text: #08120c;
    --accent-soft: #19301f; --gold: #e3b450; --gold-soft: #2e2612; --warn: #e6a35c;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Logo */
.logo { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; color: var(--text);
        text-decoration: none; white-space: nowrap; }
.logo span { color: var(--accent); }
.logo small { font-size: 0.6em; color: var(--muted); font-weight: 700; margin-left: 1px; }
.logo-big { font-size: 30px; margin-bottom: 18px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
          backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex;
                align-items: center; gap: 16px; }
.tabs { display: none; gap: 4px; }
.tabs a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 999px;
          font-weight: 600; }
.tabs a.on { color: var(--text); background: var(--panel-2); }
.where { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; max-width: 55vw;
         border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
         padding: 6px 12px; cursor: pointer; font-size: 14px; font-weight: 600; }
.where svg { width: 16px; height: 16px; fill: var(--accent); flex: none; }
.where span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-link { display: inline-flex; align-items: center; gap: 6px; flex: none; text-decoration: none;
                color: var(--text); border: 1px solid var(--line); background: var(--panel);
                border-radius: 999px; padding: 6px 10px; font-size: 14px; font-weight: 600; }
.account-link svg { width: 16px; height: 16px; fill: var(--accent); flex: none; }
.account-link span { display: none; max-width: 140px; overflow: hidden; text-overflow: ellipsis;
                     white-space: nowrap; }
.account-link.on { border-color: var(--accent); }
.topbar-inner { gap: 10px; }

/* Bottom bar (phones) */
.bottombar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex;
             background: var(--panel); border-top: 1px solid var(--line);
             padding-bottom: env(safe-area-inset-bottom); }
.bottombar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
               padding: 8px 0 6px; font-size: 12px; font-weight: 600; color: var(--muted);
               text-decoration: none; }
.bottombar svg { width: 22px; height: 22px; fill: currentColor; }
.bottombar a.on { color: var(--accent); }
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .bottombar { display: none; }
  .tabs { display: flex; }
  .topbar-inner { gap: 16px; }
  .account-link span { display: inline; }
}

/* Layout */
.view { max-width: 1040px; margin: 0 auto; padding: 18px 16px 24px; outline: none; }
.footer { max-width: 1040px; margin: 0 auto; padding: 8px 16px 28px; color: var(--muted); font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
        box-shadow: var(--shadow); }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
                margin-bottom: 10px; }
.section-head h2 { font-size: 18px; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
       padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
       background: var(--panel); cursor: pointer; font-weight: 600; text-decoration: none;
       color: var(--text); white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: default; }
.icon-btn { border: 0; background: var(--panel-2); width: 34px; height: 34px; border-radius: 999px;
            cursor: pointer; font-size: 15px; flex: none; }
.field { display: block; }
.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
                background: var(--bg); }
input:focus, select:focus, .btn:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; }
.searchbar { display: flex; gap: 8px; }
.searchbar input { font-size: 16px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
        padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text);
        text-decoration: none; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.status { min-height: 1.4em; color: var(--muted); margin: 10px 0 0; }
.status.error { color: var(--warn); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }

/* Home */
.hero { padding: 6px 0 4px; }
.hero h1 { font-size: clamp(26px, 5vw, 38px); letter-spacing: -0.02em; }
.hero p { margin: 8px 0 0; color: var(--muted); font-size: 16px; }
.modes { display: grid; gap: 14px; margin-top: 20px; }
@media (min-width: 760px) { .modes { grid-template-columns: 3fr 2fr; } }
.modes > *, .toolbar > *, .filters > * { min-width: 0; }
.mode { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.mode h2 { font-size: 19px; }
.mode p { margin: 0; color: var(--muted); }
.mode-tag { align-self: flex-start; font-size: 12px; font-weight: 700; padding: 3px 9px;
            border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.mode.choose { background: linear-gradient(160deg, var(--panel), var(--panel-2)); }
.mode.choose .btn { align-self: flex-start; }
.how { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
@media (min-width: 760px) { .how { grid-template-columns: repeat(3, 1fr); } }
.how li { padding: 14px; display: flex; gap: 12px; align-items: flex-start; }
.how b { display: block; }
.how .num { flex: none; width: 28px; height: 28px; border-radius: 999px; background: var(--accent-soft);
            color: var(--accent); font-weight: 800; display: grid; place-items: center; }

/* Toolbar */
.toolbar { display: grid; gap: 10px; }
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.filters .field > span { font-size: 11px; }
.filters select { padding: 8px 10px; font-size: 14px; }
.resultbar { display: flex; align-items: center; justify-content: space-between; gap: 10px;
             margin: 16px 0 10px; }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.toggle button { border: 0; background: var(--panel); padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 14px; }
.toggle button.on { background: var(--text); color: var(--bg); }

/* Lists */
.list { display: grid; gap: 10px; }
@media (min-width: 760px) { .list.two { grid-template-columns: 1fr 1fr; } }
.item { padding: 14px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
        text-align: left; width: 100%; font: inherit; color: inherit; }
.item:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.item-main { flex: 1; min-width: 0; }
.item-name { font-weight: 700; overflow-wrap: anywhere; }
.item-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.item-side { text-align: right; flex: none; }
.ppg { font-size: 19px; font-weight: 800; color: var(--accent); white-space: nowrap; }
.ppg small { font-size: 12px; font-weight: 600; color: var(--muted); }
.price { font-size: 13px; color: var(--muted); white-space: nowrap; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
         background: var(--gold-soft); color: var(--gold); margin-bottom: 4px; }
.badge.green { background: var(--accent-soft); color: var(--accent); }
.badge.grey { background: var(--panel-2); color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); color: var(--muted); }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.more { margin-top: 12px; text-align: center; }
.skeleton { height: 76px; border-radius: var(--radius); background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%);
            background-size: 200% 100%; animation: shimmer 1.2s infinite; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* Map */
.map { height: min(62vh, 560px); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden;
       background: var(--panel-2); }
.leaflet-popup-content { font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.leaflet-popup-content a.btn { color: var(--accent-text); margin-top: 6px; padding: 6px 12px; }
.pin-you { background: #2563eb; border: 3px solid #fff; border-radius: 999px; box-shadow: 0 0 0 2px #2563eb55; }

/* Store page */
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none;
        margin-bottom: 12px; }
.store-head { padding: 18px; display: grid; gap: 12px; }
.store-head h1 { font-size: 24px; }
.store-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.store-menu-head { display: flex; gap: 10px; align-items: center; justify-content: space-between;
                   flex-wrap: wrap; margin: 22px 0 10px; }
.group-title { font-size: 15px; font-weight: 700; margin: 18px 0 8px; color: var(--muted);
               text-transform: uppercase; letter-spacing: 0.04em; }

/* Sheets */
dialog.sheet { border: 0; padding: 0; background: transparent; color: var(--text); max-width: 560px;
               width: 100%; margin: auto auto 0; max-height: 92vh; }
@media (min-width: 760px) { dialog.sheet { margin: auto; } }
dialog.sheet::backdrop { background: rgb(0 0 0 / 45%); }
.sheet-body { background: var(--panel); border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
              display: grid; gap: 14px; max-height: 92vh; overflow-y: auto; }
@media (min-width: 760px) { .sheet-body { border-radius: 18px; } }
.sheet-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sheet-head h2 { font-size: 20px; overflow-wrap: anywhere; }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-actions .btn { flex: 1; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 0; }
.facts div { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.facts dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.facts dd { margin: 2px 0 0; font-weight: 700; font-size: 16px; }
.facts .hl dd { color: var(--accent); font-size: 20px; }
.store-line { display: flex; align-items: center; justify-content: space-between; gap: 12px;
              padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); }
.note { font-size: 13px; color: var(--muted); margin: 0; }

/* Age gate */
.gate { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; padding: 16px; }
.gate-card { max-width: 420px; text-align: center; }
.gate-card h1 { font-size: 26px; margin-bottom: 8px; }
.gate-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.gate-actions .btn { min-width: 130px; padding: 12px 18px; font-size: 16px; }
.gate-msg { color: var(--warn); min-height: 1.4em; }

/* Help me choose */
textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
           background: var(--bg); font: inherit; font-size: 16px; color: inherit; resize: vertical; }
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.choose-form { padding: 18px; display: grid; gap: 12px; }
.choose-form h1 { font-size: 24px; }
.choose-form .mode-tag { justify-self: start; }
.choose-form form { display: grid; gap: 14px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.filters.two { grid-template-columns: 1fr 1fr; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.consent input { width: auto; margin-top: 2px; }
.understood { margin: 18px 0 10px; }
.notice { padding: 14px 16px; margin-top: 16px; background: var(--gold-soft); color: var(--text);
          border-color: color-mix(in srgb, var(--gold) 35%, var(--line)); }
.strain { padding: 16px; display: grid; gap: 10px; margin-top: 12px; }
.strain h2 { font-size: 20px; }
.strain p { margin: 0; }
.strain-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.small-btn { padding: 6px 12px; font-size: 13px; }
.tag.match { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.disclaimer { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); }

/* Privacy and terms pages */
.legal { max-width: 720px; }
.legal h2 { margin-top: 24px; font-size: 18px; }
.legal li { margin-bottom: 8px; }

/* Accounts */
.auth { max-width: 440px; margin: 0 auto; padding: 22px 20px; }
.auth h1 { font-size: 22px; margin: 0 0 6px; }
.auth form { display: grid; gap: 12px; margin-top: 16px; }
.auth .switch { display: flex; gap: 6px; margin-top: 14px; }
.auth .switch .chip { flex: 1; justify-content: center; text-align: center; }
.providers { display: grid; gap: 8px; margin-top: 16px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 18px 0 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.linked { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.danger { color: var(--warn); }

/* Ask the expert */
.chat-head { padding: 16px 18px; display: grid; gap: 8px; }
.chat-head p { margin: 0; }
.chat-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.chat-title h1 { font-size: 22px; margin-top: 6px; }
.chat-log { display: grid; gap: 12px; margin: 16px 0; }
.bubble { padding: 12px 14px; border-radius: var(--radius); max-width: 100%; overflow-wrap: anywhere; }
.bubble.me { justify-self: end; max-width: 85%; background: var(--accent); color: var(--accent-text);
             border-bottom-right-radius: 4px; white-space: pre-wrap; }
.bubble.them { justify-self: stretch; background: var(--panel); border: 1px solid var(--line);
               box-shadow: var(--shadow); border-bottom-left-radius: 4px; display: grid; gap: 10px; }
.bubble.them .notice { margin: 0; }
.bubble.error { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); color: var(--warn); }
.bubble.typing { justify-self: start; color: var(--muted); }
.answer p { margin: 0 0 10px; }
.answer p:last-child, .answer ul:last-child { margin-bottom: 0; }
.answer ul { margin: 0 0 10px; padding-left: 20px; }
.answer li { margin: 4px 0; }
.answer-foot { display: flex; justify-content: flex-end; }
.linkish { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-size: 13px;
           text-decoration: underline; cursor: pointer; }
.linkish:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.chat-form { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 5;
             display: flex; gap: 8px; align-items: flex-end; padding: 10px; background: var(--panel);
             border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.chat-form textarea { flex: 1; min-width: 0; resize: none; border: 0; background: transparent; outline: none;
                      font: inherit; color: inherit; padding: 6px; }
.chat-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 12px; }
.chat-foot .note { margin: 0; }
@media (min-width: 760px) { .chat-form { bottom: 12px; } }
