@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/inter-latin.woff2) format('woff2');
}

:root {
  --surface: #f3f1ec;
  --card: #fff;
  --ink: #111c2b;
  --text: #1d2734;
  --muted: #5c636c;
  --line: #d6d2c9;
  --control: #5b6168;
  --navy: #0f1f2e;
  --green: #2bb673;
  --focus: #2563eb;
  --error: #b42318;
  --col: 480px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--surface); }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

/* ---------- App bar ---------- */
.app-bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--navy); color: #fff;
  padding-top: env(safe-area-inset-top);
}
.bar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: var(--col); margin: 0 auto; padding: 18px 20px 17px;
}
.app-name { font-size: 13px; line-height: 1.3; color: #b9c3ce; }
.app-title { margin-top: 5px; font-size: 17px; line-height: 1.3; font-weight: 500; letter-spacing: -0.005em; }
.badge {
  flex: none; padding: 5px 11px; border-radius: 999px;
  background: var(--green); color: #0a2616;
  font-size: 12.5px; font-weight: 700; line-height: 1.2;
}

/* ---------- Body ---------- */
.app-body {
  flex: 1; width: 100%; max-width: var(--col); margin: 0 auto;
  padding: 22px 20px calc(32px + env(safe-area-inset-bottom));
}
h1 {
  margin: 0 0 22px; color: var(--ink);
  font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em;
}

.field { margin: 0 0 26px; padding: 0; border: 0; min-width: 0; }
.label { display: block; margin: 0 0 10px; color: var(--ink); font-size: 15px; font-weight: 600; }
.label.small { font-size: 14px; }
.section {
  display: block; margin: 0 0 14px; padding: 0; color: var(--ink);
  font-size: 16px; font-weight: 600;
}
.help { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

input[type="text"] {
  display: block; width: 100%; height: 48px; padding: 0 14px;
  border: 1px solid #cdc8bf; border-radius: 12px; background: var(--card);
  color: var(--ink); font: inherit; font-size: 16px;
}
input[type="text"]::placeholder { color: #868b93; opacity: 1; }

/* ---------- Option cards ---------- */
.option {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 16px; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  color: var(--text); font-size: 15px; line-height: 1.4;
  cursor: pointer; user-select: none;
  transition: border-color .12s, box-shadow .12s;
}
.option:last-of-type { margin-bottom: 0; }
.option:has(input:checked) { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }

.option input {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 22px; height: 22px; margin: 0;
  border: 1.5px solid var(--control); background: #fff center / 14px no-repeat;
  cursor: pointer;
}
.option input[type="checkbox"] { border-radius: 3px; }
.option input[type="radio"] { border-radius: 50%; }
.option input[type="checkbox"]:checked {
  border-color: var(--navy); background-color: var(--navy);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.option input[type="radio"]:checked { border-color: var(--navy); box-shadow: inset 0 0 0 5px #fff; background: var(--navy); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair .option { margin: 0; min-height: 70px; padding: 12px 14px; }

/* ---------- File ---------- */
input[type="file"] {
  display: block; width: 100%; padding: 9px 10px;
  border: 1px solid #cdc8bf; border-radius: 12px; background: var(--card);
  color: var(--text); font: inherit; font-size: 15px;
}
input[type="file"]::file-selector-button {
  margin-right: 10px; padding: 5px 12px;
  border: 1px solid #b9b4aa; border-radius: 7px; background: #f4f2ee;
  color: var(--ink); font: inherit; font-size: 14px; cursor: pointer;
}

/* ---------- Focus, errors ---------- */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input[type="text"]:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.option input:focus-visible { outline: none; }
.option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

.error { margin: 8px 0 0; color: var(--error); font-size: 13.5px; font-weight: 500; }
.invalid input[type="text"], .invalid input[type="file"], .invalid .option { border-color: var(--error); }

/* ---------- Buttons, status ---------- */
.primary {
  display: block; width: 100%; height: 52px; border: 0; border-radius: 14px;
  background: var(--navy); color: #fff;
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
}
.primary:hover { background: #1b3146; }
.primary:disabled { opacity: .65; cursor: progress; }
.status { min-height: 1.4em; margin: 12px 0 0; color: var(--muted); font-size: 14px; text-align: center; }
.status.bad { color: var(--error); }

/* ---------- Saved ---------- */
#done:focus { outline: none; }
.card {
  margin: 0 0 20px; padding: 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); font-size: 15px; line-height: 1.5;
}
.card p { margin: 0 0 8px; }
.card .help { margin: 0; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; word-break: break-all; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
