/* Phone-first participant flow (voice-app-brt).
 *
 * A participant holds a phone, reads a Burmese question aloud, and taps one
 * control. Everything here serves that: Burmese at reading size, one task per
 * screen, and the record control where a thumb already rests. English stays as
 * a small second line for whoever is helping.
 *
 * Loaded after Bootstrap; the flow screens deliberately opt out of Bootstrap's
 * card/button look rather than fighting it. */

:root {
    --ink: #15211e;
    --ink-soft: #55635e;
    --paper: #f5f7f4;
    --surface: #ffffff;
    --jade: #0f5d4a;
    --jade-deep: #0a4133;
    --cinnabar: #c8341f;
    --thanaka: #e8c86a;
    --mist: #dce3dd;

    --burmese: "Noto Sans Myanmar", "Padauk", "Myanmar Text", "Myanmar Sangam MN", system-ui, sans-serif;
    --latin: system-ui, -apple-system, "Segoe UI", sans-serif;

    /* Nothing a thumb must hit is ever smaller than this. */
    --tap: 3.5rem;
    --gutter: 1.25rem;
}

/* ── Flow shell ─────────────────────────────────────────────────────
   The participant flow owns the whole viewport: no site navbar, no
   footer, nothing to wander off into. */
body.flow {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--latin);
}

body.flow .site-chrome { display: none; }

body.flow main[role="main"],
body.flow .flow-main {
    padding: 0;
}

.screen {
    display: flex;
    flex-direction: column;
    gap: var(--gutter);
    min-height: 100svh;
    max-width: 34rem;
    margin: 0 auto;
    padding: max(1rem, env(safe-area-inset-top)) var(--gutter)
             calc(1rem + env(safe-area-inset-bottom));
}

/* The strip below is sticky, so it floats over the end of this body. Leave it
   room, or the last controls sit underneath it and a tap hits the strip.
   sticky-foot.js measures the strip and sets the value. */
.screen__body {
    flex: 1 1 auto;
    padding-bottom: var(--foot-clearance, 0px);
}

/* The action zone sits at the bottom, in thumb reach, and stays put. */
.screen__foot {
    position: sticky;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.75rem;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--paper) 72%, transparent);

    /* Only the controls take taps. The strip's top edge fades to transparent,
       and a see-through pixel must not swallow a tap meant for what's behind it. */
    pointer-events: none;
}

.screen__foot > * { pointer-events: auto; }

/* ── Type ───────────────────────────────────────────────────────────
   Burmese leads at reading size. The script stacks marks above and
   below the line, so it needs far more line-height than Latin. */
.my {
    font-family: var(--burmese);
    line-height: 1.9;
}

.en {
    font-family: var(--latin);
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--ink-soft);
}

.question {
    font-family: var(--burmese);
    font-size: clamp(1.5rem, 5.5vw, 2rem);
    line-height: 1.95;
    font-weight: 600;
    margin: 0.5rem 0 0;
    color: var(--ink);
}

.instruction { margin: 0; }
.instruction .my { font-size: 1.0625rem; color: var(--ink-soft); }

/* ── Progress ───────────────────────────────────────────────────────
   A rail of one dot per question: how far in, and how much is left,
   in a single glance. */
.progress-rail {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    margin: 0 0 0.5rem;
}

.progress-rail__dot {
    flex: 1 1 auto;
    height: 0.25rem;
    border-radius: 999px;
    background: var(--mist);
}

.progress-rail__dot.is-done { background: var(--jade); }
.progress-rail__dot.is-current { background: var(--thanaka); }

.progress-label { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.progress-label .my { font-size: 1rem; font-weight: 600; }
.progress-label .identity {
    font-family: var(--latin);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--ink-soft);
}

/* ── Choices (category / topic / question lists) ────────────────────── */
.choice-list { display: flex; flex-direction: column; gap: 0.625rem; }

.choice {
    display: block;
    width: 100%;
    min-height: var(--tap);
    padding: 0.875rem 1rem;
    border: 1px solid var(--mist);
    border-left: 4px solid var(--jade);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--ink);
    text-align: left;
    font: inherit;
}

.choice:active { background: #eef3ef; }
.choice .my { font-size: 1.125rem; display: block; }
.choice .en { display: block; }

/* Categories and topics only exist in English in the topic data, so there is
   no Burmese line to lead with — that row reads at full size instead. */
.choice__label {
    display: block;
    font-family: var(--latin);
    font-size: 1.0625rem;
    line-height: 1.4;
}

/* ── The record stone ───────────────────────────────────────────────
   One control, thumb-sized. Jade at rest; while recording it turns
   cinnabar and breathes, so "is it recording?" never has to be asked. */
.stone {
    width: 7.25rem;
    height: 7.25rem;
    border: none;
    border-radius: 50%;
    background: var(--jade);
    color: #fff;
    font-family: var(--burmese);
    font-size: 1.125rem;
    line-height: 1.4;
    box-shadow: 0 0.5rem 1.25rem rgba(15, 93, 74, 0.28);
    display: grid;
    place-content: center;
    gap: 0.125rem;
}

.stone:disabled { background: var(--mist); color: var(--ink-soft); box-shadow: none; }
.stone .en { color: rgba(255, 255, 255, 0.82); }
.stone:disabled .en { color: var(--ink-soft); }

.stone--stop { background: var(--cinnabar); box-shadow: 0 0.5rem 1.25rem rgba(200, 52, 31, 0.3); }

/* Recording: the ring breathes and the screen takes a cinnabar edge. */
.is-recording .stone--stop { animation: breathe 1.6s ease-in-out infinite; }

.recording-frame {
    position: fixed;
    inset: 0;
    border: 3px solid var(--cinnabar);
    pointer-events: none;
    opacity: 0;
    transition: opacity 160ms ease;
}

.is-recording .recording-frame { opacity: 1; }

@keyframes breathe {
    0%, 100% { box-shadow: 0 0 0 0 rgba(200, 52, 31, 0.45); }
    50% { box-shadow: 0 0 0 1.125rem rgba(200, 52, 31, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .is-recording .stone--stop { animation: none; box-shadow: 0 0 0 0.5rem rgba(200, 52, 31, 0.35); }
    .recording-frame { transition: none; }
}

/* ── Level meter ────────────────────────────────────────────────────
   Two real recordings arrived about a tenth of normal speaking loudness,
   and nothing after the fact can fix that. So while the microphone is
   open the participant gets to see their own voice, with a tick marking
   the point they need to get past. guided-flow.js places the tick, so
   the mark and the too-quiet test can never drift apart. */
.meter {
    position: relative;
    width: 100%;
    height: 0.75rem;
    border-radius: 0.375rem;
    background: var(--mist);
    overflow: hidden;
}

.meter__fill {
    height: 100%;
    width: 0;
    border-radius: 0.375rem;
    background: var(--jade);
}

.meter__tick {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: var(--ink);
    opacity: 0.55;
}

/* ── Actions ────────────────────────────────────────────────────────── */
.action {
    width: 100%;
    min-height: var(--tap);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    font: inherit;
    text-align: center;
}

.action .my { display: block; font-size: 1.125rem; font-weight: 600; }
.action--primary { background: var(--jade); color: #fff; }
.action--primary:disabled { background: var(--mist); color: var(--ink-soft); }
.action--primary .en { color: rgba(255, 255, 255, 0.85); }
.action--primary:disabled .en { color: var(--ink-soft); }
.action--quiet { background: var(--surface); border-color: var(--mist); color: var(--ink); }

.action-row { display: flex; gap: 0.625rem; width: 100%; }
.action-row .action { flex: 1 1 0; }

.link-back {
    background: none;
    border: none;
    padding: 0.5rem 0;
    color: var(--ink-soft);
    font: inherit;
    font-size: 0.9375rem;
}

/* ── Notices ────────────────────────────────────────────────────────
   A blocked microphone is the difference between taking part and
   giving up, so it gets the whole screen's attention, not a grey line. */
.notice {
    border-radius: 0.5rem;
    padding: 1rem;
    border-left: 4px solid var(--mist);
    background: var(--surface);
}

.notice .my { font-size: 1.0625rem; font-weight: 600; }
.notice .en { margin-top: 0.25rem; }

/* The live status line under the record button. Both languages stack, and an
   empty one takes no room — the strip is usually silent, and a blank Burmese
   line would push the buttons down every time it cleared. */
.status .my,
.status .en { display: block; }
.status .my:empty,
.status .en:empty { display: none; }
.notice--stop { border-left-color: var(--cinnabar); background: #fdf1ef; }
.notice--wait { border-left-color: var(--thanaka); background: #fdf8ec; }
.notice--good { border-left-color: var(--jade); background: #eef5f1; }

.notice__address {
    display: block;
    margin-top: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    background: #fff;
    border: 1px dashed var(--mist);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8125rem;
    word-break: break-all;
    color: var(--ink);
}

/* ── Access code entry ──────────────────────────────────────────────── */
.code-input {
    width: 100%;
    min-height: 4rem;
    border: 2px solid var(--mist);
    border-radius: 0.5rem;
    background: var(--surface);
    text-align: center;
    font-family: var(--latin);
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.35em;
    text-indent: 0.35em;
    color: var(--ink);
}

.code-input:focus { outline: none; border-color: var(--jade); }

/* Keyboard users must be able to see where they are. */
.choice:focus-visible,
.action:focus-visible,
.stone:focus-visible,
.link-back:focus-visible,
.code-input:focus-visible {
    outline: 3px solid var(--thanaka);
    outline-offset: 2px;
}

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.hidden { display: none !important; }
