/* Striking Out Stroke SOS — light clinical theme */
:root {
    --bg: #ffffff;
    --navy: #0e2a3d;
    --surface: #f4f7fa;
    --line: #e1e8ee;
    --text: #0e2a3d;
    --muted: #5f7686;
    --teal: #13a898;
    --teal-soft: rgba(19, 168, 152, 0.16);
    --red: #e8303f;
    --red-deep: #7d1420;
    /* Heading colours, taken from the certificate artwork. */
    --heading: #14274f;
    --heading-accent: #ec4138;
    /* Injection (thrombolytic) colours: pale yellow, as on the syringe button. */
    --inj: #fcf1bf;
    --inj-deep: #e6cf74;
    --orange: #ff6b3d;
    --radius: 18px;
    --display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
    --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* By default only the page scrolls. The photo and certificate pages opt into an in-card scroll (see .fit-screen). */
html { min-height: 100%; background: var(--bg); }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--body);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: clip; /* clip, unlike hidden, doesn't create a scroll container */
}

[hidden] { display: none !important; }

/* ---------- Ambient ECG ---------- */
.ecg {
    position: fixed;
    inset: 50% 0 auto 0;
    width: 100%;
    height: 200px;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.18;
}
.ecg path {
    fill: none;
    stroke: var(--teal);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-dasharray: 1400;
    stroke-dashoffset: 1400;
    animation: ecg 4s linear infinite;
}
@keyframes ecg {
    0% { stroke-dashoffset: 1400; opacity: 0; }
    10% { opacity: 1; }
    80% { opacity: 1; }
    100% { stroke-dashoffset: 0; opacity: 0; }
}

/* ---------- Card ---------- */
.stage {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.card {
    position: relative;
    width: 100%;
    max-width: 440px;
    border-radius: 24px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 20px 50px -24px rgba(14, 42, 61, 0.25);
}
/* Pledge page: pale yellow background, a shade lighter than the injection. */
body.page-pledge,
.page-pledge .card { background: #fffae6; }
.screen {
    position: relative;
    padding: 28px 24px;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

@media (max-width: 480px) {
    .stage { padding: 16px; place-items: start stretch; }
    .card { border-radius: 20px; }
    .screen { padding: 22px 18px; }
}

/* ---------- Brand ---------- */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--display);
    font-size: 12px;
    line-height: 1.1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.brand strong { color: var(--orange); font-weight: 800; }
.brand-mark { width: 28px; height: 28px; fill: none; stroke: var(--orange); stroke-width: 1.8; stroke-linecap: round; }
.brand-mark .dot { fill: var(--orange); stroke: none; }
.brand-partner { height: 28px; width: auto; }
.brand-exit { margin-left: auto; }
.brand-exit button {
    font: 500 12px var(--body);
    color: var(--muted);
    background: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 12px;
    cursor: pointer;
}
.brand-exit button:hover { color: var(--text); border-color: var(--muted); }

/* ---------- Common ---------- */
.view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: 24px;
    animation: view-in 0.5s ease both;
}
@keyframes view-in { from { opacity: 0; transform: translateY(12px); } }

.steps { display: flex; align-items: center; gap: 6px; margin-bottom: 20px; }
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 32px;
    margin-right: 10px;
    padding: 0 12px 0 8px;
    font: 600 13px var(--body);
    color: var(--navy);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.back-btn:hover { border-color: var(--muted); background: #fff; }
.back-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.steps-count { font: 600 12px var(--body); color: var(--muted); margin-right: 4px; letter-spacing: 0.05em; }
.steps .dot { width: 8px; height: 8px; border-radius: 50%; background: #d5dee5; }
.steps .dot.on { background: var(--red); box-shadow: 0 0 8px var(--red); }

.display {
    margin: 0;
    font-family: var(--display);
    font-weight: 800;
    color: var(--heading);
    font-size: 48px;
    line-height: 0.98;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}
.display.sm { font-size: 30px; line-height: 1.05; text-transform: none; }
.view-login .display { font-size: 38px; }
/* "SWIPE TO SAVE A BRAIN" stays on one line, scaling down on narrow phones. */
.view-swipe .display.sm { font-size: clamp(18px, 7vw, 30px); white-space: nowrap; }
.accent { color: var(--heading-accent); }
/* "STRIKING OUT STROKE SOS": navy letters, red initials — as on the certificate. */
.sos-line { color: var(--heading); font-weight: 700; }

.sub { margin: 12px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    margin-top: 24px;
    padding: 0 24px;
    font: 700 16px var(--display);
    letter-spacing: 0.02em;
    color: #fff;
    background: var(--navy);
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 10px 24px -10px rgba(14, 42, 61, 0.55);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -10px rgba(14, 42, 61, 0.65); background: #163a52; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

/* ---------- Login ---------- */
.form { margin-top: 28px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input,
.field select {
    width: 100%;
    min-height: 50px;
    padding: 0 16px;
    font: 500 16px var(--body);
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input::placeholder { color: #9aabb7; }
.field input:focus,
.field select:focus { border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }
.field select {
    appearance: none;
    padding-right: 44px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239aabb7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}
.error { font-style: normal; font-size: 13px; color: #d62839; }

/* Admin sign-in (reuses the login card) */
.admin-eyebrow { margin: 0 0 10px; font: 700 12px var(--body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--orange); }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.check-row input { width: 18px; height: 18px; accent-color: var(--navy); }

/* ---------- Injection-shaped "Take the pledge" button ---------- */
.btn-syringe {
    display: flex;
    align-items: center;
    width: 100%;
    height: 60px;
    margin-top: 26px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.btn-syringe:focus-visible { outline-offset: 6px; border-radius: 14px; }
.btn-syringe > span { flex: none; }

.sy-plunger {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    width: 44px;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.5, 0, 0.3, 1);
}
.sy-plunger::before { content: ''; width: 8px; height: 42px; border-radius: 3px; background: var(--navy); }
.sy-plunger::after { content: ''; width: 36px; height: 10px; background: var(--navy); }

.sy-flange { position: relative; z-index: 2; width: 6px; height: 60px; border-radius: 3px; background: var(--navy); }

.btn-syringe > .sy-barrel {
    position: relative;
    z-index: 2;
    flex: 1;
    display: grid;
    place-items: center;
    height: 50px;
    overflow: hidden;
    background: #fff;
    border: 2.5px solid var(--navy);
    border-left: 0;
    border-radius: 0 12px 12px 0;
}
.sy-fluid {
    position: absolute;
    inset: 4px 4px 4px 0;
    border-radius: 0 8px 8px 0;
    overflow: hidden;
    background: linear-gradient(180deg, #f1df8f, #fcf1bf, #f1df8f);
    transform-origin: right center;
    transition: transform 0.6s cubic-bezier(0.5, 0, 0.3, 1), filter 0.15s ease;
}
.sy-fluid canvas { display: block; width: 100%; height: 100%; }
.sy-marks {
    position: absolute;
    top: 4px;
    left: 14px;
    right: 14px;
    height: 9px;
    background: repeating-linear-gradient(90deg, rgba(14, 42, 61, 0.35) 0 2px, transparent 2px 20px);
}
.sy-label {
    position: relative;
    font: 700 16px var(--display);
    letter-spacing: 0.02em;
    color: var(--navy);
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255, 251, 232, 0.8);
    transition: color 0.3s ease 0.3s, text-shadow 0.3s ease 0.3s;
}

.sy-hub {
    position: relative;
    z-index: 2;
    width: 14px;
    height: 26px;
    background: var(--navy);
    clip-path: polygon(0 0, 100% 32%, 100% 68%, 0 100%);
}
.sy-needle {
    position: relative;
    width: 34px;
    height: 3px;
    border-radius: 0 2px 2px 0;
    background: linear-gradient(90deg, #8699a6, #d5dee5);
}
.sy-needle::after {
    content: '';
    position: absolute;
    right: -4px;
    top: -3px;
    width: 8px;
    height: 10px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background: #ecd57a;
    opacity: 0;
}

.btn-syringe:hover .sy-plunger { transform: translateX(6px); }
.btn-syringe:hover .sy-fluid { filter: brightness(1.08); }
.btn-syringe:active .sy-plunger { transform: translateX(12px); }

.btn-syringe.injecting { cursor: progress; }
.btn-syringe.injecting .sy-plunger { transform: translateX(38px); }
.btn-syringe.injecting .sy-fluid { transform: scaleX(0.12); }
.btn-syringe.injecting .sy-label { color: var(--navy); text-shadow: none; }
.btn-syringe.injecting .sy-needle::after { animation: drip 0.5s ease-in 0.35s forwards; }
@keyframes drip {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(18px); }
}

/* ---------- Vessel + clot ---------- */
.vessel {
    --clot-x: 78%;
    position: relative;
    height: 116px;
    margin: 40px -6px 0;
    border-radius: 58px;
    background: #fbe7e6;
    box-shadow:
        inset 0 0 0 3px #eaa3a4,
        inset 0 10px 18px rgba(150, 20, 30, 0.18),
        0 0 40px -6px rgba(232, 48, 63, 0.35);
    overflow: hidden;
    touch-action: none;
    user-select: none;
}
/* Blood is drawn on this canvas by blood-flow.js; the gradient is the fallback. */
.flow {
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 0;
    width: 100%;
    height: calc(100% - 28px);
    border-radius: 44px;
    background: linear-gradient(180deg, #f0bdbc, #fdeeed, #f0bdbc);
}

.dose {
    position: absolute;
    left: 0;
    top: 50%;
    width: 0;
    height: 10px;
    transform: translateY(-50%);
    border-radius: 0 999px 999px 0;
    background: linear-gradient(90deg, rgba(252, 241, 191, 0.2), #f7e7a0);
    box-shadow: 0 0 16px var(--inj-deep), 0 0 4px var(--inj-deep);
    pointer-events: none;
}
.vessel.open .dose { transition: opacity 1s ease 0.6s; opacity: 0; }

.clot {
    position: absolute;
    left: var(--clot-x);
    top: 50%;
    width: 104px;
    height: 104px;
    transform: translate(-50%, -50%);
    overflow: visible;
    filter: drop-shadow(0 5px 8px rgba(120, 0, 12, 0.35));
    animation: clot-pulse 1.8s ease-in-out infinite;
    pointer-events: none;
}
/* Each cell: outer group breaks away on dissolve, inner group wobbles gently at rest. */
.clot .rbc { transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.9s ease; transform-box: fill-box; transform-origin: center; }
.clot .rbc-in { transform-box: fill-box; transform-origin: center; animation: rbc-wobble 3s ease-in-out infinite; }
.clot .drift { animation: rbc-drift 5s ease-in-out infinite; }
.clot .fibrin { transition: opacity 0.5s ease; }
.clot .fibrin-strand { fill: none; stroke: #e2c49c; stroke-linecap: round; opacity: 0.9; }
.clot .fibrin-shadow { fill: none; stroke: rgba(90, 10, 16, 0.3); stroke-width: 1.1; stroke-linecap: round; transform: translate(0.4px, 0.6px); }
.clot.dissolving .fibrin { opacity: 0; }
.clot.hit { animation: clot-shake 0.35s ease 2; }
@keyframes rbc-wobble {
    33% { transform: translate(0.5px, -0.4px) rotate(3deg); }
    66% { transform: translate(-0.4px, 0.5px) rotate(-2deg); }
}
@keyframes rbc-drift {
    50% { transform: translate(3px, -2.5px); }
}
@keyframes clot-pulse { 50% { transform: translate(-50%, -50%) scale(1.04); } }
@keyframes clot-shake {
    25% { transform: translate(calc(-50% - 3px), -50%); }
    75% { transform: translate(calc(-50% + 3px), -50%); }
}

/* ---------- Syringe ---------- */
.syringe {
    --x: 6px;
    position: absolute;
    left: 0;
    top: 50%;
    width: 116px;
    height: 38px;
    padding: 0;
    border: 0;
    background: none;
    transform: translate(var(--x), -50%);
    cursor: grab;
    z-index: 2;
    touch-action: none;
    filter: drop-shadow(0 2px 6px rgba(14, 42, 61, 0.35));
}
.syringe.dragging { cursor: grabbing; }
.syringe.returning { transition: transform 0.4s cubic-bezier(0.3, 1.4, 0.5, 1); }
.syringe.done { cursor: default; }
.syringe svg { width: 100%; height: 100%; overflow: visible; }
.syringe .barrel { fill: var(--inj); stroke: var(--inj-deep); stroke-width: 2.4; }
.syringe .fluid { fill: #f5e08f; opacity: 0.95; transform-origin: 104px 24px; transition: transform 1s ease; }
.syringe .marks path { fill: none; stroke: var(--inj-deep); stroke-width: 1.6; }
.syringe .flange { fill: var(--inj-deep); }
.syringe .plunger rect { fill: #fdf3c8; stroke: var(--inj-deep); stroke-width: 1; }
.syringe .plunger { transition: transform 1s ease; }
.syringe .hub { fill: #0f2e43; stroke: var(--inj-deep); stroke-width: 2.2; }
.syringe .needle { stroke: #dce9ee; stroke-width: 2.4; stroke-linecap: round; }
.syringe .drop { fill: var(--red); }
.syringe.injecting .plunger { transform: translateX(60px); }
.syringe.injecting .fluid { transform: scaleX(0.05); }

.swipe-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
    font: 600 13px var(--body);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--teal);
    transition: opacity 0.3s ease;
}
.swipe-hint svg { width: 48px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; animation: nudge 1.2s ease-in-out infinite; }
.swipe-hint span { text-align: center; }
.swipe-hint.gone { opacity: 0; }
@media (max-width: 400px) { .swipe-hint { gap: 8px; font-size: 12px; letter-spacing: 0.04em; } }
@keyframes nudge { 50% { transform: translateX(8px); } }

.status {
    margin: 28px 0 0;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    text-align: center;
}
.status.ok { color: var(--teal); border-color: rgba(19, 168, 152, 0.4); background: #eefaf8; }

/* ---------- Photo crop + certificate preview pages ---------- */
.panel { display: flex; flex-direction: column; margin-top: 16px; }
.panel-body { display: grid; gap: 0; }
.panel-foot { flex: none; padding-top: 4px; }
.panel-foot .btn { margin-top: 12px; }
.panel-foot .btn-syringe { margin-top: 10px; }
.panel-foot .link-btn { margin-top: 10px; }

/* Certificate page: the whole certificate is scaled to fit — no page, card or inner scroll. */
.fit-screen .panel-body.fit-body { overflow: hidden; display: flex; }
.fit-body .cert-preview {
    position: relative;
    flex: 1;
    min-height: 160px;
    background: none;
    border: 0;
    border-radius: 0;
    overflow: hidden;
}
.fit-body .cert-preview img {
    position: absolute;
    inset: 0;
    margin: auto;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 22px -12px rgba(14, 42, 61, 0.45);
}
/* Photo + certificate pages: the card fills the screen and only the tab body scrolls inside it. */
body.fit-screen { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.fit-screen .stage { height: 100%; min-height: 0; grid-template-rows: minmax(0, 1fr); place-items: center; }
.fit-screen .card { display: flex; flex-direction: column; height: 100%; max-height: 900px; }
.fit-screen .panel-body > .dropzone { align-self: start; }
/* Keep the crop square small enough that the zoom controls stay in view. */
.fit-screen .crop-stage { max-width: max(180px, calc(100dvh - 450px)); margin-inline: auto; }
@media (max-height: 720px) {
    .fit-screen .view-page .sub { display: none; }
    .fit-screen .view-page { padding-top: 16px; }
    .fit-screen .crop-stage { max-width: max(180px, calc(100dvh - 400px)); }
}
.fit-screen .screen { flex: 1; min-height: 0; }
.fit-screen .view-page { min-height: 0; }
.fit-screen .view-page .display.sm { font-size: 26px; }
.fit-screen .view-page .steps { margin-bottom: 12px; }
.fit-screen .panel { flex: 1; min-height: 0; }
.fit-screen .panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    border-radius: var(--radius);
}
.fit-screen .panel-foot { margin-top: 4px; }

.dropzone {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 36px 16px;
    text-align: center;
    background: var(--surface);
    border: 2px dashed #c6d3dc;
    border-radius: var(--radius);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.over { border-color: var(--teal); background: #eefaf8; }
.dropzone svg { width: 44px; height: 44px; margin-bottom: 6px; fill: none; stroke: var(--red); stroke-width: 1.6; stroke-linecap: round; }
.dropzone b { font: 700 16px var(--display); }
.dropzone span { font-size: 13px; color: var(--muted); }

.source-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 420px; margin-top: 14px; }
@media (max-width: 380px) { .source-btns { grid-template-columns: 1fr; } }
.source-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 14px;
    font: 600 14px var(--body);
    color: var(--navy);
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}
.source-btn:hover { border-color: var(--navy); }
.dropzone .source-btn svg { flex: none; width: 20px; height: 20px; margin: 0; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }

.camera-stage { position: relative; }
.camera-stage video { display: block; width: 100%; height: 100%; object-fit: cover; }
.camera-stage video.mirrored { transform: scaleX(-1); /* front camera, like a selfie */ }
/* Circle guide matching the certificate crop */
.camera-stage::after {
    content: '';
    position: absolute;
    inset: 4%;
    border-radius: 50%;
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--red), 0 0 0 999px rgba(14, 42, 61, 0.55);
    pointer-events: none;
}
.camera-tools { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 14px; }
.camera-tools .link-btn { margin: 0; justify-self: start; }
.camera-tools .camera-flip { justify-self: end; margin-left: 0; }
.shutter {
    width: 62px;
    height: 62px;
    padding: 0;
    background: var(--red);
    border: 4px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--red);
    cursor: pointer;
    transition: transform 0.1s ease;
}
.shutter:active { transform: scale(0.92); }
.shutter:disabled { opacity: 0.5; cursor: progress; }

.crop-stage {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius);
    background: #0e2a3d;
}
.crop-stage img { display: block; max-width: 100%; }
/* Round crop window to match the circle on the certificate */
.crop-stage .cropper-view-box,
.crop-stage .cropper-face { border-radius: 50%; }
.crop-stage .cropper-view-box { outline: 0; box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--red); }
.crop-stage .cropper-modal { background: #0e2a3d; opacity: 0.7; }

.crop-tools { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.crop-tools > svg { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.crop-tools input[type="range"] { flex: 1; min-width: 0; accent-color: var(--red); }
.icon-btn {
    flex: none;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-left: 4px;
    color: var(--navy);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.crop-help { margin: 8px 0 0; font-size: 12px; color: var(--muted); text-align: center; }


.form-msg { margin: 12px 0 0; min-height: 1em; font-size: 13px; text-align: center; color: var(--muted); }
.form-msg.error { color: #d62839; }

.cert-preview {
    display: grid;
    place-items: center;
    min-height: 200px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.cert-preview img { display: block; width: 100%; height: auto; }
.cert-empty { margin: 0; padding: 24px; font-size: 14px; color: var(--muted); text-align: center; }

.link-btn {
    display: block;
    width: fit-content;
    margin: 14px auto 0;
    text-align: center;
    font: 600 14px var(--body);
    color: var(--teal);
    background: none;
    border: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- Certificate + state map (step 4) ---------- */
.cert-layout { display: grid; gap: 28px; align-items: start; margin-top: 16px; }
.cert-layout > * { margin-top: 0; }
.view-cert .cert-preview { background: none; border: 0; min-height: 160px; }
.view-cert .cert-preview img {
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 22px -12px rgba(14, 42, 61, 0.45);
}

.btn.btn-outline {
    color: var(--navy);
    background: #fff;
    border: 1.5px solid var(--navy);
    box-shadow: none;
}
.btn.btn-outline:hover { background: var(--surface); box-shadow: none; }
.panel-foot .btn + .btn { margin-top: 10px; }

.share-menu {
    margin-top: 10px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    animation: view-in 0.25s ease both;
}
.share-hint { margin: 0 0 10px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.share-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.share-links > * {
    display: grid;
    place-items: center;
    min-height: 40px;
    padding: 0 8px;
    font: 600 13px var(--body);
    color: var(--navy);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
}
.share-links > *:hover { border-color: var(--teal); color: var(--teal); }
.share-links > .done { color: var(--teal); border-color: var(--teal); }

/* Wide screens: the card grows and the certificate sits beside the map. */
@media (min-width: 900px) {
    .wide .card { max-width: 940px; }
    .wide .screen { padding: 32px 36px; }
    .cert-layout { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 36px; }
    .cert-layout > .panel { position: sticky; top: 24px; }
}

@media (max-width: 360px) {
    .display { font-size: 40px; }
    .display.sm { font-size: 26px; }
    .view-login .display { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
    .ecg { display: none; }
}
