:root {
  color-scheme: light;
  --bg: #f6f7f9; --card: #fff; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0; --soft: #f1f5f9;
  --accent: #0a4f8c; --accent-hover: #083d6e; --accent-soft: #eef5fc; --accent-line: #bcd6ef;
  --ok: #047857; --ok-soft: #ecfdf5; --ok-line: #a7f3d0;
  --err: #b91c1c; --err-soft: #fef2f2; --err-line: #fecaca;
  --warn: #92400e; --warn-soft: #fffbeb; --warn-line: #fde68a;
  --radius: 14px;
}
* { box-sizing: border-box }
html { background: var(--bg) }
body {
  margin: 0; padding: 40px 16px 48px; color: var(--ink); background: var(--bg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body > * { max-width: 560px; margin-left: auto; margin-right: auto }

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 24px }
.brand h1 { font-size: 1.5rem; line-height: 1.2; margin: 0; letter-spacing: -.01em }
.brand p { margin: 0; color: var(--muted) }
.brand > div { flex: 1; min-width: 0 }
.logo { flex: none; border-radius: 11px; box-shadow: 0 1px 3px rgb(2 26 75 / .25) }
.gh {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  color: var(--ink); background: var(--card); border: 1px solid var(--line); transition: border-color .15s, color .15s;
}
.gh:hover { border-color: var(--accent); color: var(--accent) }
.gh:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.gh svg { width: 22px; height: 22px; fill: currentColor }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 24px;
  box-shadow: 0 1px 2px rgb(15 23 42 / .04), 0 8px 24px rgb(15 23 42 / .06);
}
@media (max-width: 480px) { .card { padding: 18px } body { padding-top: 24px } }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--soft); border-radius: 12px }
.tabs button {
  font: inherit; font-weight: 600; padding: 9px; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--muted);
}
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgb(15 23 42 / .12) }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }

.lead { color: var(--muted); margin: 20px 0 16px }

.drop {
  position: relative; display: flex; align-items: center; gap: 14px; margin-bottom: 12px; padding: 16px;
  border: 1.5px dashed #cbd5e1; border-radius: var(--radius); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft) }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px }
.drop input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer }
.drop-icon {
  flex: none; width: 44px; height: 44px; padding: 10px; border-radius: 12px; background: var(--soft);
  fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.drop-text { display: flex; flex-direction: column; min-width: 0 }
.drop-title { font-weight: 600 }
.drop-hint { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere }
.drop.filled { border-style: solid; border-color: var(--accent-line); background: var(--accent-soft) }
.drop.filled .drop-icon { background: var(--accent); stroke: #fff }
.drop.filled .drop-hint { color: var(--ink) }

.steps { list-style: none; margin: 0; padding: 0 }
.step { margin: 0 0 22px }
.step-title { display: flex; align-items: center; gap: 10px; font-size: 1rem; margin: 0 0 10px }
.num {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: .85rem; font-weight: 700;
}
fieldset { border: 0; margin: 0; padding: 0; min-width: 0 }
fieldset:disabled .drop, fieldset:disabled textarea { opacity: .45; cursor: not-allowed }
fieldset:disabled .drop input { cursor: not-allowed }
.locked-note { display: none }
fieldset:disabled .locked-note { display: block; float: none; padding: 0; margin: 0 0 8px; color: var(--muted); font-size: .9rem }
.switch { display: inline-grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 4px; padding: 4px; margin-bottom: 12px; background: var(--soft); border-radius: 10px }
.switch label { position: relative; white-space: nowrap; padding: 6px 22px; border-radius: 7px; font-weight: 600; color: var(--muted); text-align: center; cursor: pointer }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer }
.switch label:has(input:checked) { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgb(15 23 42 / .12) }
.switch label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px }
fieldset:disabled .switch { opacity: .45 }
textarea {
  display: block; width: 100%; resize: vertical; min-height: 96px; padding: 10px 12px; font: inherit; color: var(--ink);
  border: 1px solid #cbd5e1; border-radius: 10px; background: var(--card);
}
textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(10 79 140 / .18) }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
.message { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--card); border: 1px solid var(--ok-line); border-radius: 10px; padding: 10px 12px; margin: 10px 0 0 }
.field { margin: 0 }
.field > label { display: block; font-weight: 600; margin-bottom: 6px }
.pass { display: flex; border: 1px solid #cbd5e1; border-radius: 10px; overflow: hidden; background: var(--card) }
.pass:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(10 79 140 / .18) }
.pass input { flex: 1; min-width: 0; border: 0; padding: 11px 12px; font: inherit; color: var(--ink); background: transparent; outline: 0 }
.peek { border: 0; border-left: 1px solid var(--line); background: var(--soft); color: var(--muted); font: inherit; font-size: .9rem; padding: 0 14px; cursor: pointer }
.peek:hover { color: var(--ink) }
.hint { color: var(--muted); font-size: .88rem; margin: 6px 0 0 }

.callout {
  margin: 0 0 20px; padding: 14px 16px; border-radius: 12px;
  background: var(--warn-soft); border: 1px solid var(--warn-line); font-size: .92rem;
}
.callout summary { display: flex; gap: 12px; align-items: flex-start; list-style: none; cursor: pointer }
.callout summary::-webkit-details-marker { display: none }
.callout svg { flex: none; width: 22px; height: 22px; margin-top: 1px; fill: none; stroke: var(--warn); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round }
.callout p { margin: 4px 0 0 34px }
.callout strong { color: var(--warn) }
.callout:not([open]) summary::after { content: "Why?"; margin-left: auto; padding-left: 8px; color: var(--warn); font-weight: 600; white-space: nowrap }

.primary {
  width: 100%; margin-top: 4px; font: inherit; font-weight: 600; padding: 13px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: #fff; transition: background .15s;
}
.primary:hover { background: var(--accent-hover) }
.primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px }
.primary:disabled { background: #94a3b8; cursor: default }
.nav { display: flex; gap: 8px }
.nav .primary { flex: 1; margin-top: 0 }
.back {
  font: inherit; font-weight: 600; padding: 13px 20px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.back:hover { border-color: var(--accent); color: var(--accent) }
.back:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px }

.status:empty { display: none }
.status { margin: 0 0 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft) }
.status { overflow-wrap: anywhere }
.status p { margin: 0 }
.status p + p { margin-top: 6px }
.status .small { font-size: .9rem; color: var(--muted) }
.status.ok { background: var(--ok-soft); border-color: var(--ok-line) }
.status.ok strong { color: var(--ok) }
.status.err { background: var(--err-soft); border-color: var(--err-line) }
.status.err strong { color: var(--err) }
.status.warn { background: var(--warn-soft); border-color: var(--warn-line) }
.status.warn strong { color: var(--warn) }
.status.busy { display: flex; align-items: center; gap: 10px; color: var(--muted) }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite }
@keyframes spin { to { transform: rotate(360deg) } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s } }

.files { list-style: none; margin: 10px 0 0; padding: 0 }
.files li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--ok-line) }
.files .name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 500 }
.files .size { color: var(--muted); font-size: .9rem; white-space: nowrap }
.files button, .again {
  font: inherit; font-size: .9rem; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--ok-line); background: var(--card); color: var(--ok);
}
.files button:hover, .again:hover { border-color: var(--ok) }
.again { margin-top: 10px; max-width: 100%; text-align: left }

.privacy { display: flex; gap: 12px; align-items: flex-start; margin-top: 20px; padding: 0 4px; color: var(--muted); font-size: .9rem }
.privacy svg { flex: none; width: 22px; height: 22px; margin-top: 1px; fill: none; stroke: var(--ok); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }
.privacy p { margin: 0 }
.privacy strong { color: var(--ink) }

.credit { margin-top: 16px; padding: 0 4px; text-align: center; color: var(--muted); font-size: .85rem }
.credit a { color: var(--accent); text-decoration: none; font-weight: 500 }
.credit a:hover { text-decoration: underline }

[hidden] { display: none !important }

/* ---- phones: one screen, like an app ------------------------------------------------------------------ */
@media (max-width: 600px) {
  body { padding: 0 0 env(safe-area-inset-bottom); background: var(--card) }
  html { background: var(--card) }
  body > * { max-width: none }
  .brand {
    margin: 0; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; gap: 10px;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .logo { width: 34px; height: 34px; border-radius: 9px }
  .brand h1 { font-size: 1.2rem }
  .brand p { display: none }
  .gh { width: 36px; height: 36px; border-radius: 10px }
  .card { border: 0; border-radius: 0; box-shadow: none; padding: 12px 16px 16px }
  .tabs button { padding: 7px }
  .lead { display: none }
  #panel-hide, #panel-reveal { padding-top: 12px }
  .step { margin-bottom: 12px }
  .step-title { margin-bottom: 6px; font-size: .95rem }
  .num { width: 22px; height: 22px; font-size: .78rem }
  .drop { padding: 9px 12px; gap: 12px; margin-bottom: 0; border-radius: 12px }
  .drop-icon { width: 36px; height: 36px; padding: 8px; border-radius: 10px }
  .drop-title { font-size: .95rem }
  .drop-hint { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
  .drop-text { flex: 1 }
  .switch { margin-bottom: 8px }
  .switch label { padding: 4px 14px }
  textarea { min-height: 76px; height: 76px }
  .pass input { padding: 9px 12px }
  .hint { font-size: .8rem; margin-top: 4px }
  .field > label { margin-bottom: 4px }
  #panel-reveal .field { margin: 12px 0 }
  .callout { margin-bottom: 12px; padding: 10px 12px; font-size: .85rem }
  .callout svg { width: 18px; height: 18px }
  .callout p { margin-left: 30px }
  .status { margin-bottom: 12px; scroll-margin-bottom: 90px }
  .locked-note { font-size: .82rem }
  .nav { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 2 }
  .primary { margin: 0; box-shadow: 0 6px 20px rgb(10 79 140 / .28) }
  .privacy { margin-top: 8px; padding: 0 16px; font-size: .8rem }
  .privacy svg { width: 18px; height: 18px }
  .credit { margin: 10px 0 16px; padding: 0 16px; font-size: .78rem }
}
/* photo mark: a one-line text box styled like the textarea, its counter and the one-time model download */
input.line {
  display: block; width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  border: 1px solid #cbd5e1; border-radius: 10px; background: var(--card);
}
input.line:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(10 79 140 / .18) }
fieldset:disabled input.line { opacity: .45; cursor: not-allowed }
.count-bad { color: var(--err) }
.mark-load { margin: 8px 0 12px }
.mark-load progress { display: block; width: 100%; height: 8px; margin-bottom: 4px; accent-color: var(--accent) }
.mark-load .hint { margin: 0 }
.check { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 0; font-size: .92rem; cursor: pointer }
.check .hint { margin: 0 }
.status.busy { flex-wrap: wrap }
.status.busy > progress, .status.busy > .small { flex-basis: 100%; margin: 0 }
.status progress { height: 8px; accent-color: var(--accent) }
