:root {
  color-scheme: light;
  --ink: #171923;
  --muted: #666675;
  --accent: #644e91;
  --accent-dark: #4a3575;
  --paper: #faf9f7;
  --line: #dedbdc;
  --error: #7b2633;
  --focus: #5e48a2;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: progress; opacity: .67; }
a { color: var(--accent-dark); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.skip-link { position: absolute; top: -5rem; left: 1rem; background: #fff; color: var(--ink); padding: .65rem 1rem; z-index: 10; }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.masthead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem clamp(1.3rem, 4vw, 4rem); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 750; letter-spacing: .17em; font-size: .83rem; }
.brand-mark { color: var(--accent); font-size: 1.45rem; line-height: 1; }
.masthead-note { color: var(--muted); font-size: .63rem; letter-spacing: .12em; text-align: right; }

.page-shell { margin: 0 auto; max-width: 1440px; padding: 0 clamp(1.3rem, 4vw, 4rem) 5rem; }
.intro { padding: clamp(3rem, 6vw, 6rem) 0 3.6rem; max-width: 850px; }
.eyebrow { color: var(--accent); font-size: .69rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; margin: 0 0 .8rem; }
h1, h2, h3, .reading-empty { font-family: Georgia, Cambria, "Times New Roman", serif; font-weight: 400; }
h1 { font-size: clamp(2.8rem, 5vw, 4.8rem); line-height: 1.08; letter-spacing: -.038em; margin: 0 0 1.4rem; }
h1 em { font-weight: 400; color: var(--accent-dark); }
.introduction { max-width: 67ch; color: #4f4d55; font-size: 1.03rem; margin: 0; line-height: 1.8; }
.runtime-status { display: inline-block; margin: 1.6rem 0 0; padding: .5rem .8rem; color: #594c69; background: #eeeaf2; border: 1px solid #d9d0e2; border-radius: 5px; font-size: .77rem; line-height: 1.6; }
.runtime-status.runtime-ready { color: #28523b; border-color: #bcd7c5; background: #e8f4eb; }
.funnel-notice { margin: 1.5rem 0 0; padding: 1.1rem 1.3rem; border: 2px solid #aa855c; border-radius: 6px; color: #44372b; background: #fbf0dd; font-size: .85rem; line-height: 1.65; }
.funnel-notice[hidden] { display: none; }
.funnel-notice > strong { display: block; font-size: .95rem; }
.funnel-notice p { margin: .65rem 0 0; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.07fr); gap: clamp(2rem, 5vw, 5.5rem); padding-top: 1.5rem; border-top: 1px solid var(--line); align-items: start; }
.section-heading { margin: 0 0 1.8rem; }
.section-heading h2 { font-size: clamp(1.8rem, 2.8vw, 2.4rem); line-height: 1.2; margin: 0; }

.field { margin-bottom: 1.5rem; }
.field label, .access-panel > label { display: block; font-size: .87rem; font-weight: 680; margin-bottom: .4rem; }
.field-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.field-heading label { margin-bottom: .4rem; }
.optional, .counter { color: var(--muted); font-size: .75rem; font-weight: 400; }
.field input, .field textarea, .access-panel input { width: 100%; color: var(--ink); border: 1px solid #c9c6cf; background: #fff; border-radius: 6px; padding: .9rem .95rem; }
.field input:hover, .field textarea:hover, .access-panel input:hover { border-color: #8f839f; }
.field textarea { min-height: 275px; resize: vertical; line-height: 1.72; }
.field-note { color: var(--muted); font-size: .76rem; line-height: 1.6; margin: .55rem 0 0; }

.lenses-control { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .95rem 0; margin: 1.4rem 0; }
.lenses-control summary { cursor: pointer; font-weight: 680; font-size: .9rem; }
.lenses-control summary::marker { color: var(--accent); }
.summary-aside { color: var(--muted); font-weight: 400; font-size: .74rem; margin-left: .4rem; }
.lenses-control fieldset { border: 0; margin: 0; padding: 1rem 0 0; }
.lens-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem .85rem; margin-top: 1rem; }
.lens-grid label { display: flex; gap: .5rem; align-items: flex-start; font-size: .79rem; cursor: pointer; line-height: 1.35; }
.lens-grid input { flex: 0 0 auto; margin: .12rem 0 0; accent-color: var(--accent); }

.access-panel { margin: 1.75rem 0 1.2rem; }
.access-panel input { margin: 0; }
.disclosure-control { display: flex; align-items: flex-start; gap: .65rem; font-size: .79rem; line-height: 1.55; cursor: pointer; color: #43414a; }
.disclosure-control input { flex: 0 0 auto; margin-top: .18rem; accent-color: var(--accent); }
.primary-action { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.4rem; border: 1px solid var(--accent-dark); background: var(--accent-dark); color: white; border-radius: 6px; padding: 1rem 1.15rem; font-size: .93rem; font-weight: 650; transition: background 120ms ease; }
.primary-action:hover:not(:disabled) { background: #382657; }
.below-action { margin-top: .8rem; }

.reading-pane { min-width: 0; }
#status { color: #686373; line-height: 1.75; font-size: .92rem; max-width: 58ch; }
.error-message { border-left: 3px solid var(--error); background: #fff3f3; color: var(--error); padding: .9rem 1rem; margin: 1.2rem 0; border-radius: 0 5px 5px 0; line-height: 1.5; }
.reading-empty { border-top: 1px solid var(--line); margin-top: 2rem; padding: 4.6rem 0; color: #79707e; text-align: center; }
.reading-empty .ornament { display: block; color: var(--accent); font-family: sans-serif; font-size: 1.3rem; margin-bottom: 1.3rem; }
.reading-empty p { font-style: italic; font-size: clamp(1rem, 1.6vw, 1.35rem); line-height: 1.65; }

#results { border-top: 1px solid var(--line); margin-top: 1.4rem; padding-top: 1.3rem; }
#results:focus { outline: none; }
#results h3 { font-size: 1.8rem; line-height: 1.28; margin: 0 0 1.25rem; }
#results h4 { font-size: 1.25rem; font-family: Georgia, Cambria, "Times New Roman", serif; font-weight: 400; margin: 0 0 .8rem; }
#results p, #results li { max-width: 68ch; overflow-wrap: anywhere; line-height: 1.75; }
.result-provenance { color: var(--muted); font-size: .72rem; margin-bottom: 1.6rem; }
.result-section { margin: 0 0 2rem; }
.result-section + .result-section { border-top: 1px solid var(--line); padding-top: 1.5rem; }
.result-section .lens-basis { color: var(--muted); font-size: .75rem; margin: .3rem 0; }
.result-section blockquote { margin: .8rem 0; padding: .55rem 1rem; border-left: 2px solid #b3a8c9; color: #4e425b; background: #f2eff5; white-space: pre-wrap; overflow-wrap: anywhere; font-family: Georgia, Cambria, "Times New Roman", serif; }
.result-section ul { padding-left: 1.3rem; margin: .5rem 0; }
.secondary-action { padding: .65rem .95rem; border: 1px solid #aba1bc; color: var(--accent-dark); background: transparent; border-radius: 6px; }
.secondary-action:hover { background: #f2eef8; }

.footer { border-top: 1px solid var(--line); color: var(--muted); display: flex; justify-content: space-between; gap: 1rem; padding: 1.2rem clamp(1.3rem, 4vw, 4rem); font-size: .7rem; }
.footer p { margin: 0; }
.noscript-message { margin: 1rem; border: 1px solid var(--line); padding: 1rem; }

@media (max-width: 880px) {
  .workspace { grid-template-columns: 1fr; gap: 4rem; }
  .reading-empty { padding: 2.5rem 0; }
  .masthead-note { max-width: 21ch; }
}

@media (max-width: 500px) {
  .masthead-note { display: none; }
  .intro { padding-top: 3rem; }
  .lens-grid { grid-template-columns: 1fr; }
  .summary-aside { display: block; margin: .15rem 0 0 1.1rem; }
  .footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .primary-action { transition: none; }
}
