*, *::before, *::after { box-sizing: border-box; }

:root {
  --coral: #ff5d6c;
  --coral-dark: #f04a5a;
  --ink: #0b3a5b;
  /* One scene unit in px: the sky objects, mountains and fields all share it, so they stay lined up at any window size */
  --u: max(min(calc(100vw / 1200), calc(100vh * 0.0014)), 0.5px);
}

/* The fixed nav is about 66px tall once it has shrunk, so anchors and focus stop below it */
html { scroll-behavior: smooth; scroll-padding-top: 66px; }

body {
  margin: 0;
  font-family: "Nunito Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #fff;
  background: #1d8fc4;
}

a { color: inherit; text-decoration: none; }

.hero {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* The top padding is the room the fixed nav takes up at rest */
  padding: 97px clamp(24px, 11vw, 150px) 0;
  background: linear-gradient(180deg, #4f9cf0 0%, #7ab9f5 60%, #a9d6fb 100%);
}

/* Hand-painted sky: every object is its own layer, so moving one never repaints the others */
.sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.sky-obj {
  position: absolute;
  top: 0;
  left: 50%;
  width: calc(var(--u) * 1200);
  height: calc(var(--u) * 700);
  margin-left: calc(var(--u) * -600);
  overflow: visible;
  will-change: transform;
}
.defs-only { position: absolute; width: 0; height: 0; }

.drift { animation: drift 22s ease-in-out infinite alternate; }
.d1 { --dx: 40px; }
.d2 { animation-duration: 30s; }
.d3 { animation-duration: 38s; --dx: 30px; }

@keyframes drift {
  from { transform: translateX(calc(var(--dx, 110px) * -1)); }
  to   { transform: translateX(var(--dx, 110px)); }
}

.so-f1, .so-f2 { animation: float 5s ease-in-out infinite alternate; }
.so-f2 { animation-duration: 6.5s; animation-delay: -3s; }

@keyframes float {
  from { transform: translateY(-22px); }
  to   { transform: translateY(22px); }
}

.sun, .sun-ring { transform-box: fill-box; transform-origin: center; }
.sun { animation: pulse 4s ease-in-out infinite alternate; }
.sun-ring { animation: spin 40s linear infinite; }

@keyframes pulse {
  from { transform: scale(0.96); }
  to   { transform: scale(1.14); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .drift, .so-f1, .so-f2, .sun, .sun-ring { animation: none; }
}

/*
  The About section is one scene with the hero: the mountains start in the hero and keep going down,
  and every layer is drawn at the same uniform scale (--u px per svg unit) so nothing ever stretches.
  The layers only shift vertically, each at a rate set by its distance.
*/
.about {
  position: relative;
  z-index: 2;
  timeline-scope: --about-end;
  min-height: calc(var(--u) * 1046);
  margin-top: -1px;
  padding: calc(var(--u) * 80) clamp(24px, 11vw, 150px) calc(var(--u) * 490);
  background: linear-gradient(180deg, #a9d6fb 0%, #c4d9fb 45%, #d8d6f8 100%);
}

.scene, .fields {
  position: absolute;
  left: 0;
  right: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.scene { top: calc(var(--u) * -470); bottom: 0; }
.fields { bottom: 0; height: calc(var(--u) * 760); }

.layer {
  position: absolute;
  left: 50%;
  width: calc(var(--u) * 1200);
  margin-left: calc(var(--u) * -600);
  overflow: visible;
  will-change: transform;
}
.scene .layer { top: calc(var(--u) * 40); height: calc(var(--u) * 1250); }
.fields .layer { bottom: 0; height: calc(var(--u) * 560); }

/* Mountains and fields only ever shift vertically, so they never scale or stretch */

.f-obj .buildings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.tree {
  --x: 0; --y: 0; --w: 1; --h: 1;
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  height: calc(var(--h) * var(--u));
  overflow: visible;
  will-change: transform;
  transform-origin: 50% 92%;
  animation: breeze 5s ease-in-out infinite alternate;
}
.tree.c2 { animation-duration: 6.2s; animation-delay: -2s; }
.tree.c3 { animation-duration: 5.6s; animation-delay: -3.4s; }

@keyframes breeze {
  from { transform: rotate(-1.4deg); }
  to   { transform: rotate(1.6deg); }
}

@media (prefers-reduced-motion: reduce) {
  .tree { animation: none; }
}

/*
  Parallax. Scroll-linked animations run on the compositor, so every layer moves in lockstep with the page
  instead of trailing it by a frame the way script-driven offsets do (app.js only covers browsers without this).
  Far layers shift down more than near ones, so they seem to trail the page.
*/
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .so-f1, .so-f2 {
      --rate: 0.12;
      animation: float 5s ease-in-out infinite alternate, par-hero 1s linear both;
      animation-timeline: auto, scroll(root);
      animation-range: normal, 0px 100vh;
    }
    .so-f2 { animation-duration: 6.5s, 1s; animation-delay: -3s, 0s; }
    .so-sun {
      --rate: 0.2;
      animation: par-hero 1s linear both;
      animation-timeline: scroll(root);
      animation-range: 0px 100vh;
    }
    .drift {
      --rate: 0.3;
      animation: drift 22s ease-in-out infinite alternate, par-hero 1s linear both;
      animation-timeline: auto, scroll(root);
      animation-range: normal, 0px 100vh;
    }
    .d2 { animation-duration: 30s, 1s; }
    .d3 { animation-duration: 38s, 1s; }

    .hero-content, .hero-footer {
      animation: par-text 1s linear both, fade-text 1s linear both;
      animation-timeline: scroll(root), scroll(root);
      animation-range: 0px 100vh, 0px 700px;
    }

    .r-back, .r-mid, .r-front {
      animation-duration: 1s;
      animation-timing-function: linear;
      animation-fill-mode: both;
      animation-timeline: scroll(root);
      animation-range: 0px 1800px;
    }
    .r-back { animation-name: par-back; }
    .r-mid { animation-name: par-mid; }
    .r-front { animation-name: par-front; }

    /* Fields settle over the last 0.9 field-heights of this section (504 = 0.9 * 560 scene units): the .sentinel at
       its bottom edge is exactly that tall, so its "entry" is that stretch of scrolling */
    .f-obj, .f-1, .f-2, .f-3 {
      animation-duration: 1s;
      animation-timing-function: linear;
      animation-fill-mode: both;
      animation-timeline: --about-end;
      animation-range: entry 0% entry 100%;
    }
    .f-obj { animation-name: par-obj; }
    .f-1 { animation-name: par-f1; }
    .f-2 { animation-name: par-f2; }
    .f-3 { animation-name: par-f3; }

    /* The coast does the same over the last 0.9 coast-heights (558 = 0.9 * 620); the waves keep their own idle motion */
    .coast .c-sand {
      animation: par-c-sand 1s linear both;
      animation-timeline: --how-end;
      animation-range: entry 0% entry 100%;
    }
    .coast .c-shallow {
      animation: tide 6s ease-in-out infinite alternate, par-c-shallow 1s linear both;
      animation-timeline: auto, --how-end;
      animation-range: normal, entry 0% entry 100%;
    }
    .coast .c-mid {
      animation: tide 8s ease-in-out -2s infinite alternate, par-c-mid 1s linear both;
      animation-timeline: auto, --how-end;
      animation-range: normal, entry 0% entry 100%;
    }
    .coast .c-deep {
      animation: tide 10s ease-in-out -4s infinite alternate, par-c-deep 1s linear both;
      animation-timeline: auto, --how-end;
      animation-range: normal, entry 0% entry 100%;
    }

    /* The ocean bands settle over the last 600 units of scrolling (the Data section's sentinel) */
    .ocean .o-1 {
      animation: tide 6s ease-in-out infinite alternate, par-o1 1s linear both;
      animation-timeline: auto, --data-end;
      animation-range: normal, entry 0% entry 100%;
    }
    .ocean .o-2 {
      animation: tide 8s ease-in-out -2s infinite alternate, par-o2 1s linear both;
      animation-timeline: auto, --data-end;
      animation-range: normal, entry 0% entry 100%;
    }
    .ocean .o-3 {
      animation: tide 10s ease-in-out -4s infinite alternate, par-o3 1s linear both;
      animation-timeline: auto, --data-end;
      animation-range: normal, entry 0% entry 100%;
    }
    .ocean .o-4 {
      animation: tide 12s ease-in-out -6s infinite alternate, par-o4 1s linear both;
      animation-timeline: auto, --data-end;
      animation-range: normal, entry 0% entry 100%;
    }

    /* The sea floor settles over the last 500 units of scrolling (the end section's sentinel) */
    .seabed .s-1 {
      animation: par-s1 1s linear both;
      animation-timeline: --deep-end;
      animation-range: entry 0% entry 100%;
    }
    .seabed .s-2 {
      animation: par-s2 1s linear both;
      animation-timeline: --deep-end;
      animation-range: entry 0% entry 100%;
    }

    .about-inner, .how-inner {
      animation: card-in 1s linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 100%;
    }
  }
}

@keyframes par-hero { to { translate: 0 calc(100vh * var(--rate, 0)); } }
@keyframes par-text { to { translate: 0 calc(100vh * -0.12); } }
@keyframes fade-text { to { opacity: 0; } }
@keyframes par-back { to { transform: translateY(432px); } }
@keyframes par-mid { to { transform: translateY(252px); } }
@keyframes par-front { to { transform: translateY(108px); } }
@keyframes par-obj { from { transform: translateY(calc(var(--u) * -75.6)); } to { transform: translateY(0); } }
@keyframes par-f1 { from { transform: translateY(calc(var(--u) * -50.4)); } to { transform: translateY(0); } }
@keyframes par-f2 { from { transform: translateY(calc(var(--u) * -25.2)); } to { transform: translateY(0); } }
@keyframes par-f3 { from { transform: translateY(calc(var(--u) * 20.16)); } to { transform: translateY(0); } }
@keyframes par-c-sand { from { translate: 0 calc(var(--u) * -44.6); } to { translate: 0 0; } }
@keyframes par-c-shallow { from { translate: 0 calc(var(--u) * -22.3); } to { translate: 0 0; } }
@keyframes par-c-mid { from { translate: 0 calc(var(--u) * 11.2); } to { translate: 0 0; } }
@keyframes par-c-deep { from { translate: 0 calc(var(--u) * 27.9); } to { translate: 0 0; } }
@keyframes par-o1 { from { translate: 0 calc(var(--u) * -60); } to { translate: 0 0; } }
@keyframes par-o2 { from { translate: 0 calc(var(--u) * -36); } to { translate: 0 0; } }
@keyframes par-o3 { from { translate: 0 calc(var(--u) * -12); } to { translate: 0 0; } }
@keyframes par-o4 { from { translate: 0 calc(var(--u) * 24); } to { translate: 0 0; } }
@keyframes par-s1 { from { translate: 0 calc(var(--u) * -28); } to { translate: 0 0; } }
@keyframes par-s2 { from { translate: 0 calc(var(--u) * 30); } to { translate: 0 0; } }
@keyframes card-in { from { opacity: 0; translate: 0 40px; } to { opacity: 1; translate: 0 0; } }

/* A card keeps the text readable over whatever part of the scenery is behind it */
.about-inner {
  position: relative;
  z-index: 3;
  max-width: 580px;
  padding: 32px 36px;
  border-radius: 18px;
  background: rgba(36, 30, 92, 0.92);
  box-shadow: 0 18px 40px rgba(20, 16, 60, 0.35);
}

.eyebrow {
  margin: 0 0 16px;
  color: #ffb347;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.about h2 {
  margin: 0 0 24px;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.1;
}
.about p { font-size: 1.1rem; line-height: 1.6; }
.about .eyebrow { font-size: 0.8rem; line-height: 1.2; }

/* Invisible marker at a section's bottom edge; its scroll-linked "entry" drives that section's parallax */
.sentinel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--u) * 504);
  pointer-events: none;
  visibility: hidden;
  view-timeline: --about-end block;
}

/* How it works: the last field thins into dune grass, then sand and a small sea */
.how {
  position: relative;
  z-index: 2;
  timeline-scope: --how-end;
  min-height: calc(var(--u) * 640);
  /* Tuck up over the bare green at the foot of the last field (just below its lowest ridge point, 168 units from its bottom) */
  margin-top: calc(var(--u) * -160);
  /* Bottom padding = height of the coast above its water-free dune edge (553 units) plus a fixed gap under the card */
  padding: calc(var(--u) * 40) clamp(24px, 11vw, 150px) calc(var(--u) * 553 + 60px);
  background: #4a9a4e;
}
.how .sentinel { height: calc(var(--u) * 558); view-timeline: --how-end block; }

.coast {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.coast .layer { bottom: 0; height: calc(var(--u) * 620); }
.coast .c-grass { top: 0; bottom: auto; height: calc(var(--u) * 700); }
.layer .cover { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* Waves slide gently; the farther out, the slower and wider */
.c-shallow, .c-mid, .c-deep { --tide: 14px; animation: tide 6s ease-in-out infinite alternate; }
.c-mid { animation-duration: 8s; animation-delay: -2s; --tide: 20px; }
.c-deep { animation-duration: 10s; animation-delay: -4s; --tide: 26px; }

@keyframes tide {
  from { transform: translateX(calc(var(--tide) * -1)); }
  to   { transform: translateX(var(--tide)); }
}

.boat {
  --x: 0; --y: 0; --w: 1; --h: 1;
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  height: calc(var(--h) * var(--u));
  overflow: visible;
  will-change: transform;
  transform-origin: 50% 85%;
  animation: bob 3.6s ease-in-out infinite alternate;
}
@keyframes bob {
  from { transform: translateY(-3px) rotate(-2deg); }
  to   { transform: translateY(3px) rotate(2deg); }
}

@media (prefers-reduced-motion: reduce) {
  .c-shallow, .c-mid, .c-deep, .o-1, .o-2, .o-3, .o-4, .boat { animation: none; }
}

.how-inner {
  position: relative;
  z-index: 3;
  max-width: 900px;
  padding: 32px 36px 36px;
  border-radius: 18px;
  background: rgba(36, 30, 92, 0.92);
  box-shadow: 0 18px 40px rgba(20, 16, 60, 0.35);
}
.how h2, .data h2 {
  margin: 0 0 24px;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.1;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.steps li {
  padding: 20px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
}
.steps h3 { margin: 12px 0 6px; font-size: 1.15rem; }
.steps p { margin: 0; font-size: 0.95rem; line-height: 1.5; }
.step-num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--coral);
  font-weight: 800;
}
@media (max-width: 800px) {
  .steps { grid-template-columns: 1fr; }
}

/* Data: the sea carries on from the beach, deepening band by band */
.data {
  position: relative;
  z-index: 2;
  timeline-scope: --data-end;
  min-height: calc(var(--u) * 700);
  /* Overlaps the plain deep-water strip at the foot of the coast so the next band follows soon after */
  margin-top: calc(var(--u) * -40);
  /* The bands are anchored to the bottom, so this is the open water left under the card */
  padding: calc(var(--u) * 80) clamp(24px, 11vw, 150px) calc(var(--u) * 520);
  background: #3490bb;
}
.data .sentinel { height: calc(var(--u) * 600); view-timeline: --data-end block; }
.ocean {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.ocean .layer { bottom: 0; height: calc(var(--u) * 700); }
.ocean .o-0 { top: 0; bottom: auto; height: calc(var(--u) * 900); }
.data-stat { margin: 0 0 8px; font-size: 1.5rem; font-weight: 800; color: var(--coral); }
.steps .data-stat { font-size: 1.5rem; line-height: 1.2; }
.data-inner .steps li { display: flex; flex-direction: column; }
.data-inner .steps li > p:not(.data-stat):not(.data-credit) { margin-bottom: 12px; }
.steps .data-credit { margin-top: auto; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.25); font-size: 0.82rem; font-weight: 700; }

/* Same slide as the coast waves, a little wider the deeper the band */
.o-1, .o-2, .o-3, .o-4 { --tide: 14px; animation: tide 6s ease-in-out infinite alternate; }
.o-2 { animation-duration: 8s; animation-delay: -2s; --tide: 20px; }
.o-3 { animation-duration: 10s; animation-delay: -4s; --tide: 26px; }
.o-4 { animation-duration: 12s; animation-delay: -6s; --tide: 30px; }
.buoy { animation-duration: 4.4s; animation-delay: -1.5s; }
@media (prefers-reduced-motion: reduce) {
  .o-1, .o-2, .o-3, .o-4, .buoy { animation: none; }
}

/* End: the last band of sea gives way to the sea floor, with the footer as its bottom edge */
.deep {
  position: relative;
  z-index: 2;
  timeline-scope: --deep-end;
}
.deep-body {
  position: relative;
  min-height: calc(var(--u) * 760);
  padding: calc(var(--u) * 40) clamp(24px, 11vw, 150px) calc(var(--u) * 420 + 40px);
  background: linear-gradient(180deg, #184d7a 0%, #0f3560 55%, #0a2347 100%);
}
.deep .sentinel { height: calc(var(--u) * 500); view-timeline: --deep-end block; }
.seabed {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.seabed .layer { bottom: 0; height: calc(var(--u) * 500); }
.deep h2 {
  margin: 0 0 24px;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.1;
}
.end-inner { max-width: 620px; }
.end-lede { margin: 0 0 28px; font-size: 1.1rem; line-height: 1.6; }
.end-inner .pill {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 6px 18px rgba(240, 74, 90, 0.35);
}
.end-inner .pill:hover { background: var(--coral-dark); }

.end-foot {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 32px;
  padding: 22px clamp(24px, 11vw, 150px);
  background: #7a5f3c;
  font-size: 0.9rem;
}
.foot-tag { margin: 0 auto 0 0; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; padding: 0; list-style: none; }
.foot-links a {
  padding: 4px 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.foot-links a:hover, .foot-links a:focus-visible { border-bottom-color: #fff; }

/* Kelp sways from its root, fish swim to and fro (turning round at each end), bubbles rise and fade */
.kelp { transform-origin: 50% 100%; animation: sway var(--dur, 4s) ease-in-out var(--del, 0s) infinite alternate; }
.fish { transform-origin: 50% 50%; animation: swim var(--dur, 20s) ease-in-out var(--del, 0s) infinite; }
.bubble { transform-origin: 50% 50%; animation: rise var(--dur, 6s) ease-in var(--del, 0s) infinite; }
.starfish { animation: none; }
@keyframes sway {
  from { transform: rotate(-4deg); }
  to   { transform: rotate(4deg); }
}
@keyframes swim {
  0%    { transform: translateX(calc(var(--swim) * -1)) scaleX(1); }
  49.9% { transform: translateX(var(--swim)) scaleX(1); }
  50%   { transform: translateX(var(--swim)) scaleX(-1); }
  99.9% { transform: translateX(calc(var(--swim) * -1)) scaleX(-1); }
  100%  { transform: translateX(calc(var(--swim) * -1)) scaleX(1); }
}
@keyframes rise {
  0%   { transform: translateY(0); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translateY(calc(var(--u) * -150)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .kelp, .fish, .bubble { animation: none; }
  .bubble { opacity: 0; }
}

/* Navigation */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(24px, 11vw, 150px);
  transition: padding 0.25s ease;
}
/* The nav is fully transparent as the page scrolls; it only tightens up, and the link text carries its own shadow for legibility */
.nav.stuck {
  padding-top: 12px;
  padding-bottom: 12px;
}
.nav-links a { text-shadow: 0 1px 8px rgba(11, 58, 91, 0.55), 0 1px 2px rgba(11, 58, 91, 0.4); }
@media (prefers-reduced-motion: reduce) {
  .nav { transition: none; }
}

.logo {
  display: inline-block;
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -0.015em;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 2px 0 rgba(11, 58, 91, 0.2);
}
.logo .pheno { color: #5be37a; }
/* On the startup page the name matches the coral "Get started" button; the archive page keeps the green */
.hero .logo, .end-foot .logo { text-shadow: 0 2px 0 rgba(11, 58, 91, 0.4); }
.hero .logo .pheno, .end-foot .logo .pheno { color: var(--coral); }

.nav-links {
  display: flex;
  gap: clamp(20px, 3vw, 40px);
  margin: 0 auto 0 clamp(16px, 4vw, 56px);
  padding: 0;
  list-style: none;
}
.nav-links a {
  position: relative;
  display: inline-block;
  padding: 4px 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: #fff;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav-links a:hover::after,
.nav-links a:focus-visible::after { transform: scaleX(1); }

/* Buttons */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.nav .pill {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(11, 58, 91, 0.18);
}
.hero-footer .pill {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 6px 18px rgba(240, 74, 90, 0.35);
}
.hero-footer .pill:hover { background: var(--coral-dark); }
.pill:hover { transform: translateY(-2px); }

/* Hero text */
.hero-content {
  position: relative;
  z-index: 3;
  max-width: 820px;
  margin-top: clamp(40px, 9vh, 110px);
}
.hero-content h1 {
  margin: 0 0 24px;
  font-size: clamp(2.8rem, 7vw, 5rem);
  line-height: 1.05;
  font-weight: 800;
  text-shadow: 0 2px 12px rgba(11, 58, 91, 0.18);
}
.lede {
  max-width: 480px;
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.5;
  text-shadow: 0 1px 10px rgba(11, 58, 91, 0.45), 0 1px 2px rgba(11, 58, 91, 0.3);
}

.hero-footer {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 36px;
}

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav { justify-content: space-between; }
}

@media (max-width: 600px) {
  .drift { display: none; }
  .sun-wrap { transform: translate(-110px, 50px); }
  .nav .pill { padding: 11px 18px; }
}

@media (max-width: 420px) {
  .nav { gap: 12px; }
  .logo { font-size: 1.4rem; }
  .nav .pill { padding: 10px 12px; font-size: 0.7rem; }
}

/* Narrow or short windows: the hero grows if it must, so its text stays above the mountains */
@media (max-width: 480px), (max-height: 640px) {
  .hero { padding-bottom: calc(var(--u) * 200); }
}
@media (max-width: 340px) {
  .hero-content h1 { font-size: 2.3rem; }
  .lede { font-size: 1rem; }
}
/* Landscape phones and short windows: the text shrinks with the height */
@media (max-height: 640px) and (orientation: landscape) {
  .hero { padding-top: 76px; }
  .hero-content { margin-top: clamp(8px, 3vh, 24px); }
  .hero-content h1 { margin-bottom: 10px; font-size: clamp(1.9rem, min(7vw, 10.5vh), 5rem); }
  .lede { font-size: clamp(0.85rem, 2.8vh, 1.1rem); }
  .hero-footer { margin-top: 14px; }
}

/* Home page: a night sky behind solid indigo panels, with light green reserved for the main actions */
.home {
  --bg: #0e1240; --panel: #232a68; --panel-2: #303893; --line: #434ba3;
  --text: #f1f2ff; --muted: #b3b8e6;
  --green: #a6e8b0; --green-hover: #8ed99b; --on-green: #12301a; --error: #ff9a9a;
  position: relative;
  display: none; min-height: 100vh; padding: 0 clamp(24px, 11vw, 150px) 96px;
  background: transparent; color: var(--text); color-scheme: dark;
}
body.on-home { background: #101442; }
body.on-home .home { display: block; }
body.on-home .hero, body.on-home main { display: none; }

/* The scene is fixed, so the sky stays put while the page scrolls over it */
.night {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, #070a2b 0%, #0f1550 50%, #141a5e 100%);
}
.night-stars { position: absolute; inset: 0; width: 100%; height: 100%; will-change: opacity; }
.twinkle-a { animation: twinkle 3.2s ease-in-out infinite alternate; }
.twinkle-b { animation: twinkle 4.6s ease-in-out -1.8s infinite alternate; }
@keyframes twinkle {
  from { opacity: 0.35; }
  to   { opacity: 1; }
}
.night-float { animation: float 6s ease-in-out infinite alternate; }
.night-drift { animation: drift 26s ease-in-out infinite alternate; --dx: 90px; }
.nd2 { animation-duration: 34s; --dx: 70px; }
@media (max-width: 600px) {
  .night-moon .sun-wrap { transform: translate(-50px, 50px); }
  .night-drift { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .twinkle-a, .twinkle-b, .night-float, .night-drift { animation: none; }
}
.home-nav, .home-inner, .chat, .dash, #notice { position: relative; z-index: 1; }
.home-nav { padding: 28px 0; }
.home-inner { max-width: 960px; }
.home-head { margin-bottom: 28px; }
.home-head > .pill { margin-top: 18px; }
.home-head > .pill[hidden] { display: none; }
.eyebrow { margin: 0 0 10px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--green); }
.blank[hidden] { display: none; }
.blank { display: flex; align-items: center; gap: 22px; margin-bottom: 18px; padding: 22px 26px; border: 1px dashed var(--line); border-radius: 12px; background: var(--panel); }
.blank-icon { flex: none; width: 56px; height: 56px; color: var(--green); }
.blank-icon svg { width: 100%; height: 100%; }
.blank h3 { margin: 0 0 4px; font-size: 1.15rem; }
.blank p { max-width: 520px; margin: 0; line-height: 1.5; color: var(--muted); }
.home h2 { margin: 0; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.1; text-shadow: 0 2px 14px rgba(5, 7, 40, 0.6); }
.home-lede { max-width: 560px; margin: 0 0 32px; font-size: 1.05rem; line-height: 1.5; color: var(--muted); }
.home-head .home-lede { margin: 10px 0 0; }

.archive { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.plant, .add-btn { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 8px 22px rgba(3, 4, 28, 0.45); }
.plant { position: relative; display: flex; flex-direction: column; overflow: hidden; cursor: pointer; animation: plant-in 0.45s ease backwards; animation-delay: calc(var(--i, 0) * 60ms); transition: border-color 0.15s ease, transform 0.2s ease, box-shadow 0.2s ease; }
.plant:hover, .plant:focus-visible { border-color: var(--green); outline: none; transform: translateY(-4px); box-shadow: 0 12px 26px rgba(0, 0, 0, 0.4); }
.plant .thumb { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; background: var(--panel-2); color: var(--muted); }
.plant .thumb img, .plant .thumb svg { transition: transform 0.35s ease; }
.plant:hover .thumb img, .plant:hover .thumb svg { transform: scale(1.06); }
.plant .thumb img { width: 100%; height: 100%; object-fit: cover; }
.plant .thumb svg { width: 64%; height: 64%; }
.badge { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(12, 14, 52, 0.85); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.badge.maize::before { background: #f2d27a; }
@keyframes plant-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .plant { animation: none; } .plant:hover, .add-btn:hover { transform: none; } }
.plant .info { padding: 12px 14px; }
.plant h3 {
  margin: 0 0 2px; font-size: 1rem; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.plant .meta { margin: 0; overflow: hidden; font-size: 0.78rem; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }

/* The last card in the grid: a plus with a label */
.add-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 0; border-style: dashed;
  color: var(--green); font: inherit; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease, transform 0.2s ease;
}
.add-btn .plus { font-size: 3rem; font-weight: 400; line-height: 1; }
.add-btn:hover, .add-btn:focus-visible { border-color: var(--green); background: var(--panel-2); outline: none; transform: translateY(-4px); }
@media (max-width: 600px) {
  .archive { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .plant .info { padding: 8px 10px; }
}

.add-dialog {
  --pad: 28px;
  width: min(720px, calc(100vw - 32px)); max-height: 90vh; max-height: 90dvh; padding: var(--pad);
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text);
}
.add-dialog::backdrop { background: rgba(4, 5, 30, 0.74); }
.add-dialog h3 { margin: 0 0 16px; font-size: 1.4rem; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 0.85rem; font-weight: 700; }
.field input, .field select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-weight: 400; color: var(--text); background: var(--bg);
}
.field input::placeholder { color: var(--muted); }
.field input[type=file]::file-selector-button {
  margin-right: 12px; padding: 6px 12px; border: 0; border-radius: 6px;
  background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--green); }
.field[hidden] { display: none; }
.field .hint { font-size: 0.8rem; font-weight: 400; line-height: 1.4; color: var(--muted); }
.traits .field { justify-content: flex-end; } /* inputs line up in a row even when a name wraps */
.traits { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; max-height: 340px; overflow-y: auto; padding: 4px; }
.status { min-height: 1.4em; margin: 8px 0 0; font-size: 0.9rem; font-weight: 700; color: var(--muted); }
.status.error { color: var(--error); }
/* The buttons stay in view while a long dialog scrolls */
.dialog-actions {
  position: sticky; bottom: calc(var(--pad) * -1); z-index: 2; display: flex; justify-content: flex-end; gap: 12px;
  margin: 12px calc(var(--pad) * -1) calc(var(--pad) * -1); padding: 14px var(--pad) var(--pad); background: var(--panel);
}
/* On shorter windows the whole dialog scrolls, not a small box inside it */
@media (max-height: 820px) { .traits { max-height: none; overflow: visible; } }
@media (max-width: 420px) { .add-dialog { --pad: 18px; } .add-dialog h3 { font-size: 1.25rem; } }

.pill.submit, .pill.cancel { border: 0; cursor: pointer; font-family: inherit; }
.pill.submit { background: var(--green); color: var(--on-green); }
.pill.submit:hover { background: var(--green-hover); }
.pill.cancel { background: var(--panel-2); color: var(--text); }
.pill.cancel:hover { background: var(--line); }
.pill.danger { margin-right: auto; border: 1px solid var(--error); background: transparent; color: var(--error); cursor: pointer; font-family: inherit; transition: none; }
.pill.danger:hover, .pill.danger.confirm { background: var(--error); color: #3a1212; }
.crop-type { margin: -8px 0 16px; font-size: 0.85rem; color: var(--muted); }
.pill:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.predictions { margin-top: 12px; }
.predictions p { margin: 0 0 8px; font-size: 0.85rem; line-height: 1.4; color: var(--muted); }
.pred-scroll { overflow-x: auto; }
.predictions table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.predictions th, .predictions td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.predictions thead td { font-weight: 800; color: var(--text); }
/* A long plant name is cut short in a column heading; the full name is its tooltip */
.th-name { display: block; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Phones: each trait becomes a small card, since five columns do not fit */
@media (max-width: 600px) {
  .predictions table, .predictions tbody { display: block; }
  .predictions thead { display: none; }
  .predictions tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .predictions td { min-width: 0; padding: 0; border: 0; white-space: normal; font-size: 0.95rem; }
  .predictions td:first-child { grid-column: 1 / -1; min-width: 0; font-weight: 800; }
  .predictions td[data-label]::before { content: attr(data-label); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
}

/* Assistant: chat logs in a sidebar, the conversation beside it */
.home-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.home-links { display: flex; gap: 24px; }
.home-links a { padding: 4px 0; border-bottom: 2px solid transparent; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.home-links a:hover, .home-links a[aria-current] { color: var(--text); }
.home-links a[aria-current] { border-bottom-color: var(--green); }
.chat { display: none; max-width: 1100px; height: calc(100vh - 112px); min-height: 420px; grid-template-columns: 240px 1fr; gap: 18px; }
body.view-assistant .chat { display: grid; }
body.view-assistant .home-inner { display: none; }
/* The assistant page fills the window: the header on top, the conversation taking the rest */
body.view-assistant .home { display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding-bottom: 24px; }
body.view-assistant .chat { flex: 1; height: auto; min-height: 260px; }
.chat-side, .messages { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.chat-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 12px; }
.chat-side .pill { justify-content: center; }
.chat-list { flex: 1; min-height: 0; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.chat-list li { display: flex; align-items: center; border-radius: 8px; }
.chat-list li.current, .chat-list li:hover { background: var(--panel-2); }
.chat-list button { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.chat-item { flex: 1; min-width: 0; padding: 9px 10px; overflow: hidden; font-size: 0.9rem; text-align: left; white-space: nowrap; text-overflow: ellipsis; }
.chat-del { padding: 6px 10px; font-size: 0.8rem; color: var(--muted); }
.chat-del:hover, .chat-del.confirm { color: var(--error); }
.chat-empty { padding: 8px 10px; font-size: 0.85rem; color: var(--muted); }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.messages { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 18px; overflow-y: auto; }
/* Chat messages use .msg: .bubble is the landing page's rising ocean bubbles */
.msg { max-width: 80%; padding: 10px 14px; border-radius: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.msg p, .msg ul, .msg ol { margin: 0 0 8px; }
.msg > :last-child { margin-bottom: 0; }
.msg ul, .msg ol { padding-left: 22px; }
.msg.user { align-self: flex-end; background: var(--panel-2); }
.msg.assistant { align-self: flex-start; border: 1px solid var(--line); background: var(--bg); }
.msg.pending { color: var(--muted); }
.chat-welcome { margin: auto; max-width: 520px; text-align: center; color: var(--muted); line-height: 1.5; }
.chat-welcome h3 { margin: 0 0 8px; color: var(--text); font-size: 1.3rem; }
.chat-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.chat-chips button { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font: inherit; font-size: 0.85rem; cursor: pointer; }
.chat-chips button:hover { border-color: var(--green); }
.chat-form { display: flex; align-items: stretch; gap: 12px; }
.chat-form textarea { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; resize: none; }
.chat-form textarea:focus { outline: none; border-color: var(--green); }
@media (max-width: 700px) {
  .chat-form textarea { min-width: 0; }
  .msg { max-width: 92%; }
}
/* Portrait phones: the chat list is a short strip above the conversation */
@media (max-width: 700px) and (orientation: portrait) {
  .chat { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
  .chat-side { max-height: 128px; }
}
/* Landscape phones keep the list beside the conversation, only narrower */
@media (max-width: 700px) and (orientation: landscape) {
  .chat { grid-template-columns: 160px minmax(0, 1fr); gap: 12px; }
  .chat-side { padding: 8px; }
}
@media (max-height: 520px) {
  .home-nav { padding: 12px 0; }
  body.view-assistant .home { padding-bottom: 12px; }
  .chat-form textarea { height: 44px; }
  .add-dialog { --pad: 16px; }
  .add-dialog h3 { margin-bottom: 8px; font-size: 1.15rem; }
  .add-dialog .field { margin-bottom: 8px; }
  .dialog-actions { padding-top: 10px; }
}

/* Home tab: the latest plants and chats, with quick actions */
.dash { display: none; max-width: 1040px; }
body.view-dashboard .dash { display: block; }
body.view-dashboard .home-inner, body.view-assistant #notice { display: none; }
body.view-dashboard .home { padding-bottom: 48px; }
.dash [hidden] { display: none; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 8px 22px rgba(3, 4, 28, 0.45); }
.dash-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; margin-top: 32px; }
.dash-col { display: grid; gap: 20px; min-width: 0; }
.panel { padding: 20px 22px; }
.panel h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 14px; font-size: 1.05rem; }
.panel h3 a { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--green); }
.panel h3 a:hover { color: var(--green-hover); }
.panel .muted { margin: 0; line-height: 1.5; color: var(--muted); }
.rec { border-color: var(--green); }
.rec .eyebrow { margin-bottom: 6px; }
.panel h3.rec-title { display: block; margin-bottom: 8px; font-size: 1.4rem; overflow-wrap: anywhere; }
.rec-scroll { margin-top: 14px; overflow-x: auto; }
.rec-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.rec-table th, .rec-table td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.rec-table thead td { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.rec-table tbody td:first-child { font-weight: 700; }
.rec-note { margin: 10px 0 0; font-size: 0.78rem; line-height: 1.4; color: var(--muted); }
.rec .pill { margin-top: 16px; border: 0; cursor: pointer; font-family: inherit; }
.goal-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.goal-chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 6px 5px 12px; border: 1px solid var(--green); border-radius: 999px; font-size: 0.82rem; font-weight: 700; }
.goal-chip button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); font: inherit; line-height: 1; cursor: pointer; }
.goal-chip button:hover, .goal-chip button:focus-visible { background: var(--panel-2); color: var(--error); outline: none; }
.goal-hint { margin-top: 12px; font-size: 0.88rem; }
.goal-note { margin: 12px 0 0; font-size: 0.82rem; line-height: 1.4; color: var(--green); }
.goal-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 14px; }
.goal-form select, #dash-goals > select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; min-width: 0; }
.goal-form select:focus, #dash-goals > select:focus { outline: none; border-color: var(--green); }
.goal-form .pill { grid-column: 1 / -1; justify-content: center; border: 0; cursor: pointer; font-family: inherit; }
#dash-goals > select { width: 100%; }
#dash-goals .status { margin-top: 10px; }
.dash-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.dash-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.dash-row:hover, .dash-row:focus-visible { background: var(--panel-2); outline: none; }
.dash-row .thumb { flex: none; display: grid; place-items: center; width: 48px; height: 48px; overflow: hidden; border-radius: 8px; background: var(--panel-2); color: var(--muted); }
.dash-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.dash-row .thumb svg { width: 70%; height: 70%; }
.dash-label { display: grid; min-width: 0; gap: 2px; }
.dash-label strong, .dash-label small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dash-label small { font-size: 0.78rem; color: var(--muted); }
@media (max-width: 800px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  /* One column: the recommendation is followed by the goals that drive it */
  .dash-col { display: contents; }
  #dash-rec { order: 1; }
  #dash-goals { order: 2; }
  #dash-plants { order: 3; }
  #dash-chats { order: 4; }
}
@media (max-width: 520px) {
  .home-nav { flex-wrap: wrap; row-gap: 10px; padding: 16px 0; }
  .home-links { gap: 18px; }
  .panel { padding: 18px 16px; }
  .rec-table { font-size: 0.8rem; }
  .rec-table th, .rec-table td { padding-right: 8px; }
  .rec-table thead td { letter-spacing: 0; }
  .rec-table td:first-child { min-width: 96px; }
  /* Each trait becomes a small card, so the predicted offspring is never off-screen */
  .rec-table, .rec-table tbody { display: block; }
  .rec-table thead { display: none; }
  .rec-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
  .rec-table td, .rec-table td:first-child { min-width: 0; padding: 0; border: 0; }
  .rec-table tbody td:first-child, .rec-table td:last-child { grid-column: 1 / -1; }
  .rec-table td[data-label]::before { content: attr(data-label); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
}

/* Trait names with an "i" that explains them */
.trait-name { display: inline; }
.trait-end { white-space: nowrap; }
.tip-icon {
  display: inline-grid; place-items: center; width: 19px; height: 19px; margin-left: 7px; border-radius: 50%; background: var(--line);
  color: var(--text); font: 800 0.8rem/1 system-ui, -apple-system, "Segoe UI", sans-serif; text-transform: none; letter-spacing: 0;
  vertical-align: -3px; cursor: help; transition: background 0.15s ease, color 0.15s ease;
}
.tip-icon:hover, .tip-icon:focus-visible { background: var(--green); color: var(--on-green); outline: none; }
.tip-icon:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--green); }
.tip {
  inset: auto; margin: 0; max-width: min(280px, calc(100vw - 16px)); padding: 10px 12px; border: 1px solid #434ba3; border-radius: 10px;
  background: #0e1240; color: #f1f2ff; font-size: 0.8rem; font-weight: 500; line-height: 1.45; text-align: left; text-transform: none;
  letter-spacing: 0; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); pointer-events: none;
}
.tip:not([popover]) { position: fixed; z-index: 100; display: none; } /* browsers without the popover API */
@media (min-width: 601px) { .predictions td:first-child { white-space: normal; min-width: 170px; } }
/* Cookie question: the startup page's colors, a cream card with ink text and a coral button */
.cookie {
  position: fixed;
  left: clamp(12px, 3vw, 32px);
  bottom: clamp(12px, 3vw, 32px);
  z-index: 60;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: min(480px, calc(100vw - 24px));
  padding: 20px 22px;
  border-radius: 16px;
  background: #fff6e8;
  color: var(--ink);
  box-shadow: 0 14px 38px rgba(11, 58, 91, 0.35), 0 0 0 3px rgba(255, 255, 255, 0.6);
  animation: cookie-in 0.35s ease backwards;
}
.cookie[hidden] { display: none; }
.cookie-art { flex: none; width: 52px; height: 52px; }
.cookie h2 { margin: 0 0 6px; font-family: "Nunito", "Segoe UI", system-ui, sans-serif; font-size: 1.2rem; font-weight: 900; line-height: 1.2; }
.cookie p { margin: 0; font-size: 0.9rem; line-height: 1.5; }
.cookie .cookie-fine { margin-top: 8px; font-size: 0.78rem; opacity: 0.8; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.cookie .pill { padding: 11px 20px; border: 0; cursor: pointer; font-family: inherit; }
.cookie-yes { background: var(--coral); color: #fff; box-shadow: 0 6px 18px rgba(240, 74, 90, 0.35); }
.cookie-yes:hover { background: var(--coral-dark); }
.cookie-no { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px rgba(11, 58, 91, 0.35); }
.cookie-no:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.cookie .pill:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
@keyframes cookie-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cookie { animation: none; } }
@media (max-width: 420px) { .cookie { padding: 16px; } .cookie-art { width: 40px; height: 40px; } }
/* Wide windows: the question sits bottom right, clear of the startup text on the left */
@media (min-width: 700px) { .cookie { left: auto; right: clamp(12px, 3vw, 32px); } }
/* Short windows: a compact card so the page stays visible behind it */
@media (max-height: 520px) {
  .cookie { padding: 12px 16px; gap: 12px; }
  .cookie-art { display: none; }
  .cookie h2 { margin-bottom: 4px; font-size: 1rem; }
  .cookie p { font-size: 0.78rem; line-height: 1.35; }
  .cookie .cookie-fine { margin-top: 4px; font-size: 0.7rem; }
  .cookie-actions { margin-top: 8px; }
  .cookie .pill { padding: 8px 14px; }
}
@media (max-height: 520px) and (min-width: 540px) {
  .cookie { width: min(820px, calc(100vw - 2 * clamp(12px, 3vw, 32px))); align-items: center; }
  .cookie-body { display: grid; grid-template-columns: 1fr auto; gap: 0 20px; align-items: center; }
  .cookie-body h2 { grid-column: 1; }
  .cookie-body p { grid-column: 1; }
  .cookie-actions { grid-column: 2; grid-row: 1 / span 3; flex-direction: column; margin-top: 0; }
}

.foot-btn {
  padding: 4px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.foot-btn:hover, .foot-btn:focus-visible { border-bottom-color: #fff; outline: none; }

/* In the app: a note when saving is off, and a way back to the cookie question */
.link-btn { padding: 0; border: 0; background: none; color: var(--green); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--green-hover); }
.save-note { position: relative; z-index: 1; max-width: 760px; margin: 0 0 20px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 0.85rem; line-height: 1.5; color: var(--muted); }
.save-note[hidden] { display: none; }
.home-foot { position: relative; z-index: 1; margin: 40px 0 0; font-size: 0.78rem; }
.home-foot .link-btn { color: var(--muted); font-weight: 600; }
.home-foot .link-btn:hover { color: var(--text); }
body.view-assistant .home-foot { display: none; }
/* Tutorial: the same cream card as the cookie question, with a painted picture on a sky-blue tile */
.tutorial {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #fff6e8;
  color: var(--ink);
  overflow: auto;
  box-shadow: 0 20px 60px rgba(4, 5, 30, 0.55), 0 0 0 3px rgba(255, 255, 255, 0.6);
}
.tutorial::backdrop { background: rgba(4, 5, 30, 0.74); }
.tutorial[open] { animation: cookie-in 0.35s ease backwards; }
.tutorial [hidden] { display: none; }
.tut-art { display: grid; place-items: center; height: 156px; background: linear-gradient(180deg, #4f9cf0 0%, #7ab9f5 55%, #a9d6fb 100%); }
.tut-art svg { width: auto; height: 124px; overflow: visible; }
.tut-body { padding: 22px 26px 24px; }
.tut-count { margin: 0 0 6px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--coral-dark); }
.tutorial h2 { margin: 0 0 10px; font-family: "Nunito", "Segoe UI", system-ui, sans-serif; font-size: 1.7rem; font-weight: 900; line-height: 1.15; }
.tutorial #tut-text { margin: 0; min-height: 7.5em; font-size: 1rem; line-height: 1.55; }
.tut-dots { display: flex; gap: 8px; margin: 18px 0; }
.tut-dot { width: 9px; height: 9px; border-radius: 5px; background: rgba(11, 58, 91, 0.2); transition: width 0.25s ease, background 0.25s ease; }
.tut-dot.on { width: 26px; background: var(--coral); }
.tut-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tut-nav { display: flex; gap: 10px; margin-left: auto; }
.tut-skip { padding: 6px 2px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 0.85rem; font-weight: 700; text-decoration: underline; opacity: 0.75; cursor: pointer; }
.tut-skip:hover { opacity: 1; }
.tutorial .pill { padding: 12px 22px; border: 0; cursor: pointer; font-family: inherit; }
.tut-next { background: var(--coral); color: #fff; box-shadow: 0 6px 18px rgba(240, 74, 90, 0.35); }
.tut-next:hover { background: var(--coral-dark); }
.tut-back { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px rgba(11, 58, 91, 0.35); }
.tut-back:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.tutorial .pill:focus-visible, .tut-skip:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .tutorial[open] { animation: none; } .tut-dot { transition: none; } }
@media (max-width: 420px) { .tut-art { height: 130px; } .tut-art svg { height: 104px; } .tut-body { padding: 18px 18px 20px; } .tutorial h2 { font-size: 1.45rem; } }
/* Short, wide windows (landscape phones): the picture sits beside the text instead of above it */
@media (max-height: 520px) and (min-width: 480px) {
  .tutorial { width: min(720px, calc(100vw - 24px)); }
  .tutorial[open] { display: grid; grid-template-columns: minmax(150px, 36%) 1fr; }
  .tut-art { height: auto; min-height: 100%; }
  .tut-art svg { height: 120px; max-width: 92%; }
  .tut-body { padding: 14px 20px 16px; }
  .tutorial h2 { margin-bottom: 6px; font-size: 1.35rem; }
  .tutorial #tut-text { min-height: 6em; font-size: 0.9rem; line-height: 1.45; }
  .tut-dots { margin: 10px 0; }
}