/* ==========================================================================
   成都大学生书包挂件消费调研 · 页面样式
   2026-11 视觉改版：一栏式阅读版式、单一主色、去渐变/去 emoji，
   组件顺序：令牌 → 基础 → 排版 → 欢迎页 → 答题页 → 完成页 → 单页模式 → 通用件
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root {
    --ink: #1A1D23;
    --ink-2: #4B5563;
    --ink-3: #77808C;

    --line: #E3E6EB;
    --line-strong: #CBD2DB;

    --bg: #F4F5F7;
    --card: #FFFFFF;
    --wash: #FAFBFC;

    --accent: #0F4C81;
    --accent-strong: #0B3A63;
    --accent-soft: #EDF3F9;
    --accent-line: #C9DCEB;

    --ok: #1F7A5A;
    --warn: #8A5A00;
    --danger: #B3261E;

    --radius: 12px;
}

body.dark-mode {
    --ink: #ECEFF3;
    --ink-2: #C3CAD4;
    --ink-3: #98A2B3;

    --line: #2A3040;
    --line-strong: #3A4356;

    --bg: #141821;
    --card: #1B2029;
    --wash: #1F2733;

    --accent: #7FB0DA;
    --accent-strong: #A7C8E8;
    --accent-soft: #1E2A38;
    --accent-line: #2E4053;

    --ok: #6FCF97;
    --warn: #E3B341;
    --danger: #F08A85;
}

/* ---------- 2. 基础 ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI",
        system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.7;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 28px 12px 48px;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 600px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 32px 28px 24px;
}

.hidden { display: none !important; }

/* 页面切换：不做位移，只做很轻的淡入 */
.page { display: none; }
.page.active {
    display: block;
    animation: fade .22s ease-out both;
}
@keyframes fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ---------- 3. 排版 ---------- */
h1 {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: .01em;
    color: var(--ink);
    word-break: break-word;
}

.subtitle {
    font-size: 13px;
    color: var(--ink-3);
    margin-top: 6px;
}

/* 标题上方的小标签：一行字 + 一段短线，代替原来的大 emoji */
.kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    letter-spacing: .06em;
    color: var(--ink-3);
    margin-bottom: 12px;
}
.kicker::before {
    content: "";
    width: 16px;
    height: 1px;
    background: var(--line-strong);
}

/* 旧版的 emoji 图标：元素仍在（JS 会写 textContent），但不显示 */
.title-icon { display: none; }

/* ---------- 4. 欢迎页 ---------- */
.desc-box {
    margin: 20px 0 22px;
    padding: 14px 16px;
    background: var(--wash);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.75;
    color: var(--ink-2);
}
.desc-box p { color: var(--ink-2); }
.desc-box b { color: var(--ink); font-weight: 600; }
.desc-box ul {
    margin: 8px 0 2px 18px;
    color: var(--ink-3);
    font-size: 13px;
}
.desc-box li { margin-top: 2px; }
.desc-box .bk { color: var(--ink); font-weight: 600; }

.paper-list { display: flex; flex-direction: column; gap: 12px; }

.paper-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px 18px;
    transition: border-color .15s, background .15s;
}
.paper-card:hover {
    border-color: var(--accent-line);
    background: var(--wash);
}
.paper-card .no {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 4px;
    padding: 1px 8px;
    margin-bottom: 8px;
}
.paper-card .t {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--ink);
}
.paper-card .d {
    font-size: 13px;
    color: var(--ink-3);
    margin-top: 5px;
    line-height: 1.65;
}
.paper-card .m {
    font-size: 12.5px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 10px;
}

/* ---------- 5. 按钮 ---------- */
.btn-main {
    display: block;
    width: 100%;
    height: 46px;
    margin: 20px auto 0;
    padding: 0 20px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .02em;
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.btn-main:hover { background: var(--accent-strong); }
.btn-main:active { transform: translateY(1px); }
.btn-main:disabled { opacity: .55; cursor: not-allowed; }

.btn-ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent-line);
}
.btn-ghost:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ---------- 6. 答题页：顶部与进度 ---------- */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.progress-text {
    font-size: 12.5px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--line);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 3px;
    transition: width .25s ease;
}
.progress-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--ink-3);
    margin: 6px 0 24px;
    font-variant-numeric: tabular-nums;
}

/* ---------- 7. 题目区 ---------- */
.question-type-badge {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 4px;
    padding: 1px 8px;
    margin-bottom: 10px;
}
.question-helper {
    font-size: 12.5px;
    color: var(--ink-3);
    line-height: 1.65;
    margin-bottom: 6px;
}
h2.question-text {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.65;
    color: var(--ink);
    margin-bottom: 16px;
    word-break: break-word;
}
h2.question-text .required-star,
.required-star {
    color: var(--danger);
    margin-left: 3px;
    font-weight: 400;
}
/* 题干里的题号：与题干拉开一点距离 */
.qno {
    display: inline-block;
    margin-right: 8px;
    font-size: .8em;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--ink-3);
    vertical-align: .06em;
}
.question-section {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 6px;
    padding: 6px 12px;
    margin-bottom: 14px;
}

.skip-hint {
    display: inline-block;
    font-size: 12px;
    color: var(--warn);
    background: transparent;
    border: 1px dashed var(--line-strong);
    border-radius: 6px;
    padding: 4px 10px;
    margin: -6px 0 14px;
}

/* ---------- 8. 选项 ---------- */
.options-wrapper { display: block; }

.option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    padding: 13px 15px;
    text-align: left;
    font-family: inherit;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.55;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.option-btn + .option-btn { margin-top: 10px; }
.option-btn:hover {
    border-color: var(--accent-line);
    background: var(--wash);
}
.option-btn.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.opt-mark {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--line-strong);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    color: #fff;
    transition: background .15s, border-color .15s;
}
.option-btn.square .opt-mark { border-radius: 4px; }
.option-btn.selected .opt-mark {
    background: var(--accent);
    border-color: var(--accent);
}
.option-btn .opt-label { flex: 1; }

/* 「其他」补充输入 */
.other-box {
    margin-top: 12px;
    padding: 14px 15px;
    background: var(--wash);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.other-tip {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 8px;
}
.other-input,
.text-input {
    width: 100%;
    padding: 11px 13px;
    font-family: inherit;
    font-size: 15px;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
    transition: border-color .15s;
}
.other-input:focus,
.text-input:focus { border-color: var(--accent); }

/* 量表题 */
.scale-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}
.scale-btn {
    height: 46px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
    transition: border-color .15s, background .15s, color .15s;
}
.scale-btn:hover { border-color: var(--accent-line); }
.scale-btn.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--ink-3);
    margin-top: 8px;
}

/* 开放题 */
.text-input {
    min-height: 120px;
    line-height: 1.7;
    resize: vertical;
}
.text-input.single-line {
    min-height: 0;
    height: 46px;
    padding: 0 13px;
    line-height: 44px;
    resize: none;
}
.text-input::placeholder { color: var(--ink-3); opacity: .8; }

/* ---------- 9. 底部导航 ---------- */
.quiz-nav {
    display: flex;
    gap: 10px;
    margin-top: 26px;
}
.quiz-nav .btn-prev,
.quiz-nav .btn-next {
    height: 46px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
}
.quiz-nav .btn-prev {
    flex: 0 0 32%;
    background: transparent;
    color: var(--ink-2);
    border: 1px solid var(--line);
}
.quiz-nav .btn-prev:hover { border-color: var(--line-strong); color: var(--ink); }
.quiz-nav .btn-next {
    flex: 1;
    background: var(--accent);
    color: #fff;
    border: none;
}
.quiz-nav .btn-next:hover { background: var(--accent-strong); }
.quiz-nav .btn-prev:active,
.quiz-nav .btn-next:active { transform: translateY(1px); }

/* ---------- 10. 完成页 ---------- */
/* 勾选图标用 CSS 画，避免依赖系统 emoji 字体 */
.done-icon {
    position: relative;
    width: 40px;
    height: 40px;
    margin: 4px 0 12px;
    font-size: 0;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
}
.done-icon::after {
    content: "";
    position: absolute;
    left: 14px;
    top: 9px;
    width: 9px;
    height: 16px;
    border-right: 2px solid var(--ok);
    border-bottom: 2px solid var(--ok);
    transform: rotate(42deg);
}
.done-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 6px;
}
.done-desc {
    font-size: 13px;
    color: var(--ink-3);
    margin-bottom: 20px;
}
.upload-box:empty { display: none; }
.upload-box {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--wash);
    font-size: 13px;
    color: var(--ink-2);
}
.upload-ok { color: var(--ok); font-weight: 600; }
.upload-fail { color: var(--danger); font-weight: 600; }
.hint { font-size: 12.5px; color: var(--ink-3); }

.stats-box:empty { display: none; }
.stats-box {
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.stats-box .row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--line);
}
.stats-box .row:last-child { border-bottom: none; }
.stats-box .k { color: var(--ink-3); }
.stats-box .v {
    color: var(--ink);
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

#export-box { margin-top: 4px; }
#export-box .btn-main { margin-top: 10px; }
#export-box.highlight .btn-main:first-child {
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.export-hint {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--ink-3);
}
.done-again {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
.done-again .btn-main { margin-top: 0; }

/* ---------- 11. 单页模式 ---------- */
.form-q {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px 16px;
    margin-bottom: 14px;
    background: var(--card);
}
.form-q.missing { border-color: var(--danger); }
.form-q-title {
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.65;
    color: var(--ink);
    margin-bottom: 12px;
}
.form-q-title .qno {
    display: inline-block;
    min-width: 22px;
    margin-right: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.form-q-helper {
    font-size: 12.5px;
    color: var(--ink-3);
    margin: -6px 0 10px;
}

/* ---------- 12. 页脚与署名 ---------- */
.footer {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    line-height: 1.8;
    color: var(--ink-3);
    text-align: center;
}
.footer a { color: var(--accent); text-decoration: none; }

/* 署名块：姓名一行，单位/专业一行 */
.sig {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    text-align: center;
    line-height: 1.8;
}
.sig-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    letter-spacing: .02em;
}
.sig-meta {
    display: block;
    font-size: 11.5px;
    color: var(--ink-3);
}
.sig-note {
    display: block;
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--ink-3);
}

/* ---------- 13. 提示与控件 ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(8px);
    padding: 10px 16px;
    border-radius: 8px;
    background: #1A1D23;
    color: #fff;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 12000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
    max-width: min(90%, 420px);
    text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#dark-mode-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1000;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;              /* 隐藏原来的 emoji，改用 CSS 画一个开关 */
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
    cursor: pointer;
    transition: border-color .15s;
}
#dark-mode-toggle::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid var(--ink-3);
    background: linear-gradient(90deg, var(--ink-3) 50%, transparent 50%);
}
#dark-mode-toggle:hover { border-color: var(--line-strong); }

/* ---------- 14. 移动端 ---------- */
@media (max-width: 520px) {
    body { padding: 46px 10px 32px; font-size: 15px; }
    #dark-mode-toggle { top: 10px; right: 10px; }
    .container { padding: 22px 16px 18px; border-radius: 10px; }
    h1 { font-size: 19px; }
    h2.question-text { font-size: 16.5px; }
    .desc-box { padding: 12px 14px; }
    .option-btn { padding: 12px 13px; font-size: 14.5px; }
    .scale-grid { gap: 6px; }
    .scale-btn { height: 42px; font-size: 14px; }
    /* iOS 聚焦输入框时，字号小于 16px 会触发页面缩放 */
    .other-input,
    .text-input { font-size: 16px; }
    .quiz-nav .btn-prev { flex: 0 0 30%; }
}

@media print {
    body { background: #fff; padding: 0; }
    .container { border: none; padding: 0; }
    #dark-mode-toggle { display: none; }
}
