:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1d2733;
  --muted: #5c6b7a;
  --line: #d9e0e6;
  --accent: #256d85;
  --accent-ink: #ffffff;
  --accent-soft: #e4f1f5;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --ok: #2e7d4f;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--line); }
.top-in { max-width: 760px; margin: 0 auto; padding: 10px 16px 8px; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; min-height: 40px; }
.crumb { color: var(--muted); }
.save { color: var(--muted); white-space: nowrap; }
.save[data-state="ok"] { color: var(--ok); }
.save[data-state="err"] { color: var(--danger); font-weight: 600; }
.progress { height: 4px; background: var(--line); }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }

main { max-width: 760px; margin: 0 auto; padding: 20px 16px 64px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 22px; }
h1 { font-size: 26px; line-height: 1.25; margin: 0 0 12px; }
h2 { font-size: 22px; line-height: 1.3; margin: 0 0 14px; }
.part { margin: 0 0 4px; font-size: 13px; letter-spacing: .02em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.lead { color: var(--muted); margin: 0 0 20px; }
details.lead { margin-bottom: 20px; }
details.lead summary { cursor: pointer; color: var(--accent); }
.sub { font-size: 16px; margin: 28px 0 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.k[hidden] { display: none; }
.k:first-child .sub { border-top: 0; margin-top: 0; padding-top: 0; }

.field { margin: 0 0 22px; padding: 0; border: 0; min-width: 0; border-radius: 8px; }
.field.invalid { outline: 2px solid var(--danger); outline-offset: 8px; background: var(--danger-soft); }
.q { display: block; font-weight: 600; margin: 0 0 8px; padding: 0; }
legend.q:has(.num) { display: flex; gap: 6px; float: left; width: 100%; }
legend.q:has(.num) + * { clear: both; }
.q .num { flex: none; min-width: 1.9em; color: var(--accent); }
.opt-tag { font-weight: 400; color: var(--muted); font-size: 14px; }
.hint { margin: -2px 0 8px; color: var(--muted); font-size: 14px; }
.err { display: none; margin: 8px 0 0; color: var(--danger); font-size: 14px; font-weight: 600; }
.invalid .err { display: block; }

input[type=text], input[type=number], input[type=date], input[type=email], textarea {
  display: block; width: 100%; min-height: 46px; margin-top: 6px; padding: 10px 12px; font: inherit; color: inherit; background: #fff;
  border: 1px solid #b7c2cc; border-radius: 8px;
}
textarea { resize: vertical; min-height: 72px; overflow: hidden; }
.with-suffix input { margin-top: 0; }
.card, .field, .k, .opts, .story { min-width: 0; }
.card { overflow-wrap: anywhere; }
input[type=date] { -webkit-appearance: none; appearance: none; }
input:focus-visible, textarea:focus-visible, .btn:focus-visible, .link:focus-visible { outline: 3px solid #7fb8cb; outline-offset: 1px; }
.with-suffix { display: flex; align-items: center; gap: 8px; max-width: 220px; }
.suffix { color: var(--muted); white-space: nowrap; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row .with-suffix { max-width: 170px; }

.opts { display: flex; flex-direction: column; gap: 6px; }
.opts.pills { flex-direction: row; flex-wrap: wrap; }
.opt { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; }
.opts.pills .opt { flex: 1 1 130px; justify-content: center; text-align: center; padding: 9px 8px; font-size: 15px; }
.opt:hover { border-color: var(--accent); }
.opt input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; margin: 0; }
.opts.pills .opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.opt:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.opts.pills .opt:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt:has(input:focus-visible) { outline: 3px solid #7fb8cb; outline-offset: 1px; }

.meds-head, .med { display: grid; grid-template-columns: 2fr 1fr 1fr 1.3fr; gap: 8px; }
.meds-head { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.meds { display: flex; flex-direction: column; gap: 8px; }
.med input { min-width: 0; }
@media (max-width: 560px) {
  .meds-head { display: none; }
  .med { grid-template-columns: 1fr 1fr; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
  .med input:first-child { grid-column: 1 / -1; }
}

.story { margin: 0 0 24px; padding: 14px 16px; background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; font-size: 17px; line-height: 1.65; }

.banner { margin: 8px 0 0; padding: 10px 14px; background: var(--danger-soft); color: var(--danger); border-radius: 8px; font-weight: 600; }
.banner[hidden] { display: none; }
.nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.nav .btn:only-child { margin-left: auto; }
.btn { font: inherit; font-weight: 600; padding: 11px 24px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); }
.link { background: none; border: 0; padding: 6px 0; color: var(--accent); font: inherit; cursor: pointer; }
.intro p { margin: 0 0 12px; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  main { padding: 10px 10px 32px; }
  .top-in { padding: 8px 12px 6px; }
  .card { padding: 18px 14px 0; }
  .intro.card { padding-bottom: 18px; }
  h1 { font-size: 22px; }
  h2 { font-size: 20px; }
  .field { margin-bottom: 26px; }

  /* Dokunması kolay seçenekler */
  .opt { min-height: 48px; padding: 10px 12px; }
  .opts.pills { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .opts.pills .opt { flex: none; min-height: 48px; font-size: 15px; }
  .opts.pills .opt:last-child:nth-child(odd) { grid-column: 1 / -1; }

  .with-suffix, .row .with-suffix { max-width: none; flex: 1 1 100%; }
  .row { gap: 8px; }

  /* Alt sabit gezinme çubuğu */
  .nav { gap: 10px; flex-wrap: nowrap; }
  .nav .btn { flex: 1 1 0; min-height: 48px; padding: 12px 10px; }
  .nav.stick {
    position: sticky; bottom: 0; z-index: 4;
    margin: 20px -14px 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    background: var(--card); border-top: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
  }
  .intro .nav { margin-top: 18px; }
}
