/* The friends' test: a radio studio's cue cards (DESIGN.md). Paper-grey, dark ink, one red lamp that is lit only while
   sound is recording or playing. Nothing else on the page is red. */
:root {
  --paper: #E7EAE8; --card: #F6F7F6; --ink: #1D2626; --muted: #5E6B69; --line: #C9D0CE; --lamp: #C8382E;
  --wash: #EDF0EE;
  --r-card: 18px; --r-btn: 14px; --gut: 16px; --measure: 42rem;
  --kufi: "Noto Kufi Arabic", "Noto Sans Arabic", system-ui, sans-serif;
  --sans: "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161C1C; --card: #212929; --ink: #E4E9E8; --muted: #97A3A1; --line: #344040; --lamp: #E0533F;
    --wash: #1B2222; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161C1C; --card: #212929; --ink: #E4E9E8; --muted: #97A3A1; --line: #344040; --lamp: #E0533F;
  --wash: #1B2222; color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
@media (min-width: 1200px) { html { font-size: 18px; } }
@media (min-width: 1700px) { html { font-size: 20px; } }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--sans); line-height: 1.85; -webkit-tap-highlight-color: transparent; min-height: 100vh; min-height: 100dvh; }
bdi { unicode-bidi: isolate; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.shell { max-width: var(--measure); margin: 0 auto; padding: 8px var(--gut) calc(128px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.brand { font: 700 .95rem/1.6 var(--kufi); }
.linkbtn { background: none; border: 0; color: var(--muted); font: 600 .95rem/1.6 var(--kufi); padding: 10px 4px; min-height: 48px; }
.linkbtn:hover { color: var(--ink); }

/* progress: one bar per section, as wide as the section is long; the current one is thicker */
.strip { display: flex; gap: 5px; margin: 2px 0 20px; align-items: center; }
.seg { flex: var(--w, 1) 1 0; height: 4px; border-radius: 3px; background: var(--line); overflow: hidden; }
.seg.now { height: 7px; border-radius: 4px; }
.seg i { display: block; height: 100%; width: var(--p, 0%); background: var(--ink); transition: width .45s ease; }

.meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 2px 10px; color: var(--muted); font-size: .92rem; }
.meta b { font: 600 .95rem/1.6 var(--kufi); color: var(--ink); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 24px 20px; }
@media (min-width: 700px) { .card { padding: 32px 36px; } }
.chip-ctx { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; font-size: .88rem; color: var(--muted); margin: 0 0 8px; }
.title { font: 700 1.8rem/1.6 var(--kufi); margin: 0 0 12px; }
.q { font: 500 1.35rem/1.9 var(--kufi); margin: 0 0 8px; }
.sub { font: 600 1.1rem/1.9 var(--kufi); margin: 22px 0 6px; }
.help, .muted { color: var(--muted); font-size: .95rem; margin: 0 0 16px; }
.lead { font-size: 1.1rem; margin: 0 0 16px; }
.pts { margin: 0 0 18px; padding: 0; list-style: none; display: grid; gap: 10px; }
.pts li { position: relative; padding-inline-start: 22px; }
.pts li::before { content: ""; position: absolute; inset-inline-start: 2px; top: .8em; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

/* buttons */
.btn { min-height: 52px; border-radius: 999px; padding: 10px 22px; font: 700 1.1rem/1.5 var(--kufi); border: 1.5px solid var(--ink); background: transparent; color: var(--ink); }
.btn.solid { background: var(--ink); color: var(--card); }
.btn.text { border-color: transparent; color: var(--muted); font-weight: 600; padding-inline: 12px; }
.btn.text:hover { color: var(--ink); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.wide { width: 100%; }
.btn.small { min-height: 44px; font-size: .98rem; padding: 6px 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.row .btn { flex: 1 1 auto; }

.nav { position: fixed; inset: auto 0 0 0; background: var(--paper); border-top: 1px solid var(--line);
  padding: 12px var(--gut) calc(12px + env(safe-area-inset-bottom)); z-index: 5; }
.nav .in { max-width: var(--measure); margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.nav .btn.ghost, .nav .btn.solid { flex: 1; }
.nav .btn.text { flex: 0 0 auto; }

/* choices */
.opts { display: grid; gap: 10px; margin: 14px 0 0; }
.opts.chips { display: flex; flex-wrap: wrap; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; text-align: start; padding: 10px 16px;
  border: 1.5px solid var(--line); border-radius: var(--r-btn); background: transparent; font: 400 1.05rem/1.7 var(--sans); }
.opts.chips .opt { width: auto; border-radius: 999px; min-height: 48px; padding: 6px 18px; }
.opt .mark { flex: none; width: 22px; height: 22px; border: 1.5px solid var(--muted); border-radius: 50%; display: grid; place-items: center; }
.opt[role="checkbox"] .mark { border-radius: 6px; }
.opts.chips .opt .mark { display: none; }
.opt:hover { border-color: var(--ink); }
.opt[aria-checked="true"] { background: var(--ink); color: var(--card); border-color: var(--ink); }
.opt[aria-checked="true"] .mark { border-color: var(--card); background: var(--card); }
.opt[aria-checked="true"] .mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.opt[role="checkbox"][aria-checked="true"] .mark::after { width: 10px; height: 6px; border-radius: 0; background: none;
  border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg) translate(1px, -1px); }
.qwrap { margin-top: 24px; }
.qwrap:first-child { margin-top: 0; }
.qwrap > .sub:first-child { margin-top: 0; }

.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 12px 0 0; }
.scale .opt { justify-content: center; padding: 0; min-height: 56px; border-radius: 16px; font: 700 1.2rem/1 var(--kufi); }
.ends { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .88rem; line-height: 1.6; margin-top: 8px; }
.ends span:nth-child(2) { text-align: center; }

textarea, input[type="text"] { width: 100%; margin-top: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: transparent; font: 400 1.05rem/1.9 var(--sans); }
textarea { min-height: 7.5rem; resize: vertical; }
textarea:focus, input[type="text"]:focus { border-color: var(--ink); outline: none; }
::placeholder { color: var(--muted); opacity: .8; }
label.check { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0; font-size: 1rem; }
label.check input { width: 24px; height: 24px; margin-top: 6px; accent-color: var(--ink); flex: none; }

/* the lamp: red only while sound is recording or playing */
.lamp { width: 16px; height: 16px; border-radius: 50%; background: var(--line); flex: none; transition: background .2s, box-shadow .2s; }
.on .lamp { background: var(--lamp); box-shadow: 0 0 0 7px color-mix(in srgb, var(--lamp) 22%, transparent); }
.play, .rec { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; min-height: 76px; border-radius: var(--r-btn);
  border: 1.5px solid var(--line); background: transparent; font: 700 1.2rem/1.5 var(--kufi); }
.play:hover, .rec:hover { border-color: var(--ink); }
.play .t, .rec .t { font: 600 .95rem/1 var(--sans); color: var(--muted); }
.clipbox { margin: 14px 0 0; }
.clipbox .lbl { font: 600 1rem/1.6 var(--kufi); margin: 0 0 6px; }
.bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); }
.clips { display: grid; gap: 14px; }
@media (min-width: 700px) { .clips.two { grid-template-columns: 1fr 1fr; } }
.meter { display: flex; gap: 4px; align-items: center; height: 28px; justify-content: center; margin-top: 12px; }
.meter i { width: 6px; height: 4px; border-radius: 3px; background: var(--line); transition: height .08s linear, background .08s; }
.meter.live i { background: var(--ink); }
.done-tag { display: inline-flex; gap: 8px; align-items: center; font: 600 .98rem/1.6 var(--kufi); }
.done-tag::before { content: ""; width: 12px; height: 7px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg) translateY(-2px); }
.cut { background: var(--wash); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 14px 0 0; font-size: 1rem; }
.cut b { font-family: var(--kufi); }
.note { margin-top: 12px; color: var(--muted); font-size: .95rem; }

/* the list of sections */
.map { display: grid; gap: 10px; margin: 18px 0 0; padding: 0; list-style: none; }
.sec { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center; width: 100%; text-align: start; padding: 14px 16px;
  border: 1.5px solid var(--line); border-radius: var(--r-btn); background: transparent; min-height: 76px; }
.sec:hover { border-color: var(--ink); }
.sec b { font: 700 1.1rem/1.6 var(--kufi); }
.sec .d { color: var(--muted); font-size: .92rem; line-height: 1.6; grid-column: 1; }
.sec .n { grid-row: 1 / span 2; grid-column: 2; display: flex; flex-direction: column; align-items: center; gap: 6px; font: 600 .95rem/1 var(--sans); color: var(--muted); min-width: 56px; }
.sec .n .bar { width: 56px; margin: 0; }
.sec.next { border-color: var(--ink); background: var(--wash); }
.sec .tick { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; }
.sec .tick::after { content: ""; width: 12px; height: 6px; border-left: 2px solid var(--card); border-bottom: 2px solid var(--card); transform: rotate(-45deg) translateY(-1px); }
.sec.fresh .tick { animation: stamp .35s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes stamp { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.big { font: 700 2.6rem/1.2 var(--kufi); margin: 4px 0; }
.code { direction: ltr; text-align: center; font: 600 1.3rem/1.8 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .06em; padding: 14px; border: 1.5px dashed var(--muted);
  border-radius: 12px; margin: 12px 0; word-spacing: .4em; user-select: all; }

.swap { animation: slide .18s ease-out both; }
@keyframes slide { from { opacity: .4; transform: translateX(calc(var(--dir, 1) * 10px)); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .swap, .sec.fresh .tick { animation: none; }
  .seg i, .lamp, .meter i { transition: none; }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.play .t, .rec .t { direction: ltr; unicode-bidi: isolate; }
#qs { margin-top: 24px; }
#qs:empty { margin: 0; }
.code { font-size: 1.15rem; }

/* ---- test v2: the map's time line, the "we finished this part" page, scenarios, the sound check, the replay ---- */
.total { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin: 14px 0 0; font: 600 1rem/1.8 var(--kufi); }
.total .dim { font: 400 .95rem/1.8 var(--sans); color: var(--muted); }
.morecard { margin: 22px 0 0; padding: 18px 16px; border: 1.5px dashed var(--muted); border-radius: var(--r-btn); }
.morecard .muted { margin: 0 0 4px; }

.donecard { text-align: center; padding-block: 36px; }
.donecard .row { justify-content: center; }
.donecard .row .btn.wide { flex: 1 1 100%; }
.bigtick { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--ink); margin: 0 auto 10px; }
.bigtick::after { content: ""; width: 26px; height: 13px; border-left: 4px solid var(--card); border-bottom: 4px solid var(--card); transform: rotate(-45deg) translateY(-3px); }
.bigtick.stamp { animation: stamp .45s cubic-bezier(.2, .9, .3, 1.3) both; }
.donecard .lead, .donecard .muted { text-align: center; }

.scenario { background: var(--wash); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 12px 0 4px; }
.scenario p { margin: 0; font: 500 1.15rem/1.95 var(--kufi); }
.vopts { display: grid; gap: 12px; margin: 14px 0 0; }
.vopt { border: 1.5px solid var(--line); border-radius: var(--r-btn); padding: 12px 14px 14px; margin: 0; }
.vopt .lbl { display: block; margin: 0 0 2px; }
.vopt .vtxt { margin: 0 0 10px; font-size: 1.05rem; line-height: 1.9; }
.vopt .play { min-height: 64px; }
.tag { display: inline-block; color: var(--muted); font-size: .92rem; border: 1px dashed var(--line); border-radius: 999px; padding: 2px 14px; }

.probe { display: grid; gap: 4px; justify-items: start; }
.probe .btn { min-width: 60%; }
.rp .note { margin-top: 4px; }
.clipbox .lbl { margin-bottom: 6px; }

.sec .d { overflow-wrap: anywhere; }
@media (max-width: 420px) { .title { font-size: 1.5rem; } .scale { gap: 6px; } .donecard { padding-inline: 14px; } }
@media (prefers-reduced-motion: reduce) { .bigtick.stamp { animation: none; } }
.nav .btn { white-space: nowrap; }
@media (max-width: 420px) { .nav .btn { padding-inline: 12px; font-size: 1rem; } .nav .btn.ghost, .nav .btn.solid { flex: 1 1 0; } .nav .in { gap: 6px; } }
