/* Dairy School seminar feedback — participant, guide and results UI */

:root {
  color-scheme: light;
  --bg: #f2f5f4;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --ink: #0f1f28;
  --ink-2: #44565f;
  --ink-3: #5d6f78;
  --line: #d6dfdc;
  --line-strong: #b4c3bf;
  --brand: #0e76bb;
  --brand-strong: #0a5f98;
  --brand-ink: #0a5c93;
  --brand-wash: #e5f0f8;
  --on-brand: #ffffff;
  --green: #5e9a12;
  --green-ink: #36660a;
  --green-wash: #ebf5de;
  --warn-wash: #fff4d4;
  --warn-ink: #6b4700;
  --warn-line: #eccf7c;
  --danger-ink: #b3261e;
  --danger-wash: #fdecea;
  --marker: #fff06a;
  --marker-ink: #2b2600;
  --scale-line: #7d8e94;
  --on-danger: #ffffff;
  --shadow-sm: 0 1px 2px rgb(15 31 40 / .06);
  --shadow-md: 0 1px 2px rgb(15 31 40 / .05), 0 8px 28px rgb(15 31 40 / .08);
  --r-card: 16px;
  --r-btn: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --bar-h: 76px;
  /* chart tokens (results) */
  --viz-low: #d24a43;
  --viz-mid: #a8a59c;
  --viz-high: #0e76bb;
  --viz-grid: #e3e8e6;
  --viz-axis: #b4c3bf;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1519; --surface: #13212a; --surface-2: #172833; --ink: #e6eef1; --ink-2: #a9bcc4; --ink-3: #93a8b1;
    --line: #253e49; --line-strong: #3a5764; --brand: #4ea9e6; --brand-strong: #62b6ee; --brand-ink: #86c8f3;
    --brand-wash: #15324a; --on-brand: #04131c; --green: #8cc63f; --green-ink: #a8d86c; --green-wash: #1b3214;
    --warn-wash: #372b0b; --warn-ink: #f2d27c; --warn-line: #6b5518; --danger-ink: #ff948a; --danger-wash: #3a1614;
    --marker: #5f5400; --marker-ink: #fff7b8; --scale-line: #5f808e; --on-danger: #2a0a08;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4); --shadow-md: 0 1px 2px rgb(0 0 0 / .35), 0 8px 28px rgb(0 0 0 / .3);
    --viz-low: #e8716a; --viz-mid: #6f6d66; --viz-high: #4ea9e6; --viz-grid: #1f3440; --viz-axis: #3a5764;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1519; --surface: #13212a; --surface-2: #172833; --ink: #e6eef1; --ink-2: #a9bcc4; --ink-3: #93a8b1;
  --line: #253e49; --line-strong: #3a5764; --brand: #4ea9e6; --brand-strong: #62b6ee; --brand-ink: #86c8f3;
  --brand-wash: #15324a; --on-brand: #04131c; --green: #8cc63f; --green-ink: #a8d86c; --green-wash: #1b3214;
  --warn-wash: #372b0b; --warn-ink: #f2d27c; --warn-line: #6b5518; --danger-ink: #ff948a; --danger-wash: #3a1614;
  --marker: #5f5400; --marker-ink: #fff7b8; --scale-line: #5f808e; --on-danger: #2a0a08;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4); --shadow-md: 0 1px 2px rgb(0 0 0 / .35), 0 8px 28px rgb(0 0 0 / .3);
  --viz-low: #e8716a; --viz-mid: #6f6d66; --viz-high: #4ea9e6; --viz-grid: #1f3440; --viz-axis: #3a5764;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-ink); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
/* Headings get focus only so screen readers start at the new screen: no ring on them. */
[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- prototype bar (demo mode only) ---------- */
.demo-bar { display: flex; align-items: center; gap: 12px; padding: 6px 16px; background: var(--surface-2); color: var(--ink-2); border-bottom: 1px solid var(--line); font-size: 13px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.demo-bar a { color: var(--ink-2); text-decoration: none; padding: 4px 2px; border-bottom: 2px solid transparent; }
.demo-bar a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--green); font-weight: 650; }
.demo-bar button { margin-left: auto; flex: none; background: var(--surface); color: var(--ink-2); border: 1px solid var(--line-strong); border-radius: 8px; padding: 3px 10px; font-size: 12.5px; }
.demo-tag { background: var(--green-wash); color: var(--green-ink); font-weight: 750; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; }

/* ---------- shell ---------- */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
}
.topbar-inner { max-width: 560px; margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo-chip { display: inline-flex; background: #fff; border-radius: 10px; padding: 6px 10px; box-shadow: var(--shadow-sm); border: 1px solid rgb(15 31 40 / .06); }
.logo-chip img { height: 26px; width: auto; display: block; }
.lang { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px; background: var(--surface); }
.lang button { border: 0; background: transparent; border-radius: 999px; padding: 6px 14px; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.lang button[aria-pressed="true"] { background: var(--brand-strong); color: var(--on-brand); }

.main { flex: 1; width: 100%; max-width: 560px; margin-inline: auto; padding: 8px 16px calc(var(--bar-h) + 32px + env(safe-area-inset-bottom, 0px)); }
.screen { display: flex; flex-direction: column; gap: 20px; animation: enter .22s ease-out; }
.no-anim .screen { animation: none; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* staff preview of a draft survey */
.preview-flag { max-width: 560px; margin: 8px auto 0; font-size: 13.5px; font-weight: 650; color: var(--warn-ink); background: var(--warn-wash); border: 1px solid var(--warn-line); border-radius: 10px; padding: 6px 10px; }

/* bottom action bar */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
}
.bar-inner { max-width: 560px; margin-inline: auto; display: flex; gap: 10px; align-items: center; }
.bar-note { max-width: 560px; margin: 0 auto 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border-radius: var(--r-btn); border: 1.5px solid transparent;
  font-size: 17px; font-weight: 650; text-decoration: none; transition: transform .08s ease, background-color .15s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--brand-strong); color: var(--on-brand); flex: 1; }
.btn-primary:disabled { background: var(--line); color: var(--ink-3); cursor: not-allowed; }
.btn-primary.is-sending, .btn-primary.is-sending:disabled { background: var(--brand-strong); color: var(--on-brand); opacity: .88; cursor: progress; }
.btn-danger { background: var(--danger-ink); color: var(--on-danger); }
.btn-back { flex: 0 0 auto; padding: 0 16px; }
.icon.down { transform: rotate(90deg); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost { background: transparent; color: var(--brand-ink); min-height: 44px; padding: 0 8px; }
.btn-2l { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.btn-2l small { font-size: 13px; font-weight: 600; opacity: .9; }
.btn-2l b { font-size: 16.5px; font-weight: 700; }
.btn .spinner { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- welcome ---------- */
.hero { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.eyebrow { font-size: 13px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-ink); }
.hero h1 { font-size: clamp(28px, 7.4vw, 36px); font-weight: 750; letter-spacing: -.015em; }
.hero .sub { font-size: 18px; color: var(--ink-2); }
.dates { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.intro { font-size: 17px; color: var(--ink); max-width: 46ch; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-sm); }
.facts li { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.fact-txt { flex: 1; min-width: 0; }
.facts li + li { border-top: 1px solid var(--line); }
.fact-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-wash); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
details.privacy { background: transparent; }
details.privacy summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; color: var(--brand-ink); font-weight: 600; font-size: 15px; min-height: 44px; cursor: pointer; }
details.privacy summary::-webkit-details-marker { display: none; }
details.privacy summary .chev { transition: transform .2s ease; }
details.privacy[open] summary .chev { transform: rotate(90deg); }
details.privacy p { font-size: 15px; color: var(--ink-2); padding: 4px 0 8px; max-width: 52ch; }

.notice { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r-card); background: var(--brand-wash); }
.notice h2 { font-size: 18px; }

/* ---------- name picker ---------- */
.title-block { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.title-block h1 { font-size: 28px; font-weight: 750; letter-spacing: -.01em; }
.title-block p { color: var(--ink-2); font-size: 16px; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
.names { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow-sm); }
.names li + li { border-top: 1px solid var(--line); }
.name-opt { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 64px; cursor: pointer; position: relative; }
.name-opt input { position: absolute; opacity: 0; pointer-events: none; }
.name-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.name-main { font-size: 17px; }
.name-main b { font-weight: 700; }
.name-alt { font-size: 14px; color: var(--ink-3); }
.radio { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; display: grid; place-items: center; }
.name-opt.is-selected { background: var(--brand-wash); }
.name-opt.is-selected .radio { border-color: var(--brand-strong); background: var(--brand-strong); }
.name-opt.is-selected .radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--on-brand); }
body.kbd .name-opt.is-focus { outline: 3px solid var(--brand); outline-offset: -3px; }
.name-opt.is-done { cursor: default; }
.name-opt.is-done .name-main, .name-opt.is-done .name-alt { color: var(--ink-3); }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 650; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.chip-done { background: var(--green-wash); color: var(--green-ink); align-self: flex-start; margin-top: 4px; }
.name-help { font-size: 15px; color: var(--ink-2); }
.search-wrap { display: flex; flex-direction: column; gap: 8px; }
.search { min-height: 50px; border-radius: 12px; border: 1.5px solid var(--line-strong); padding: 0 14px; background: var(--surface); font-size: 17px; }
.search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); }
body.kb-open .bar { display: none; }

/* ---------- section / items ---------- */
.progress { display: flex; flex-direction: column; gap: 8px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.segments i { height: 5px; border-radius: 9px; background: var(--line); }
.segments i.done { background: var(--green); }
.segments i.now { background: var(--brand); }
.sec-head { display: flex; flex-direction: column; gap: 6px; }
.sec-head h1 { font-size: 26px; font-weight: 750; letter-spacing: -.01em; }
.scale-hint { font-size: 14px; color: var(--ink-2); }
.items { display: flex; flex-direction: column; gap: 12px; }

.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-sm); scroll-margin-top: 90px; scroll-margin-bottom: calc(var(--bar-h) + 24px); transition: border-color .2s ease, background-color .2s ease; }
.item fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.item legend { padding: 0 4px; font-size: 17px; font-weight: 650; line-height: 1.35; display: flex; gap: 10px; align-items: flex-start; width: 100%; }
.item legend .t { flex: 1; }
.item .ok { color: var(--green); flex: none; margin-top: 1px; opacity: 0; transform: scale(.6); transition: opacity .2s ease, transform .2s ease; }
.item.complete .ok { opacity: 1; transform: none; }
.item .detail { font-size: 14.5px; color: var(--ink-2); margin-top: -6px; }
.item.flash, .q-open.flash { border: 2px solid var(--warn-ink); background: var(--warn-wash); }
.q-open.flash textarea { border-color: var(--warn-ink); }
.flag { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--warn-ink); margin: -2px 4px 0; }
.flag .icon { width: 17px; height: 17px; }
.scale { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.scale label { position: relative; }
.scale input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.scale span {
  display: grid; place-items: center; height: 48px; border-radius: 11px; border: 1.5px solid var(--scale-line);
  background: var(--surface); font-size: 18px; font-weight: 650; color: var(--ink); transition: background-color .12s ease, border-color .12s ease, transform .12s ease;
  font-variant-numeric: tabular-nums; pointer-events: none;
}
@media (hover: hover) { .scale label:hover span { border-color: var(--brand); } }
.scale input:checked + span { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); font-weight: 800; transform: translateY(-1px); box-shadow: 0 3px 10px rgb(10 95 152 / .28); }
.scale input:focus-visible + span, body.kbd .scale input:focus + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.anchors { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; color: var(--ink-2); margin-top: -2px; }
.anchors span { flex: 0 1 auto; min-width: 0; }
.anchors span:last-child { text-align: right; }
.item-actions { display: flex; justify-content: flex-start; align-items: center; gap: 0 18px; flex-wrap: wrap; margin: -6px 0; }
.linkbtn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--brand-ink); font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 2px; }
.linkbtn .icon { width: 18px; height: 18px; }
.linkbtn.quiet { color: var(--ink-2); }
.linkbtn[aria-pressed="true"] { color: var(--ink); }
.na-state { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 12px; padding: 6px 6px 6px 14px; font-size: 15px; color: var(--ink-2); }
.item.is-na legend .t { color: var(--ink-2); }
.comment textarea { min-height: 48px; padding: 11px 14px; resize: none; overflow: hidden; }
textarea {
  width: 100%; min-height: 88px; resize: vertical; border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 12px 14px;
  background: var(--surface); font-size: 16px; line-height: 1.45;
}
textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }

.soft { border: 1px solid var(--warn-line); background: var(--warn-wash); color: var(--warn-ink); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.soft p { font-size: 15px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .btn { min-height: 48px; width: 100%; font-size: 16px; }
.bar.prompting .bar-inner { display: none; }
.saved { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }

/* ---------- final ---------- */
.q-open { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm); }
.q-open label { font-weight: 650; font-size: 17px; line-height: 1.35; }
.summary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.summary .big { font-size: 17px; font-weight: 650; }
.summary ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.summary li button { border: 0; background: transparent; color: var(--brand-ink); text-align: left; padding: 8px 0; font-size: 15px; font-weight: 600; min-height: 44px; }
.as-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; color: var(--ink-2); }
.as-line b { color: var(--ink); }
.alert { border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; font-size: 15.5px; }
.alert-error { background: var(--danger-wash); color: var(--danger-ink); border: 1.5px solid var(--danger-ink); }
.alert-title { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 16px; }
.alert-error p { color: var(--ink); }

/* ---------- thanks / states ---------- */
.center { text-align: center; align-items: center; padding-top: 12vh; gap: 14px; }
.center h1 { font-size: 32px; font-weight: 800; }
.center p { color: var(--ink-2); font-size: 17px; max-width: 34ch; }
.badge-ok { width: 88px; height: 88px; border-radius: 50%; background: var(--green-wash); color: var(--green-ink); display: grid; place-items: center; }
.badge-ok svg { width: 48px; height: 48px; stroke-width: 2.6; }
.badge-ok:not(.badge-info) path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .5s .15s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.badge-info { background: var(--brand-wash); color: var(--brand-ink); }
.offline-note { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--warn-wash); color: var(--warn-ink); border: 1px solid var(--warn-line); font-size: 14.5px; font-weight: 600; }
.center .second-lang { font-size: 15px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 12px; }
.divider { width: 100%; max-width: 320px; border: 0; border-top: 1px solid var(--line); margin: 18px 0 6px; }
/* thank-you screen: the Google review ask */
.review { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-sm); padding: 18px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 6px; }
.review .stars { display: inline-flex; gap: 3px; color: #f4b400; }
.review .stars svg { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.review h2 { font-size: 19px; }
.review p { font-size: 15px; color: var(--ink-2); max-width: 32ch; }
.review .btn { width: 100%; margin-top: 6px; min-height: 50px; }
.review .review-alt { display: inline-block; margin-top: 12px; font-size: 15px; }
.loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 24vh; color: var(--ink-2); }
.loading .spinner { width: 28px; height: 28px; border: 3px solid var(--line-strong); border-right-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }

@media (max-width: 370px) {
  body { font-size: 16px; }
  .btn-back span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .btn-back { padding: 0 14px; }
  .item { padding: 14px 10px; }
  .scale { gap: 3px; }
  .scale span { height: 46px; font-size: 17px; border-radius: 10px; }
  .hero h1 { font-size: 27px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .badge-ok:not(.badge-info) path { stroke-dashoffset: 0; }
}
@media (forced-colors: active) {
  .scale input:checked + span { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}
