:root {
  --green: #2f6b3f; --green-2: #e7f1e9; --ink: #1d2a21; --muted: #5d6b61; --line: #dfe6e0;
  --bg: #f6f8f5; --card: #fff; --warn: #a33a1f; --warn-bg: #fdeee9; --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #e6eee7; --muted: #9fb0a4; --line: #2c3a30; --bg: #121a14; --card: #1a241d;
          --green-2: #213528; --warn-bg: #3a2019; --warn: #ff9b80; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5;
       padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--green); }
@media (prefers-color-scheme: dark) { a { color: #8fd3a2; } }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
       gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--card);
       border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem;
         color: var(--ink); text-decoration: none; }
.brand img { width: 28px; height: 28px; }
main { max-width: 900px; margin: 0 auto; padding: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px;
       border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
       font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--warn); border-color: var(--warn); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.small { padding: 5px 10px; font-size: .9rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
          background: var(--card); color: var(--ink); font: inherit; margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        overflow: hidden; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.card .ph { aspect-ratio: 1; background: var(--green-2) center/cover no-repeat; display: grid;
            place-items: center; font-size: 2.5rem; }
.card .t { padding: 8px 10px 10px; }
.card .t b { display: block; font-size: .98rem; line-height: 1.25; }
.card .t i { color: var(--muted); font-size: .82rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 7px; border-radius: 99px;
         background: var(--warn-bg); color: var(--warn); margin-top: 4px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
         padding: 14px 16px; margin: 14px 0; }
.panel h2 { font-size: 1.05rem; margin: 0 0 8px; }
.panel h3 { font-size: .95rem; margin: 12px 0 2px; }
.panel p { margin: 4px 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
h1 { font-size: 1.5rem; margin: 6px 0 0; line-height: 1.2; }
.sci { color: var(--muted); font-style: italic; margin: 2px 0 10px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.gallery figure { margin: 0; flex: 0 0 auto; position: relative; scroll-snap-align: start; }
.gallery img { height: 260px; max-width: 85vw; object-fit: cover; border-radius: var(--radius); display: block; }
.gallery figcaption { position: absolute; left: 8px; bottom: 6px; font-size: .75rem; color: #fff;
                      text-shadow: 0 1px 3px #000; }
.gallery .x { position: absolute; top: 6px; right: 6px; background: #0008; color: #fff; border: 0;
              border-radius: 99px; width: 28px; height: 28px; cursor: pointer; }
.care { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 16px; }
.links a { display: block; font-weight: 600; margin-top: 8px; }
.links small { color: var(--muted); display: block; }
.toxic { background: var(--warn-bg); border-color: var(--warn); }
textarea, input[type=text], input[type=password], select { width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line);
         background: var(--bg); color: var(--ink); font: inherit; }
textarea { min-height: 70px; resize: vertical; }
label.f { display: block; font-weight: 600; font-size: .88rem; margin: 10px 0 4px; }
.answer { white-space: normal; background: var(--green-2); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.answer ul { margin: 4px 0; padding-left: 20px; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick label { display: grid; place-items: center; gap: 6px; padding: 28px 10px; border: 2px dashed var(--line);
              border-radius: var(--radius); background: var(--card); cursor: pointer; font-weight: 600; text-align: center; }
.pick label span { font-size: 2.2rem; }
.pick input { display: none; }
.preview { width: 100%; max-height: 50vh; object-fit: contain; border-radius: var(--radius); margin: 12px 0; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--green);
           border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.hist { font-size: .82rem; color: var(--muted); }
.hist li { margin: 2px 0; }
#toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
         background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; max-width: 90vw;
         z-index: 20; box-shadow: 0 4px 16px #0004; }
details summary { cursor: pointer; font-weight: 600; }
[hidden] { display: none !important; }
