/* Local prototype. All typography, shapes and color stay on this device. */
:root {
  color-scheme: light dark;
  --page: #f7f5ee;
  --paper: #fffef9;
  --ink: #103b4b;
  --text: #254651;
  --muted: #53666b;
  --teal: #087f78;
  --teal-text: #066f69;
  --button-text: #fffef9;
  --teal-hover: #066760;
  --soft-teal: #e6f1ea;
  --line: #ccd7cf;
  --strong-line: #859b94;
  --warm: #eee7d6;
  --error: #a1362d;
  --error-bg: #fff1eb;
  --focus: #1257b0;
  --shadow: 0 12px 34px rgb(16 59 75 / 6%);
  --radius: 20px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #101e24;
    --paper: #192a30;
    --ink: #f2f4e9;
    --text: #dce5df;
    --muted: #b4c3c0;
    --teal: #8ed6c9;
    --teal-text: #8ed6c9;
    --button-text: #101e24;
    --teal-hover: #b6e7dc;
    --soft-teal: #203d3c;
    --line: #405656;
    --strong-line: #72928a;
    --warm: #38382e;
    --error: #ffb5a8;
    --error-bg: #3d2927;
    --focus: #b1d5ff;
    --shadow: 0 12px 34px rgb(0 0 0 / 12%);
  }
}

/* An optional theme control can override the system without loading assets. */
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f7f5ee;
  --paper: #fffef9;
  --ink: #103b4b;
  --text: #254651;
  --muted: #53666b;
  --teal: #087f78;
  --teal-text: #066f69;
  --button-text: #fffef9;
  --teal-hover: #066760;
  --soft-teal: #e6f1ea;
  --line: #ccd7cf;
  --strong-line: #859b94;
  --warm: #eee7d6;
  --error: #a1362d;
  --error-bg: #fff1eb;
  --focus: #1257b0;
  --shadow: 0 12px 34px rgb(16 59 75 / 6%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #101e24;
  --paper: #192a30;
  --ink: #f2f4e9;
  --text: #dce5df;
  --muted: #b4c3c0;
  --teal: #8ed6c9;
  --teal-text: #8ed6c9;
  --button-text: #101e24;
  --teal-hover: #b6e7dc;
  --soft-teal: #203d3c;
  --line: #405656;
  --strong-line: #72928a;
  --warm: #38382e;
  --error: #ffb5a8;
  --error-bg: #3d2927;
  --focus: #b1d5ff;
  --shadow: 0 12px 34px rgb(0 0 0 / 12%);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font-size: 17px; line-height: 1.6; }
body, button, input, textarea { font-family: var(--font); }
button, input, textarea { font-size: inherit; }
button, a, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, a.button { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--teal-text); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible,
summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
button, a, p, h1, h2, h3, li, dt, dd, legend { overflow-wrap: anywhere; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { color: var(--ink); line-height: 1.12; font-weight: 700; letter-spacing: -.035em; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.2rem, 5.3vw, 4.4rem); }
h2 { margin-bottom: 1rem; font-size: clamp(1.8rem, 3.6vw, 2.8rem); }
h3 { margin-bottom: .7rem; font-size: 1.3rem; letter-spacing: -.015em; }
p { margin-bottom: 1.05rem; }
p:last-child { margin-bottom: 0; }
strong { color: var(--ink); font-weight: 700; }
.shell { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.small { font-size: .88rem; line-height: 1.55; }
.muted { color: var(--muted); }
.lead, .lede { max-width: 60ch; color: var(--text); font-size: clamp(1.08rem, 2vw, 1.25rem); line-height: 1.6; }
.eyebrow, .mini-label, .note-label, .card-kicker {
  margin-bottom: .8rem;
  color: var(--teal-text);
  font-size: .76rem;
  font-weight: 750;
  letter-spacing: .1em;
  line-height: 1.5;
  text-transform: uppercase;
}
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.skip-link { position: absolute; z-index: 10; left: 16px; top: 12px; padding: 12px 18px; background: var(--paper); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }

.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-block: 25px; border-bottom: 1px solid var(--line); }
.wordmark { color: var(--ink); font-size: 1.18rem; font-weight: 800; letter-spacing: -.025em; text-decoration: none; }
.wordmark { white-space: nowrap; }
.wordmark span { color: var(--teal-text); }
.header-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 16px; font-size: .88rem; }
.header-links a { display: inline-flex; align-items: center; min-height: 44px; }
.header-links button { min-height: 44px; padding: 8px 12px; color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 10px; }
.prototype-badge { display: inline-block; color: var(--muted); font-size: .75rem; letter-spacing: .025em; }
main.shell { padding-block: 30px 60px; }

.progress { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 0; margin: 0 0 40px; list-style: none; }
.progress li { display: flex; align-items: flex-start; gap: 8px; padding-top: 12px; border-top: 3px solid var(--line); color: var(--muted); font-size: .82rem; line-height: 1.35; }
.progress li > span { color: var(--muted); font-size: .72rem; line-height: 1.65; font-variant-numeric: tabular-nums; }
.progress li[aria-current="step"] { border-color: var(--teal); color: var(--ink); font-weight: 750; }
.progress li[aria-current="step"] > span { color: var(--teal-text); }
.progress .complete, .progress [data-complete="true"] { border-color: var(--strong-line); }
.progress-caption { margin: 0 0 18px; color: var(--muted); font-size: .84rem; }
.step { min-width: 0; }
.step-heading { max-width: 24ch; scroll-margin-top: 28px; }
.step-heading:focus:not(:focus-visible) { outline: none; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(270px, 1fr); gap: clamp(30px, 5vw, 70px); align-items: center; }
.hero-copy { min-width: 0; }
.hero-copy h1 { max-width: 15ch; margin-bottom: 22px; }
.title-number { display: block; margin-bottom: .08em; color: var(--teal-text); font-size: 1.34em; line-height: .95; letter-spacing: -.065em; }
.title-rest { display: block; }
.hero-copy .lead { max-width: 42ch; }
.hero-note { position: relative; min-width: 0; padding: clamp(24px, 3vw, 40px); background: var(--warm); border-radius: var(--radius); }
.hero-note::before { content: ""; position: absolute; left: 0; top: 28px; width: 4px; height: 44px; background: var(--teal); }
.hero-note h2 { font-size: clamp(1.55rem, 2.8vw, 2.1rem); }
.mini-example { padding-top: 20px; margin-top: 24px; border-top: 1px solid var(--strong-line); }
.mini-example p { font-size: .95rem; }
.mini-example strong { display: block; margin-bottom: 5px; font-size: 1.15rem; }
.glass-mark { width: 78px; margin: 0 0 25px; color: var(--teal); transform: rotate(-5deg); }
.glass-mark svg { width: 100%; height: auto; }

form { margin-top: 28px; }
fieldset { min-width: 0; padding: 0; margin: 0 0 26px; border: 0; }
legend { max-width: 100%; margin-bottom: 14px; padding: 0; color: var(--ink); font-size: 1.15rem; font-weight: 700; line-height: 1.4; }
legend + p { color: var(--muted); font-size: .94rem; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr)); gap: 12px; }
.choice { display: grid; grid-template-columns: 21px minmax(0, 1fr); gap: 3px 12px; align-items: start; min-height: 62px; padding: 17px 18px; background: var(--paper); border: 1.5px solid var(--line); border-radius: 13px; cursor: pointer; }
.choice:hover { border-color: var(--strong-line); }
.choice:has(input:checked) { border-color: var(--teal); background: var(--soft-teal); box-shadow: inset 0 0 0 1px var(--teal); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 4px; }
.choice input[type="radio"], .choice input[type="checkbox"] { grid-column: 1; grid-row: 1 / span 2; width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--teal); }
.choice-title { grid-column: 2; color: var(--ink); font-weight: 700; line-height: 1.45; }
.choice-detail { display: block; grid-column: 2; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.choice > span:not(.choice-title):not(.choice-detail) { grid-column: 2; }
.choice > span .choice-title { display: block; }
.choices.compact { grid-template-columns: 1fr; gap: 9px; }
.choices.compact .choice { min-height: 58px; padding-block: 14px; }
.knowledge-check { max-width: 780px; }
button.choice[data-outcome] { display: block; width: 100%; color: var(--ink); text-align: left; line-height: 1.5; }
button.choice[data-outcome][aria-pressed="true"] { border-color: var(--teal); background: var(--soft-teal); box-shadow: inset 0 0 0 1px var(--teal); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 30px; align-items: start; }
.field-error { margin-block: 10px 0; color: var(--error); font-size: .93rem; font-weight: 650; }
[aria-invalid="true"] { border-color: var(--error); }
.action-preview { padding: 22px 26px; margin-block: 8px 26px; border-left: 4px solid var(--teal); background: var(--soft-teal); border-radius: 0 12px 12px 0; }
.action-preview p { max-width: 68ch; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 28px; }
button.primary, button.secondary, button.text-button, a.button, .back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  max-width: 100%;
  padding: 12px 21px;
  border: 1.5px solid transparent;
  border-radius: 11px;
  font-size: .96rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
}
button.primary, a.button.primary { background: var(--teal); color: var(--button-text); }
button.primary:hover, a.button.primary:hover { background: var(--teal-hover); }
button.secondary, a.button.secondary { background: var(--paper); color: var(--ink); border-color: var(--strong-line); }
button.secondary:hover, a.button.secondary:hover { background: var(--soft-teal); border-color: var(--teal); }
button.text-button, .back-button { padding-inline: 10px; background: transparent; color: var(--teal-text); }
button.text-button:hover, .back-button:hover { text-decoration: underline; text-underline-offset: .2em; }
.back-button { margin: 0 0 18px -10px; }
.actions .back-button { margin: 0; }

.example-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-block: 28px; }
.meal-note { min-width: 0; padding: clamp(22px, 3vw, 32px); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.meal-note.full { background: var(--soft-teal); }
.note-body { max-width: 60ch; }
.meal-note h3 { margin-top: 4px; }
.drink-detail { color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-color: var(--teal); text-decoration-thickness: 2px; text-underline-offset: .16em; }
.drink-detail strong { display: block; margin-bottom: 5px; }
.feedback { padding: 20px 24px; margin-block: 24px; border-left: 4px solid var(--strong-line); background: var(--paper); border-radius: 0 12px 12px 0; }
.feedback.success { border-color: var(--teal); background: var(--soft-teal); }
.feedback.hint { border-color: var(--strong-line); background: var(--warm); }
.feedback p { max-width: 72ch; }
details.context { margin-block: 24px; padding-block: 12px; border-block: 1px solid var(--line); }
summary { min-height: 44px; padding-block: 9px; color: var(--ink); font-weight: 650; line-height: 1.5; cursor: pointer; }
summary::marker { color: var(--teal); }
details[open] > summary { margin-bottom: 12px; }
details p { max-width: 78ch; font-size: .93rem; }
.safety-note { max-width: 82ch; margin-top: 25px; color: var(--muted); font-size: .86rem; line-height: 1.65; }

.result-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr); gap: 34px; align-items: start; margin-top: 28px; }
.action-card { position: relative; min-width: 0; padding: clamp(25px, 4vw, 44px); background: var(--paper); border: 1px solid var(--line); border-top: 6px solid var(--teal); border-radius: 8px 8px var(--radius) var(--radius); box-shadow: var(--shadow); }
.card-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 15px; margin-bottom: 26px; }
.card-brand { color: var(--ink); font-size: .86rem; font-weight: 800; letter-spacing: -.015em; }
.card-top .card-kicker { margin: 0; font-size: .67rem; }
.action-card h2, .action-card h3 { max-width: 19ch; margin-bottom: 26px; font-size: clamp(1.8rem, 3.4vw, 2.7rem); }
.card-fields { margin: 0; }
.card-fields dt { margin: 22px 0 6px; color: var(--muted); font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.card-fields dd { margin: 0; color: var(--ink); font-size: 1.13rem; font-weight: 600; line-height: 1.5; }
.card-note { padding-top: 22px; margin-top: 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; line-height: 1.65; }
.card-return { margin-top: 20px; font-size: .9rem; line-height: 1.65; }
.card-return p { margin-bottom: 12px; }
#card-return-link { display: inline-flex; align-items: center; min-height: 44px; max-width: 100%; padding: 9px 16px; color: var(--teal); background: var(--paper); border: 1px solid currentColor; border-radius: 10px; font-weight: 700; text-decoration: none; }
#card-return-link:hover { text-decoration: underline; }
.save-panel { min-width: 0; padding-top: 8px; }
.save-panel h3 { font-size: 1.45rem; }
.save-panel > p { font-size: .96rem; }
.save-actions { display: grid; gap: 11px; margin-block: 22px; }
.save-actions > button, .save-actions > a { width: 100%; }
.copy-fallback { display: block; width: 100%; min-height: 210px; padding: 14px; resize: vertical; color: var(--text); background: var(--paper); border: 1px solid var(--strong-line); border-radius: 10px; line-height: 1.5; }
#copy-fallback { margin-block: 18px; }
#copy-fallback label { display: block; margin-bottom: 10px; font-size: .93rem; }
.checkin { padding-top: 34px; margin-top: 42px; border-top: 1px solid var(--line); }
.checkin > p { max-width: 72ch; }
.checkin .choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.checkin button[data-outcome] { min-height: 52px; padding: 13px 17px; background: var(--paper); color: var(--ink); border: 1.5px solid var(--line); border-radius: 11px; line-height: 1.45; }
.checkin button[data-outcome]:hover { border-color: var(--teal); }
.checkin button[aria-pressed="true"] { border-color: var(--teal); background: var(--soft-teal); box-shadow: inset 0 0 0 1px var(--teal); }
.outcome-message { max-width: 76ch; margin-top: 18px; color: var(--text); }
.live-message:not(:empty) { padding: 14px 18px; margin-block: 20px; background: var(--soft-teal); border-radius: 10px; color: var(--ink); font-size: .94rem; }

.site-footer { padding-block: 28px 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.site-footer > p { max-width: 86ch; }
.site-footer details { margin-top: 16px; }
.site-footer summary { font-size: .85rem; font-weight: 600; }
.site-footer details p { font-size: .85rem; }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 22px; padding-top: 12px; }
.footer-bottom .text-button { margin-left: -10px; font-size: .84rem; font-weight: 600; }
.support-links, .source-links { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 0; list-style: none; }
.support-links:has(details) { display: block; margin-top: 28px; }
.support-links a, .source-links a { display: inline-flex; align-items: center; min-height: 44px; }

@media (min-width: 1000px) {
  body { font-size: 18px; }
  main.shell { padding-top: 38px; }
}

@media (max-width: 760px) {
  .example-grid { grid-template-columns: minmax(0, 1fr); }
  .progress li { display: block; overflow-wrap: normal; }
  .progress li > span { display: block; }
  .hero-grid, .result-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-grid { gap: 28px; }
  .hero-copy h1 { max-width: 19ch; }
  .hero-note { max-width: 100%; }
  .hero-note .glass-mark { float: right; margin: 8px 10px 20px 24px; }
  .hero-note::after { content: ""; display: block; clear: both; }
  .form-grid { gap: 2px; }
  .result-grid { gap: 28px; }
  .save-panel { padding: 0; }
  .checkin .choices { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 24rem) {
  .progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .shell { width: calc(100% - 32px); }
  .site-header { align-items: flex-start; gap: 8px; padding-block: 17px; }
  .wordmark { padding-block: 9px; font-size: 1.06rem; }
  .header-links { gap: 2px 9px; font-size: .78rem; }
  .header-links button { padding-inline: 8px; }
  main.shell { padding-block: 24px 42px; }
  .progress { gap: 8px; margin-bottom: 30px; }
  .progress li { display: block; padding-top: 8px; font-size: .71rem; }
  .progress li > span { display: block; margin-bottom: 5px; font-size: .65rem; }
  h1 { font-size: clamp(2rem, 9.5vw, 2.7rem); }
  .hero-copy h1 { max-width: 100%; }
  .title-number { font-size: 1.23em; }
  .hero-note { padding: 23px; }
  .hero-note .glass-mark { width: 58px; margin-left: 16px; }
  .example-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .choices { grid-template-columns: minmax(0, 1fr); }
  .choice { padding: 15px; }
  .actions { align-items: stretch; gap: 10px; }
  .actions > .primary, .actions > .secondary, .actions > a.button { flex: 1 1 100%; }
  .feedback, .action-preview { padding: 18px 19px; }
  .card-top { margin-bottom: 21px; }
  .card-fields dd { font-size: 1.05rem; }
  .checkin { margin-top: 30px; padding-top: 27px; }
}

@media (prefers-reduced-motion: no-preference) {
  button, a.button, .choice { transition: background-color 130ms ease, border-color 130ms ease; }
}

@media print {
  @page { size: auto; margin: 18mm; }
  :root { color-scheme: light; --page: #fff; --paper: #fff; --ink: #111; --text: #222; --muted: #444; --teal: #111; --line: #aaa; }
  body { background: #fff !important; color: #222 !important; font-size: 12pt; }
  .site-header, .site-footer, .prototype-badge, .skip-link, .progress, .live-message,
  main > :not(#step-result), #step-result > :not(.result-grid),
  .result-grid > :not(#action-card), #step-result .actions, .checkin { display: none !important; }
  .shell, main.shell { width: 100%; max-width: none; margin: 0; padding: 0; }
  #step-result, .result-grid { display: block !important; margin: 0; padding: 0; }
  #action-card { display: block !important; width: 100%; max-width: 170mm; padding: 7mm; color: #111 !important; background: #fff !important; border: 1px solid #777; border-top: 3px solid #111; border-radius: 0; box-shadow: none; break-inside: avoid; }
  #action-card * { color: #111 !important; text-shadow: none !important; }
  #action-card .card-top { margin-bottom: 4mm; }
  #action-card h2, #action-card h3 { max-width: 23ch; margin-bottom: 5mm; font-size: 22pt; }
  #action-card .card-fields dt { margin-top: 4mm; margin-bottom: 1.5mm; font-size: 9pt; }
  #action-card .card-fields dd { font-size: 12pt; line-height: 1.4; }
  #action-card .card-note { margin-top: 5mm; padding-top: 4mm; border-color: #777; font-size: 10pt; line-height: 1.4; }
  #action-card .card-return { margin-top: 4mm; font-size: 10pt; line-height: 1.4; }
  #action-card .card-return p { margin-bottom: 3mm; }
  #action-card .card-return p:last-child { margin-bottom: 0; font-size: 10pt; }
  #action-card a { text-decoration: none; }
  #action-card #card-return-link { display: block; min-height: 0; padding: 0; border: 0; border-radius: 0; }
  #action-card #card-return-link::after { content: attr(href); display: block; margin-top: 1mm; font-weight: 400; overflow-wrap: anywhere; }
}
