@font-face {
  font-family: "Permanent Marker";
  src: url("/assets/fonts/PermanentMarker-Regular.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Finger Paint";
  src: url("/assets/fonts/FingerPaint-Regular.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

:root {
  --navy: #20275f;
  --navy-deep: #11183f;
  --navy-soft: #eef0fa;
  --gold: #e5b84c;
  --gold-bright: #f5c518;
  --cream: #fffaf0;
  --ink: #1c2430;
  --muted: #62687a;
  --line: #d7d2c5;
  --surface: #ffffff;
  --page: #f6f7f2;
  --accent: var(--navy);
  --warn-surface: #fff7e2;
  --warn-line: #c78917;
  --ok-surface: #edf7ef;
  --radius: 14px;
  --shadow: 0 14px 34px rgb(28 31 63 / 11%);
  --font-grading: "Annai MN", "Amnai MN", "Segoe Print", "Bradley Hand", cursive;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1rem 4rem;
  background:
    radial-gradient(circle at 90% 0%, rgb(229 184 76 / 16%), transparent 28rem),
    var(--page);
  color: var(--ink);
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

header, main { max-width: 72rem; margin: 0 auto; }
header { padding: 2rem 0 1.2rem; }
.brand-lockup { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.8rem; }
.brand-logo { width: clamp(6rem, 12vw, 8.5rem); height: auto; flex: 0 0 auto; filter: drop-shadow(0 8px 14px rgb(17 24 63 / 24%)); }
.brand-name { margin: 0 0 -0.15rem; color: #d98b13; font-family: "Finger Paint", cursive; font-size: 0.88rem; letter-spacing: 0.1em; text-transform: uppercase; }
h1 { margin: 0; color: var(--navy); font-family: "Permanent Marker", cursive; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 400; line-height: 1.1; letter-spacing: 0.01em; }
h2 { margin: 0 0 0.75rem; color: var(--navy); font-size: 1.25rem; }
h3 { margin: 0; font-size: 1rem; }
.lede, .note { color: var(--muted); margin: 0 0 0.75rem; }
.lede { max-width: 52rem; }
.note { font-size: 0.9rem; }

.adapter-banner {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.9rem;
}
.adapter-banner[data-kind="synthetic"] { border-left-color: var(--warn-line); background: var(--warn-surface); }
.adapter-banner[data-kind="bridge"] { border-left-color: #6b4fa0; background: #f3eefc; }
.adapter-banner[data-kind="local"] { border-left-color: #2f7d4f; background: var(--ok-surface); }
.adapter-banner[data-kind="paid"] { border-left-color: #8a5300; background: var(--warn-surface); }
.adapter-banner[data-kind="unavailable"] { border-left-color: #b3261e; background: #fdecea; }

section {
  margin: 1.25rem 0;
  padding: clamp(1.15rem, 3vw, 1.65rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.field-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.field { margin: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-weight: 600; font-size: 0.9rem; }

button {
  font: inherit;
  min-height: 2.65rem;
  padding: 0.55rem 1rem;
  border: 2px solid var(--navy);
  border-radius: 9px;
  background: var(--surface);
  color: var(--navy);
  font-weight: 750;
  cursor: pointer;
  transition: transform 100ms ease, background 140ms ease, color 140ms ease;
}
button:hover { background: var(--navy-soft); }
button:active { transform: translateY(2px); }
button:disabled { opacity: 0.55; cursor: default; }
button.primary { background: var(--navy-deep); border-color: var(--navy-deep); color: var(--gold-bright); font-weight: 800; box-shadow: 0 4px 0 #070b20; }
button.primary:hover { background: var(--gold-bright); border-color: var(--gold-bright); color: #111; }
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

table { width: 100%; border-collapse: collapse; margin-bottom: 0.9rem; }
th, td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
td input[type="text"], td input[type="number"] { font: inherit; width: 100%; padding: 0.3rem; border: 1px solid var(--line); border-radius: 3px; }
td input[type="number"] { max-width: 7rem; }
#questions-table input,
#directions,
.confirm-row input,
.transcription textarea {
  font-family: var(--font-grading);
  font-size: 1rem;
}
.confirm-row input { font-size: 1.1rem; font-weight: 700; }

.document-preview { margin-top: 1rem; }
.document-preview h3 { font-size: 0.9rem; margin-bottom: 0.4rem; }
.page-strip { display: flex; gap: 0.6rem; overflow-x: auto; padding-bottom: 0.4rem; }
.page-thumb { border: 1px solid var(--line); border-radius: 4px; background: var(--surface); padding: 0.3rem; flex: 0 0 auto; }
.page-thumb figcaption { font-size: 0.75rem; color: var(--muted); text-align: center; margin-top: 0.25rem; }
.page-thumb canvas { display: block; cursor: crosshair; }
.page-thumb.selecting { border-color: var(--accent); }

.submission { border: 1px solid var(--line); border-radius: 6px; margin-bottom: 1.25rem; }
.submission-heading {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); background: var(--page);
}
.submission-heading label { font-size: 0.85rem; font-weight: 600; display: flex; gap: 0.4rem; align-items: center; }
.submission-heading input { font: inherit; padding: 0.3rem; border: 1px solid var(--line); border-radius: 3px; }
.submission-adapter { font-size: 0.8rem; color: var(--muted); }
.submission-total { font-weight: 600; }
.submission-total[data-complete="no"] { color: #8a5300; }

.question { padding: 1rem; border-top: 1px solid var(--line); display: grid; gap: 1rem; grid-template-columns: minmax(12rem, 20rem) 1fr; }
.question:first-of-type { border-top: none; }
.question[data-kind="no_proposal"] { background: var(--warn-surface); }
.question[data-confirmed="yes"] { background: var(--ok-surface); }
@media (max-width: 54rem) { .question { grid-template-columns: 1fr; } }

.evidence { display: flex; flex-direction: column; gap: 0.5rem; }
.evidence figure { margin: 0; }
.evidence figcaption { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.2rem; }
.evidence canvas { display: block; max-width: 100%; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.evidence .missing { font-size: 0.8rem; color: var(--muted); font-style: italic; }

.proposal { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.proposal-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; justify-content: space-between; }
.proposal-kind { font-weight: 600; }
.proposal-kind[data-kind="no_proposal"] { color: #8a5300; }
.proposal dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem; font-size: 0.9rem; }
.proposal dt { color: var(--muted); }
.proposal dd { margin: 0; }
.transcription { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; }
.transcription textarea { font: inherit; min-height: 3.2rem; padding: 0.35rem; border: 1px solid var(--line); border-radius: 3px; resize: vertical; }
.confirm-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; }
.confirm-row label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; font-weight: 600; }
.confirm-row input { font: inherit; width: 7rem; padding: 0.35rem; border: 1px solid var(--line); border-radius: 3px; }
.entry-error { color: #b3261e; font-size: 0.8rem; margin: 0; }
.review-heading { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.review-summary { font-weight: 600; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Subscription bridge: deliberately distinct from every automated adapter. */
#bridge { border-left: 4px solid #6b4fa0; }
#bridge h3 { margin: 1rem 0 0.4rem; font-size: 0.95rem; }
#bridge h4 { margin: 0.6rem 0 0.3rem; font-size: 0.85rem; }
#bridge ol { margin: 0 0 0.75rem; padding-left: 1.3rem; font-size: 0.9rem; }
#bridge textarea {
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  resize: vertical;
}
.bridge-prompt-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.25rem; }
.bridge-feedback { font-size: 0.85rem; color: var(--muted); margin: 0.3rem 0; min-height: 1.2em; }
.bridge-feedback[data-state="ok"] { color: #2f7d4f; font-weight: 600; }
.bridge-feedback[data-state="error"] { color: #b3261e; font-weight: 600; }
.start-card {
  border: 2px solid var(--gold);
  background: linear-gradient(145deg, var(--cream) 0%, #fff 72%);
}
.step-kicker {
  margin: 0 0 0.25rem;
  color: var(--navy);
  font-family: "Finger Paint", cursive;
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.section-intro { margin: 0 0 1rem; color: var(--muted); }
.field-help { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.8rem; }
.optional { color: var(--muted); font-weight: 500; }

.upload-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.upload-card {
  min-height: 9.2rem;
  padding: 1rem;
  border: 2px dashed #a9aec7;
  border-radius: 12px;
  background: rgb(255 255 255 / 78%);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}
.upload-card:hover, .upload-card:focus-within {
  border-color: var(--gold);
  background: #fffdf7;
  transform: translateY(-1px);
}
.upload-card label { color: var(--navy); font-size: 1rem; font-weight: 850; }
.upload-card input[type="file"] {
  width: 100%; margin-top: 0.3rem; color: var(--muted); font: inherit; font-size: 0.86rem;
}
.upload-card input[type="file"]::file-selector-button {
  margin-right: 0.65rem; padding: 0.55rem 0.75rem; border: 0; border-radius: 8px;
  background: var(--navy); color: var(--gold-bright); font: inherit; font-weight: 800; cursor: pointer;
}
.upload-card input[type="file"]::file-selector-button:hover { background: var(--navy-deep); }

input, textarea, select {
  color: var(--ink); background: #fff; border-color: var(--line); border-radius: 7px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 3px solid rgb(229 184 76 / 48%); outline-offset: 2px;
}

@media (max-width: 42rem) {
  body { padding-inline: 0.75rem; }
  .brand-lockup { align-items: center; }
  .brand-logo { width: 5.5rem; }
  .upload-grid { grid-template-columns: 1fr; }
  .upload-card { min-height: 0; }
}
