:root {
  --bg: #f6f3ea;
  --surface: #fffdf7;
  --ink: #1f2a1f;
  --muted: #5f6b5c;
  --line: #e2dccb;
  --green: #2f6b3a;
  --green-ink: #ffffff;
  --leaf: #8fbf5a;
  --sun: #e8963a;
  --danger: #b3412f;
  --calm: #20412a;
  --calm-ink: #eef5e6;
  --radius: 18px;
  --shadow: 0 1px 2px rgb(30 40 20 / 6%), 0 6px 20px rgb(30 40 20 / 6%);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121712;
    --surface: #1b221b;
    --ink: #e8eee2;
    --muted: #9eab98;
    --line: #2c372b;
    --green: #6fbf73;
    --green-ink: #0f1a10;
    --leaf: #a6d46f;
    --sun: #f0a85a;
    --danger: #ef8a76;
    --calm: #0d1f12;
    --calm-ink: #dfeed6;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px 24px; flex: 1; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; width: 100%; margin: 0 auto; padding: 14px 16px;
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.05rem; }

.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 600; cursor: pointer;
}

.screen { padding-top: 8px; }
.hero { font-size: clamp(2.1rem, 9vw, 3rem); line-height: 1.05; margin: 18px 0 12px; letter-spacing: -0.02em; }
.lede { color: var(--muted); margin: 0 0 24px; }
.eyebrow { color: var(--muted); font-size: 0.9rem; margin: 4px 0 12px; }
h2 { margin: 12px 0 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 14px; padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer;
  min-height: 48px; text-align: center;
}
.btn.primary { background: var(--green); color: var(--green-ink); border-color: transparent; }
.btn.big { width: 100%; font-size: 1.1rem; padding: 16px; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn:focus-visible, .link:focus-visible, .chip:focus-visible { outline: 3px solid var(--leaf); outline-offset: 2px; }

.link {
  background: none; border: 0; padding: 6px 0; color: var(--green); font: inherit;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.link.danger { color: var(--danger); }

.search { display: flex; gap: 8px; margin-top: 12px; }
.search input, .settings input, .settings select {
  flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 14px; padding: 12px 14px; font: inherit; min-height: 48px;
}

.error { color: var(--danger); }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.label { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.weather { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.weather strong { display: block; white-space: nowrap; font-size: clamp(1.15rem, 5.4vw, 1.5rem); line-height: 1.2; margin: 2px 0; font-variant-numeric: tabular-nums; }
.weather .muted { font-size: 0.9rem; }
.sun strong { color: var(--sun); }

.ai-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.ai-head .label { flex: none; }
.tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.plan-text { margin: 6px 0 10px; font-size: 1.05rem; white-space: pre-line; }
.plan-text.loading { color: var(--muted); }
.mission {
  margin: 0 0 6px; padding: 10px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--leaf) 22%, transparent); font-weight: 600;
}
.mission::before { content: "🎯 "; }

.progress { margin: 8px 0; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--green); transition: width 0.3s; }
.progress small { color: var(--muted); }

.map { height: 240px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 12px; z-index: 0; }
.map:empty { display: none; }

.spots { list-style: none; padding: 0; margin: 0 0 96px; }
.spots li { border-bottom: 1px solid var(--line); }
.spots a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px; color: var(--ink); text-decoration: none; }
.spots .meta { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }

.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 35%); z-index: 5;
}
.sticky-cta .btn { max-width: 528px; margin: 0 auto; display: flex; }

.calm {
  position: fixed; inset: 0; z-index: 10; background: var(--calm); color: var(--calm-ink);
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; justify-content: center;
}
.calm[hidden] { display: none; }
.calm .eyebrow, .calm .muted { color: color-mix(in srgb, var(--calm-ink) 70%, transparent); }
.calm .link { color: var(--calm-ink); align-self: center; margin-top: 12px; }
.calm .btn.primary { background: var(--leaf); color: #10200f; }
.big-mission { font-size: 1.2rem; background: rgb(255 255 255 / 10%); }
.calm > * { width: 100%; max-width: 528px; margin-left: auto; margin-right: auto; }

.file-btn { width: 100%; margin: 16px 0 8px; }

.proof-img { width: 100%; max-height: 50vh; object-fit: cover; border-radius: var(--radius); }
.verdict { margin: 16px 0; }
.verdict h3 { margin: 0 0 6px; font-size: 1.4rem; }
.verdict .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; padding: 0; list-style: none; }
.verdict .tags li, .entries .tags li {
  background: color-mix(in srgb, var(--leaf) 22%, transparent); border-radius: 999px; padding: 2px 10px; font-size: 0.85rem;
}
.row { display: flex; gap: 8px 20px; flex-wrap: wrap; align-items: center; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.stats strong { display: block; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 0.82rem; }

.entries { list-style: none; padding: 0; margin: 8px 0; }
.entries li { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.entries img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; }
.entries > li:last-child { border-bottom: 0; }
.entries .tags { display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 4px 0 0; list-style: none; }
.entries .tags li { display: inline; grid-template-columns: none; border: 0; padding: 1px 8px; }

.offline-note { background: color-mix(in srgb, var(--sun) 20%, transparent); padding: 8px 12px; border-radius: 12px; }

.settings { margin: 24px 0 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.settings summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.settings fieldset { border: 0; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.settings legend { font-weight: 600; margin-bottom: 6px; }
.settings label { display: flex; gap: 8px; align-items: center; }
.ollama { display: grid; gap: 6px; padding-left: 24px; }
code { font-size: 0.85em; word-break: break-all; }

.foot { text-align: center; padding: 16px; font-size: 0.85rem; }
.foot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) { .bar span { transition: none; } }

#ai-note .row { flex-wrap: nowrap; margin-bottom: 6px; }
#ai-note .btn { flex: 1; padding: 10px 8px; font-size: 0.95rem; }
