/* ============================================================
   瑞雪记单词 - 全站样式（简约校园风）
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2f6fed;
    --primary-dark: #1d4fc4;
    --green: #16a34a;
    --red: #dc2626;
    --text: #1f2937;
    --text-sub: #64748b;
    --line: #e2e8f0;
    --bg: #f0f4f8;
    --card: #ffffff;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.main { min-height: calc(100vh - 130px); padding-top: 24px; padding-bottom: 40px; }

/* ---------- 顶栏 ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-admin { border-top: 4px solid var(--primary); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { font-size: 18px; font-weight: 700; color: var(--primary-dark); text-decoration: none; }
.topbar-admin .brand { color: var(--primary); }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: var(--text); text-decoration: none; font-size: 14px; }
.nav a:hover { color: var(--primary); }
.nav-user { color: var(--text-sub); font-size: 13px; }
.nav-out { color: var(--red) !important; }

/* ---------- 页头 ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin-bottom: 4px; }
.sub { color: var(--text-sub); font-size: 13.5px; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 18px; }
.card-narrow { max-width: 520px; }
.card h3 { font-size: 16px; margin-bottom: 12px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13.5px; color: var(--text-sub); margin-bottom: 5px; }
input[type="text"], input[type="password"], input[type="file"], input[type="number"], textarea, select {
    width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px;
    font-size: 14px; outline: none; background: #fff; font-family: inherit;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus { border-color: var(--primary); }
input[disabled] { background: #f6f8fb; color: var(--text-sub); }
.search-input { width: 220px; }
.form-grid4 { display: grid; grid-template-columns: 2fr 2fr 3fr auto; gap: 10px; align-items: center; margin-bottom: 8px; }

/* 纸质默写补录 */
details.paper-form { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
details.paper-form summary { cursor: pointer; display: inline-block; color: var(--primary-dark); font-size: 13.5px; user-select: none; }
details.paper-form summary:hover { text-decoration: underline; }
details.paper-form .paper-body { margin-top: 12px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-block; padding: 8px 16px; border-radius: 6px; border: 1px solid transparent;
    font-size: 14px; cursor: pointer; text-decoration: none; line-height: 1.5; font-family: inherit;
    transition: all .15s; background: #fff; color: var(--text);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: #eef4ff; }
.btn-plain { border-color: var(--line); color: var(--text-sub); }
.btn-plain:hover { color: var(--text); border-color: #cbd5e1; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-lg { padding: 11px 28px; font-size: 15px; }
.btn-mini { padding: 3px 10px; font-size: 12.5px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-row.center { justify-content: center; margin-top: 18px; }
.inline { display: inline-block; margin: 0; }

/* ---------- 提示 ---------- */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #e0ecff; color: var(--primary-dark); }
.tag-gray { background: #f1f5f9; color: var(--text-sub); }
.tag-ok { background: #dcfce7; color: #166534; }
.tag-warn { background: #fef3c7; color: #92400e; }

/* ---------- 登录注册 ---------- */
.auth-card {
    max-width: 400px; margin: 60px auto; background: var(--card); border: 1px solid var(--line);
    border-radius: 12px; padding: 32px; box-shadow: 0 4px 20px rgba(15, 40, 80, .06);
}
.auth-card h2 { font-size: 20px; margin-bottom: 20px; text-align: center; color: var(--primary-dark); }
.auth-tip { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--text-sub); }
.auth-tip a { color: var(--primary); text-decoration: none; }
.admin-login-bg { background: linear-gradient(160deg, #eef4ff 0%, #f0f4f8 60%); }

/* ---------- 学习中心计划卡片 ---------- */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.plan-grid-one { grid-template-columns: 1fr; }
.plan-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.plan-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.plan-name { font-size: 17px; font-weight: 700; }
.plan-meta { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.plan-pct { font-size: 22px; font-weight: 700; color: var(--primary); }
.progress { height: 8px; background: #e8eef7; border-radius: 4px; overflow: hidden; margin-bottom: 14px; }
.progress-in { height: 100%; background: linear-gradient(90deg, var(--primary), #5a92ff); border-radius: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-grid-wide { grid-template-columns: repeat(6, 1fr); }
.stat { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; text-align: center; padding: 10px 4px; }
.stat b { display: block; font-size: 18px; color: var(--text); }
.stat span { font-size: 12px; color: var(--text-sub); }
.stat-card { padding: 16px 8px; }
.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.plan-done-flag { color: var(--green); font-size: 13.5px; font-weight: 600; }
.ok-flag { color: var(--green); font-size: 13.5px; font-weight: 600; }
.c-green { color: var(--green) !important; }
.c-red { color: var(--red) !important; }

/* ---------- 词库选择 ---------- */
.lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.lib-card { display: flex; gap: 12px; background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 16px; cursor: pointer; transition: border-color .15s; }
.lib-card:hover { border-color: #9db9f5; }
.lib-card input { width: 18px; height: 18px; margin-top: 4px; flex: none; }
.lib-card:has(input:checked) { border-color: var(--primary); background: #f7faff; }
.lib-disabled { opacity: .55; cursor: not-allowed; }
.lib-name { font-weight: 700; font-size: 15.5px; }
.lib-stage { color: var(--primary-dark); font-size: 13px; margin-top: 2px; }
.lib-remark { color: var(--text-sub); font-size: 13px; margin-top: 2px; }
.lib-facts { margin-top: 8px; font-size: 13px; color: var(--text-sub); }
.lib-facts b { color: var(--primary); }
.lib-has { margin-top: 6px; font-size: 12.5px; color: #92400e; }
.hint { color: var(--text-sub); font-size: 13px; }

/* ---------- 每日任务网格 ---------- */
.day-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.day-cell {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 14px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--card);
    text-decoration: none; color: var(--text); transition: transform .12s;
}
a.day-cell:hover { transform: translateY(-2px); border-color: var(--primary); }
.day-cell b { font-size: 15px; }
.day-cell span { font-size: 12.5px; color: var(--text-sub); margin-top: 3px; }
.day-cell.todo { border-left: 4px solid #cbd5e1; }
.day-cell.previewed { border-left: 4px solid #f59e0b; background: #fffbeb; }
.day-cell.done { border-left: 4px solid var(--green); background: #f0fdf4; }
.day-cell.done span { color: var(--green); }
.day-cell.previewed span { color: #b45309; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-sub); }
.legend .lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.lg-todo::before { background: #cbd5e1; }
.lg-previewed::before { background: #f59e0b; }
.lg-done::before { background: var(--green); }
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.pg { padding: 5px 12px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--text); font-size: 13.5px; background: #fff; }
.pg.current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 任务页 ---------- */
.task-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.state-badge { display: inline-block; padding: 4px 12px; border-radius: 12px; font-size: 13px; margin-right: 8px; }
.state-todo { background: #f1f5f9; color: var(--text-sub); }
.state-previewed { background: #fef3c7; color: #92400e; }
.state-done { background: #dcfce7; color: #166534; }
.report-card { border-left: 4px solid var(--green); }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; background: #f8fafc; color: var(--text-sub); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.table td { padding: 8px 10px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.table tr:hover td { background: #fafcff; }
.w-word { font-weight: 600; }
.w-phon { color: var(--text-sub); font-family: "Segoe UI", "Times New Roman", serif; font-style: italic; }
.ops { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.ops input[type="text"], .table input[type="text"] { padding: 4px 8px; font-size: 13px; border-radius: 4px; }
td .table input[type="text"] { width: 100%; }
.list-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.center { text-align: center; }
.full { width: 100%; }
.user-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- 在线默写（与空白默写卷同版式：4 列 × 10 行表格格） ---------- */
.quiz-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1.5px solid #333; border-left: 1.5px solid #333; background: var(--card); }
.quiz-item { border-right: 1.5px solid #333; border-bottom: 1.5px solid #333; min-height: 118px; padding: 8px 10px; display: flex; flex-direction: column; overflow: hidden; }
.quiz-head { display: flex; align-items: flex-start; gap: 6px; }
.quiz-no { flex: none; min-width: 20px; height: 20px; border-radius: 50%; background: #e8eef7; color: var(--primary-dark); font-size: 11.5px; display: flex; align-items: center; justify-content: center; font-weight: 600; margin-top: 1px; }
.quiz-mean { flex: 1; font-size: 13.5px; line-height: 1.45; color: #1e293b; word-break: break-word; }
.quiz-input { width: 100%; flex: none; margin-top: auto; border: none; border-bottom: 1.5px solid #94a3b8; border-radius: 0; padding: 4px 2px; font-size: 15px; text-align: center; }
.quiz-input:focus { border-bottom-color: var(--primary); }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 60px 20px; background: var(--card); border: 1px dashed var(--line); border-radius: 10px; }
.empty p { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty .sub { margin-bottom: 16px; }

/* ---------- 打印纸张视图（预习/默写页） ---------- */
.print-page { background: #e8edf3; padding: 20px 12px 40px; }
.sheet {
    max-width: 820px; margin: 0 auto 26px; background: #fff; padding: 28px 30px 30px;
    box-shadow: 0 2px 14px rgba(15, 40, 80, .12); border-radius: 4px;
}
.sheet-title { text-align: center; font-size: 19px; letter-spacing: 1px; margin-bottom: 6px; }
.ans-flag { display: inline-block; margin-left: 10px; font-size: 13px; color: var(--red); border: 1px solid var(--red); border-radius: 4px; padding: 0 8px; vertical-align: 3px; }
.sheet-sub { text-align: center; color: var(--text-sub); font-size: 12.5px; margin-bottom: 16px; }

.grid-page { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1.5px solid #333; border-left: 1.5px solid #333; }
.cell {
    border-right: 1.5px solid #333; border-bottom: 1.5px solid #333;
    min-height: 128px; padding: 6px 6px; display: flex; flex-direction: column; overflow: hidden;
}
.c-word { font-size: 13px; font-weight: 700; line-height: 1.35; word-break: break-word; }
.sheet-preview .c-word { font-size: 18px; line-height: 1.2; }
.sheet-preview .c-word, .sheet-preview .c-phon, .sheet-preview .c-mean { text-align: center; }
.sheet-preview .cell { justify-content: center; }
.c-phon { font-size: 10px; color: #475569; font-style: italic; line-height: 1.4; word-break: break-word; }
.c-mean { font-size: 11px; line-height: 1.45; word-break: break-word; color: #1e293b; }
.c-answer { font-size: 15px; font-weight: 700; color: #0f172a; line-height: 1.2; word-break: break-word; text-align: center; }
.c-ans-mean { font-size: 11.5px; line-height: 1.35; }
.c-line { margin-top: auto; border-bottom: 1px solid #94a3b8; min-height: 26px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 2px; }
.c-line-ans { min-height: 30px; }

.toolbar { max-width: 820px; margin: 0 auto 14px; display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; }
.toolbar-tip { flex: 1; font-size: 12.5px; color: var(--text-sub); }

/* ---------- 页脚 ---------- */
.footer { text-align: center; color: #94a3b8; font-size: 13px; padding: 20px 0 26px; }

/* ---------- 公开首页 ---------- */
.home .nav a { font-size: 13.5px; }
.home-hero { background: linear-gradient(160deg, #eef4ff 0%, #f0f4f8 65%, #e8f7ef 100%); border-bottom: 1px solid var(--line); }
.hero-in { display: flex; gap: 40px; align-items: center; padding-top: 56px; padding-bottom: 56px; }
.hero-text { flex: 1.15; min-width: 0; }
.hero-text h1 { font-size: 40px; line-height: 1.2; color: var(--primary-dark); letter-spacing: 1px; }
.hero-slogan { font-size: 18px; font-weight: 600; color: var(--text); margin-top: 12px; }
.hero-desc { color: var(--text-sub); font-size: 14.5px; margin-top: 12px; max-width: 560px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.hero-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.hero-chip { background: rgba(255,255,255,.8); border: 1px solid var(--line); border-radius: 20px; padding: 3px 12px; font-size: 12.5px; color: var(--primary-dark); }
.auth-box { flex: 1; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px 26px 24px; box-shadow: 0 8px 28px rgba(15, 40, 80, .10); scroll-margin-top: 80px; }
.auth-tabs { display: flex; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.auth-tab { flex: 1; background: none; border: none; padding: 10px 0; font-size: 15px; font-weight: 600; color: var(--text-sub); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; font-family: inherit; }
.auth-tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.auth-box .auth-tip { margin-top: 12px; }
.auth-box .auth-tip a { color: var(--primary); text-decoration: none; }

.home-section { padding: 48px 0 54px; }
.home-alt { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hm-h2 { text-align: center; font-size: 24px; color: var(--text); }
.hm-sub { text-align: center; color: var(--text-sub); font-size: 13.5px; margin: 8px 0 28px; }

.hm-feats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hm-feat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.hm-feat h3 { font-size: 16px; margin-bottom: 6px; }
.hm-feat p { font-size: 13.5px; color: var(--text-sub); }
.feat-ico { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 9px; color: #fff; font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.i-blue { background: var(--primary); }
.i-green { background: var(--green); }
.i-purple { background: #7c3aed; }
.i-orange { background: #d97706; }
.i-red { background: var(--red); }
.i-cyan { background: #0891b2; }

.hm-flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.hm-step { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.hm-step b { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 14px; margin-bottom: 10px; }
.hm-step h3 { font-size: 15.5px; margin-bottom: 6px; }
.hm-step p { font-size: 13.5px; color: var(--text-sub); }
.hm-step:not(:last-child)::after { content: "→"; position: absolute; right: -16px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 16px; z-index: 1; }
.hm-cta { text-align: center; margin-top: 30px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .plan-grid, .lib-grid, .task-cols, .cols-2 { grid-template-columns: 1fr; }
    .hero-in { flex-direction: column; gap: 30px; padding-top: 36px; padding-bottom: 36px; }
    .hero-text { text-align: center; }
    .hero-desc { margin-left: auto; margin-right: auto; }
    .hero-cta, .hero-chips { justify-content: center; }
    .auth-box { max-width: 440px; width: 100%; }
    .hm-feats { grid-template-columns: repeat(2, 1fr); }
    .hm-flow { grid-template-columns: repeat(2, 1fr); }
    .hm-step:not(:last-child)::after { content: none; }
    .stat-grid-wide { grid-template-columns: repeat(3, 1fr); }
    .day-grid { grid-template-columns: repeat(3, 1fr); }
    .quiz-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .day-grid { grid-template-columns: repeat(2, 1fr); }
    .nav { gap: 10px; }
    .nav-user { display: none; }
    .home .nav a:not(.btn) { display: none; }
    .hm-feats, .hm-flow { grid-template-columns: 1fr; }
    .hero-text h1 { font-size: 30px; }
    .grid-page { grid-template-columns: repeat(2, 1fr); }
    .cell { min-height: 110px; }
    .quiz-grid { grid-template-columns: 1fr; }
    .quiz-item { min-height: 96px; }
}
