@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/Manrope.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/static/fonts/DMSans.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --canvas: #f3f9fa;
  --surface: #ffffff;
  --ink: #12374b;
  --muted: #547383;
  --sky: #147eb2;
  --sky-button: #106f9e;
  --coral: #d66760;
  --border: #d2e4e9;
  --border-strong: #6d929f;
  --soft-sky: #eaf4f7;
  --soft-coral: #fff0ee;
  --heading: "Manrope", "Avenir Next", Arial, sans-serif;
  --body: "DM Sans", "Avenir Next", Arial, sans-serif;
  --reading: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  padding: 0 max(5vw, 24px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font: 700 16px/1 var(--heading);
  letter-spacing: -.25px;
}
.brand span { color: var(--sky); }
.shell { width: min(700px, calc(100% - 40px)); margin: 48px auto 0; }
.intro { margin: 0 auto 25px; }
.intro h1 {
  margin: 0;
  font: 700 clamp(28px, 5vw, 40px)/1.15 var(--heading);
  letter-spacing: -1.1px;
}
.lede { margin: 8px 0 0; color: var(--muted); font-size: 16px; }
.workspace {
  max-width: 650px;
  margin: 0 auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.upload-panel { padding: 0; }
.dropzone {
  min-height: 214px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: 6px;
  background: #fbfdfe;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover {
  outline: none;
  border-color: var(--sky-button);
  background: var(--soft-sky);
}
.upload-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
}
.upload-icon svg { width: 23px; height: 23px; fill: none; stroke: var(--sky-button); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { font: 600 17px/1.4 var(--heading); }
.drop-subtitle { margin-top: 5px; color: var(--muted); font-size: 14px; }
.text-link { color: var(--sky-button); text-decoration: underline; text-underline-offset: 3px; }
.microcopy { max-width: 100%; margin-top: 18px; padding: 0 12px; color: #466778; font-size: 12px; text-align: center; }
.form-row { margin-top: 18px; }
.field-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.optional { margin-left: 5px; color: var(--muted); font-size: 12px; font-weight: 400; }
.text-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}
.text-input::placeholder { color: var(--muted); opacity: 1; }
.text-input:focus-visible { outline: 3px solid var(--sky-button); outline-offset: 1px; border-color: var(--sky-button); }
.selected-file { margin-top: 13px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 5px; background: var(--soft-sky); color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.challenge-container { margin-top: 16px; min-height: 65px; }
.challenge-feedback { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.challenge-status { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.challenge-feedback .quiet-button { margin-top: 4px; white-space: nowrap; }
.button {
  width: 100%;
  min-height: 46px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  transition: background-color .15s, border-color .15s;
}
.button-primary { margin-top: 18px; border: 1px solid var(--sky-button); background: var(--sky-button); color: #fff; }
.button-primary:hover:not(:disabled) { border-color: #0c5e88; background: #0c5e88; }
.button-primary:disabled { opacity: 1; background: #dae8ed; border-color: #91afb9; color: #47606c; cursor: not-allowed; }
.button-secondary { margin-top: 9px; border: 1px solid var(--sky-button); background: var(--surface); color: var(--sky-button); }
.button-secondary:hover { background: var(--soft-sky); }
.button:focus-visible, .quiet-button:focus-visible, .reader-control:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}
.under-button { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.privacy-note { margin: 6px 0 0; color: #67471f; font-size: 12px; line-height: 1.5; text-align: center; }
.footnote { max-width: 650px; margin: 16px auto 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1000px, calc(100% - 48px));
  margin: 58px auto 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.result-panel { padding: 2px 0 0; }
.panel-topline, .reader-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-topline { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.eyebrow { margin: 0; color: var(--sky-button); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.quiet-button { padding: 7px 4px; border: 0; background: transparent; color: var(--sky-button); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.progress-book, .ready-heading { display: flex; align-items: center; gap: 16px; margin: 23px 0 18px; }
.book-art { width: 48px; height: 62px; flex: none; display: flex; align-items: flex-end; padding: 8px; border: 1px solid #9bbcc8; border-left: 4px solid var(--sky); border-radius: 3px; background: var(--soft-sky); color: var(--ink); font: 600 11px var(--heading); }
.book-art-ready { border-left-color: var(--coral); }
.progress-book h2, .ready-heading h2 { margin: 0 0 4px; font: 650 21px/1.3 var(--heading); letter-spacing: -.4px; }
.muted { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.progress-track { height: 7px; overflow: hidden; border-radius: 5px; background: #dcebef; }
.progress-track span { display: block; width: 6%; height: 100%; border-radius: inherit; background: var(--sky-button); transition: width .3s ease; }
.status-line { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.error-box { margin-top: 14px; padding: 11px 12px; border: 1px solid #efb1ab; border-radius: 5px; background: var(--soft-coral); color: #792e29; font-size: 13px; line-height: 1.5; }
.ready-heading { margin-top: 22px; margin-bottom: 17px; }
.ready-heading .eyebrow { margin-bottom: 5px; }
.report { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 14px 0; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.report strong { color: var(--ink); font-weight: 700; }
.warning-note { margin: 0 0 14px; padding: 10px 12px; border: 1px solid #e8c7a4; border-radius: 5px; background: #fff8ee; color: #67471f; font-size: 13px; line-height: 1.5; }
.reader-panel { overflow: hidden; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.reader-toolbar { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.reader-controls { display: flex; gap: 6px; }
.reader-control { min-width: 38px; height: 36px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.reader-control:hover { background: var(--soft-sky); }
.reader-content { max-height: 68vh; overflow: auto; padding: 34px clamp(20px, 7vw, 64px) 48px; }
.reader-content .eyebrow { margin-bottom: 8px; }
.reader-content h2 { margin: 0 0 22px; font: 650 28px/1.25 var(--heading); }
.reader-body { color: #203f50; font: 18px/1.8 var(--reading); }
.reader-body p { margin: 0 0 1.2em; }
.reader-panel.night { background: #183341; border-color: #355666; }
.reader-panel.night .reader-content h2, .reader-panel.night .reader-body { color: #edf7f8; }
.reader-panel.night .reader-toolbar { border-color: #355666; }
.reader-panel.night .quiet-button, .reader-panel.night .reader-content .eyebrow { color: #a9d7e6; }
.reader-panel.night .reader-control { border-color: #86a5b2; background: #234657; color: #f3fbfc; }

@media (max-width: 600px) {
  .topbar { min-height: 58px; padding: 0 18px; }
  .shell { width: calc(100% - 28px); margin-top: 32px; }
  .intro { margin-bottom: 20px; }
  .lede { margin-top: 6px; font-size: 15px; }
  .workspace { padding: 15px; }
  .dropzone { min-height: 190px; }
  .microcopy { max-width: 290px; line-height: 1.5; }
  .result-panel { padding: 0; }
  .progress-book h2, .ready-heading h2 { font-size: 19px; }
  .reader-content { padding: 27px 20px 36px; }
  .reader-body { font-size: 17px; }
  .footer { width: calc(100% - 36px); margin-top: 42px; flex-direction: column; gap: 5px; }
}

.dropzone:focus-visible { outline: 3px solid var(--sky-button); outline-offset: 3px; }
