/* Mobile-first styles tuned for Safari on iPhone. No external fonts or assets. */
:root {
  --bg: #f5f5f2; --fg: #1d1d1b; --muted: #6b6b66; --card: #fff; --line: #deddd6;
  --accent: #1f5f8b; --ok: #2e7d4f; --warn: #a15c00; --danger: #b3261e;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151514; --fg: #ecebe6; --muted: #a3a29b; --card: #1f1f1d; --line: #34332f; --accent: #6fb0e0; --ok: #6cc28d; --warn: #e3a14a; --danger: #f08a82; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
main { max-width: 760px; margin: 0 auto; padding: 12px max(12px, env(safe-area-inset-left)) 24px max(12px, env(safe-area-inset-right)); }
h1 { font-size: 1.5rem; margin: .4em 0; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; margin: 0 0 .5em; }
h3 { font-size: 1rem; margin: .8em 0 .3em; }
a { color: var(--accent); }
.top {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--fg); }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { flex: 1; text-align: center; padding: 14px 4px; min-height: 52px; text-decoration: none; color: var(--muted); font-weight: 600; }
.tabs a.active { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 12px 0; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card.warn, .warn { border-color: var(--warn); }
.card.danger { border-color: var(--danger); }
.muted { color: var(--muted); font-size: .92rem; }
.error { color: var(--danger); font-weight: 600; }
label { display: block; margin: 10px 0; font-weight: 600; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 400; min-height: 44px; margin: 2px 0; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=date], input[type=search],
input[type=password], input[type=file], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px; min-height: 44px;
  font-size: 16px; /* 16px prevents iOS Safari from zooming on focus */
  font-family: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  -webkit-appearance: none; appearance: none;
}
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
textarea { resize: vertical; }
button, .button {
  display: inline-block; min-height: 44px; padding: 10px 16px; margin: 4px 4px 4px 0; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; touch-action: manipulation;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { border-color: var(--danger); color: var(--danger); }
button.link { border: 0; background: none; color: var(--accent); padding: 8px; min-height: 0; }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-start; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line); padding: 10px 0; overflow-wrap: anywhere; }
.list > li:last-child { border-bottom: 0; }
.list > li.card { padding: 14px; border: 1px solid var(--line); }
.row { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; min-height: 44px; }
.badge { display: inline-block; padding: 2px 8px; margin: 2px 2px 2px 0; border-radius: 999px; font-size: .8rem; background: var(--accent); color: #fff; white-space: nowrap; }
.badge.soft { background: var(--line); color: var(--fg); }
.badge.ok { background: var(--ok); }
.badge.warn { background: var(--warn); }
dl { display: grid; grid-template-columns: minmax(96px, 34%) 1fr; gap: 6px 12px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--line); }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; padding: 8px 12px; }
fieldset.flagged { border: 2px solid var(--warn); }
legend { font-weight: 700; padding: 0 4px; }
fieldset .value { font-size: 1.05rem; overflow-wrap: anywhere; }
figure { margin: 12px 0; }
figure img { display: block; max-width: 100%; height: auto; border-radius: 8px; }
pre, code { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; }
pre.final { font: inherit; white-space: pre-wrap; }
table.conflicts { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .92rem; }
table.conflicts th, table.conflicts td { border: 1px solid var(--line); padding: 6px; text-align: left; overflow-wrap: anywhere; }
ol.steps { display: flex; flex-wrap: wrap; gap: 4px; padding: 0; list-style: none; font-size: .8rem; }
ol.steps li { padding: 3px 8px; border-radius: 999px; background: var(--line); }
ol.steps li.current { background: var(--accent); color: #fff; }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
