* { box-sizing: border-box; margin: 0; padding: 0; }

/* 守卫：作者 display 规则（.btn/.learn-next 等）优先级高于 UA 的 [hidden]，
   没有这条时 hidden 属性会被覆盖，按钮藏不掉 */
[hidden] { display: none !important; }


body {
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    background: #f5f7fa;
    color: #2c3e50;
    line-height: 1.6;
}

/* ===== 导航栏 ===== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { font-size: 1.2rem; font-weight: bold; color: #2c3e50; text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-links a { color: #2c3e50; text-decoration: none; }
.nav-links a:hover { color: #4a90d9; }
.nav-user { color: #7f8c8d; font-size: 0.9rem; }
.inline-form { display: inline; }
.link-btn {
    background: none; border: none; color: #4a90d9; cursor: pointer;
    font-size: 1rem; padding: 0;
}

/* ===== 布局 ===== */
.container { max-width: 960px; margin: 0 auto; padding: 32px 20px; }
h1 { margin-bottom: 20px; }
h2 { margin: 24px 0 12px; }
a { color: #4a90d9; }

/* ===== 按钮 ===== */
.btn {
    display: inline-block;
    background: #4a90d9; color: #fff;
    border: none; border-radius: 8px;
    padding: 10px 22px; font-size: 1rem;
    cursor: pointer; text-decoration: none;
}
.btn:hover { background: #357abd; }
.btn-outline { background: #fff; color: #4a90d9; border: 1px solid #4a90d9; }
.btn-outline:hover { background: #eaf2fb; }
.btn-small { padding: 5px 14px; font-size: 0.9rem; }
.btn-full { width: 100%; margin-top: 8px; }

/* ===== 首页 ===== */
.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 { font-size: 2.2rem; margin-bottom: 12px; }
.hero p { color: #7f8c8d; margin-bottom: 24px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; }
.stats { margin-top: 16px; }
.stat-cards { display: flex; gap: 20px; flex-wrap: wrap; }
.stat-card {
    flex: 1; min-width: 220px;
    background: #fff; border-radius: 12px;
    padding: 20px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.stat-num { font-size: 1.8rem; font-weight: bold; color: #4a90d9; }
.stat-label { color: #7f8c8d; margin: 4px 0 10px; }
.progress-bar { height: 8px; background: #ecf0f1; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: #4a90d9; border-radius: 4px; }

/* ===== 音标 ===== */
.phoneme-section .count { font-size: 0.9rem; color: #7f8c8d; font-weight: normal; }
.phoneme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}
.phoneme-card {
    position: relative;
    display: flex; flex-direction: column; align-items: center;
    background: #fff; border-radius: 10px; padding: 16px 8px;
    text-decoration: none; color: #2c3e50;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: transform 0.1s;
}
.phoneme-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); }
.phoneme-card .symbol { font-size: 1.5rem; font-weight: bold; }
.phoneme-card .example { color: #7f8c8d; font-size: 0.9rem; }
.phoneme-card.learned { outline: 2px solid #7ed6a5; }
.badge {
    position: absolute; top: 6px; right: 8px;
    font-size: 0.7rem; color: #27ae60;
}

/* ===== 详情页 ===== */
.detail-card {
    background: #fff; border-radius: 12px;
    padding: 28px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.big-symbol { font-size: 3.5rem; font-weight: bold; color: #4a90d9; }
.category-tag {
    display: inline-block;
    background: #eaf2fb; color: #4a90d9;
    border-radius: 20px; padding: 2px 14px; font-size: 0.85rem;
    margin: 8px 0 16px;
}
.tip { background: #fdf6e3; border-radius: 8px; padding: 12px 16px; margin-bottom: 8px; }
.word-list, .sentence-list { list-style: none; margin: 12px 0 24px; }
.word-list li, .sentence-list li {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 8px; border-bottom: 1px solid #ecf0f1;
}
.play-btn {
    background: #eaf2fb; border: none; border-radius: 50%;
    width: 40px; height: 40px; font-size: 1.1rem;
    cursor: pointer; flex-shrink: 0;
}
.play-btn:hover { background: #d4e6f7; }
.play-btn.playing { background: #4a90d9; }
.word { font-size: 1.15rem; font-weight: 600; min-width: 100px; }
.meaning { color: #7f8c8d; }
.sentence-text { display: flex; flex-direction: column; }
.sentence-text .en { font-size: 1.1rem; font-weight: 600; }
.sentence-text .cn { color: #7f8c8d; font-size: 0.9rem; }

/* ===== 课程卡片 ===== */
.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.lesson-card {
    position: relative;
    display: block; background: #fff; border-radius: 10px;
    padding: 18px; text-decoration: none; color: #2c3e50;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.lesson-card:hover { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); }
.lesson-card.learned { outline: 2px solid #7ed6a5; }
.lesson-title { font-size: 1.1rem; font-weight: 600; }
.lesson-meta { color: #7f8c8d; font-size: 0.9rem; margin-top: 4px; }

/* ===== 登录注册 ===== */
.auth-card {
    max-width: 380px; margin: 48px auto;
    background: #fff; border-radius: 12px;
    padding: 32px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.auth-card h1 { text-align: center; }
.auth-card label { display: block; margin: 14px 0; font-size: 0.95rem; }
.auth-card input {
    width: 100%; padding: 10px 12px; margin-top: 4px;
    border: 1px solid #dfe4ea; border-radius: 8px; font-size: 1rem;
}
.auth-card input:focus { outline: 2px solid #4a90d9; border-color: transparent; }
.auth-switch { text-align: center; margin-top: 16px; color: #7f8c8d; }
.error { color: #e74c3c; text-align: center; }
.success { color: #27ae60; text-align: center; }

/* ===== 音素块 ===== */
.tiles { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.phoneme-tile {
    display: inline-block;
    background: #f0f3f7; border: 1px solid #dfe4ea; border-radius: 6px;
    padding: 2px 8px; font-size: 0.95rem; color: #7f8c8d;
    user-select: none;
}
.phoneme-tile[data-audio] { color: #2c3e50; cursor: pointer; }
.phoneme-tile[data-audio]:hover { background: #eaf2fb; border-color: #4a90d9; }
.phoneme-tile.tile-active {
    background: #4a90d9; border-color: #4a90d9; color: #fff;
    transition: background 0.15s;
}
/* 学词卡片：音素内嵌在音标行，去掉块样式；播放时当前音素变黄 */
.big-ipa .phoneme-tile {
    background: none; border: none; border-radius: 4px;
    padding: 0 1px; font-size: inherit; color: inherit;
}
.big-ipa .phoneme-tile[data-audio]:hover { background: #eaf2fb; border: none; }
.big-ipa .phoneme-tile.tile-active { background: #ffe08a; border: none; color: #2c3e50; }

/* ===== 掌握度徽章 ===== */
.badge-mastery {
    display: inline-block;
    border-radius: 20px; padding: 2px 12px; font-size: 0.8rem;
    white-space: nowrap;
}
.badge-mastery[data-mastery="已掌握"] { background: #e3f7ec; color: #27ae60; }
.badge-mastery[data-mastery="巩固中"] { background: #eaf2fb; color: #4a90d9; }
.badge-mastery[data-mastery="薄弱"] { background: #fdecea; color: #e74c3c; }
.badge-mastery[data-mastery="学练中"] { background: #fdf6e3; color: #b8860b; }
.badge-mastery[data-mastery="未学"] { background: #f0f3f7; color: #7f8c8d; }

/* ===== 词库卡片 / 掌握度分布条 ===== */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.book-card {
    display: block; background: #fff; border-radius: 10px;
    padding: 18px; text-decoration: none; color: #2c3e50;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.book-card:hover { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); }
.book-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.book-title { font-size: 1.1rem; font-weight: 600; }
.book-level { color: #7f8c8d; font-size: 0.85rem; }
.mastery-bar {
    display: flex; height: 10px; border-radius: 5px;
    overflow: hidden; background: #ecf0f1;
}
.mastery-bar .seg { height: 100%; }
.mastery-bar .seg[data-mastery="已掌握"] { background: #27ae60; }
.mastery-bar .seg[data-mastery="巩固中"] { background: #4a90d9; }
.mastery-bar .seg[data-mastery="薄弱"] { background: #e74c3c; }
.mastery-bar .seg[data-mastery="学练中"] { background: #f1c40f; }
.mastery-bar .seg[data-mastery="未学"] { background: #dfe4ea; }
.mastery-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; font-size: 0.8rem; color: #7f8c8d; }
.legend-item::before {
    content: ""; display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; margin-right: 4px; background: #dfe4ea;
}
.legend-item[data-mastery="已掌握"]::before { background: #27ae60; }
.legend-item[data-mastery="巩固中"]::before { background: #4a90d9; }
.legend-item[data-mastery="薄弱"]::before { background: #e74c3c; }
.legend-item[data-mastery="学练中"]::before { background: #f1c40f; }

/* ===== 词卡（词库详情行） ===== */
.count-sub { font-size: 0.9rem; color: #7f8c8d; font-weight: normal; }
.word-row { flex-wrap: wrap; row-gap: 6px; }
.word-row .ipa { color: #7f8c8d; font-family: monospace; }
.word-row .meaning { flex: 1; min-width: 60px; }
.word-actions { display: flex; gap: 10px; font-size: 0.9rem; }

/* ===== 学词页 ===== */
.learn-card .big-word { font-size: 3rem; font-weight: bold; margin: 0 0 4px; }
.big-ipa {
    font-size: 2.1rem; color: #2c3e50; margin: 8px 0;
    display: flex; align-items: center; gap: 14px;
}
.meaning-big { font-size: 1.2rem; margin-bottom: 20px; }
.full-def {
    text-align: left; border-top: 1px solid #eee; padding-top: 10px;
    margin-bottom: 14px; font-size: 0.95rem; line-height: 1.7;
}
.full-def p { margin: 0 0 2px; }
.full-def-title { color: #95a5a6; font-size: 0.8rem; margin-bottom: 6px !important; }
.full-def.en { color: #7f8c8d; font-size: 0.9rem; }
.full-def.forms .form-item .form-label { color: #95a5a6; font-size: 0.82rem; margin-right: 2px; }
.full-def.forms .form-item { white-space: nowrap; }
.learn-meta { color: #7f8c8d; font-size: 0.9rem; margin-bottom: 12px; }
.learn-next { display: flex; gap: 12px; margin-top: 16px; }

/* ===== 答题（quiz） ===== */
.quiz-hint { color: #7f8c8d; margin-bottom: 16px; }
/* 音标题（看音标选单词 / 看音标写单词）：音标是题眼，说明弱化、音标放大为主角 */
.quiz-instruction { color: #7f8c8d; margin-bottom: 4px; }
.quiz-ipa-hero {
    font-size: clamp(2.4rem, 9vw, 3.4rem); font-weight: 600; color: #2c3e50;
    line-height: 1.3; margin: 0 0 24px; user-select: none;
}
/* 听词/看释义题：题眼（单词+播放键 / 播放键 / 中文释义）放大为主角 */
.quiz-hero {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    font-size: clamp(2rem, 8vw, 2.8rem); font-weight: 600; color: #2c3e50;
    line-height: 1.3; margin: 0 0 24px;
}
.quiz-hero .play-btn { width: 52px; height: 52px; font-size: 1.3rem; flex-shrink: 0; }
.quiz-progress { color: #7f8c8d; font-size: 0.9rem; margin-bottom: 12px; }
.quiz-prompt { font-size: 1.2rem; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.quiz-options { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.quiz-option {
    background: #fff; border: 1px solid #dfe4ea; border-radius: 8px;
    padding: 10px 22px; font-size: 1.1rem; cursor: pointer;
}
.quiz-option:hover { border-color: #4a90d9; }
.quiz-option.opt-correct { background: #e3f7ec; border-color: #27ae60; color: #27ae60; }
.quiz-option.opt-wrong { background: #fdecea; border-color: #e74c3c; color: #e74c3c; }
.quiz-option:disabled { cursor: default; opacity: 0.8; }
.tile-answer {
    min-height: 48px; border: 1px dashed #dfe4ea; border-radius: 8px;
    padding: 8px; margin-bottom: 12px;
    display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.tile-answer .phoneme-tile { cursor: pointer; color: #2c3e50; }
.tile-pool { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tile-pool .phoneme-tile { cursor: pointer; color: #2c3e50; font-size: 1.1rem; padding: 6px 12px; }
.quiz-input {
    width: 100%; max-width: 320px; padding: 10px 12px; margin-bottom: 12px;
    border: 1px solid #dfe4ea; border-radius: 8px; font-size: 1.1rem;
}
.quiz-input:focus { outline: 2px solid #4a90d9; border-color: transparent; }
.quiz-actions { display: flex; gap: 10px; margin-bottom: 12px; }
.quiz-feedback { margin: 8px 0; font-size: 1.05rem; }
.opt-correct-text { color: #27ae60; }
.opt-wrong-text { color: #e74c3c; }
.quiz-next { margin-top: 8px; }
.quiz-summary h2 { margin: 0 0 12px; }
.quiz-links { display: flex; gap: 12px; margin-top: 16px; }

/* ===== 评测报告表格 ===== */
.report-table {
    width: 100%; border-collapse: collapse;
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.report-table th, .report-table td {
    padding: 10px 14px; text-align: left;
    border-bottom: 1px solid #ecf0f1;
}
.report-table th { background: #f0f3f7; font-size: 0.9rem; color: #7f8c8d; }
.report-table tr:last-child td { border-bottom: none; }
