:root {
  /* premium emerald + ivory + gold palette */
  --g900: #122a1c;
  --g800: #163c26;
  --g700: #1f5c38;
  --g600: #2a7849;
  --g100: #e9efe3;
  --g50: #f5f2e7;
  --text: #20291d;
  --muted: #6c7363;
  --border: #e5dfcb;
  --bg: #faf7ef;
  --card: #fffdf8;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --blue: #1565c0;
  --blue-bg: #e8f1fd;
  --radius: 18px;
  --shadow: 0 1px 2px rgb(20 30 20 / 6%), 0 10px 26px rgb(20 50 30 / 10%);
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans Gurmukhi", "Noto Sans Devanagari", "Nirmala UI", Roboto, sans-serif;
  /* gold accent, new this redesign */
  --gold-700: #a3792f;
  --gold-600: #bf8f3f;
  --gold-500: #d4a84a;
  --gold-400: #e4c374;
  --gold-100: #f8edd2;
  --ink-900: #0c2016;
  --ink-800: #113224;
  --on-dark: #f6f2e2;
  --on-dark-muted: #c7cfba;
  --shadow-dark: 0 18px 40px rgb(5 15 10 / 45%);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 17px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button { font: inherit; }

/* top bar for inner screens */
.topbar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: #fff; border-bottom: 1px solid var(--border); }
.topbar h1 { margin: 0; font-size: 18px; text-align: center; color: var(--g900); }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--g50); color: var(--g800); font-size: 30px; line-height: 1; cursor: pointer; }
.lang-chip select { font-size: 14px; color: var(--g900); background: var(--g50); border: 1px solid var(--border); border-radius: 999px; padding: 7px 10px; max-width: 34vw; }
.lang-chip.light select { background: rgb(255 255 255 / 90%); border: 0; }

main { max-width: 560px; margin: 0 auto; padding: 14px 16px calc(32px + env(safe-area-inset-bottom)); }
main:has(.home:not([hidden])) { padding-top: 0; }

/* home — premium emerald hero over a real Punjab wheat-field photo */
.hero {
  margin: 0 -16px; padding: calc(18px + env(safe-area-inset-top)) 18px 28px;
  position: relative; overflow: hidden; border-radius: 0 0 32px 32px; isolation: isolate;
  background: var(--ink-900);
}
.hero-bg { position: absolute; inset: 0; z-index: -2; background: url("photos/hero-wheat-sunset.jpg") center 38% / cover no-repeat; }
.hero-scrim { position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgb(10 26 17 / 78%) 0%, rgb(12 32 22 / 88%) 55%, rgb(12 32 22 / 97%) 100%); }
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { border-radius: 10px; background: #fff; padding: 2px; }
.brand div { display: flex; flex-direction: column; line-height: 1.15; color: var(--on-dark); }
.brand b { font-size: 18px; }
.brand small { font-size: 11px; color: var(--gold-400); }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 6px; margin: 22px 0 0; padding: 5px 12px; border-radius: 999px;
  background: rgb(228 195 116 / 14%); border: 1px solid rgb(228 195 116 / 35%); color: var(--gold-400); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.hero-eyebrow::before { content: "●"; font-size: 8px; color: var(--gold-500); }
.hero-title { font-size: 34px; line-height: 1.18; margin: 14px 0 8px; color: var(--on-dark); font-weight: 800; letter-spacing: -.01em; }
.hero-sub { margin: 0 0 20px; color: var(--on-dark-muted); max-width: 86%; font-size: 15.5px; }
.hero-art { display: none; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; position: relative; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left; width: 100%;
  background: rgb(255 255 255 / 6%); border: 1px solid rgb(246 242 226 / 14%); border-radius: var(--radius);
  padding: 14px; box-shadow: none; cursor: pointer; color: var(--on-dark); backdrop-filter: blur(6px); position: relative; overflow: hidden;
}
.tile.main {
  grid-column: 1 / -1; flex-direction: row; align-items: center; color: var(--ink-900); border: 0; padding: 18px 16px;
  background: linear-gradient(100deg, var(--gold-500) 0%, rgb(212 168 74 / 88%) 46%, rgb(212 168 74 / 55%) 100%), url("photos/harvest-hand.jpg") right center / cover no-repeat;
}
.tile.main .tile-tx small { color: rgb(12 32 22 / 70%); }
.tile-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: rgb(255 255 255 / 12%); flex: none; }
.tile.main .tile-ic { background: rgb(12 32 22 / 14%); }
.tile-ic.green { background: rgb(42 120 73 / 35%); } .tile-ic.blue { background: rgb(21 101 192 / 25%); } .tile-ic.amber { background: var(--warn-bg); }
.tile-ic.whatsapp { background: #25D366; }
.tile-tx { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tile-tx b { font-size: 15px; line-height: 1.25; } .tile-tx small { font-size: 12px; opacity: .75; }
.tile.main .tile-tx b { font-size: 18px; }
.chev { display: none; }
.tile.main .chev { display: block; font-size: 24px; opacity: .55; margin-left: auto; }
.link-btn { display: block; margin: 8px auto 0; background: none; border: 0; color: var(--g700); font-weight: 600; padding: 10px; cursor: pointer; }
.link-btn.danger { color: var(--danger); }

/* stepper */
.stepper { display: flex; justify-content: center; gap: 0; list-style: none; padding: 0; margin: 4px 0 14px; counter-reset: s; }
.stepper li { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--border); color: var(--muted); font-weight: 700; position: relative; }
.stepper li + li { margin-left: 44px; }
.stepper li + li::before { content: ""; position: absolute; right: 100%; top: 50%; width: 44px; height: 2px; background: var(--border); }
.stepper li.on { background: var(--g700); border-color: var(--g700); color: #fff; }
.stepper li.done { background: var(--g100); border-color: var(--g600); color: var(--g700); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card.center { text-align: center; padding: 28px 16px; }
.label { display: block; font-weight: 700; margin: 14px 0 6px; }
.label:first-child { margin-top: 0; }
.tip { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.tips ul { margin: 8px 0 0; padding-left: 0; list-style: none; }
.tips li { padding-left: 26px; position: relative; margin-bottom: 4px; }
.tips li::before { content: "✓"; position: absolute; left: 0; color: var(--g700); font-weight: 800; }
.or { text-align: center; color: var(--muted); font-size: 13px; margin: 10px 0; }

.photo-box { border: 2px dashed var(--g600); border-radius: 14px; background: var(--g50); min-height: 200px; display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 12px; cursor: pointer; }
.photo-box.dragover { background: var(--g100); }
.photo-box img { width: 100%; max-height: 340px; object-fit: contain; display: block; }
.photo-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--g700); padding: 20px; text-align: center; }

.row { display: flex; gap: 10px; }
.row > .btn { flex: 1; }
.btn { border-radius: 12px; border: 0; cursor: pointer; padding: 12px 14px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, var(--g700), var(--g800)); color: #fff; }
.btn.secondary { background: var(--g100); color: var(--g900); }
.btn.whatsapp { background: #25D366; color: #fff; width: 100%; font-size: 17px; min-height: 54px; }
.btn.good { background: var(--g100); color: var(--g800); } .btn.bad { background: var(--danger-bg); color: var(--danger); }
.btn.call { background: #fff; color: var(--g800); border: 2px solid var(--g700); width: 100%; margin: 10px 0; }
.btn.wide { width: 100%; } .btn.small { min-height: 46px; flex: none; }
.btn.big { width: 100%; font-size: 18px; min-height: 56px; margin-top: 4px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .field:focus-visible, .icon-btn:focus-visible, select:focus-visible, textarea:focus-visible, .tile:focus-visible { outline: 3px solid #8cd39f; outline-offset: 2px; }
.field, textarea { width: 100%; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; min-height: 48px; }
textarea { resize: vertical; }
.counter { text-align: right; font-size: 12px; color: var(--muted); margin: 2px 0 10px; }

.thumb-row { position: relative; margin-bottom: 14px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.thumb-row img { width: 100%; height: 170px; object-fit: cover; display: block; }
.x-btn { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #fff; font-size: 16px; cursor: pointer; box-shadow: var(--shadow); }

.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; }
.seg button { border: 2px solid var(--border); background: #fff; border-radius: 12px; padding: 10px 6px; font-weight: 700; color: var(--text); cursor: pointer; min-height: 48px; }
.seg button.on { border-color: var(--g700); background: var(--g100); color: var(--g800); }
.tabs { grid-template-columns: 1fr 1fr; margin-bottom: 12px; }

/* Ask a farming question: a real chat, input pinned near the bottom like a messaging app */
.ask-chat { display: flex; flex-direction: column; }
.ask-scroll { flex: 1 1 auto; }

.ask-hero { text-align: center; margin: 4px 0 18px; }
.ask-avatar { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 20px; display: grid; place-items: center; font-size: 30px;
  background: linear-gradient(135deg, var(--g700), var(--ink-900)); box-shadow: var(--shadow); }
.ask-hero h2 { margin: 0 0 4px; font-size: 20px; color: var(--g900); }
.ask-hero p { margin: 0; color: var(--muted); font-size: 14px; }

.chat-thread { display: flex; flex-direction: column; gap: 14px; margin-bottom: 10px; }
.chat-thread:empty { display: none; }
.msg-row { display: flex; align-items: flex-end; gap: 8px; }
.msg-row.user { justify-content: flex-end; }
.chat-avatar { flex: none; width: 30px; height: 30px; border-radius: 10px; background: var(--g100); color: var(--g800); display: grid; place-items: center; font-size: 15px; }
.chat-bubble { max-width: 78%; padding: 11px 15px; border-radius: 18px; font-size: 15.5px; line-height: 1.5; white-space: pre-wrap; box-shadow: var(--shadow); }
.chat-bubble.user { background: linear-gradient(135deg, var(--gold-500), var(--gold-700)); color: var(--ink-900); font-weight: 500; border-bottom-right-radius: 5px; }
.chat-bubble.bot-msg { background: var(--card); border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 5px; }

/* typing indicator: three dots bouncing in sequence, shown as its own bot message row */
.typing-bubble { display: inline-flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; border-bottom-left-radius: 5px; padding: 13px 16px; box-shadow: var(--shadow); }
.typing-bubble i { width: 7px; height: 7px; border-radius: 50%; background: var(--g600); font-style: normal; animation: typingDot 1.2s ease-in-out infinite; }
.typing-bubble i:nth-child(2) { animation-delay: .15s; } .typing-bubble i:nth-child(3) { animation-delay: .3s; }
@keyframes typingDot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing-bubble i { animation: none !important; opacity: .8; } }

.ask-suggest { margin: 6px 0 4px; }

/* pill composer pinned near the bottom, like a messaging app */
.ask-input-bar { position: sticky; bottom: -32px; background: var(--bg); padding: 10px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 4; }
.composer { display: flex; align-items: flex-end; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 26px; padding: 7px 7px 7px 18px; box-shadow: 0 -6px 16px rgb(0 0 0 / 7%), var(--shadow); }
.composer textarea { flex: 1; border: 0; background: none; resize: none; font: inherit; font-size: 15.5px; padding: 8px 0; max-height: 120px; color: var(--text); }
.composer textarea:focus { outline: none; }
.send-fab { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: linear-gradient(135deg, var(--g700), var(--g800)); color: #fff; transition: transform .15s; }
.send-fab:active { transform: scale(.9); }
.send-fab:disabled { opacity: .45; cursor: not-allowed; }
.composer-counter { text-align: right; font-size: 11px; color: var(--muted); margin: 4px 8px 0 0; }

.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; background: var(--danger-bg); color: var(--danger); border: 1px solid #f3c2bd; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: #f0d9a6; }
.disclaimer { font-size: 13px; color: var(--muted); text-align: center; margin: 12px 4px 0; }
.disclaimer.strong { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 14px; }

/* loading */
.loader { text-align: center; padding: 10px 0; }
.ring { width: 120px; height: 120px; margin: 8px auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 46px; background: conic-gradient(var(--g700) 0 30%, var(--g100) 30% 100%); position: relative; animation: spin 1.8s linear infinite; }
.ring::before { content: ""; position: absolute; inset: 9px; background: var(--bg); border-radius: 50%; }
.ring span { position: relative; animation: spin 1.8s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; border: 5px solid var(--g100); border-top-color: var(--g700); animation: spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { .ring, .ring span, .spinner { animation-duration: 6s; } }
.loader h2 { font-size: 20px; margin: 0; }
.checklist { list-style: none; margin: 14px 0; padding: 14px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--muted); }
.checklist li i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-style: normal; font-size: 14px; flex: none; }
.checklist li.done { color: var(--text); } .checklist li.done i { background: var(--g700); border-color: var(--g700); color: #fff; }
.checklist li.now { color: var(--text); font-weight: 700; } .checklist li.now i { border-color: var(--g700); border-top-color: transparent; animation: spin 1s linear infinite; }
.note-box { background: var(--blue-bg); color: var(--blue); border-radius: 12px; padding: 12px 14px; text-align: center; font-size: 14px; }

/* result */
.result-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.result-photo { width: 112px; height: 112px; border-radius: 16px; overflow: hidden; flex: none; box-shadow: var(--shadow); background: #fff; }
.result-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.result-title { min-width: 0; } .result-title h2 { margin: 2px 0; font-size: 22px; line-height: 1.2; color: var(--g900); } .result-title small { color: var(--muted); }
.conf-badge { display: inline-block; font-size: 13px; font-weight: 800; border-radius: 999px; padding: 3px 10px; margin-bottom: 4px; }
.conf-badge.high { background: #fde2e1; color: #9b1c15; } .conf-badge.medium { background: var(--warn-bg); color: var(--warn); } .conf-badge.low { background: var(--g100); color: var(--g800); } .conf-badge:empty { display: none; }
.weather { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; padding: 12px; }
.weather .w-title { grid-column: 1 / -1; text-align: left; font-weight: 800; color: var(--g900); }
.weather .w-item { background: var(--g50); border-radius: 12px; padding: 8px 2px; }
.weather .w-val { font-weight: 800; } .weather .w-lbl { font-size: 12px; color: var(--muted); }
.section h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; margin: 0 0 8px; color: var(--g900); }
.section p { margin: 0 0 6px; }
.section ul { margin: 0; padding-left: 20px; } .section li { margin-bottom: 4px; }
.section.problems { border-left: 6px solid var(--g600); }
.section.todo ol { list-style: none; margin: 0; padding: 0; } .section.todo li { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.section.todo li b { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--g700); color: #fff; display: grid; place-items: center; font-size: 14px; }
.section.wx { background: var(--blue-bg); border-color: #c4dcf8; }
.section.help { background: var(--warn-bg); border-color: #f0d9a6; }
.conf { display: inline-block; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 1px 8px; vertical-align: 1px; }
.conf.high { background: #fde2e1; color: #9b1c15; } .conf.medium { background: var(--warn-bg); color: var(--warn); } .conf.low { background: var(--g100); color: var(--g900); }
.feedback .row { margin-top: 10px; }

/* ask */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chips button { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 9px 14px; font-size: 13.5px; font-weight: 600; color: var(--g800); cursor: pointer; transition: border-color .15s, transform .15s; }
.chips button:hover { border-color: var(--gold-500); }
.chips button:active { transform: scale(.96); }

/* weather */
.wx-main { background: linear-gradient(160deg, #e3f4ff, #fff); }
.wx-place { font-weight: 800; color: var(--g900); }
.wx-now { display: flex; align-items: center; gap: 12px; font-size: 46px; font-weight: 800; margin: 6px 0; } .wx-icon { font-size: 54px; }
.wx-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.wx-stats div { background: #fff; border-radius: 12px; padding: 8px 2px; border: 1px solid var(--border); font-weight: 700; } .wx-stats small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.forecast { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 14px; }
.forecast div { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 10px 4px; text-align: center; font-weight: 700; } .forecast small { display: block; color: var(--muted); font-weight: 400; }
.advisory { background: var(--warn-bg); border: 1px solid #f0d9a6; color: var(--warn); border-radius: 14px; padding: 12px 14px; }

/* history */
.hist-item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; box-shadow: var(--shadow); cursor: pointer; color: var(--text); }
.hist-item img, .hist-item .ph { width: 60px; height: 60px; border-radius: 12px; object-fit: cover; flex: none; background: var(--g100); display: grid; place-items: center; font-size: 28px; }
.hist-item b { display: block; } .hist-item small { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--g900); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 20; max-width: 90vw; }
.section.todo li.subhead { display: block; margin: 12px 0 6px; }
.section.todo li.subhead:first-child { margin-top: 0; }
.section.todo .sub { color: var(--g800); font-size: 15px; text-transform: uppercase; letter-spacing: .03em; }
.section.prevent { border-left: 6px solid var(--g600); background: var(--g50); }
.section ul.detail { margin: 4px 0 8px; padding-left: 18px; color: var(--muted); font-size: 15px; list-style: circle; }
.section.problems > ul > li { margin-bottom: 10px; font-weight: 600; }
.section.problems ul.detail li { font-weight: 400; }

/* home animations (switched off when the phone asks for reduced motion) */
.sun { transform-origin: 40px 30px; animation: sunspin 24s linear infinite; }
.cloud { animation: drift 16s ease-in-out infinite alternate; }
.cloud.c2 { animation-duration: 22s; animation-direction: alternate-reverse; }
.sw { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 3.2s ease-in-out infinite; }
.sw.s2 { animation-delay: -1s; } .sw.s3 { animation-delay: -2s; }
.sprout { transform-box: fill-box; transform-origin: 290px 112px; animation: grow 1.4s cubic-bezier(.2, .9, .3, 1.2) both, breathe 4s ease-in-out 1.4s infinite; }
.leaf { transform-box: fill-box; transform-origin: 0 100%; animation: flutter 3.6s ease-in-out infinite; }
.leaf.l2 { animation-delay: -1.8s; }
.hero-title, .hero-sub { animation: rise .7s ease-out both; }
.hero-sub { animation-delay: .12s; }
.tiles .tile { animation: rise .6s ease-out both; }
.tiles .tile:nth-child(1) { animation-delay: .2s; } .tiles .tile:nth-child(2) { animation-delay: .3s; }
.tiles .tile:nth-child(3) { animation-delay: .4s; } .tiles .tile:nth-child(4) { animation-delay: .5s; }
.tile.main { position: relative; overflow: hidden; }
.tile.main::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(100deg, transparent, rgb(255 255 255 / 28%), transparent); animation: shine 4.5s ease-in-out 1.5s infinite; }
.tile.main .tile-ic { animation: pulse 2.4s ease-in-out infinite; }
.tile:active { transform: scale(.98); }
@keyframes sunspin { to { transform: rotate(360deg); } }
@keyframes drift { from { transform: translateX(-14px); } to { transform: translateX(16px); } }
@keyframes sway { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes grow { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes flutter { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(5deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  .sun, .cloud, .sw, .sprout, .leaf, .hero-title, .hero-sub, .tiles .tile, .tile.main::after, .tile.main .tile-ic { animation: none !important; }
}

/* weather animations */
.wx-main { position: relative; overflow: hidden; }
.wx-main > :not(.sky) { position: relative; z-index: 1; }
.sky { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sky-clear { background: linear-gradient(160deg, #cdeaff, #fff 70%); }
.sky-cloudy, .sky-foggy { background: linear-gradient(160deg, #dfe8f0, #fff 75%); }
.sky-rainy, .sky-stormy { background: linear-gradient(160deg, #c3d1df, #eef3f8 80%); }
.sky-snowy { background: linear-gradient(160deg, #e6eefc, #fff 80%); }
.sky .glow { position: absolute; right: -30px; top: -30px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle, rgb(255 214 92 / 75%), rgb(255 214 92 / 0%) 68%); animation: glow 3.6s ease-in-out infinite; }
.sky .wcloud { position: absolute; left: -60px; width: 90px; height: 28px; border-radius: 999px; background: rgb(255 255 255 / 85%); box-shadow: 22px -10px 0 4px rgb(255 255 255 / 85%), 46px 0 0 0 rgb(255 255 255 / 85%); animation: wdrift 16s linear infinite; }
.sky .drop { position: absolute; top: -14px; width: 2px; height: 14px; border-radius: 2px; background: rgb(60 110 170 / 55%); animation: fall .9s linear infinite; }
.sky .flake { position: absolute; top: -10px; width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 4px rgb(120 150 200 / 60%); animation: snow 4.5s linear infinite; }
.sky .bolt { position: absolute; inset: 0; background: #fff; opacity: 0; animation: flash 6s ease-in-out infinite; }
.wx-icon { display: inline-block; animation: bob 3.6s ease-in-out infinite; }
.sky-clear .wx-icon { animation: bob 3.6s ease-in-out infinite, sunturn 18s linear infinite; }
.wx-stats div, .forecast div, .advisory { animation: rise .6s ease-out both; }
.wx-stats div:nth-child(2) { animation-delay: .1s; } .wx-stats div:nth-child(3) { animation-delay: .2s; }
.forecast div:nth-child(1) { animation-delay: .25s; } .forecast div:nth-child(2) { animation-delay: .35s; } .forecast div:nth-child(3) { animation-delay: .45s; }
.forecast div span { display: inline-block; animation: bob 3.2s ease-in-out infinite; }
.forecast div:nth-child(2) span { animation-delay: -1s; } .forecast div:nth-child(3) span { animation-delay: -2s; }
.advisory { animation-delay: .6s; }
@keyframes glow { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.18); opacity: 1; } }
@keyframes wdrift { from { transform: translateX(0); } to { transform: translateX(520px); } }
@keyframes fall { from { transform: translateY(0) rotate(12deg); opacity: .9; } to { transform: translateY(190px) rotate(12deg); opacity: 0; } }
@keyframes snow { from { transform: translate(0, 0); } 50% { transform: translate(14px, 95px); } to { transform: translate(-6px, 190px); } }
@keyframes flash { 0%, 92%, 100% { opacity: 0; } 94% { opacity: .75; } 96% { opacity: .1; } 97% { opacity: .6; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes sunturn { to { rotate: 360deg; } }
@media (prefers-reduced-motion: reduce) {
  .sky .glow, .sky .wcloud, .sky .drop, .sky .flake, .sky .bolt, .wx-icon, .wx-stats div, .forecast div, .forecast div span, .advisory { animation: none !important; }
}

/* logo: header emblem, loader */
.brand .emb { width: 46px; height: 46px; }
.emb-load { position: relative; z-index: 1; width: 64px; height: 64px; animation: logofloat 2.2s ease-in-out infinite; }
.ring { font-size: 0; }
.about-logo { display: block; margin: 10px auto; width: 170px; height: auto; cursor: pointer; }
@keyframes logofloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.ring .emb-load { animation: spin 1.8s linear infinite reverse; }
@media (prefers-reduced-motion: reduce) { .ring .emb-load { animation-duration: 6s !important; animation: spin 6s linear infinite reverse !important; } }


/* logo intro: 5 seconds in total. 0-0.6 ivory in, 0.6-2 emblem builds, 2-2.8 circuit scan, 2.8-4 name rises, 4-5 highlight and settle */
.splash { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: #fbfbf4; pointer-events: none; opacity: 0; animation: ivory .625s ease-out forwards, splashout .375s ease-in 4.625s forwards; }
.splash.gone { display: none; }
.splash .stage { position: relative; width: min(72vw, 320px); aspect-ratio: 520 / 448; animation: settle 1s ease-out 4s both; }
.splash .ly { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.splash .ly-base { transform-origin: 50% 80%; animation: unfold 1.125s cubic-bezier(.25, .8, .3, 1) .625s forwards; }
.splash .ly-field { transform-origin: 50% 80%; animation: unfold 1.125s cubic-bezier(.25, .8, .3, 1) .625s forwards; }
.splash .ly-wheat { opacity: 1; clip-path: inset(100% 0 0 0); animation: rise-clip .875s ease-out 1s forwards; }
.splash .ly-sun { transform-origin: 64.4% 16.7%; animation: sunin .875s ease-out 1.125s forwards; }
.splash .ly-text { transform: translateY(12px); animation: textin 1.25s ease-out 2.75s forwards; }
.splash .pg { position: absolute; width: 5.5%; aspect-ratio: 1; margin: -2.75% 0 0 -2.75%; border-radius: 50%; border: 2px solid #2fae5a; opacity: 0; animation: ping 1.25s ease-out forwards; }
.splash .r1 { left: 61.7%; top: 28.1%; animation-delay: 1.875s; } .splash .r2 { left: 67.3%; top: 31.7%; animation-delay: 2.063s; }
.splash .r3 { left: 68.7%; top: 39.7%; animation-delay: 2.25s; } .splash .r4 { left: 67.7%; top: 47.3%; animation-delay: 2.438s; }
.splash .scan { position: absolute; inset: 0; clip-path: inset(25% 27% 48% 56%); -webkit-mask: url(layer-base.webp) center / 100% 100% no-repeat; mask: url(layer-base.webp) center / 100% 100% no-repeat; background: linear-gradient(100deg, transparent 38%, rgb(90 235 140 / 95%) 50%, transparent 62%) -160% 0 / 260% 100% no-repeat; animation: scanmove .875s ease-in-out 1.875s forwards; }
.splash .shine { position: absolute; inset: 0; -webkit-mask: url(logo-full.webp) center / 100% 100% no-repeat; mask: url(logo-full.webp) center / 100% 100% no-repeat; background: linear-gradient(105deg, transparent 40%, rgb(255 255 255 / 85%) 50%, transparent 60%) -160% 0 / 260% 100% no-repeat; animation: scanmove 1s ease-in-out 4s forwards; }
@keyframes ivory { to { opacity: 1; } }
@keyframes splashout { to { opacity: 0; visibility: hidden; } }
@keyframes unfold { from { opacity: 0; transform: scale(.88) rotate(-6deg); } to { opacity: 1; transform: none; } }
@keyframes draw { to { clip-path: inset(0 0 0 0); } }
@keyframes rise-clip { to { clip-path: inset(0 0 0 0); } }
@keyframes sunin { from { opacity: 0; transform: scale(.55); } to { opacity: 1; transform: none; } }
@keyframes textin { to { opacity: 1; transform: none; } }
@keyframes ping { 0% { opacity: .85; transform: scale(.5); } 100% { opacity: 0; transform: scale(2.4); } }
@keyframes scanmove { to { background-position: 160% 0; } }
@keyframes settle { from { transform: scale(1.03); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .splash { animation: ivory .25s ease-out forwards, splashout .375s ease-in 1.5s forwards; }
  .splash .stage, .splash .ly, .splash .pg, .splash .scan, .splash .shine { animation: none !important; }
  .splash .ly { opacity: 1; clip-path: none; transform: none; } .splash .pg, .splash .scan, .splash .shine { display: none; }
}

/* result header: crop first, then the problem */
.result-title .eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: 12px; }
.result-title h2 { margin: 0 0 6px; font-size: 24px; }
.prob-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.prob-row small { color: var(--muted); flex-basis: 100%; }
.prob-row b { font-size: 17px; color: var(--g800); }
.section.photos { background: var(--blue-bg); border-color: #c4dcf8; }
.section.photos h2 { color: var(--blue); }

/* ====== premium homepage sections (new) ====== */
.home { padding-bottom: 8px; }
.stats-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 18px 0 26px; text-align: center; }
.stats-bar .stat b { display: block; font-size: 28px; color: var(--g800); font-weight: 800; }
.stats-bar .stat span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stats-bar .stat + .stat { border-left: 1px solid var(--border); }

.home-section { margin: 30px 0; }
.home-section .kicker { display: block; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-700); margin-bottom: 6px; }
.home-section h3 { font-size: 22px; margin: 0 0 16px; color: var(--g900); line-height: 1.25; }

.process { background: var(--ink-900); border-radius: 24px; padding: 24px 18px; margin: 0 -2px; box-shadow: var(--shadow-dark); }
.process .kicker { color: var(--gold-400); }
.process h3 { color: var(--on-dark); }
.process-grid { display: grid; gap: 12px; }
.process-step { background: rgb(255 255 255 / 5%); border: 1px solid rgb(246 242 226 / 12%); border-radius: 16px; padding: 14px; display: flex; align-items: center; gap: 12px; }
.process-step .num { font-family: var(--font); font-size: 13px; font-weight: 800; color: var(--gold-400); letter-spacing: .04em; flex: none; width: 34px; }
.process-step .pic { width: 30px; height: 30px; border-radius: 9px; background: rgb(228 195 116 / 14%); display: grid; place-items: center; font-size: 15px; flex: none; }
.process-step div.tx { min-width: 0; }
.process-step b { display: block; color: var(--on-dark); font-size: 15px; }
.process-step small { display: block; color: var(--on-dark-muted); font-size: 12.5px; margin-top: 1px; }

.trust-card { display: flex; flex-direction: column; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); }
.trust-photo { height: 150px; background: url("photos/hands-grain.jpg") center 30% / cover no-repeat; }
.trust-body { padding: 4px 18px 20px; }
.trust-body h3 { margin: 0 0 8px; font-size: 19px; color: var(--g900); }
.trust-body p { margin: 0 0 12px; color: var(--muted); font-size: 14.5px; }
.trust-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.trust-list li { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--text); }
.trust-list li::before { content: "✓"; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--g100); color: var(--g700); font-size: 12px; font-weight: 800; display: grid; place-items: center; margin-top: 1px; }

.feature-photo-card { border-radius: 20px; overflow: hidden; position: relative; aspect-ratio: 4/3; box-shadow: var(--shadow); }
.feature-photo-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feature-photo-card .fp-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgb(10 26 17 / 85%) 100%); }
.feature-photo-card .fp-tx { position: absolute; left: 12px; right: 12px; bottom: 12px; color: var(--on-dark); }
.feature-photo-card .fp-tx b { display: block; font-size: 14.5px; }
.feature-photo-card .fp-tx small { display: block; font-size: 11.5px; opacity: .85; }

.expert-cta { background: linear-gradient(135deg, var(--ink-900), var(--g800)); border-radius: 24px; padding: 22px 18px; box-shadow: var(--shadow-dark); color: var(--on-dark); }
.expert-cta .kicker { color: var(--gold-400); }
.expert-cta h3 { color: var(--on-dark); margin: 0 0 6px; font-size: 20px; }
.expert-cta p { color: var(--on-dark-muted); margin: 0 0 16px; font-size: 14px; }
.expert-cta .row { gap: 10px; }
.expert-cta .btn.gold { flex: 1; }
.expert-cta .btn.outline-light { flex: none; background: transparent; border: 1px solid rgb(246 242 226 / 30%); color: var(--on-dark); }

.btn.gold { background: linear-gradient(135deg, var(--gold-500), var(--gold-700)); color: var(--ink-900); }
.btn.gold:active { transform: scale(.98); }

/* home -> library entry card */
.library-cta { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); cursor: pointer; }
.lc-ic { width: 48px; height: 48px; border-radius: 14px; background: var(--gold-100); color: var(--gold-700); display: grid; place-items: center; font-size: 24px; flex: none; }
.lc-tx { flex: 1; min-width: 0; } .lc-tx b { display: block; font-size: 16px; color: var(--g900); } .lc-tx small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.chev-dark { font-size: 24px; color: var(--muted); }

/* ====== disease library ====== */
.lib-intro { text-align: center; margin: 4px 0 14px; }
.lib-intro .kicker { display: block; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-700); margin-bottom: 4px; }
.lib-intro h2 { margin: 0 0 6px; font-size: 21px; color: var(--g900); }
.lib-intro p { margin: 0; color: var(--muted); font-size: 14px; }
.lib-search { margin-bottom: 10px; }
.lib-filters { margin-bottom: 14px; }
.lib-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; margin-bottom: 10px; overflow: hidden; box-shadow: var(--shadow); }
.lib-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 10px; row-gap: 2px; width: 100%; text-align: left; background: none; border: 0; padding: 14px; cursor: pointer; color: var(--text); }
.lib-head .lib-crop { grid-column: 1 / -1; font-size: 11px; font-weight: 700; color: var(--gold-700); text-transform: uppercase; letter-spacing: .03em; }
.lib-head b { grid-column: 1 / 2; font-size: 16px; color: var(--g900); }
.lib-head small { grid-column: 1 / 2; font-size: 13px; color: var(--muted); }
.lib-head .lib-chev { grid-row: 2 / 4; grid-column: 2; font-size: 22px; color: var(--muted); transition: transform .2s; }
.lib-card.open .lib-chev { transform: rotate(90deg); color: var(--gold-700); }
.lib-body { padding: 0 14px 16px; border-top: 1px solid var(--border); }
.lib-body p { margin: 12px 0 0; font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; }
.lib-varieties { margin-top: 12px; background: var(--gold-100); border-radius: 12px; padding: 10px 12px; }
.lib-varieties b { display: block; font-size: 12.5px; color: var(--gold-700); margin-bottom: 4px; }
.lib-varieties p { margin: 0; font-size: 14px; }
.lib-source { margin-top: 10px; font-size: 12px; color: var(--muted); }

/* ====== polish pass: premium topbar, icon chips, gold stepper, entrance motion ====== */
.topbar { background: var(--bg); border-bottom: 1px solid var(--border); }
.topbar h1 { font-weight: 800; }
.icon-btn { background: var(--g100); color: var(--g800); transition: transform .15s; }
.icon-btn:active { transform: scale(.92); }
.stepper li.on { background: linear-gradient(135deg, var(--gold-500), var(--gold-700)); border-color: var(--gold-600); color: var(--ink-900); }
.stepper li.done { background: var(--g100); border-color: var(--g600); color: var(--g700); }

/* a small tinted badge for a standalone emoji, used wherever an icon sits alone (ask intro, empty states) */
.icon-badge { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--g100); font-size: 28px; }
.icon-badge.gold { background: var(--gold-100); }
.photo-empty svg { color: var(--g600); }
.photo-box { border-color: var(--g600); background: var(--g50); }

main[data-view] .card, main :not([hidden]) > .card, [data-view]:not([hidden]) > .card,
[data-view]:not([hidden]) .lib-card, [data-view]:not([hidden]) .hist-item, [data-view]:not([hidden]) .chat-bubble,
[data-view]:not([hidden]) > .thumb-row, [data-view]:not([hidden]) > .result-head {
  animation: rise .45s ease-out both;
}
[data-view]:not([hidden]) .card:nth-of-type(2), [data-view]:not([hidden]) .lib-card:nth-of-type(2), [data-view]:not([hidden]) .hist-item:nth-of-type(2) { animation-delay: .06s; }
[data-view]:not([hidden]) .card:nth-of-type(3), [data-view]:not([hidden]) .lib-card:nth-of-type(3), [data-view]:not([hidden]) .hist-item:nth-of-type(3) { animation-delay: .12s; }
[data-view]:not([hidden]) .card:nth-of-type(n+4), [data-view]:not([hidden]) .lib-card:nth-of-type(n+4), [data-view]:not([hidden]) .hist-item:nth-of-type(n+4) { animation-delay: .16s; }
@media (prefers-reduced-motion: reduce) {
  [data-view] .card, [data-view] .lib-card, [data-view] .hist-item, [data-view] .chat-bubble, [data-view] .thumb-row, [data-view] .result-head { animation: none !important; }
}

/* premium shine sweep on every primary/gold button, not just the home hero tile */
.btn.primary, .btn.gold { position: relative; overflow: hidden; }
.btn.primary::after, .btn.gold::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(100deg, transparent, rgb(255 255 255 / 25%), transparent); animation: shine 5s ease-in-out .6s infinite; }
@media (prefers-reduced-motion: reduce) { .btn.primary::after, .btn.gold::after { animation: none !important; } }
