/* ==========================================================================
   问卷星球 · 市调大赛调研问卷
   样式改编自 xmbhjQAQ/my-static-sites（CC BY-NC 4.0）的页面设计语言：
   圆角卡片容器、渐变背景、胶囊按钮、进度条、深浅色模式。
   仅保留问卷所需组件，配色改为青蓝系（可在 :root 一键切回原粉色）。
   ========================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
    /* 主色（青蓝系，贴合法律消费调研主题）
       想换回原作的粉色：把 --primary 改为 #ff8fab、--primary-strong 改为 #ff5c8a、
       --primary-soft 改为 #fff0f3、--accent 保持 #8eecf5 即可 */
    --primary: #2f7de1;
    --primary-strong: #1f5fc0;
    --primary-light: #a8c8f5;
    --primary-soft: #eef4fe;
    --accent: #35c7d4;

    --text-main: #253044;
    --text-light: #6b7789;
    --bg-body: #f7f9fc;
    --card-bg: rgba(255, 255, 255, 0.96);
    --line: #e8ebf1;
    --ok: #14a06d;
    --danger: #e03131;
}

body.dark-mode {
    --text-main: #eef1f6;
    --text-light: #a9b3c2;
    --bg-body: #161c2b;
    --card-bg: rgba(26, 33, 48, 0.96);
    --line: #2b3548;
    --primary-soft: #1e2a44;
    background: linear-gradient(135deg, #141a28 0%, #1b2438 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: linear-gradient(135deg, #cfe4fb 0%, #b9eef4 100%);
    background-attachment: fixed;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px 10px;
    line-height: 1.6;
}

.container {
    background: var(--card-bg);
    width: 100%;
    max-width: 540px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(18, 40, 80, 0.12);
    padding: 30px 22px;
    position: relative;
    margin-bottom: 20px;
}

/* ---------- 页面切换 ---------- */
.page { display: none; animation: fadeIn .4s ease forwards; }
.page.active { display: block; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- 通用按钮 ---------- */
.btn-main {
    background: linear-gradient(45deg, var(--primary), var(--primary-strong));
    color: #fff;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(47, 125, 225, 0.28);
    transition: all .2s;
    width: 100%;
    display: block;
    margin: 20px auto 0;
}
.btn-main:active { transform: scale(.96); }
.btn-main.hidden { display: none; }

.btn-ghost {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    box-shadow: none;
}

/* ---------- 欢迎页 ---------- */
.title-icon { font-size: 56px; text-align: center; margin-bottom: 10px; }
h1 { font-size: 24px; color: var(--primary-strong); text-align: center; margin-bottom: 8px; line-height: 1.4; }
.subtitle { text-align: center; font-size: 13px; color: var(--text-light); margin-bottom: 18px; }

.desc-box {
    background: var(--primary-soft);
    padding: 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.75;
    color: var(--text-main);
    margin-bottom: 22px;
    border-left: 4px solid var(--primary);
}
.desc-box b { color: var(--primary-strong); }
.desc-box ul { margin: 8px 0 0 20px; color: var(--text-light); }
/* 书名号改用规范写法，避免依赖字体特殊字形 */
.desc-box .bk { color: var(--primary-strong); font-weight: 600; }

/* 题干编号徽标 */
.q-tag {
    display: inline-block;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 10px;
    font-weight: 700;
    margin-bottom: 10px;
}

/* ---------- 答题页 ---------- */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 10px;
}
.btn-prev {
    background: transparent;
    border: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0;
}
.btn-prev.hidden { display: none; }
.progress-text { font-size: 13px; color: var(--text-light); font-weight: 500; }

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--line);
    border-radius: 999px;
    margin-bottom: 8px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    width: 0%;
    transition: width .3s ease;
    border-radius: 999px;
}
.progress-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
    font-size: 12px;
    margin-bottom: 22px;
}

.question-type-badge {
    display: inline-block;
    background: #e0f7fa;
    color: #00acc1;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-weight: 700;
}
body.dark-mode .question-type-badge { background: #14384a; color: #6fe3f0; }

.question-helper {
    color: var(--text-light);
    font-size: 12.5px;
    line-height: 1.6;
    margin: -2px 0 12px;
}
.question-text {
    font-size: 18px;
    line-height: 1.55;
    font-weight: 600;
    margin-bottom: 22px;
    min-height: 54px;
}
.question-text .qno {
    color: var(--primary);
    font-weight: 800;
    margin-right: 6px;
}
.required-star { color: var(--danger); margin-left: 4px; }

.options-wrapper { display: flex; flex-direction: column; gap: 12px; }

.option-btn {
    background: var(--card-bg);
    border: 2px solid var(--line);
    color: var(--text-main);
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 15px;
    cursor: pointer;
    transition: all .2s;
    text-align: left;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    line-height: 1.5;
}
.option-btn:hover { border-color: var(--primary-light); background: var(--primary-soft); }
.option-btn.selected {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-strong);
    animation: pop .3s ease;
    box-shadow: 0 0 0 4px rgba(47, 125, 225, .18);
}
.opt-mark {
    width: 22px;
    height: 22px;
    border: 2px solid var(--line);
    border-radius: 50%;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #fff;
    transition: all .15s;
}
.option-btn.square .opt-mark { border-radius: 6px; }
.option-btn.selected .opt-mark {
    background: var(--primary);
    border-color: var(--primary);
}
.option-btn .opt-label { flex: 1; }

/* 量表（0-10 分） */
.scale-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}
.scale-btn {
    background: var(--card-bg);
    border: 2px solid var(--line);
    border-radius: 10px;
    height: 48px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    transition: all .15s;
}
.scale-btn:hover { border-color: var(--primary-light); }
.scale-btn.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(47, 125, 225, .18);
}
.scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-light);
    margin-top: 8px;
}

@keyframes pop {
    0% { transform: scale(.97); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* 开放题输入框 */
.text-input {
    width: 100%;
    border: 2px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-main);
    background: var(--card-bg);
    outline: none;
    resize: vertical;
    min-height: 120px;
    transition: border-color .15s;
}
.text-input:focus { border-color: var(--primary); }
.text-input::placeholder { color: var(--text-light); opacity: .75; }

/* ---------- 提交完成页 ---------- */
.done-icon { font-size: 64px; text-align: center; margin-bottom: 12px; }
.done-title { font-size: 20px; font-weight: 800; color: var(--primary-strong); text-align: center; margin-bottom: 10px; }
.done-desc { font-size: 14px; color: var(--text-light); text-align: center; line-height: 1.8; margin-bottom: 22px; }

.stats-box {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    background: var(--primary-soft);
    font-size: 13px;
    line-height: 2;
}
.stats-box .row { display: flex; justify-content: space-between; gap: 14px; }
.stats-box .k { color: var(--text-light); }
.stats-box .v { font-weight: 800; }

/* ---------- 提交状态提示 ---------- */
.upload-box:empty { display: none; }
.upload-box {
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
    font-size: 13.5px;
    line-height: 1.7;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .6);
}
body.dark-mode .upload-box { background: rgba(255, 255, 255, .04); }
.upload-ok { color: var(--ok); font-weight: 800; font-size: 14.5px; }
.upload-fail { color: var(--danger); font-weight: 700; }

/* 上传成功 → 导出按钮降级；上传失败 → 高亮提示导出 */
#export-box.secondary { opacity: .72; }
#export-box.highlight .btn-main:first-child {
    box-shadow: 0 0 0 4px rgba(47, 125, 225, .18), 0 8px 20px rgba(47, 125, 225, .3);
}

/* ---------- 提示条 ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(20px);
    background: rgba(24, 34, 52, .95);
    color: #fff;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 12000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
    max-width: 90%;
    text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 右上角控件 ---------- */
#dark-mode-toggle {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000;
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 19px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .3s;
}

/* ---------- 页脚 ---------- */
.footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.7;
}
.footer a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* ---------- 首页导航卡（index.html 用） ---------- */
.paper-list { display: flex; flex-direction: column; gap: 14px; }
.paper-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 2px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    transition: all .2s;
    background: var(--card-bg);
}
.paper-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(47, 125, 225, .14);
}
.paper-card .no {
    display: inline-block;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: 12px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 8px;
    margin-bottom: 8px;
}
.paper-card .t { font-size: 16px; font-weight: 800; color: var(--text-main); line-height: 1.45; }
.paper-card .d { font-size: 13px; color: var(--text-light); margin-top: 6px; line-height: 1.6; }
.paper-card .m { font-size: 12px; color: var(--primary); margin-top: 10px; font-weight: 700; }

/* ---------- 移动端适配 ---------- */
@media (max-width: 480px) {
    body { padding: 15px 6px; }
    .container { padding: 24px 16px; border-radius: 16px; }
    h1 { font-size: 20px; }
    .title-icon { font-size: 46px; }
    .question-text { font-size: 16px; min-height: 48px; margin-bottom: 18px; }
    .option-btn { padding: 12px 14px; font-size: 14px; border-radius: 10px; }
    .scale-grid { grid-template-columns: repeat(6, 1fr); gap: 6px; }
    .scale-btn { height: 42px; font-size: 14px; }
}
