/* Layout: one narrow column of question cards, the record control is the loudest thing on the page. */
:root {
  --bg: #f1f4f7;
  --surface: #ffffff;
  --ink: #14202b;
  --muted: #566676;
  --line: #d3dbe3;
  --accent: #0f5c7a;
  --accent-ink: #ffffff;
  --rec: #d8382b;
  --ok: #1d7a4d;
  --soft: #e7eef3;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e151b; --surface: #16212a; --ink: #e8eef3; --muted: #93a3b1; --line: #263541;
    --accent: #5bb8da; --accent-ink: #08212c; --rec: #ff6b5c; --ok: #5fcf98; --soft: #1d2b36;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e151b; --surface: #16212a; --ink: #e8eef3; --muted: #93a3b1; --line: #263541;
  --accent: #5bb8da; --accent-ink: #08212c; --rec: #ff6b5c; --ok: #5fcf98; --soft: #1d2b36;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  padding-block: 28px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
main { max-width: 640px; margin: 0 auto; display: grid; gap: 16px; }
h1, h2 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.7rem, 6vw, 2.3rem); line-height: 1.1; font-weight: 700; }
.intro { color: var(--muted); margin: 8px 0 0; max-width: 56ch; }
header { padding-bottom: 4px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: grid;
  gap: 12px;
  min-width: 0;
}
.card h2 { font-size: 1.1rem; font-weight: 600; line-height: 1.3; }
.req { color: var(--rec); margin-left: 4px; }
.err-text { color: var(--rec); font-size: .9rem; margin: 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"], textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}
textarea { min-height: 120px; resize: vertical; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input[type="text"]:focus-visible, textarea:focus-visible { outline-offset: 0; }

.choices { display: grid; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; cursor: pointer;
  background: var(--bg);
}
.choice input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--soft); }

.switch { display: inline-grid; grid-auto-flow: column; gap: 4px; background: var(--soft); padding: 4px; border-radius: 10px; justify-self: start; }
.switch button {
  font: inherit; font-weight: 600; font-size: .92rem; border: 0; background: transparent; color: var(--muted);
  padding: 7px 16px; border-radius: 7px; cursor: pointer; min-height: 38px;
}
.switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.18); }

.voice { display: grid; gap: 12px; justify-items: start; }
.voice p { margin: 0; color: var(--muted); font-size: .93rem; }
.recbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; width: 100%; }
.recbtn {
  width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--rec); color: #fff; cursor: pointer;
  display: grid; place-items: center; flex: none;
}
.recbtn .dot { width: 22px; height: 22px; border-radius: 50%; background: #fff; }
.recbtn .sq { width: 20px; height: 20px; border-radius: 4px; background: #fff; }
.recbtn.live { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rec) 55%, transparent); } 100% { box-shadow: 0 0 0 16px transparent; } }
@media (prefers-reduced-motion: reduce) { .recbtn.live { animation: none; } }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1.15rem; min-width: 5.5ch; }
.meter { flex: 1; min-width: 120px; height: 44px; max-width: 100%; }
audio { width: 100%; max-width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.btn {
  font: inherit; font-weight: 600; border-radius: 9px; padding: 11px 18px; min-height: 44px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.link { border: 0; background: transparent; color: var(--accent); padding-inline: 4px; text-decoration: underline; }
.btn[disabled] { opacity: .55; cursor: default; }
.file-label { display: inline-block; }
.file-label input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-label:focus-within span { outline: 3px solid var(--accent); outline-offset: 2px; }

.hp { position: absolute; inset-block-start: 0; inset-inline-start: 0; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }
.status { min-height: 1.4em; margin: 0; color: var(--muted); }
.banner { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; color: var(--muted); font-size: .92rem; }
.done { text-align: center; padding-block: 40px; }
.done .tick { width: 56px; height: 56px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; margin: 0 auto 14px; font-size: 1.6rem; }

/* admin */
.admin-wrap { max-width: 860px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.resp { display: grid; gap: 10px; }
.resp time { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.qa { display: grid; gap: 4px; }
.qa .q { font-size: .85rem; color: var(--muted); font-weight: 600; }
.qa .a { white-space: pre-wrap; overflow-wrap: anywhere; }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); margin-inline-start: 6px; }

/* ---------- v2: bilingual, multi-screen ---------- */
[hidden] { display: none !important; }
html[lang="ar"] { --font-display: "Cairo", "Segoe UI", Tahoma, sans-serif; --font-body: "Cairo", "Segoe UI", Tahoma, sans-serif; }
html[lang="ar"] h1 { line-height: 1.35; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.kicker { color: var(--muted); font-size: .9rem; font-weight: 600; }
.lang {
  font: inherit; font-weight: 600; font-size: .95rem; color: var(--accent); background: transparent;
  border: 1px solid var(--line); border-radius: 99px; padding: 6px 16px; min-height: 40px; cursor: pointer;
}
.progress { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s; }
.screen { display: grid; gap: 16px; }
.note { margin: 0; color: var(--muted); font-size: .93rem; max-width: 60ch; }
.nav { display: flex; gap: 10px; justify-content: space-between; }
.nav .btn.primary { flex: 1; max-width: 280px; }
.card h2 { text-wrap: pretty; }
html[lang="ar"] .choice, html[lang="ar"] textarea { text-align: start; }

.card.missing { border-color: var(--rec); box-shadow: 0 0 0 1px var(--rec); }
.status { color: var(--rec); font-weight: 600; }
.status:empty { display: none; }

.btn.danger { color: var(--rec); border-color: var(--rec); }
.btn.danger.solid { background: var(--rec); color: #fff; }
.resp h2 { font-size: 1.15rem; }
.resp .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.resp .actions .warn { color: var(--rec); font-weight: 600; flex-basis: 100%; margin: 0; }
