/* 晨读打卡 · 网页版全站样式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #FFF6E9; color: #3A3226; font-size: 15px; line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 15px; }

.page-body { max-width: 520px; margin: 0 auto; padding: 16px 14px 60px; }
.topbar {
    max-width: 520px; margin: 0 auto; padding: 14px 14px 0;
    display: flex; align-items: center; justify-content: space-between;
}
.topbar-back { color: #8A8071; font-size: 14px; padding: 6px 10px 6px 0; }
.topbar-title { font-size: 16px; font-weight: 600; color: #6B5B3E; }
.topbar-right { min-width: 60px; text-align: right; font-size: 13px; color: #8A8071; }

/* 首页 */
.home { max-width: 520px; margin: 0 auto; padding: 46px 20px 40px; }
.hero { text-align: center; margin-bottom: 44px; }
.hero-sun {
    width: 76px; height: 76px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #FFDF9E, #FAC775);
    margin: 0 auto 16px; box-shadow: 0 4px 20px rgba(234, 160, 58, .35);
}
.hero-title { font-size: 26px; font-weight: 600; color: #633806; }
.hero-sub { font-size: 13px; color: #8A8071; margin-top: 4px; }
.resume-bar {
    display: flex; align-items: center; justify-content: space-between;
    background: #FFF1D6; border-radius: 12px; padding: 14px 18px; margin-bottom: 14px;
}
.resume-text { font-size: 15px; color: #854F0B; font-weight: 500; }
.resume-arrow { color: #C09A5B; font-size: 20px; }
.role-card {
    background: #FFF; border-radius: 16px; padding: 22px;
    display: flex; align-items: center; margin-bottom: 14px;
    box-shadow: 0 2px 12px rgba(186, 117, 23, .08);
}
.role-icon {
    width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 600; margin-right: 16px;
}
.role-icon-student { background: #FAEEDA; color: #854F0B; }
.role-icon-teacher { background: #E1F5EE; color: #0F6E56; }
.role-info { flex: 1; min-width: 0; }
.role-title { font-size: 17px; font-weight: 600; }
.role-desc { font-size: 13px; color: #8A8071; margin-top: 2px; }
.role-arrow { color: #C9BFAF; font-size: 22px; }
.foot { text-align: center; font-size: 12px; color: #B9AE9C; margin-top: 34px; }

/* 通用卡片 */
.card {
    background: #FFF; border-radius: 16px; padding: 18px;
    margin-bottom: 14px; box-shadow: 0 2px 12px rgba(186, 117, 23, .07);
}
.btn-primary, .btn-ghost, .btn-danger {
    display: block; width: 100%; border-radius: 40px;
    padding: 13px 0; font-size: 16px; font-weight: 600; text-align: center;
}
.btn-primary { background: #E87D2B; color: #FFF; }
.btn-primary:active { background: #D0691C; }
.btn-primary:disabled { background: #EFC49B; }
.btn-ghost { background: #FFF; color: #BA7517; border: 1.5px solid #E8C79A; }
.btn-ghost:disabled { color: #D9C9A8; }
.btn-danger { background: #FCEBEB; color: #A32D2D; font-weight: 500; }
.tag {
    display: inline-block; padding: 2px 12px; border-radius: 20px;
    font-size: 12px; background: #FAEEDA; color: #854F0B; white-space: nowrap;
}
.tag-green { background: #E1F5EE; color: #0F6E56; }
.tag-red { background: #FCEBEB; color: #A32D2D; }
.tag-gray { background: #F1EFE8; color: #5F5E5A; }
.muted { color: #8A8071; font-size: 13px; }
.empty-state { text-align: center; padding: 48px 0; color: #8A8071; font-size: 14px; }
.empty-state .btn-ghost { width: 160px; margin: 16px auto 0; }

/* 表单 */
.field { margin-bottom: 16px; }
.field-label { font-size: 14px; color: #6B6152; margin-bottom: 6px; display: block; }
.field input, .field textarea, .field select {
    background: #FFF; border: 1.5px solid #EBDCC3; border-radius: 10px;
    padding: 11px 14px; font-size: 15px; width: 100%;
}
.field textarea { min-height: 96px; resize: vertical; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.error-text { color: #A32D2D; font-size: 13px; margin: 8px 0; min-height: 18px; }
.link-quiet { color: #BA7517; font-size: 14px; text-align: center; display: block; margin: 14px 0 0; }

/* 统计格 */
.stat-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.stat-card {
    flex: 1; min-width: 42%;
    background: #FFF; border-radius: 16px; padding: 16px 18px;
    box-shadow: 0 2px 12px rgba(186, 117, 23, .07);
}
.stat-num { font-size: 26px; font-weight: 600; color: #BA7517; }
.stat-label { font-size: 12px; color: #8A8071; }
.section-title { font-size: 16px; font-weight: 600; margin: 22px 0 10px; }

/* 任务列表（学生） */
.me-card {
    display: flex; justify-content: space-between; align-items: center;
    background: #FFF; border-radius: 16px; padding: 18px; margin-bottom: 14px;
    box-shadow: 0 2px 12px rgba(186, 117, 23, .07);
}
.me-name { font-size: 18px; font-weight: 600; }
.me-group { font-size: 12px; color: #8A8071; margin-top: 2px; }
.me-right { text-align: center; }
.me-points { font-size: 24px; font-weight: 600; color: #BA7517; }
.me-points-label { font-size: 11px; color: #8A8071; }
.week-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.week-title { font-size: 15px; font-weight: 600; color: #6B5B3E; }
.week-nav { color: #BA7517; font-size: 14px; padding: 6px 8px; }
.week-nav-disabled { color: #CFC5B2; }
.date-row {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 6px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.date-row::-webkit-scrollbar { display: none; }
.date-chip {
    flex-shrink: 0; width: 62px; background: #FFF; border-radius: 14px;
    padding: 10px 0 8px; text-align: center; border: 2px solid transparent;
}
.date-chip-on { border-color: #E87D2B; }
.date-chip-week { font-size: 12px; color: #8A8071; }
.date-chip-day { font-size: 15px; font-weight: 600; margin-top: 1px; }
.date-chip-dot { width: 7px; height: 7px; border-radius: 50%; margin: 5px auto 0; background: #E4DECF; }
.dot-done { background: #35A47C; }
.dot-todo { background: #E8A23C; }
.task-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-card-future { opacity: .55; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.task-status { flex-shrink: 0; }
.bonus-banner {
    background: #E1F5EE; color: #0F6E56; border-radius: 12px;
    padding: 14px; font-size: 14px; text-align: center; margin-top: 4px;
}
.logout { text-align: center; color: #B9AE9C; font-size: 13px; padding: 24px 0 0; }

/* 打卡页 */
.task-head { margin-bottom: 12px; }
.task-head-title { font-size: 18px; font-weight: 600; }
.pages-wrap { position: relative; }
.pages {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    border-radius: 16px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.pages::-webkit-scrollbar { display: none; }
.page-card {
    flex: 0 0 100%; scroll-snap-align: center;
    background: #FFF; border-radius: 16px; padding: 22px 20px; min-height: 200px;
    box-shadow: 0 2px 12px rgba(186, 117, 23, .07);
}
.page-num { font-size: 12px; color: #BA7517; margin-bottom: 10px; }
.page-text { font-size: 18px; line-height: 2; color: #4A3B22; }
/* 文字素材自动排版：每段首行缩进 2 字，段间留白 */
.page-text .para { text-indent: 2em; margin: 0 0 .6em; }
.page-text .para:last-child { margin-bottom: 0; }
.page-text .para-title { text-indent: 0; font-weight: 600; color: #6B5427; margin: 0 0 .4em; }
.swipe-hint { text-align: center; margin: 8px 0 4px; }
.rec-area { text-align: center; padding: 24px 0 8px; }
.rec-status {
    display: inline-flex; align-items: center; gap: 8px;
    background: #FDECEC; color: #C0392B; border-radius: 20px;
    padding: 6px 16px; font-size: 14px; margin-bottom: 18px;
}
.rec-blink {
    width: 9px; height: 9px; border-radius: 50%; background: #C0392B;
    animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: .15; } }
.rec-btn {
    width: 132px; height: 132px; border-radius: 50%;
    background: #E87D2B; color: #FFF; font-size: 19px; font-weight: 600;
    box-shadow: 0 8px 24px rgba(232, 125, 43, .4);
    display: inline-flex; align-items: center; justify-content: center;
}
.rec-btn:active { transform: scale(.96); }
.rec-btn-on { background: #C0392B; box-shadow: 0 8px 24px rgba(192, 57, 43, .4); }
.rec-tip { margin-top: 14px; }
.wx-connect {
    background: #FFF8EC; border: 1.5px dashed #E8C79A; border-radius: 12px;
    padding: 12px 14px; font-size: 13px; color: #8A6222; margin-bottom: 12px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.wx-connect-btn {
    flex-shrink: 0; background: #E1F5EE; color: #0F6E56; border-radius: 20px;
    padding: 7px 14px; font-size: 13px; font-weight: 600;
}
.overlay {
    position: fixed; inset: 0; background: rgba(58, 50, 38, .55);
    display: flex; align-items: center; justify-content: center; z-index: 99; padding: 24px;
}
.result-card {
    background: #FFF; border-radius: 20px; padding: 32px 26px;
    max-width: 320px; width: 100%; text-align: center;
    animation: pop .35s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.star-pop {
    width: 74px; height: 74px; margin: 0 auto 12px; border-radius: 50%;
    background: #FDEBD2; color: #E8A23C; font-size: 40px; line-height: 74px;
    animation: star .7s cubic-bezier(.2,1.6,.4,1);
}
@keyframes star { from { transform: scale(0) rotate(-40deg); } }
.fail-icon {
    width: 74px; height: 74px; margin: 0 auto 12px; border-radius: 50%;
    background: #FCEBEB; color: #A32D2D; font-size: 40px; font-weight: 600; line-height: 74px;
}
.result-title { font-size: 19px; font-weight: 600; }
.result-points { font-size: 26px; font-weight: 600; color: #BA7517; margin: 8px 0 2px; }
.result-bonus { color: #0F6E56; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.result-actions { margin-top: 18px; display: grid; gap: 10px; }
.result-fail-text { margin: 10px 0 4px; }
.judge-box { text-align: center; padding: 40px 0; }
.judge-loading {
    width: 42px; height: 42px; margin: 0 auto 14px; border-radius: 50%;
    border: 4px solid #F0E4CC; border-top-color: #E87D2B;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.done-box { text-align: center; padding: 30px 0; }
.done-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.done-box .btn-primary { width: 220px; margin: 18px auto 0; }

/* 排行榜 */
.rank-row {
    display: flex; align-items: center; gap: 12px;
    background: #FFF; border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
}
.rank-row-me { border: 2px solid #E8A23C; }
.rank-no { width: 30px; text-align: center; font-size: 16px; font-weight: 600; color: #BA7517; flex-shrink: 0; }
.rank-no-top { font-size: 18px; }
.rank-name { flex: 1; min-width: 0; }
.rank-name b { font-size: 15px; }
.rank-name .muted { display: block; font-size: 11px; }
.rank-pts { font-size: 15px; font-weight: 600; color: #BA7517; flex-shrink: 0; }
.rank-gap { text-align: center; color: #0F6E56; font-size: 13px; padding: 14px 0 4px; }

/* 辅导端 */
.menu-card {
    display: flex; align-items: center; gap: 14px;
    background: #FFF; border-radius: 16px; padding: 18px; margin-bottom: 12px;
    box-shadow: 0 2px 12px rgba(186, 117, 23, .07);
}
.menu-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.menu-main { flex: 1; min-width: 0; }
.menu-title { font-size: 16px; font-weight: 600; }
.menu-desc { font-size: 12px; color: #8A8071; margin-top: 1px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0; background: #FFF; border-radius: 20px; padding: 6px 16px;
    font-size: 13px; color: #6B6152;
}
.chip-on { background: #E87D2B; color: #FFF; font-weight: 600; }
.stu-row { display: flex; align-items: center; gap: 10px; }
.stu-main { flex: 1; min-width: 0; }
.stu-name { font-size: 15px; font-weight: 600; }
.stu-meta { font-size: 12px; color: #8A8071; }
.stu-pts { font-size: 13px; color: #BA7517; font-weight: 600; flex-shrink: 0; }
.stu-del { color: #C9BFAF; font-size: 13px; flex-shrink: 0; padding: 6px; }
.task-stat-bar { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.stat-bar-track { flex: 1; height: 8px; border-radius: 4px; background: #F1EFE8; overflow: hidden; }
.stat-bar-fill { height: 100%; background: #35A47C; border-radius: 4px; }
.expand-head { display: flex; align-items: center; justify-content: space-between; }
.expand-arrow { color: #C9BFAF; font-size: 14px; padding: 6px; flex-shrink: 0; }
.sub-row {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 9px 0; border-top: 1px solid #F5EFE3; font-size: 13.5px;
}
.sub-name { flex: 1; min-width: 0; }
.listen-btn {
    flex-shrink: 0; background: #FAEEDA; color: #854F0B; border-radius: 16px;
    padding: 4px 12px; font-size: 12px; font-weight: 600;
}
.listen-btn-disabled { background: #F1EFE8; color: #B9AE9C; }
.copy-btn {
    background: #F1EFE8; color: #5F5E5A; border-radius: 16px;
    padding: 5px 13px; font-size: 12.5px;
}
.delete-account { background: #FCEBEB; color: #A32D2D; }
audio { width: 100%; margin-top: 8px; }

/* toast */
#toast {
    position: fixed; left: 50%; bottom: 18%; transform: translateX(-50%) translateY(10px);
    background: rgba(58, 50, 38, .88); color: #FFF; border-radius: 10px;
    padding: 10px 20px; font-size: 14px; opacity: 0; pointer-events: none;
    transition: all .25s; z-index: 199; max-width: 80vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 可点击卡片的指针样式（全端生效） */
.role-card, .menu-card, .chip { cursor: pointer; }

/* 素材图片（辅导端编辑页） */
/* 素材形式二选一：做成两个大按钮，辅导一眼能看到「传图片」这条路 */
.mode-pick { display: grid; grid-template-columns: 1fr; gap: 10px; }
.mode-opt {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    text-align: left; background: #FBF6EC; border: 1.5px solid #EFE3CC;
    border-radius: 14px; padding: 14px 16px; cursor: pointer;
    font-family: inherit; color: #4A3B22; transition: all .15s;
}
.mode-opt:hover { border-color: #E0B978; background: #FFF9EF; }
.mode-opt.mode-on { border-color: #BA7517; background: #FFF3DE; box-shadow: 0 2px 10px rgba(186,117,23,.12); }
.mode-emoji { font-size: 20px; line-height: 1.2; }
.mode-name { font-size: 16px; font-weight: 600; }
.mode-opt.mode-on .mode-name { color: #854F0B; }
.mode-desc { font-size: 13px; color: #8A8071; }

/* 拖拽上传区 */
.drop-zone {
    border: 2px dashed #DCC9A6; border-radius: 14px; background: #FFFDF7;
    padding: 26px 16px; text-align: center; cursor: pointer;
    font-size: 14px; color: #6B6152; transition: all .15s;
}
.drop-zone:hover { border-color: #BA7517; background: #FFF8EC; }
.drop-zone.busy { border-color: #BA7517; background: #FFF3DE; cursor: default; }
.drop-icon { font-size: 26px; color: #C8A470; line-height: 1; margin-bottom: 6px; }
/* 拖着图片经过页面时，整页给个提示边框 */
body.dragging::after {
    content: '松手就把图片加进素材';
    position: fixed; inset: 12px; border: 3px dashed #BA7517;
    border-radius: 18px; background: rgba(255, 248, 236, .82);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #854F0B; pointer-events: none; z-index: 300;
}

.img-list { margin-top: 14px; display: grid; grid-template-columns: 1fr; gap: 12px; }
.img-item {
    display: flex; align-items: center; gap: 12px;
    background: #FBF6EC; border-radius: 12px; padding: 10px;
}
.img-thumb {
    width: 62px; height: 62px; object-fit: cover; border-radius: 8px;
    flex-shrink: 0; background: #FFF; border: 1px solid #EFE3CC;
}
.img-meta { flex: 1; min-width: 0; font-size: 13px; color: #6B6152; }
.img-ops { display: flex; gap: 6px; flex-shrink: 0; }

/* 学生打卡页 · 图片素材模式 */
.material-img {
    display: block; width: 100%; border-radius: 14px; margin-bottom: 12px;
    background: #FFF; box-shadow: 0 2px 12px rgba(186, 117, 23, .07);
}
body.mode-image .page-body { padding-bottom: 170px; }
body.mode-image .pages { display: block; overflow: visible; }
.rec-fixed {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(255, 247, 234, .97); border-top: 1px solid #F0E4CC;
    padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
    text-align: center; backdrop-filter: blur(8px);
}
.rec-fixed .rec-btn {
    width: 100%; max-width: 420px; height: 62px; border-radius: 32px;
    font-size: 18px; box-shadow: 0 4px 14px rgba(232, 125, 43, .3);
}
.rec-fixed .rec-status { margin-bottom: 10px; }
.rec-fixed .rec-tip { display: none; }

/* ============================================================
   辅导端桌面布局（body.page-teacher，屏幕宽 ≥ 900px 时生效）
   学生端保持手机优先的 520px 居中布局，不参与以下规则
   ============================================================ */
@media (min-width: 900px) {
    body.page-teacher { background: #FBF3E3; }
    body.page-teacher .topbar,
    body.page-teacher .page-body { max-width: 1080px; }
    body.page-teacher .topbar {
        position: sticky; top: 0; z-index: 20;
        background: rgba(251, 243, 227, .96);
        padding-top: 18px; padding-bottom: 10px;
        border-bottom: 1px solid rgba(232, 199, 154, .35);
    }
    body.page-teacher .topbar-title { font-size: 18px; }
    body.page-teacher .topbar-right, body.page-teacher .topbar-back { font-size: 15px; }

    /* 鼠标悬停反馈 */
    body.page-teacher .menu-card, body.page-teacher .role-card {
        transition: transform .15s, box-shadow .15s;
    }
    body.page-teacher .menu-card:hover, body.page-teacher .role-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 18px rgba(186, 117, 23, .16);
    }
    body.page-teacher .copy-btn:hover, body.page-teacher .listen-btn:hover,
    body.page-teacher .chip:hover { opacity: .78; }
    body.page-teacher .expand-head { cursor: pointer; }
    body.page-teacher .stu-del:hover { color: #A32D2D; }

    /* 工作台：三个功能入口并排 */
    .menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
    .menu-grid .menu-card { margin-bottom: 0; }
    body.page-teacher .stat-grid .stat-card { min-width: 0; }

    /* 素材管理：卡片两列排布 */
    #listArea.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
    #listArea.grid-2 > .card { margin-bottom: 0; }
    #listArea.grid-2 > .empty-state { grid-column: 1 / -1; }

    /* 左主右辅的两栏布局（学员管理 / 素材编辑） */
    .two-col { display: flex; gap: 16px; align-items: flex-start; }
    .two-col > .col-main { flex: 1; min-width: 0; }
    .two-col > .col-side { width: 380px; flex-shrink: 0; }
    .col-main .chip-row { margin-bottom: 12px; }

    /* 学员管理：名单卡片自动多列 */
    .stu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
    .stu-grid > .card { margin-bottom: 0; }
    .stu-grid > .empty-state { grid-column: 1 / -1; }

    /* 统计页：展开后的名单两列，一屏看全班 */
    .sub-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
    .sub-list > .muted, .sub-list > .copy-btn, .sub-list > #playBar { grid-column: 1 / -1; }
    .sub-list > .copy-btn { justify-self: start; }

    /* 素材编辑：保存按钮不拉通全宽 */
    body.page-teacher .save-bar { max-width: 420px; margin: 4px auto 0; }

    /* 素材形式两个按钮在宽屏并排 */
    .mode-pick { grid-template-columns: 1fr 1fr; }

    /* 素材图片：桌面两列 */
    .img-list { grid-template-columns: 1fr 1fr; }
    .img-thumb { width: 78px; height: 78px; }

    /* 表单在宽屏下更紧凑 */
    body.page-teacher .field input, body.page-teacher .field textarea, body.page-teacher .field select {
        padding: 10px 14px;
    }

    /* 登录页保持窄卡片，不拉宽 */
    body.page-narrow .topbar, body.page-narrow .page-body { max-width: 520px; }
}
