:root {
  --ink: #10241d;
  --paper: #f5f0e7;
  --card: #fffdf8;
  --clay: #ad452a;
  --clay-light: #f1d9cc;
  --line: #d7cdbd;
  --muted: #5d6964;
  --sage: #dfe9e4;
  --shadow: 0 24px 70px rgba(16, 36, 29, 0.11);
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 12%, rgba(173, 69, 42, 0.13), transparent 25rem),
    var(--paper);
  font-family: var(--sans);
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

.clinic-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(180px, 420px) auto;
  gap: 24px;
  align-items: center;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid rgba(16, 36, 29, 0.1);
  background: rgba(245, 240, 231, 0.93);
  backdrop-filter: blur(14px);
}
.clinic-brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.1em;
}
.clinic-brand img { width: 40px; height: 40px; object-fit: contain; }
.clinic-progress { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.clinic-progress span { color: var(--muted); font-size: 0.74rem; font-weight: 750; }
.clinic-progress div { height: 5px; overflow: hidden; border-radius: 999px; background: rgba(16, 36, 29, 0.1); }
.clinic-progress i { display: block; width: 12.5%; height: 100%; border-radius: inherit; background: var(--clay); transition: width 260ms ease; }
.quiet-button, .clinic-controls button {
  padding: 10px 15px;
  color: var(--ink);
  border: 1px solid rgba(16, 36, 29, 0.16);
  border-radius: 999px;
  background: transparent;
  font-weight: 750;
}

.clinic-stage {
  width: min(1320px, calc(100% - 32px));
  min-height: calc(100vh - 160px);
  margin: 0 auto;
  padding: clamp(36px, 7vh, 82px) 0 120px;
}
.clinic-slide { animation: slide-in 280ms ease both; }
.clinic-slide[hidden] { display: none; }
@keyframes slide-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.slide-grid { display: grid; grid-template-columns: 1.35fr 0.8fr; gap: clamp(28px, 6vw, 90px); align-items: center; }
.eyebrow {
  margin: 0 0 18px;
  color: var(--clay);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
h1, h2, h3 { margin-top: 0; }
h1, h2 {
  max-width: 950px;
  margin-bottom: 24px;
  font-family: var(--display);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.055em;
}
h1 { font-size: clamp(4rem, 9vw, 8.8rem); }
h2 { font-size: clamp(3.2rem, 7vw, 7rem); }
.lead, .slide-heading > p:last-child {
  max-width: 800px;
  color: var(--muted);
  font-size: clamp(1.12rem, 2vw, 1.5rem);
  line-height: 1.55;
}
.opening-actions, .closing-actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 34px; }
.opening-actions span { color: var(--muted); font-size: 0.82rem; }
.primary-button, .secondary-button {
  display: inline-flex;
  min-height: 48px;
  padding: 13px 20px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
}
.primary-button { color: #fff; border: 1px solid var(--ink); background: var(--ink); }
.secondary-button { color: var(--ink); border: 1px solid rgba(16, 36, 29, 0.22); background: transparent; }
.opening-card, .host-card {
  padding: clamp(28px, 5vw, 52px);
  color: #fff;
  border-radius: 34px 34px 34px 8px;
  background: var(--ink);
  box-shadow: var(--shadow);
}
.opening-card > span, .host-card > span, .economics-result > span {
  color: #efae88;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.13em;
}
.opening-card ol, .host-card ul { margin: 24px 0 0; padding-left: 20px; }
.opening-card li, .host-card li { margin: 13px 0; color: rgba(255,255,255,0.78); line-height: 1.45; }

.slide-heading { margin-bottom: 34px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field-grid .wide, .guardrail-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 8px; color: var(--ink); font-size: 0.78rem; font-weight: 800; }
label span { color: var(--muted); font-size: 0.7rem; font-weight: 500; }
input, textarea {
  width: 100%;
  padding: 16px 17px;
  color: var(--ink);
  border: 1px solid rgba(16, 36, 29, 0.18);
  border-radius: 13px;
  outline: none;
  background: rgba(255, 253, 248, 0.9);
  font-weight: 500;
  line-height: 1.5;
}
input:focus, textarea:focus { border-color: var(--clay); box-shadow: 0 0 0 3px rgba(173, 69, 42, 0.12); }
textarea { resize: vertical; }
.facilitator-note {
  margin-top: 22px;
  padding: 18px 20px;
  border-left: 3px solid var(--clay);
  background: rgba(255,255,255,0.5);
  color: var(--muted);
}
.facilitator-note b { color: var(--ink); }

.economics-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 0.8fr); gap: 24px; }
.compact-fields { padding: 26px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); }
.economics-result {
  display: flex;
  min-height: 360px;
  padding: clamp(28px, 5vw, 54px);
  flex-direction: column;
  justify-content: center;
  color: #fff;
  border-radius: 32px;
  background: var(--ink);
}
.economics-result strong { margin: 18px 0 8px; font-family: var(--display); font-size: clamp(3.4rem, 7vw, 6.2rem); font-weight: 500; line-height: 0.95; }
.economics-result p { margin: 0; color: #fff; font-size: 1.2rem; }
.economics-result small { margin-top: 14px; color: #efae88; font-weight: 800; }
.economics-result em { margin-top: 30px; color: rgba(255,255,255,0.58); font-size: 0.75rem; line-height: 1.5; }

.relay-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.relay-grid label { padding: 22px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); }
.relay-grid label > span { color: var(--clay); font-size: 0.72rem; font-weight: 850; letter-spacing: 0.12em; }
.reviewer-field { margin-top: 18px; }

.guardrail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
fieldset { margin: 0; padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); }
legend { max-width: 95%; padding: 0 8px; font-family: var(--display); font-size: 1.15rem; line-height: 1.3; }
fieldset label { display: flex; gap: 9px; align-items: flex-start; margin-top: 14px; font-weight: 550; line-height: 1.45; }
fieldset input { width: auto; margin-top: 2px; }

.route-card { padding: clamp(32px, 7vw, 70px); border-radius: 36px; background: var(--clay-light); }
.route-card span { color: var(--clay); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.13em; }
.route-card h3 { max-width: 900px; margin: 18px 0; font-family: var(--display); font-size: clamp(2.5rem, 6vw, 5.6rem); font-weight: 500; line-height: 1; }
.route-card p { max-width: 800px; margin: 0; color: var(--muted); font-size: 1.15rem; line-height: 1.55; }
.route-card.is-caution { background: #efe2bf; }
.route-card.is-human { color: #fff; background: var(--ink); }
.route-card.is-human p { color: rgba(255,255,255,0.7); }
.route-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.route-steps article { padding: 20px; border-top: 3px solid var(--clay); background: var(--card); }
.route-steps span { display: block; color: var(--clay); font-weight: 900; }
.route-steps p { margin-bottom: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }

.prompt-heading { display: flex; gap: 24px; align-items: end; justify-content: space-between; }
.prompt-heading h2 { margin-bottom: 0; }
.prompt-actions { display: flex; gap: 10px; flex-shrink: 0; }
.generated-prompt {
  min-height: 430px;
  padding: clamp(22px, 4vw, 38px);
  color: #ecf2ef;
  border: 0;
  border-radius: 26px;
  background: var(--ink);
  font: 0.88rem/1.62 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.copy-status { min-height: 24px; color: var(--clay); font-weight: 750; }

.closing-grid { grid-template-columns: 1.15fr 0.85fr; }
.host-card h3 { margin: 18px 0; font-family: var(--display); font-size: clamp(2rem, 4vw, 3.4rem); font-weight: 500; line-height: 1.05; }
.host-card p { color: rgba(255,255,255,0.72); line-height: 1.6; }
.host-card a { display: inline-block; margin-top: 18px; color: #fff; font-weight: 800; }

.clinic-controls {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border-top: 1px solid rgba(16, 36, 29, 0.1);
  background: rgba(245, 240, 231, 0.96);
  backdrop-filter: blur(14px);
}
.clinic-controls span { color: var(--muted); font-size: 0.72rem; }
.clinic-controls .next-control { color: #fff; border-color: var(--ink); background: var(--ink); }
.clinic-controls button:disabled { opacity: 0.38; cursor: not-allowed; }
.print-summary { display: none; }

@media (max-width: 850px) {
  .clinic-header { grid-template-columns: 1fr auto; }
  .clinic-progress { grid-column: 1 / -1; grid-row: 2; }
  .slide-grid, .economics-grid, .closing-grid { grid-template-columns: 1fr; }
  .relay-grid, .route-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opening-card, .host-card { border-radius: 26px; }
  h1 { font-size: clamp(3.4rem, 15vw, 6rem); }
  h2 { font-size: clamp(3rem, 12vw, 5rem); }
}

@media (min-width: 851px) and (max-height: 800px) {
  .clinic-header { min-height: 64px; padding-top: 8px; padding-bottom: 8px; }
  .clinic-brand img { width: 34px; height: 34px; }
  .clinic-stage { min-height: calc(100vh - 136px); padding-top: 38px; }
  h1 { font-size: clamp(3.8rem, 8vw, 7rem); }
  .lead { line-height: 1.4; }
  .opening-actions { margin-top: 22px; }
  .opening-card { padding: 36px; }
}

@media (max-width: 600px) {
  .clinic-header { gap: 10px; }
  .clinic-brand span, .clinic-controls span { display: none; }
  .clinic-stage { width: min(100% - 24px, 1320px); padding-top: 34px; }
  .field-grid, .guardrail-grid, .relay-grid, .route-steps { grid-template-columns: 1fr; }
  .field-grid .wide, .guardrail-grid .wide { grid-column: auto; }
  .prompt-heading { display: block; }
  .prompt-actions { margin-top: 20px; }
}

@media print {
  body { background: #fff; }
  .clinic-header, .clinic-stage, .clinic-controls { display: none !important; }
  .print-summary { display: block; padding: 24px; color: #111; }
  .print-summary h1, .print-summary h2 { font-family: Georgia, serif; letter-spacing: -0.03em; }
  .print-summary h1 { font-size: 30px; }
  .print-summary h2 { margin-top: 24px; font-size: 20px; }
  .print-summary dl { display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; }
  .print-summary dt { font-weight: 800; }
  .print-summary dd { margin: 0; }
  .print-summary pre { padding: 16px; border: 1px solid #bbb; white-space: pre-wrap; font-size: 9px; line-height: 1.45; }
}
