:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #172722;
  background: #f1f3ed;
  --ink: #172722;
  --pine: #142622;
  --leaf: #d7ed9f;
  --border: #c5cdc3;
  --muted: #475b51;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
[hidden] { display: none !important; }
.top { background: var(--pine); color: #fff; padding-top: env(safe-area-inset-top); }
.top-inner, main { width: min(100% - 2rem, 42rem); margin-inline: auto; }
.top-inner, .brand { display: flex; align-items: center; gap: .75rem; }
.top-inner { min-height: 5.25rem; justify-content: space-between; }
.brand img { border-radius: .75rem; }
h1, h2, p { margin: 0; }
.brand h1 { font-size: 1.25rem; line-height: 1.2; letter-spacing: -.025em; }
.brand p { margin-top: .2rem; color: #ced9cb; font-size: .9rem; }
main { padding-block: 1.5rem calc(1.5rem + env(safe-area-inset-bottom)); }
.search-panel, .results {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: clamp(1rem, 4vw, 1.6rem);
}
.search-panel h2 { font-size: clamp(1.5rem, 5vw, 2rem); margin-bottom: .9rem; letter-spacing: -.045em; }
textarea, input {
  width: 100%;
  border: 1px solid #87978b;
  border-radius: .75rem;
  font: inherit;
  font-size: 1.0625rem;
  padding: .8rem;
  color: var(--ink);
  background: #fafbf8;
}
textarea { display: block; min-height: 5rem; resize: vertical; }
textarea::placeholder { color: #586760; }
button, .source a { -webkit-tap-highlight-color: transparent; }
button {
  font: inherit;
  cursor: pointer;
  min-height: 2.85rem;
  padding: .5rem .85rem;
  border: 1px solid var(--border);
  border-radius: .65rem;
  background: #fff;
  color: var(--ink);
  font-weight: 650;
}
button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 3px solid #247a59; outline-offset: 3px; }
.top :focus-visible { outline-color: var(--leaf); }
.actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: .65rem; margin-top: .75rem; }
.primary { color: #fff; background: var(--pine); border-color: var(--pine); }
#photo-fields { border: 0; margin: .55rem 0 0; padding: 0; min-inline-size: 0; }
#photo-picker summary { width: fit-content; padding: .65rem .15rem; min-height: 2.75rem; cursor: pointer; color: #175540; font-weight: 650; }
.photo-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
#photo-target { display: block; width: fit-content; max-width: 100%; padding: 0; margin-block: .6rem; overflow: hidden; background: var(--pine); cursor: crosshair; }
#photo-preview { display: block; width: auto; height: auto; max-width: 100%; max-height: 45vh; }
.dictate { display: flex; align-items: center; justify-content: center; gap: .45rem; }
.dictate[aria-pressed=true], .install { background: var(--leaf); border-color: var(--leaf); }
.topics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55rem; margin: .85rem 0 1.15rem; }
.topics button { padding-inline: .5rem; }
.results h2 { font-size: 1.3rem; margin-bottom: .6rem; }
.answer { line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.history { background: #fff; border: 1px solid var(--border); border-radius: 1.25rem; padding: .3rem 1rem; margin-top: 1rem; }
.history summary { cursor: pointer; min-height: 2.85rem; padding: .75rem 0; font-weight: 650; overflow-wrap: anywhere; }
.history > summary { font-size: 1.2rem; }
.history .notice { margin: 0 0 .75rem; }
#history-list details { border-top: 1px solid var(--border); }
#history-list time { display: block; font-size: .875rem; font-weight: 400; color: var(--muted); margin-top: .2rem; }
#history-list button { margin: .65rem 0; }
.source { margin-top: .85rem; padding-top: .85rem; border-top: 1px solid var(--border); }
.source a, footer a { color: #175540; text-underline-offset: .18em; }
.source a { display: inline-flex; min-height: 2.75rem; align-items: center; font-weight: 700; }
.source p { line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.notice { color: var(--muted); margin-top: .75rem; line-height: 1.45; }
.gate form { display: grid; gap: .65rem; }
footer { margin-top: 1.25rem; font-size: .9375rem; padding-inline: .2rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 420px) { .topics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
