/* Mushroom Detector design system */
/* Mushroom Wiki design system — warm, light, vibrant */
:root {
  --bg: #fff9f0;
  --surface: #ffffff;
  --surface-2: #fff4e4;
  --ink: #2b2016;
  --muted: #7b6a58;
  --line: #f1e3cf;
  --brand: #1e8a5a;
  --brand-deep: #126844;
  --brand-ink: #ffffff;
  --brand-2: #7fd4a2;
  --accent: #ff8a3d;
  --accent-2: #ffb347;
  --berry: #e4517f;
  --sun: #ffd166;
  --sky: #5ec6e8;
  --edible: #1f9d5f;
  --caution: #e0961f;
  --inedible: #7a8392;
  --toxic: #ef5a2a;
  --deadly: #c8203a;
  --unknown: #5b6b84;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(90,55,20,.05), 0 14px 36px -16px rgba(140,80,20,.22);
  --shadow-lift: 0 2px 4px rgba(90,55,20,.06), 0 22px 48px -18px rgba(140,80,20,.32);
  --glow: 0 10px 28px -8px rgba(30,138,90,.5);
  --grad-brand: linear-gradient(135deg, #1e8a5a 0%, #3fb57c 100%);
  --grad-warm: linear-gradient(135deg, #ff8a3d 0%, #ffb347 100%);
  --grad-berry: linear-gradient(135deg, #e4517f 0%, #ff8a6d 100%);
  --grad-sky: linear-gradient(135deg, #3aa9d6 0%, #7fd4a2 100%);
  --grad-text: linear-gradient(92deg, #126844 0%, #1e8a5a 38%, #ff8a3d 100%);
  --blob-1: #ffe4c4; --blob-2: #d6f4e3; --blob-3: #ffe3ec;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1510; --surface: #251d16; --surface-2: #2f251b; --ink: #f7ecdc; --muted: #bba993; --line: #3d3127;
    --brand: #3fb57c; --brand-deep: #2c9a66; --brand-ink: #10140f; --brand-2: #2a7f57; --accent: #ff9d5c; --accent-2: #ffc46b;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 14px 36px -16px rgba(0,0,0,.7);
    --shadow-lift: 0 2px 4px rgba(0,0,0,.5), 0 22px 48px -18px rgba(0,0,0,.8);
    --grad-text: linear-gradient(92deg, #7fd4a2 0%, #3fb57c 38%, #ffb347 100%);
    --blob-1: #3a2a18; --blob-2: #1c3328; --blob-3: #3a2030;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body { font: 16px/1.55 var(--font-body); color: var(--ink); background: radial-gradient(900px 520px at -10% -10%, var(--blob-1) 0%, transparent 62%), radial-gradient(760px 460px at 108% -4%, var(--blob-2) 0%, transparent 62%), radial-gradient(900px 560px at 50% 112%, var(--blob-3) 0%, transparent 62%), var(--bg); background-attachment: fixed; min-height: 100dvh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(30px, 5vw, 44px); }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; margin-left: auto; margin-right: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(160%) blur(12px); background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.nav { display: flex; align-items: center; gap: 14px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { border-radius: 9px; }
.wordmark { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.links { display: flex; gap: 4px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
.links::-webkit-scrollbar { display: none; }
.links a { white-space: nowrap; }
.links a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 10px; border-radius: 999px; }
.links a:hover { color: var(--ink); background: var(--surface-2); }
.links a.active { color: var(--brand-ink); background: var(--brand); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.lang-select { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font: inherit; font-size: 13px; }
.avatar-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; text-decoration: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.profile-card .avatar { width: 56px; height: 56px; font-size: 22px; }
@media (max-width: 640px) {
  .wordmark { display: none; }
  .links a { padding: 8px 8px; font-size: 13px; }
  .lang-select { max-width: 92px; }
  .avatar-btn span.name { display: none; }
}

/* ---------- layout ---------- */
main { flex: 1; padding: 24px 16px 40px; }
.view { display: flex; flex-direction: column; gap: 16px; }
.view.center { align-items: center; justify-content: center; min-height: 50vh; text-align: center; }
.page-head { margin: 8px 0 4px; }
.page-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lede { color: var(--muted); font-size: 17px; max-width: 60ch; }
.footer { border-top: 1px solid var(--line); padding: 18px 0 calc(env(safe-area-inset-bottom) + 18px); font-size: 13px; color: var(--muted); }
.footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- landing ---------- */
.hero { padding: 36px 0 12px; max-width: 760px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.hero h1 { font-size: clamp(36px, 6vw, 58px); margin-bottom: 14px; }
.hero .lede { font-size: 19px; margin-bottom: 20px; }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-note { font-size: 13px; color: var(--muted); margin-top: 12px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.feature-icon { font-size: 28px; margin-bottom: 10px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--muted); margin: 0; font-size: 15px; }
.steps { margin-top: 10px; }
.steps h2 { margin-bottom: 12px; }
.step-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step-list li { display: flex; gap: 12px; align-items: flex-start; }
.step-list p { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; font-family: var(--font-display); }
.safety-banner { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: var(--radius); padding: 14px 16px; font-size: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 760px) { .features, .step-list { grid-template-columns: 1fr; } .hero { padding-top: 16px; } }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; transition: transform .05s ease, background .15s ease; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); background: var(--brand); }
.btn.ghost { background: transparent; }
.btn.lg { padding: 13px 20px; font-size: 16px; }
.btn.wide { width: 100%; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.danger-btn { background: var(--deadly); color: #fff; border-color: var(--deadly); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 500; }
.field em { font-style: normal; opacity: .8; font-weight: 400; }
.field small { font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], textarea, select.plain { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; font: inherit; background: var(--surface); color: var(--ink); }
input:focus, textarea:focus, select:focus, .dropzone:focus { outline: 2px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 1px; }
textarea { resize: vertical; }
#profileLang { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; font: inherit; background: var(--surface); color: var(--ink); }
.form-error { color: var(--toxic); font-size: 14px; margin: 0; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-card h1 { font-size: 28px; }
.auth-card .lede { font-size: 15px; margin: 0; }
.auth-switch { font-size: 14px; color: var(--muted); text-align: center; margin: 4px 0 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card h2 { margin-bottom: 10px; }
.card h3 { margin: 14px 0 4px; }
.card p { margin: 6px 0; }
.card ul { margin: 6px 0; padding-left: 20px; }
.card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; }
.card dt { color: var(--muted); font-size: 14px; }
.card dd { margin: 0; }
.card.alert { border-left: 5px solid var(--deadly); background: color-mix(in srgb, var(--deadly) 9%, var(--surface)); }
.card.alert h2 { color: var(--deadly); }
.card.warn { border-left: 5px solid var(--caution); background: color-mix(in srgb, var(--caution) 9%, var(--surface)); }
.card.danger { border-color: color-mix(in srgb, var(--deadly) 40%, var(--line)); }
form.card { display: flex; flex-direction: column; gap: 12px; }
form.card h2 { margin: 0; }
.profile-card { display: flex; align-items: center; gap: 16px; }
.profile-card > div:nth-child(2) { flex: 1; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.panel-title { font-size: 18px; }
.safety-note { font-size: 13px; color: var(--muted); margin: 0; }

/* ---------- identify ---------- */
.identify-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }
.identify-grid .col { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 860px) { .identify-grid { grid-template-columns: 1fr; } }
.dropzone { position: relative; border: 2px dashed var(--line); border-radius: var(--radius); min-height: 280px; display: grid; place-items: center; overflow: hidden; background: var(--surface); cursor: pointer; }
.dropzone.has-image { border-style: solid; }
.dropzone img { width: 100%; max-height: 62vh; object-fit: contain; display: block; }
.drop-hint { text-align: center; color: var(--muted); padding: 24px; display: flex; flex-direction: column; gap: 6px; }
.drop-hint .big { font-size: 42px; }
.drop-hint small { font-size: 13px; max-width: 36ch; }
.mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-opt { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.mode-opt:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--surface); }
.mode-opt input { margin-top: 4px; }
.mode-opt span { display: flex; flex-direction: column; font-size: 14px; }
.mode-opt small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.mode-opt .gate { color: var(--accent); font-weight: 600; margin-top: 2px; }
.model-status { font-size: 13px; color: var(--muted); padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.model-status progress { width: 100%; height: 6px; }
details.tips { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 0; }
details.tips summary { cursor: pointer; padding: 12px 14px; font-weight: 600; font-size: 15px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.tips summary::-webkit-details-marker { display: none; }
details.tips summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.tips[open] summary::before { transform: rotate(90deg); }
details.tips ol { margin: 0; padding: 0 14px 4px 32px; font-size: 14px; }
details.tips li, .guide-list li { margin: 6px 0; }
details.tips .safety-note { padding: 0 14px 12px; }
.guide-list { padding-left: 22px; margin: 6px 0; }

/* ---------- loading ---------- */
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--brand); animation: spin .9s linear infinite; }
.spinner.small { width: 16px; height: 16px; border-width: 2px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 17px; margin-top: 14px; }

/* ---------- result ---------- */
.result-actions { display: flex; gap: 8px; }
.result { display: flex; flex-direction: column; gap: 14px; max-width: 800px; }
.verdict { border-radius: var(--radius); padding: 18px 20px; color: #fff; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.verdict .label { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; opacity: .92; font-weight: 700; }
.verdict .name { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.15; }
.verdict .sci { font-style: italic; opacity: .92; }
.verdict .conf { font-size: 14px; margin-top: 8px; }
.verdict.edible { background: var(--edible); } .verdict.edible_with_caution { background: var(--caution); } .verdict.inedible { background: var(--inedible); }
.verdict.toxic { background: var(--toxic); } .verdict.deadly { background: var(--deadly); } .verdict.unknown { background: var(--unknown); }
.conf-bar { height: 6px; background: rgba(255,255,255,.3); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.conf-bar > div { height: 100%; background: #fff; }
.group-conf { margin-top: 10px; }
.offline-badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.25); color: #fff; margin-bottom: 4px; align-self: flex-start; }
.result-photo { width: 100%; max-height: 46vh; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.notice { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.notice.warn-notice { border-color: var(--caution); }
.pending { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.lookalike { padding: 10px 0; border-top: 1px solid var(--line); }
.lookalike:first-of-type { border-top: 0; padding-top: 0; }
.lookalike .head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pill { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; color: #fff; }
.pill.deadly { background: var(--deadly); } .pill.toxic { background: var(--toxic); } .pill.harmless, .pill.inedible, .pill.unknown { background: var(--inedible); }
.pill.edible, .pill.easy { background: var(--edible); } .pill.edible_with_caution, .pill.medium { background: var(--caution); } .pill.hard { background: var(--toxic); }
.cand { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.cand:first-of-type { border-top: 0; padding-top: 0; }
.cand .n { font-weight: 650; }
.cand .s { font-style: italic; color: var(--muted); font-size: 14px; grid-column: 1; }
.cand .p { font-weight: 700; font-variant-numeric: tabular-nums; grid-row: 1 / span 2; align-self: center; font-size: 22px; font-family: var(--font-display); }
.cand .bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.cand .bar > div { height: 100%; }
.cand .bar .edible { background: var(--edible); } .cand .bar .edible_with_caution { background: var(--caution); } .cand .bar .inedible { background: var(--inedible); }
.cand .bar .toxic { background: var(--toxic); } .cand .bar .deadly { background: var(--deadly); } .cand .bar .unknown { background: var(--unknown); }
.cand .why { grid-column: 1 / -1; font-size: 14px; color: var(--muted); margin: 0; }
.cand .tag { font-size: 11px; }
.members { display: flex; flex-direction: column; gap: 6px; }
.member { display: grid; grid-template-columns: 44px 1fr; gap: 8px; font-size: 14px; align-items: baseline; }
.member .p { font-weight: 700; font-variant-numeric: tabular-nums; }
.member em { color: var(--muted); }
details.recipe { border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; overflow: hidden; background: var(--surface-2); }
details.recipe summary { cursor: pointer; padding: 12px 14px; font-weight: 650; list-style: none; display: flex; flex-direction: column; gap: 4px; }
details.recipe summary::-webkit-details-marker { display: none; }
details.recipe summary .meta { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
details.recipe[open] summary { border-bottom: 1px solid var(--line); }
details.recipe .body { padding: 12px 14px; background: var(--surface); }
.ingredients { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
.ingredients .amt { color: var(--muted); font-variant-numeric: tabular-nums; }
ol.steps { padding-left: 22px; } ol.steps li { margin: 6px 0; }
.error { background: color-mix(in srgb, var(--toxic) 12%, var(--surface)); border: 1px solid var(--toxic); border-radius: 12px; padding: 12px 14px; }

/* ---------- history ---------- */
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.hist-card { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; cursor: pointer; text-align: left; font: inherit; color: inherit; box-shadow: var(--shadow); }
.hist-card:hover { background: var(--surface-2); }
.hist-card img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.hist-card .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hist-card .t strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-card .t small { color: var(--muted); }
.hist-card .src { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; grid-column: 1 / -1; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: calc(env(safe-area-inset-bottom) + 16px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 40; width: min(92vw, 420px); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); animation: rise .2s ease; }
.toast.err { background: var(--toxic); color: #fff; }
.toast.ok { background: var(--edible); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* collapsible result sections */
details.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
details.section > summary { cursor: pointer; list-style: none; padding: 14px 20px; font-family: var(--font-display); font-weight: 700; font-size: 19px; display: flex; align-items: center; gap: 10px; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::before { content: "▸"; color: var(--muted); font-size: 16px; transition: transform .15s; font-family: var(--font-body); }
details.section[open] > summary::before { transform: rotate(90deg); }
details.section > summary .meta { margin-left: auto; font-family: var(--font-body); font-size: 13px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
details.section > .body { padding: 0 20px 18px; }
details.section > .body .card { box-shadow: none; border: 0; padding: 0; background: transparent; }
details.section > .body .card + .card { border-top: 1px solid var(--line); border-radius: 0; padding-top: 14px; margin-top: 14px; }
.quick-badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.25); color: #fff; margin-bottom: 4px; align-self: flex-start; }

/* ---------- wiki landing ---------- */
.wiki-hero h1 { font-size: clamp(34px, 5.6vw, 56px); }
.search { display: flex; gap: 8px; margin-top: 18px; }
.search input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 999px; padding: 12px 18px; font: inherit; font-size: 16px; background: var(--surface); color: var(--ink); }
.search .btn { border-radius: 999px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.tile { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: transform .08s ease, border-color .15s; }
.tile:hover { transform: translateY(-2px); border-color: var(--brand-2); }
.tile-icon { font-size: 26px; margin-bottom: 8px; }
.tile h3 { margin-bottom: 4px; }
.tile p { color: var(--muted); font-size: 14px; margin: 0; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; padding: 14px 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.stat { display: flex; flex-direction: column; }
.stat b { font-family: var(--font-display); font-size: 26px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
@media (max-width: 860px) { .tiles { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .tiles { grid-template-columns: 1fr; } }

/* ---------- species library ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.library-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.sp-row { display: flex; gap: 12px; align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-decoration: none; color: inherit; box-shadow: var(--shadow); overflow: hidden; }
.sp-thumb { width: 96px; height: 96px; flex-shrink: 0; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.sp-thumb.placeholder { display: grid; place-items: center; font-size: 30px; color: var(--muted); }
.sp-body { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: start; min-width: 0; flex: 1; }
.sp-figure { margin: 0 0 12px; }
.sp-figure img { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.sp-figure figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.sp-row:hover { background: var(--surface-2); }
.sp-row .cn { font-weight: 650; }
.sp-row .sci { grid-column: 1; font-style: italic; color: var(--muted); font-size: 13px; }
.sp-row .note { grid-column: 1 / -1; font-size: 13px; color: var(--muted); margin: 2px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-row .tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.tag-soft { font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
.sp-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.sp-head .sci { font-style: italic; color: var(--muted); font-size: 18px; }
.sp-head .pills { display: flex; gap: 6px; flex-wrap: wrap; }
.sp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.lang-notes dt { color: var(--muted); font-size: 13px; }

/* ---------- myths ---------- */
.myths { display: flex; flex-direction: column; gap: 12px; }
.myth { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: grid; gap: 6px; }
.myth .claim { font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.25; }
.myth .verdict { justify-self: start; }
.pill.false { background: var(--deadly); } .pill.mostly_false { background: var(--toxic); } .pill.true_with_caveats { background: var(--caution); }
.myth .reality { color: var(--ink); margin: 0; }
.myth .lab { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }

/* ---------- claim checker ---------- */
.examples { display: flex; flex-direction: column; gap: 6px; }
.examples div { display: flex; flex-wrap: wrap; gap: 6px; }
.claim-result { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.claim-result .claim { font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1.25; }
.pill.true { background: var(--edible); } .pill.mostly_true { background: var(--caution); } .pill.unverifiable { background: var(--unknown); }
.risk { font-weight: 700; } .risk.low { color: var(--edible); } .risk.medium { color: var(--caution); } .risk.high { color: var(--toxic); } .risk.life_threatening { color: var(--deadly); }
/* ---------- duels ---------- */
.duel-score { font-size: 14px; color: var(--muted); text-align: right; font-weight: 600; }
.duel { display: flex; flex-direction: column; gap: 12px; }
.duel-photo { width: 100%; max-height: 60vh; object-fit: contain; border-radius: var(--radius); background: var(--surface-2); box-shadow: var(--shadow); }
.duel-credit { font-size: 12px; color: var(--muted); }
.duel-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.duel-choice { padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font: inherit; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.duel-choice:hover { background: var(--surface-2); }
.duel-choice em { color: var(--muted); font-size: 13px; }
.duel-choice.right { border-color: var(--edible); box-shadow: inset 0 0 0 2px var(--edible); }
.duel-choice.wrong { border-color: var(--deadly); box-shadow: inset 0 0 0 2px var(--deadly); }
.duel-choice:disabled { cursor: default; }
.duel-feedback { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
@media (max-width: 480px) { .duel-choices { grid-template-columns: 1fr; } }


/* ---------- warm & fancy layer (overrides) ---------- */
.topbar { background: color-mix(in srgb, var(--surface) 72%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); box-shadow: 0 6px 24px -20px rgba(140,80,20,.35); }
.links a.active { background: var(--grad-brand); color: #fff; box-shadow: var(--glow); }
.links a:hover { background: var(--surface-2); }
.avatar { background: var(--grad-warm); }
.lang-select, .avatar-btn { background: color-mix(in srgb, var(--surface) 85%, transparent); }

.eyebrow { display: inline-flex; align-items: center; gap: 6px; background: var(--grad-warm); color: #fff; padding: 5px 12px; border-radius: 999px; letter-spacing: .1em; box-shadow: 0 8px 20px -10px rgba(255,138,61,.7); }
.hero h1, .wiki-hero h1 { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: .06em; }
.hero .lede { color: var(--muted); }
.hero { position: relative; }
.hero::after { content: "🍄"; position: absolute; right: -6px; top: 8px; font-size: clamp(56px, 10vw, 110px); opacity: .18; filter: saturate(1.3) drop-shadow(0 10px 20px rgba(228,81,127,.35)); pointer-events: none; transform: rotate(-12deg); }
@media (max-width: 760px) { .hero::after { display: none; } }
.search input { padding: 14px 20px; box-shadow: var(--shadow); border-color: transparent; }
.search input:focus { outline: 0; border-color: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent), var(--shadow); }

.btn.primary { background: var(--grad-brand); border-color: transparent; box-shadow: var(--glow); transition: transform .15s ease, box-shadow .15s ease, filter .15s ease; }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 32px -10px rgba(30,138,90,.6); filter: brightness(1.04); }
.btn.primary:active { transform: translateY(0); }
.btn { border-radius: 14px; }
.chip.active { background: var(--grad-brand); border-color: transparent; box-shadow: var(--glow); }
.step-num { background: var(--grad-warm); box-shadow: 0 8px 18px -8px rgba(255,138,61,.8); }

.tile { position: relative; overflow: hidden; border-color: color-mix(in srgb, var(--line) 80%, transparent); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.tile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--grad-brand); }
.tile:nth-child(2)::before { background: var(--grad-warm); } .tile:nth-child(3)::before { background: var(--grad-berry); }
.tile:nth-child(4)::before { background: var(--grad-sky); } .tile:nth-child(5)::before { background: linear-gradient(135deg, var(--berry), var(--accent-2)); } .tile:nth-child(6)::before { background: linear-gradient(135deg, var(--sun), var(--accent)); }
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); border-color: transparent; }
.tile-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); margin-bottom: 12px; }
.tile:nth-child(2) .tile-icon { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); } .tile:nth-child(3) .tile-icon { background: color-mix(in srgb, var(--berry) 12%, var(--surface)); }
.tile:nth-child(4) .tile-icon { background: color-mix(in srgb, var(--sky) 16%, var(--surface)); } .tile:nth-child(5) .tile-icon { background: color-mix(in srgb, var(--accent-2) 20%, var(--surface)); } .tile:nth-child(6) .tile-icon { background: color-mix(in srgb, var(--sun) 28%, var(--surface)); }

.stats { background: linear-gradient(135deg, color-mix(in srgb, var(--sun) 22%, var(--surface)), color-mix(in srgb, var(--brand-2) 22%, var(--surface))); border-color: transparent; box-shadow: var(--shadow); }
.stat b { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 30px; }
.safety-banner { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), color-mix(in srgb, var(--sun) 24%, var(--surface))); border-color: transparent; box-shadow: var(--shadow); }

.feature, .card, .panel, .auth-card, details.section, .myth, .hist-card, .sp-row { border-color: color-mix(in srgb, var(--line) 85%, transparent); }
.card.alert { background: linear-gradient(135deg, color-mix(in srgb, var(--deadly) 10%, var(--surface)), var(--surface)); }
.card.warn { background: linear-gradient(135deg, color-mix(in srgb, var(--caution) 12%, var(--surface)), var(--surface)); }
.verdict { background-image: linear-gradient(135deg, rgba(255,255,255,.16), rgba(0,0,0,.08)); box-shadow: var(--shadow-lift); }
.verdict.edible { background-color: var(--edible); } .verdict.deadly { background-color: var(--deadly); }
.dropzone { border-color: color-mix(in srgb, var(--brand-2) 70%, var(--line)); background: color-mix(in srgb, var(--brand-2) 7%, var(--surface)); }
.mode-opt:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset, var(--glow); }
.spinner { border: 4px solid var(--line); border-top-color: var(--accent); border-right-color: var(--brand); }

.sp-row { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.sp-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--brand-2); background: var(--surface); }
.sp-thumb { box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); }
.sp-thumb.placeholder { background: linear-gradient(135deg, color-mix(in srgb, var(--sun) 30%, var(--surface)), color-mix(in srgb, var(--brand-2) 24%, var(--surface))); }
.sp-figure img { box-shadow: var(--shadow-lift); }
.myth .claim, .claim-result .claim { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.duel-choice { transition: transform .12s ease, box-shadow .12s ease; }
.duel-choice:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow); }
.duel-photo { box-shadow: var(--shadow-lift); }
.toast { background: var(--ink); color: var(--surface); border-radius: 14px; }
.footer { border-top-color: color-mix(in srgb, var(--line) 70%, transparent); }
