:root {
  color-scheme: dark;
  --ink: #f4f2ff;
  --muted: #bdc7df;
  --line: rgba(162, 180, 228, .24);
  --accent: #9ce8f5;
  --paper: #080c1b;
  --surface: #11182b;
  --control-line: #6d7fa1;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  isolation: isolate;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Malgun Gothic", sans-serif;
  font-size: 17px;
  line-height: 1.7;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--paper);
  background-image:
    linear-gradient(180deg, rgba(8, 12, 27, .34), rgba(8, 12, 27, .45) 42%, rgba(8, 12, 27, .94) 100%),
    radial-gradient(ellipse at 50% 24%, rgba(39, 23, 85, .08), rgba(6, 10, 24, .48) 76%),
    url("./deal-scanner-nebula-v1.png");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}
::selection { background: #c9b6ff; color: #101427; }
a { color: #b6e9f5; text-underline-offset: 3px; }
a:hover { color: #edfaff; }
header {
  max-width: 1120px;
  margin: auto;
  min-height: 96px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  text-decoration: none;
  color: var(--ink);
  font-size: 23px;
  font-weight: 850;
  letter-spacing: -1px;
}
.brand span {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  margin-left: 14px;
  color: #d0c9e9;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #dce2f5;
  background: rgba(15, 22, 43, .9);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 5px 12px;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(156, 232, 245, .5);
}
main { width: min(780px, 100% - 40px); margin: 48px auto 60px; }
.intro { text-align: center; margin-bottom: 32px; }
.eyebrow {
  display: inline-block;
  margin: 0;
  padding: 5px 12px;
  color: #c6f2fb;
  background: rgba(11, 26, 46, .8);
  border: 1px solid rgba(156, 232, 245, .27);
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .7px;
}
h1 {
  color: #f7f4ff;
  font-size: clamp(36px, 7vw, 60px);
  line-height: 1.2;
  letter-spacing: -2px;
  margin: 22px 0;
  text-wrap: balance;
  text-shadow: 0 2px 30px rgba(136, 103, 210, .22);
}
p { color: var(--muted); }
.intro > p:not(.eyebrow) { color: #d8daee; }
h2 { font-size: 19px; line-height: 1.4; }
.scan {
  background: rgba(17, 24, 43, .97);
  border: 1px solid rgba(183, 165, 244, .5);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 20px 64px rgba(0, 0, 0, .34), 0 0 40px rgba(117, 80, 199, .11), inset 0 1px 0 rgba(232, 220, 255, .07);
}
.scan:focus-within {
  border-color: #a8d9f1;
  box-shadow: 0 20px 64px rgba(0, 0, 0, .34), 0 0 0 1px rgba(156, 232, 245, .15);
}
.scan > label { font-size: 13px; font-weight: 700; color: #ded6f6; }
textarea {
  resize: vertical;
  width: 100%;
  min-height: 140px;
  border: 0;
  border-radius: 8px;
  padding: 8px 0;
  background: none;
  color: var(--ink);
  caret-color: var(--accent);
  font: inherit;
  margin-top: 8px;
}
textarea::placeholder, input::placeholder { color: #a8b4cd; opacity: 1; }
textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid rgba(162, 180, 228, .13);
}
.muted, .disclosure { font-size: 12px; color: var(--muted); }
.disclosure { text-align: center; margin: 18px 0 32px; }
button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 20px;
  background: linear-gradient(110deg, #d7c8ff, #ace9f2);
  color: #13182b;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 5px 18px rgba(101, 107, 197, .14);
}
button:hover { background: #e3dcff; }
button:active { background: #bce6ef; }
button:disabled { cursor: not-allowed; opacity: .65; }
button:focus-visible, a:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.panel, details {
  background: rgba(17, 24, 43, .97);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  margin-top: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
}
.panel { border-top-color: rgba(156, 232, 245, .5); }
.panel ul { padding-left: 22px; }
.panel li { margin: 14px 0; }
.panel li::marker { color: var(--accent); }
.panel li p { margin: 4px 0; font-size: 14px; }
details[open] { border-color: rgba(183, 165, 244, .48); }
summary { cursor: pointer; font-weight: 700; min-height: 44px; align-content: center; }
summary::marker { color: #b8a6ef; }
summary span {
  font-size: 11px;
  color: #d1c5f4;
  margin-left: 8px;
  font-weight: 500;
}
details > p { font-size: 13px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0; }
label { display: block; font-size: 13px; color: #e4e6f3; }
input:not([type=checkbox]), select {
  display: block;
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--control-line);
  border-radius: 9px;
  padding: 9px;
  margin-top: 6px;
  background: #0a1122;
  color: var(--ink);
  caret-color: var(--accent);
  font: inherit;
  font-size: 16px;
}
option { background: #0a1122; color: var(--ink); }
small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.confirm { display: flex; align-items: flex-start; gap: 9px; margin: 22px 0; }
.confirm input { width: 18px; height: 18px; flex: none; accent-color: #b6e9f5; }
.result {
  background: #101f32;
  border: 1px solid rgba(156, 232, 245, .35);
  border-radius: 12px;
  padding: 18px;
  margin-top: 22px;
}
.result strong { font-size: 26px; color: #c1f4fb; }
.result p { font-size: 13px; color: #c9d8e8; }
.result ul { padding-left: 20px; }
.limits { margin: 30px 8px; }
.limits h2 { font-size: 15px; color: #e0d9f2; }
.limits p { font-size: 12px; }
.secondary {
  color: #e3dcf6;
  background: #182138;
  border-color: #657394;
  box-shadow: none;
  font-weight: 600;
}
.secondary:hover { background: #28334e; color: #fff; }
.secondary:active { background: #202b43; }
.footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 11px;
  color: var(--muted);
}
footer {
  text-align: center;
  padding: 24px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: rgba(8, 12, 27, .75);
}
[hidden] { display: none !important; }
/* A short first step, readable controls, and optional tools for every age. */
.input-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.input-choices button { min-height: 54px; padding: 10px; font-size: 17px; }
.input-choices button[aria-pressed="true"] { background: #d0eaf6; color: #11182b; border-color: #c7e8fa; box-shadow: inset 0 -3px 0 #9b83d7; }
.input-help { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0 12px; font-size: 15px; color: var(--muted); }
.input-help button { min-height: 44px; padding: 8px 12px; font-size: 15px; }
.scan > label { font-size: 17px; }
.scan textarea { min-height: 104px; padding: 12px; background: #0a1122; border: 1px solid var(--control-line); font-size: 17px; }
.scan .actions { border: 0; padding-top: 4px; }
.scan .actions button { width: 100%; min-height: 56px; font-size: 19px; }
.scan .scan-options { padding: 0; margin-top: 18px; border: 0; background: transparent; box-shadow: none; }
.scan-options summary { color: #d6ddf0; font-size: 16px; font-weight: 500; }
.scan-options .scan-settings { grid-template-columns: 1fr; }
.toolbox > summary span { display: block; margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.toolbox > section > p { margin-top: 16px; }
.toolbox .calculators details { box-shadow: none; }
.scan-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 10px 0; }
.scan .confirm { font-size: 12px; margin: 16px 0; }
.ai-panel { border-color: rgba(156, 232, 245, .45); }
.ai-panel h3 { font-size: 15px; }
.ai-question { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 16px 0; }
.ai-question label { font-weight: 650; }
.ai-question textarea { min-height: 80px; padding: 10px; border: 1px solid var(--control-line); background: #0a1122; }
.ai-question .confirm { margin: 8px 0 0; }
.ai-evidence { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; white-space: pre-wrap; }
.ai-panel li { overflow-wrap: anywhere; }
.ai-answer { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ai-answer button { min-height: 44px; padding: 8px 12px; font-size: 12px; }
.intake-panel { border-color: rgba(156, 232, 245, .45); }
.intake-panel h3 { font-size: 15px; }
.intake-question { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 16px 0; }
.intake-question .confirm { margin: 10px 0 0; }
.intake-answer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.intake-answer span { min-width: 0; overflow-wrap: anywhere; }
.intake-answer button { flex: none; padding: 8px 12px; font-size: 12px; }
.intake-panel > button { margin-top: 18px; }
.example-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.example-grid button { text-align: left; font-size: 13px; overflow-wrap: anywhere; }
.question-guide p, .question-guide li { font-size: 13px; }
.question-guide details { padding: 14px; }
.intake-question input:disabled { opacity: .5; }
#document-inputs { margin: 20px 0; padding-top: 16px; border-top: 1px solid var(--line); }
#document-inputs > div { margin: 18px 0; }
#document-image-preview { display: block; width: 100%; max-height: 360px; object-fit: contain; margin-top: 12px; border-radius: 12px; background: #080c1b; }
#ai-refresh-status { font-size: 12px; margin-bottom: 10px; }
.table-scroll { overflow-x: auto; margin-top: 18px; }
.table-scroll table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.calculator-table table { min-width: 580px; table-layout: auto; }
#extended-calculators .confirm { grid-column: 1 / -1; }
#extended-calculators form > button { margin-top: 16px; }
#extended-calculators .result p { overflow-wrap: anywhere; }
.table-scroll caption { text-align: left; color: var(--muted); padding-bottom: 10px; }
.table-scroll th, .table-scroll td { border: 1px solid var(--line); padding: 10px; vertical-align: top; text-align: left; overflow-wrap: anywhere; }
.table-scroll th:first-child { width: 25%; }
.table-scroll td:last-child { color: var(--muted); }
#document-result p, #document-result li { overflow-wrap: anywhere; }
#document-common { border-top: 1px solid var(--line); margin-top: 18px; }
#document-common p, #document-warnings li { font-size: 13px; }
#document-open-calculator { width: 100%; }
@media(max-width:520px) {
  header { padding: 18px; min-height: 76px; }
  .brand { font-size: 20px; }
  .brand span { display: block; margin: 0; font-size: 11px; }
  main { margin-top: 24px; width: calc(100% - 28px); }
  .grid { grid-template-columns:1fr; }
  .scan-settings { grid-template-columns: 1fr; }
  .example-grid { grid-template-columns: 1fr; }
  .intake-answer { align-items: flex-start; flex-direction: column; }
  .scan, .panel, details { padding: 17px; }
  .actions button { width: 100%; }
  summary { font-size: 14px; }
  .footer-actions { align-items: flex-start; flex-direction: column; }
  body::before { background-position: 58% top; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* Keep safety and supporting copy readable rather than treating it as fine print. */
header { min-height: 76px; padding-top: 16px; padding-bottom: 16px; }
main { margin-top: 20px; }
.intro { margin-bottom: 24px; }
h1 { font-size: clamp(32px, 6vw, 46px); margin: 14px 0; }
.intro > p:not(.eyebrow) { margin: 12px 0; font-size: 17px; }
.eyebrow { font-size: 14px; letter-spacing: 0; padding: 0; border: 0; background: none; margin: 0; }
.muted, .disclosure, small, details > p, .question-guide p, .question-guide li,
.limits p, .panel li p, .result p, .ai-evidence, .ai-answer button,
.intake-answer, .intake-answer button, #document-common p, #document-warnings li { font-size: 15px; }
label, summary { font-size: 17px; }
summary { min-height: 48px; }
button { min-height: 50px; font-size: 17px; }
input:not([type=checkbox]), select { min-height: 50px; font-size: 17px; }
.confirm input { width: 24px; height: 24px; margin-top: 2px; }
.scan .confirm { font-size: 16px; line-height: 1.65; margin: 14px 0; min-height: 48px; }
.consent-box { padding: 14px; border-radius: 12px; background: #0b1427; border: 1px solid var(--control-line); }
#document-inputs { border: 0; padding-top: 0; margin: 12px 0; }
#ai-status { margin: 10px 0; }
#ai-refresh-status { font-size: 16px; margin-top: 12px; }
.safety-note { margin: 10px 0; }
.disclosure { margin: 14px 0; text-align: left; }
.table-scroll table { font-size: 16px; }
.example-grid button { font-size: 16px; min-height: 54px; }
.limits { margin: 18px 0; }
.footer-actions, footer { font-size: 14px; }
@media(max-width:520px) {
  header { min-height: 64px; padding: 12px 16px; }
  .brand span { font-size: 14px; }
  .badge { font-size: 13px; padding: 4px 10px; }
  main { margin-top: 12px; width: calc(100% - 28px); }
  .scan, .panel, details { padding: 16px; }
  .scan .scan-options { padding: 0; }
  .toolbox .calculators details { padding: 14px; }
  .input-choices { gap: 8px; }
  .scan textarea { font-size: 17px; }
  .intro .eyebrow { font-size: 14px; }
  h1 { letter-spacing: -1px; }
}
