:root {
  color-scheme: light;
  --ink: #152f29;
  --muted: #48645a;
  --page: #eff8f2;
  --paper: #fffefa;
  --line: #cbded3;
  --teal: #11634e;
  --teal-dark: #084b3a;
  --bubble: #e4f2e9;
  --choice: #f8fcf9;
  --error: #a22925;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
  line-height: 1.75;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p, figure { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
:focus-visible { outline: 3px solid #a65013; outline-offset: 3px; }
.muted { color: var(--muted); }
.error { color: var(--error); font-weight: 600; }

#survey, .admin main {
  width: min(1110px, calc(100% - 2.5rem));
  margin: clamp(1.25rem, 5vw, 4rem) auto;
}
.welcome, .conversation {
  display: grid;
  grid-template-columns: 1.04fr 1fr;
  gap: clamp(1.15rem, 3vw, 2.5rem);
  align-items: start;
}
.welcome {
  align-items: center;
  padding: clamp(1.05rem, 3vw, 2.1rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1.55rem;
}
.welcome-copy {
  display: grid;
  justify-items: start;
  gap: 1rem;
  padding: clamp(.25rem, 2vw, 1.25rem);
}
.welcome h1 {
  max-width: 13ch;
  font-size: clamp(2rem, 4.9vw, 3.9rem);
  letter-spacing: -.03em;
  line-height: 1.3;
}
.welcome-copy > p { max-width: 38ch; }
.privacy-note {
  padding: .55rem .85rem;
  color: #164a44;
  background: #e1f0e6;
  border-inline-start: 4px solid #2e8070;
  border-radius: .65rem;
  font-weight: 700;
}
.welcome-image, .context img { width: 100%; border-radius: 1.05rem; object-fit: cover; }
.welcome-image { aspect-ratio: 4 / 4.15; }
.primary, .secondary, .option {
  min-height: 2.85rem;
  border: 1px solid transparent;
  border-radius: .75rem;
  padding: .5rem 1rem;
  line-height: 1.5;
  font-weight: 600;
}
.primary {
  color: white;
  background: var(--teal);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.primary:hover:not(:disabled) { background: var(--teal-dark); }
.secondary { color: var(--teal-dark); background: transparent; }
.secondary:hover:not(:disabled) { background: var(--bubble); }

.chat, .thanks {
  min-width: 0;
  padding: clamp(1rem, 2.8vw, 1.8rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1.45rem;
}
.history { display: grid; gap: .55rem; margin-bottom: .9rem; }
.history:empty { display: none; }
.past-question, .past-answer { padding: .28rem .78rem; border-radius: .78rem; max-width: 94%; overflow-wrap: anywhere; }
.past-question { justify-self: start; background: var(--bubble); color: var(--muted); font-size: .9rem; }
.past-answer { justify-self: end; background: var(--teal-dark); color: white; }
.bot-mark {
  flex: 0 0 2.1rem;
  display: inline-grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  border-radius: 50%;
  color: var(--teal-dark);
  background: var(--bubble);
  font-size: 1rem;
}
.prompt {
  min-width: 0;
  width: 100%;
  display: grid;
  gap: .8rem;
  padding: .8rem .9rem;
  background: var(--bubble);
  border-radius: .95rem;
}
.prompt h1 { font-size: clamp(1.14rem, 2.2vw, 1.4rem); line-height: 1.55; }
.prompt .intro { color: var(--muted); }
.inline-image { width: 100%; height: auto; border-radius: .65rem; }
#answer-form { margin-top: 1rem; }
.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}
.choices > :not(.option) { grid-column: 1 / -1; }
.choices .option {
  min-width: 0;
  min-height: 3.25rem;
  color: var(--teal-dark);
  text-align: start;
  overflow-wrap: anywhere;
  background: var(--choice);
  border-color: var(--line);
}
.option[aria-pressed="true"], .option:hover:not(:disabled) { background: var(--bubble); border-color: var(--teal); }
.option-icon { margin-inline-end: .36rem; }
.actions { display: flex; gap: .3rem .6rem; flex-wrap: wrap; align-items: center; margin-top: 1.1rem; }
.choices input, .choices textarea { width: 100%; min-height: 3rem; padding: .55rem .65rem; border: 1px solid #8ba39a; border-radius: .65rem; background: white; color: var(--ink); }
.choices textarea { resize: vertical; min-height: 6rem; }
.error:not([hidden]) { margin-top: .6rem; }
.context { position: sticky; top: 1.25rem; }
.context img { aspect-ratio: 3 / 2; border: 1px solid var(--line); }
.thanks { display: grid; justify-items: start; gap: .65rem; margin-inline: auto; max-width: 34rem; }

.admin main { display: grid; justify-items: start; gap: 1rem; }
.admin h2 { font-size: 1.25rem; margin-top: .8rem; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: .8rem; }
table { width: 100%; border-collapse: collapse; background: var(--paper); text-align: start; }
th, td { font-size: .93rem; padding: .62rem .8rem; text-align: start; white-space: nowrap; }
thead { background: var(--bubble); }
tbody tr + tr { border-top: 1px solid var(--line); }

@media (min-width: 761px) {
  .inline-image { display: none; }
}
@media (max-width: 760px) {
  #survey, .admin main { width: calc(100% - 1.4rem); }
  .welcome, .conversation { grid-template-columns: 1fr; }
  .welcome-image { grid-row: 1; aspect-ratio: 16 / 9; }
  .welcome h1 { font-size: clamp(2rem, 7vw, 3rem); }
  .welcome-copy { gap: .8rem; }
  .context { display: none; }
  .chat { padding: .85rem; }
  .choices { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
}

.multi-hint, #choices input[type=range] { width:100%; }
#choices input[type=range] {direction:ltr; accent-color:#12634e;}
#choices input[hidden] {display:none;}

:root {--page:#f3f5ef;--ink:#153331;--teal:#12635e;--teal-dark:#0b4745;--bubble:#e5efea;--line:#cbd9d1;--choice:#fff; font-family:"Segoe UI",Tahoma,Arial,sans-serif}
body:not(.admin){background:radial-gradient(ellipse at 90% 12%,#e4efe7,transparent 55%),var(--page);min-height:100vh}
.welcome{padding:clamp(1rem,3vw,2.5rem);border-radius:2rem;background:#fffcf5;box-shadow:0 14px 60px #163d3610;align-items:center}
.welcome h1{font-size:clamp(2.35rem,5.3vw,4.7rem);line-height:1.18}
.welcome-image{aspect-ratio:1.28;object-fit:cover;border-radius:1.4rem}
.primary{border-radius:2rem;padding-inline:1.55rem}
.chat{box-shadow:0 12px 50px #143b3210}
.stations{display:flex;gap:.5rem;list-style:none;padding:0;margin:0 0 1.4rem}
.stations li{flex:1;border-top:4px solid #dbe3de;padding-top:.35rem;color:#4d6259;font-size:.85rem}
.stations .visited{border-color:#188178}.stations [aria-current]{font-weight:700;color:#134d47}
#selection-scene{display:flex;flex-wrap:wrap;gap:.4rem;margin-bottom:.8rem}
.source-chip{display:inline-flex;align-items:center;gap:.4rem;padding:.2rem .35rem .2rem .65rem;border:1px solid #bdd3c9;border-radius:1rem;background:#edf5ed;font-size:.9rem}
.source-chip img{width:3rem;height:3rem;border-radius:.7rem}
.choices .option[aria-pressed=true]{background:#d2e9df;border:2px solid #15645d;padding:calc(.5rem - 1px) calc(1rem - 1px)}
@media(prefers-reduced-motion:no-preference){.source-chip{animation:enter .2s ease-out}@keyframes enter{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}}
@media(max-width:760px){.welcome-image{aspect-ratio:1.8}.welcome{padding:1rem}.stations{margin-bottom:1rem}}

@font-face {
  font-family: "Lemonada";
  src: url("/fonts/lemonada.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Readex Pro";
  src: url("/fonts/readex-pro.woff2") format("woff2");
  font-style: normal;
  font-weight: 160 700;
  font-display: swap;
}

body:not(.admin) {
  --ink: #213932;
  --muted: #505e4b;
  --paper: #fff8e9;
  --line: #bd8e67;
  --teal: #00665d;
  --teal-dark: #164a44;
  --bubble: #e3eee1;
  --choice: #fff9ed;
  --coral: #a94036;
  font-family: "Readex Pro", Tahoma, sans-serif;
  background:
    radial-gradient(ellipse at 94% 0%, #efaa88aa, transparent 46%),
    radial-gradient(ellipse at 4% 25%, #84bbb0ad, transparent 42%),
    radial-gradient(ellipse at 87% 88%, #eac56fa6, transparent 52%),
    #fff0d5;
}

.welcome, .chat, .thanks {
  background: var(--paper);
  box-shadow: 5px 7px 0 #9f613026, 0 18px 40px #5a382118;
}
.welcome {
  border-radius: 1.5rem .9rem 1.75rem 1rem;
  border-block-start: 5px solid #d78365;
}
.welcome h1, .thanks h1 {
  font-family: "Lemonada", Tahoma, sans-serif;
  font-weight: 700;
  letter-spacing: normal;
  color: var(--teal-dark);
  line-height: 1.42;
}
.welcome h1 {
  max-width: 17ch;
  font-size: clamp(1.85rem, 4.1vw, 3.55rem);
}
.welcome h1::after {
  content: "";
  display: block;
  width: 4.5rem;
  height: .35rem;
  margin-top: .65rem;
  background: #cc684e;
  border-radius: 75% 32% 64% 30%;
  transform: rotate(-3deg);
}
.welcome-image, .context img {
  border: 3px solid #fff8e8;
  box-shadow: 0 0 0 1px #b37b53, 3px 4px 0 #dda86f;
}
body:not(.admin) .primary { background: var(--coral); box-shadow: 2px 3px 0 #682e24; }
body:not(.admin) .primary:hover:not(:disabled) { background: #85352c; }
.chat { border-block-start: 4px solid #cc7c5e; }
.prompt {
  background: #e7f0e2;
  border-inline-start: 3px solid #72a99a;
}
.prompt h1 { font-weight: 650; }
.bot-mark { background: #f6dfab; }
.past-question { background: #f4e4bf; }
.past-answer { background: var(--teal-dark); }
.stations li { border-color: #e7cd9f; color: var(--muted); }
.stations .visited { border-color: #419b85; }
.stations [aria-current] { border-color: #b95a43; color: #86382b; }
.source-chip { background: #f4e4bf; border-color: #ccac76; }
.choices .option[aria-pressed=true] { background: #d6e9dc; border-color: #00665d; }
.choices .option:hover:not(:disabled) { border-color: #00665d; background: #e8eee2; }
#choices input[type=range] { accent-color: var(--teal); }
.welcome-image, .context img.cover-illustration { aspect-ratio: 4 / 3; }

.conversation.story-layout { grid-template-columns: minmax(0, 1fr); max-width: 49rem; margin-inline: auto; }
.story-layout .prompt {
  background: #fff0d9;
  border-inline-start-color: #cf8967;
}
#bottle-story { display: grid; gap: .75rem; }
.story-art { position: relative; }
.story-art img { width: 100%; aspect-ratio: 4 / 3; border-radius: .75rem; }
.story-water { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.story-water path {
  fill: none;
  stroke: #0074c1;
  stroke-width: 13;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px white);
}
.story-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
#story-caption { margin-top: .55rem; font-weight: 700; }
#story-flow-text { color: #164a44; }
#story-flow-text p + p { margin-top: .45rem; }
@media (prefers-reduced-motion: no-preference) {
  .story-water:not([hidden]) path { animation: trace-water 1.6s ease-out both; }
  @keyframes trace-water {
    from { stroke-dasharray: 1; stroke-dashoffset: 1; }
    to { stroke-dasharray: 1; stroke-dashoffset: 0; }
  }
}

@media (max-width: 760px) {
  .welcome h1 { font-size: clamp(1.75rem, 6.5vw, 2.7rem); }
  .welcome h1::after { margin-top: .35rem; }
}
