/* Medical Conference Presentation Trainer — styles.
   Clean, academic, information-first. English-first with secondary Chinese labels. */

:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --ink: #1c2433;
    --muted: #5d6b80;
    --line: #e2e7ef;
    --brand: #1f5fae;
    --brand-dark: #16467f;
    --ok-bg: #e6f4ea;
    --ok: #1d7a3f;
    --ok-line: #b6e0c2;
    --warn-bg: #fdeede;
    --warn: #a35200;
    --warn-line: #f3cfa0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(20, 35, 60, .08), 0 8px 24px rgba(20, 35, 60, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    line-height: 1.55;
    font-size: 16px;
}

.zh { color: var(--muted); font-weight: 400; font-size: .86em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
a { color: var(--brand); }

/* ---------- layout ---------- */
.app { max-width: 880px; margin: 0 auto; padding: 0 20px 64px; }

.hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 0 16px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 24px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { font-size: 30px; line-height: 1; }
.brand-text h1 { font-size: 1.2rem; margin: 0; letter-spacing: -.01em; }
.brand-text p { margin: 2px 0 0; }

.badge {
    background: #eef3fb;
    color: var(--brand-dark);
    border: 1px solid #d4e1f5;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: .8rem;
    white-space: nowrap;
}
.badge.small { padding: 1px 8px; font-size: .72rem; margin-left: 6px; }

.intro { color: var(--muted); margin: 0 0 22px; }

.about { margin: 0 0 22px; }
.about-summary { cursor: pointer; font-weight: 600; font-size: 1.05rem; list-style: none; }
.about-summary::-webkit-details-marker { display: none; }
.about-summary::before { content: "▸ "; color: var(--muted); }
.about[open] .about-summary::before { content: "▾ "; }
.about-body { margin-top: 14px; }
.about-body p { margin: 0 0 12px; line-height: 1.55; }
.flow-list { margin: 0 0 12px; padding-left: 1.3em; }
.flow-list li { margin: 0 0 8px; line-height: 1.5; }

/* ---------- cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    margin-bottom: 20px;
}
.card h2 { font-size: 1.02rem; margin: 0 0 16px; }

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-weight: 600; margin-bottom: 8px; font-size: .95rem; }

input[type="text"], textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 11px 13px;
    font: inherit;
    color: var(--ink);
    background: #fbfcfe;
    resize: vertical;
}
input[type="text"]:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(31, 95, 174, .12);
}
input[type="file"] { font: inherit; }

/* radio cards */
.radio-row { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-card {
    flex: 1 1 220px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    cursor: pointer;
    background: #fbfcfe;
}
.radio-card input { margin-top: 3px; }
.radio-card:has(input:checked) {
    border-color: var(--brand);
    background: #f1f6fd;
    box-shadow: 0 0 0 2px rgba(31, 95, 174, .12);
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 9px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.btn:hover { border-color: #c8d2e1; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.primary:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn .zh { color: rgba(255, 255, 255, .8); }
.btn.ghost .zh { color: var(--muted); }

.demo-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 18px;
    padding: 12px 14px;
    background: #f3f7fc;
    border: 1px solid #e1e8f2;
    border-radius: 10px;
}
.demo-hint p { margin: 0; flex: 1 1 220px; }
#demo-status.ok { color: var(--ok); }
#demo-status.warn { color: var(--warn); }
#demo-status.bad { color: var(--danger, #b3261e); }

.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---------- report ---------- */
.report-meta { color: var(--muted); font-size: .9rem; margin: 0 0 18px; }
.report-block { margin-bottom: 22px; }
.report-block h3 { font-size: .98rem; margin: 0 0 10px; }
.report-block p { margin: 6px 0; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.chip {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 11px;
    font-size: .82rem;
    border: 1px solid var(--line);
    background: #f1f4f9;
}
.chip.ok { background: #e8f5ec; color: var(--ok); border-color: var(--ok-line); }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }

.round { border-left: 3px solid var(--line); padding: 2px 0 2px 14px; margin: 10px 0; }
.round strong { font-size: .9rem; }

.fix-list { margin: 0; padding-left: 22px; }
.fix-list li { margin-bottom: 14px; }
.fix-list .why, .fix-list .how { margin: 3px 0; font-size: .92rem; color: var(--muted); }

.rep {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: #fbfcfe;
}
.rep-from { color: var(--warn); text-decoration: line-through; }
.rep-arrow { color: var(--muted); }
.rep-to { color: var(--ok); font-weight: 600; }
.rep p { margin: 4px 0 0; }

.disclaimer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
    color: var(--muted);
    font-size: .86rem;
}

/* ---------- footer ---------- */
.ft {
    color: var(--muted);
    font-size: .82rem;
    border-top: 1px solid var(--line);
    padding-top: 16px;
}

/* ---------- consent overlay ---------- */
.consent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(18, 27, 45, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}
.consent-overlay[hidden] { display: none; }
.consent-card {
    background: #fff;
    border-radius: 14px;
    max-width: 620px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    padding: 26px 28px;
    box-shadow: 0 20px 60px rgba(10, 20, 40, .35);
}
.consent-card h2 { margin: 0 0 14px; font-size: 1.15rem; }
.consent-body { font-size: .92rem; color: #33405a; }
.consent-body ul { padding-left: 20px; }
.consent-body li { margin-bottom: 8px; }
.consent-check { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0; }
.consent-check input { margin-top: 4px; }
.consent-actions { display: flex; gap: 12px; }

#app-root[aria-hidden="true"] { filter: blur(2px); pointer-events: none; }

/* ---------- analysis progress panel ---------- */
.progress-panel {
    margin-top: 16px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #fbfdff, #f3f8fd);
    animation: prog-fade .3s ease;
}
@keyframes prog-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.progress-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: 12px; }
.progress-title { font-weight: 600; color: var(--ink); }
.progress-pct { font-weight: 700; color: var(--brand); font-size: 1.05em; font-variant-numeric: tabular-nums; }

.progress-track { height: 10px; border-radius: 999px; background: #e7edf6; overflow: hidden; }
.progress-fill {
    height: 100%; width: 0; border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), #4f97da, var(--brand));
    background-size: 200% 100%;
    transition: width .35s cubic-bezier(.22, .61, .36, 1);
    animation: prog-shimmer 1.4s linear infinite;
}
@keyframes prog-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.progress-steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 9px; }
.pstep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .92rem; transition: color .3s ease; }
.pstep .pdot {
    flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid var(--line); background: var(--surface); position: relative;
    transition: border-color .3s ease, background .3s ease;
}
.pstep.active { color: var(--ink); font-weight: 600; }
.pstep.active .pdot { border-color: var(--brand); animation: prog-pulse 1.2s ease-out infinite; }
@keyframes prog-pulse {
    0% { box-shadow: 0 0 0 0 rgba(31, 95, 174, .45); }
    70% { box-shadow: 0 0 0 7px rgba(31, 95, 174, 0); }
    100% { box-shadow: 0 0 0 0 rgba(31, 95, 174, 0); }
}
.pstep.done { color: var(--ink); }
.pstep.done .pdot { border-color: var(--ok); background: var(--ok); }
.pstep.done .pdot::after {
    content: ''; position: absolute; left: 4px; top: 1px;
    width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.progress-hint {
    margin: 12px 0 0; min-height: 1.1em; color: var(--muted);
    font-size: .85rem; font-variant-numeric: tabular-nums;
}
.progress-hint:empty { margin: 0; }

@media (prefers-reduced-motion: reduce) {
    .progress-fill { animation: none; }
    .pstep.active .pdot { animation: none; box-shadow: 0 0 0 3px rgba(31, 95, 174, .18); }
    .progress-panel { animation: none; }
}

/* ---------- mobile / small screens ---------- */
@media (max-width: 600px) {
    .app { padding: 0 14px 48px; }

    .hd {
        flex-direction: column; align-items: stretch;
        gap: 10px; padding: 16px 0 14px; margin-bottom: 18px;
    }
    .brand { gap: 10px; }
    .brand-mark { font-size: 26px; }
    .brand-text h1 { font-size: 1.02rem; }
    #session-badge { align-self: flex-start; }

    .intro { margin-bottom: 18px; }

    .card { padding: 18px 16px; margin-bottom: 16px; border-radius: 10px; }
    .card h2 { font-size: 1rem; }

    /* keep inputs at 16px so iOS Safari does not zoom on focus */
    input[type="text"], textarea { font-size: 16px; }

    /* stack the task-type choices into full-width rows */
    .radio-row { flex-direction: column; gap: 10px; }
    .radio-card { flex: 1 1 auto; padding: 14px; }

    /* full-width, comfortable tap targets */
    .form-actions { flex-direction: column; align-items: stretch; gap: 12px; }
    .form-actions .btn { width: 100%; justify-content: center; padding: 14px 18px; }
    #form-status { text-align: center; }

    .progress-panel { padding: 14px 14px; }
    .progress-head { flex-wrap: wrap; gap: 2px 12px; }

    .report-block { margin-bottom: 18px; }
    .fix-list { padding-left: 18px; }
    .rep { word-break: break-word; }

    .consent-overlay { padding: 12px; }
    .consent-card { padding: 20px 18px; max-height: 92vh; border-radius: 12px; }
    .consent-card h2 { font-size: 1.05rem; }
    .consent-actions { flex-direction: column; }
    .consent-actions .btn { width: 100%; justify-content: center; padding: 14px 18px; }
}

/* ---------- drag-and-drop slide upload ---------- */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    padding: 22px 18px;
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    background: #fafbfd;
    color: var(--muted);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--brand); background: #f3f7fc; }
.dropzone.dragover {
    border-color: var(--brand);
    background: #eaf2fb;
    color: var(--brand-dark);
}
.dz-input {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px; border: 0;
    clip: rect(0 0 0 0); overflow: hidden;
}
.dz-icon { font-size: 1.7rem; line-height: 1; }
.dz-text { font-size: .92rem; }
.dz-text strong { color: var(--ink); }
.dz-file {
    margin-top: 4px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--ok);
    word-break: break-word;
}

/* ---------- post-report actions ---------- */
.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 6px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

/* ---------- AI tutor questions ---------- */
.tutor {
    margin-top: 18px;
    padding: 16px 16px 6px;
    background: #f7faff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.tutor h3 { margin: 0 0 4px; }
.q-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    margin: 12px 0;
}
.q-type {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--brand-dark);
    background: #e9f1fb;
    border-radius: 999px;
    padding: 2px 10px;
    margin-bottom: 8px;
}
.q-text { font-weight: 600; margin: 4px 0 2px; }
.q-text-zh { margin: 0 0 8px; }
.q-options { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.q-option {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
}
.q-option:hover { border-color: var(--brand); background: #f5f9fe; }
.q-option input { margin-top: 3px; }
.q-answer {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 11px;
    font: inherit;
    margin: 6px 0;
    resize: vertical;
}
.q-result { font-weight: 600; margin: 8px 0 0; }
.q-result.ok { color: var(--ok); }
.q-result.bad, .q-result.warn { color: var(--warn); }
.q-explain {
    margin-top: 8px;
    padding: 10px 12px;
    background: #f4f6f9;
    border-left: 3px solid var(--brand);
    border-radius: 6px;
    font-size: .92rem;
}
.q-explain p { margin: 0 0 6px; }
.q-explain p:last-child { margin-bottom: 0; }
.q-sample { color: var(--ink); }
.btn.small { padding: 7px 14px; font-size: .88rem; }

@media (max-width: 620px) {
    .report-actions { flex-direction: column; }
    .report-actions .btn { width: 100%; justify-content: center; }
}

/* ---- Module navigation (landing-page directory of all modules) --------- */
.module-nav .zh { display: inline; }
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.module-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 12px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.module-link:hover {
    border-color: var(--brand);
    box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
}
.module-link.is-current {
    border-color: var(--brand);
    background: var(--brand-tint, #f2f6fc);
}
.module-link.is-soon {
    background: var(--panel, #f8fafc);
    border-style: dashed;
    cursor: default;
    opacity: .8;
}
.module-link.is-soon:hover {
    border-color: var(--line, #e2e8f0);
    box-shadow: none;
    transform: none;
}
.soon-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    font-size: .68rem;
    font-weight: 600;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 999px;
    vertical-align: middle;
}
.module-ico { font-size: 1.5rem; line-height: 1; }
.module-name { font-weight: 600; color: var(--ink, #0f172a); }
.module-desc { font-size: .85rem; color: var(--muted); }
.module-link .zh { font-size: .8rem; color: var(--muted); }
