:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #5b6475;
    --brand: #c8102e;
    --brand-ink: #ffffff;
    --border: #dfe3ea;
    --brand-soft: #fdecef;
    --danger: #b3261e;
    --focus: #1a5fd0;
    --link: #1a5fd0;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151b;
        --surface: #1c2029;
        --text: #eef1f6;
        --muted: #a3acbd;
        --brand: #e2384f;
        --border: #2d3340;
        --brand-soft: #3a1a20;
        --danger: #ff8a80;
        --focus: #8ab4ff;
        --link: #8ab4ff;
    }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.top { background: var(--brand); color: var(--brand-ink); padding: 14px 16px; }
.brand { font-weight: 700; font-size: 1.1rem; }
.brand-sub { font-weight: 400; opacity: .85; }
.page { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 20px 16px 32px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.btn {
    display: inline-block; background: var(--brand); color: var(--brand-ink); text-decoration: none;
    padding: 12px 20px; border-radius: 10px; font-weight: 600; min-height: 48px;
}
.foot { color: var(--muted); font-size: .85rem; text-align: center; padding: 16px; }

/* ---- start page ---- */
.hero { display: block; width: 100%; height: 120px; object-fit: cover; border-radius: 12px; margin-bottom: 16px; }
.card + .card { margin-top: 16px; }
.card-quiet { background: transparent; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
.btn-block { display: block; width: 100%; text-align: center; border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.btn:focus-visible, .choice input:focus-visible + span, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted, .hint { color: var(--muted); }
.hint { display: block; font-size: .9rem; margin-top: 4px; }
.ref { font-family: ui-monospace, Consolas, monospace; letter-spacing: .08em; font-size: 1.15rem; }

/* ---- progress ---- */
.steps { list-style: none; display: flex; gap: 4px; padding: 0; margin: 0 0 16px; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .72rem; color: var(--muted); text-align: center; }
.step-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border); background: var(--surface); font-weight: 700; font-size: .8rem; }
.step-current { color: var(--text); font-weight: 600; }
.step-current .step-dot { border-color: var(--brand); color: var(--brand); }
.step-done .step-dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ---- forms ---- */
.field { margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.field > label, legend { display: block; font-weight: 600; margin-bottom: 6px; padding: 0; }
input[type=text], input:not([type]), input[type=tel], input[type=email] {
    width: 100%; font: inherit; padding: 12px; min-height: 48px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.input-validation-error { border-color: var(--danger) !important; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 52px; padding: 8px; border: 2px solid var(--border); border-radius: 10px; font-weight: 600; }
.choice input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }
.field-error, .error-summary { color: var(--danger); font-weight: 600; font-size: .92rem; }
.field-error:empty { display: none; }
.error-summary ul { margin: 0 0 12px; padding-left: 20px; }
.validation-summary-valid { display: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.privacy { margin: 8px 0 20px; color: var(--muted); font-size: .92rem; }
.privacy summary { cursor: pointer; font-weight: 600; color: var(--text); min-height: 32px; }
.cancel { margin-top: 12px; text-align: center; }
.link-button { background: none; border: 0; color: var(--muted); text-decoration: underline; font: inherit; cursor: pointer; padding: 8px; }
a { color: var(--link); }

/* ---- presentation player ---- */
.player-head { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 4px 0 10px; }
.player-pos { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .92rem; color: var(--muted); margin-bottom: 6px; }
.speak-toggle { font: inherit; font-size: .85rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 12px; min-height: 36px; cursor: pointer; }
.speak-toggle[aria-pressed=true] { border-color: var(--brand); color: var(--brand); }
.bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--brand); transition: width .25s ease; }
.chapter { text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; font-weight: 700; color: var(--brand); margin: 0 0 4px; }
.slide h1:focus { outline: none; }
.figs { display: grid; gap: 8px; margin: 4px 0 14px; }
.figs-2, .figs-3 { grid-template-columns: 1fr 1fr; }
.figs figure { margin: 0; }
.figs img { display: block; width: 100%; height: 190px; object-fit: cover; border-radius: 8px; background: var(--border); }
.figs-1 img { height: auto; max-height: 300px; object-fit: contain; }
.figs figcaption { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.points { margin: 0 0 14px; padding-left: 20px; }
.points li { margin-bottom: 6px; }
.caption { background: var(--bg); border-left: 4px solid var(--brand); border-radius: 0 8px 8px 0; padding: 10px 12px; }
.caption-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.narration { margin: 0; font-size: .96rem; }
.player-error { color: var(--danger); font-weight: 600; margin: 12px 0 0; }
.player-nav { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin: 16px 0 12px; }
.player-nav .btn { border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border) !important; }
.small { font-size: .85rem; }
@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none; } }

/* ---- forms: rules, health, sign ---- */
.center { text-align: center; }
.doc-ref { font-size: .78rem; color: var(--muted); letter-spacing: .04em; margin: 0 0 4px; }
.form-doc h3 { font-size: 1rem; margin: 16px 0 8px; }
.rules { padding-left: 22px; margin: 0 0 16px; }
.rules li { margin-bottom: 8px; }
.declare { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 2px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 600; }
.declare input { width: 24px; height: 24px; flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--brand); }
.declare:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.q-group { font-size: 1.05rem; margin: 20px 0 8px; }
.question { border: 0; border-top: 1px solid var(--border); padding: 14px 0 6px; margin: 0; min-width: 0; }
.question:first-of-type { border-top: 0; padding-top: 0; }
.question legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.question .hint { margin: -2px 0 8px; }
.q-key { color: var(--muted); font-weight: 700; margin-right: 2px; }
.question-error .choice span { border-color: var(--danger); }
.if-yes { margin-top: 10px; }
.if-yes label, .label { display: block; font-weight: 600; margin-bottom: 6px; }
textarea { width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: vertical; }
.summary { padding-left: 20px; margin: 0 0 10px; }
.summary li { margin-bottom: 4px; }
.sig-box { position: relative; border: 2px dashed var(--border); border-radius: 10px; background: #fff; }
.sig-box canvas { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; }
.sig-clear { position: absolute; top: 4px; right: 6px; }
.done { text-align: center; }
.done-tick { width: 64px; height: 64px; margin: 4px auto 12px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 34px; font-weight: 700; }
.ref-big { font-family: ui-monospace, Consolas, monospace; font-size: 2rem; letter-spacing: .15em; font-weight: 700; margin: 8px 0 16px; }
