:root {
  --bg: #f6f1ea;
  --card: #fffdf9;
  --ink: #2a2520;
  --muted: #7a6f64;
  --line: #e4dacd;
  --accent: #8a5a3b;
  --accent-ink: #fffaf4;
  --chip: #efe6da;
  --chip-on: #8a5a3b;
  --help: #f1ebe1;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1916; --card: #26221e; --ink: #f1ebe3; --muted: #a99d90; --line: #3a342d;
    --accent: #d09a72; --accent-ink: #1c1916; --chip: #322c26; --chip-on: #d09a72; --help: #2e2924;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1916; --card: #26221e; --ink: #f1ebe3; --muted: #a99d90; --line: #3a342d;
  --accent: #d09a72; --accent-ink: #1c1916; --chip: #322c26; --chip-on: #d09a72; --help: #2e2924;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, "SF Arabic", "Geeza Pro", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  font-size: 17px; line-height: 1.7; -webkit-text-size-adjust: 100%;
}
.bar {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); font-size: 14px; min-height: 42px;
}
main { max-width: 720px; margin: 0 auto; padding: 20px 16px 120px; }
h1 { font-size: 28px; line-height: 1.35; margin: 18px 0 6px; }
h2 { font-size: 22px; margin: 8px 0 14px; }
.muted { color: var(--muted); }
.lead { font-size: 18px; color: var(--muted); margin: 0 0 18px; }
.intro p { margin: 0 0 10px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 0 0 14px;
}
.q-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.q-title h3 { font-size: 18px; margin: 0; line-height: 1.5; }
.q-num { color: var(--muted); font-variant-numeric: tabular-nums; margin-inline-end: 6px; }
.note { color: var(--muted); font-size: 15px; margin: 0 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.chip {
  font: inherit; font-size: 15px; border: 1px solid var(--line); background: var(--chip); color: var(--ink);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; min-height: 40px;
}
.chip[aria-pressed="true"] { background: var(--chip-on); color: var(--accent-ink); border-color: var(--chip-on); }
.field { display: block; margin: 0 0 10px; }
.field span { display: block; font-size: 15px; color: var(--muted); margin-bottom: 4px; }
input[type="text"], input[type="password"], textarea {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink);
}
textarea { min-height: 64px; resize: vertical; }
.group-label { font-size: 15px; color: var(--muted); margin: 6px 0 6px; }
.btn {
  font: inherit; border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer; min-height: 48px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; font-weight: 500; }
.nav { position: fixed; bottom: 0; inset-inline: 0; display: flex; gap: 10px; justify-content: space-between;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.nav .btn { flex: 1; max-width: 340px; }
.who { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-top: 16px; }
.who .btn { min-height: 96px; font-size: 20px; }
.help { background: var(--help); border-radius: 10px; padding: 12px; margin-top: 8px; font-size: 15px; white-space: pre-line; }
.error { color: #b3261e; }
.row-card { border: 1px dashed var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.row-card .fixed { font-weight: 600; margin-bottom: 6px; }
.summary { white-space: pre-line; }
@media (max-width: 420px) { .who { grid-template-columns: 1fr; } h1 { font-size: 24px; } }
.chip.num { min-width: 46px; text-align: center; padding: 7px 0; }
.chip.full { outline: 2px solid var(--accent); }
.scale-row { display: flex; gap: 8px; }
.scale-ends { display: flex; justify-content: space-between; font-size: 14px; margin: 4px 0 8px; }
.rate-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rate-item { font-size: 15px; }
.rate-btns { display: flex; gap: 6px; }
.saved-note { background: var(--help); padding: 10px 12px; border-radius: 10px; }
