/* =========================================================
   自然拼读练习 phonics-drill —— 独立视觉风格（靛紫渐变 / 纸感卡片）
   依赖：home.css 全局变量 + tool-detail.css
   ========================================================= */

.pd-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    margin: 6px 0 22px;
    padding: 26px 28px;
    border-radius: 22px;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(139, 92, 246, .16), transparent 55%),
        linear-gradient(135deg, rgba(99, 102, 241, .10), rgba(14, 165, 233, .07));
    border: 1px solid var(--c-border, #e3e8ef);
}
.pd-head h1 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--c-text, #1f2933);
}
.pd-head-en { font-size: 15px; font-weight: 700; color: #6366f1; margin-left: 6px; }
.pd-head-sub {
    margin: 0 0 12px;
    font-size: 14.5px;
    line-height: 1.75;
    color: var(--c-text-sub, #5b6572);
}
.pd-head-sub b { color: #4f46e5; }
.pd-head-badges { display: flex; flex-wrap: wrap; gap: 8px; }

.pd-head-card {
    min-width: 168px;
    padding: 20px 22px;
    border-radius: 18px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--c-border, #e3e8ef);
    box-shadow: 0 10px 30px rgba(79, 70, 229, .12);
}
.pd-head-card-label { font-size: 12px; color: var(--c-text-muted, #9aa5b1); letter-spacing: .08em; }
.pd-head-card-word {
    margin: 6px 0 2px;
    font-size: 30px;
    font-weight: 900;
    color: #4f46e5;
    letter-spacing: .02em;
}
.pd-head-card-ipa { font-size: 15px; color: var(--c-text-sub, #5b6572); }
.pd-hero-play {
    margin-top: 12px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #0ea5e9);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, filter .15s;
}
.pd-hero-play:hover { filter: brightness(1.06); transform: translateY(-1px); }

/* ---------- 主板 ---------- */
.pd-board {
    border-radius: 20px;
    border: 1px solid var(--c-border, #e3e8ef);
    background: var(--c-bg-card, #fff);
    padding: 18px 18px 22px;
    margin-bottom: 22px;
}

.pd-mode {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: var(--c-surface-soft, #f2f5f9);
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.pd-mode-btn {
    border: none;
    background: transparent;
    padding: 9px 16px;
    border-radius: 11px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--c-text-sub, #5b6572);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.pd-mode-btn.active {
    background: #fff;
    color: #4f46e5;
    box-shadow: 0 2px 10px rgba(79, 70, 229, .16);
}

/* ---------- 分类 chips ---------- */
.pd-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.pd-cat {
    border: 1px solid var(--c-border, #e3e8ef);
    background: var(--c-surface-soft, #f6f8fa);
    color: var(--c-text-sub, #5b6572);
    padding: 7px 13px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
}
.pd-cat:hover { border-color: #a5b4fc; color: #4f46e5; }
.pd-cat.active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}

/* ---------- 学习卡 ---------- */
.pd-learn-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 16px;
}
.pd-sound-card {
    padding: 22px;
    border-radius: 18px;
    background:
        radial-gradient(140% 120% at 0% 0%, rgba(99, 102, 241, .12), transparent 60%),
        var(--c-surface-soft, #f6f8fa);
    border: 1px solid var(--c-border, #e3e8ef);
}
.pd-sound-top { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.pd-sound-label {
    font-size: 46px;
    font-weight: 900;
    color: #4f46e5;
    letter-spacing: .01em;
    line-height: 1;
}
.pd-sound-ipa { font-size: 22px; font-weight: 700; color: #0ea5e9; }
.pd-sound-play {
    margin-top: 16px;
    padding: 9px 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #0ea5e9);
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}
.pd-sound-play:hover { filter: brightness(1.06); }
.pd-sound-rule {
    margin: 16px 0 0;
    font-size: 13.5px;
    line-height: 1.8;
    color: var(--c-text-sub, #5b6572);
}
.pd-sound-rule b { color: var(--c-text, #1f2933); }
.pd-sound-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 18px;
}
.pd-nav-btn {
    border: 1px solid var(--c-border, #e3e8ef);
    background: #fff;
    color: var(--c-text, #1f2933);
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.pd-nav-btn:hover { border-color: #6366f1; color: #4f46e5; }
.pd-sound-pos { font-size: 12.5px; color: var(--c-text-muted, #9aa5b1); font-variant-numeric: tabular-nums; }

.pd-words {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--c-border, #e3e8ef);
    background: var(--c-bg-card, #fff);
}
.pd-words-head {
    font-size: 13px;
    font-weight: 800;
    color: var(--c-text, #1f2933);
    margin-bottom: 12px;
}
.pd-word-list { display: flex; flex-direction: column; gap: 9px; }
.pd-word-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--c-border, #e3e8ef);
    border-radius: 13px;
    background: var(--c-surface-soft, #f6f8fa);
    cursor: pointer;
    text-align: left;
    transition: transform .12s, border-color .15s, background .15s;
}
.pd-word-item:hover { border-color: #a5b4fc; background: rgba(99, 102, 241, .06); transform: translateX(2px); }
.pd-word-item .w-speak { font-size: 16px; }
.pd-word-item .w-word {
    font-size: 17px;
    font-weight: 800;
    color: var(--c-text, #1f2933);
    letter-spacing: .01em;
}
.pd-word-item .w-ipa { font-size: 13px; color: #0ea5e9; font-weight: 600; }
.pd-word-item .w-cn { margin-left: auto; font-size: 12.5px; color: var(--c-text-muted, #9aa5b1); }

/* ---------- 闯关 ---------- */
.pd-quiz-top {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}
.pd-stat {
    padding: 7px 13px;
    border-radius: 11px;
    background: var(--c-surface-soft, #f6f8fa);
    border: 1px solid var(--c-border, #e3e8ef);
    font-size: 12.5px;
    color: var(--c-text-sub, #5b6572);
}
.pd-stat b { color: #4f46e5; font-size: 15px; margin-left: 3px; }

.pd-quiz-type { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pd-type-btn {
    border: 1px solid var(--c-border, #e3e8ef);
    background: var(--c-surface-soft, #f6f8fa);
    color: var(--c-text-sub, #5b6572);
    padding: 8px 14px;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.pd-type-btn.active { background: #eef2ff; border-color: #a5b4fc; color: #4f46e5; }

.pd-quiz-area {
    padding: 22px;
    border-radius: 18px;
    border: 1px solid var(--c-border, #e3e8ef);
    background: var(--c-surface-soft, #f6f8fa);
    text-align: center;
}
.pd-big-play {
    padding: 12px 24px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1, #0ea5e9);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(79, 70, 229, .25);
}
.pd-big-play:hover { filter: brightness(1.06); }
.pd-big-play:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.pd-quiz-prompt {
    margin: 16px 0;
    font-size: 14px;
    color: var(--c-text-sub, #5b6572);
    min-height: 22px;
}
.pd-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-width: 560px;
    margin: 0 auto;
}
.pd-option {
    padding: 14px 12px;
    border: 2px solid var(--c-border, #e3e8ef);
    border-radius: 14px;
    background: #fff;
    font-size: 17px;
    font-weight: 800;
    color: var(--c-text, #1f2933);
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .12s;
}
.pd-option:hover:not(:disabled) { border-color: #a5b4fc; transform: translateY(-1px); }
.pd-option:disabled { cursor: default; }
.pd-option.is-right { border-color: #16a34a; background: #ecfdf5; color: #15803d; }
.pd-option.is-wrong { border-color: #ef4444; background: #fef2f2; color: #dc2626; }

.pd-feedback { margin-top: 14px; font-size: 13.5px; font-weight: 600; min-height: 20px; }
.pd-feedback.ok { color: #16a34a; }
.pd-feedback.no { color: #dc2626; }

.pd-quiz-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.pd-btn {
    border: 1px solid var(--c-border, #e3e8ef);
    background: #fff;
    color: var(--c-text, #1f2933);
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
}
.pd-btn:hover:not(:disabled) { border-color: #6366f1; color: #4f46e5; }
.pd-btn:disabled { opacity: .55; cursor: not-allowed; }
.pd-btn-primary {
    border: none;
    background: linear-gradient(135deg, #6366f1, #0ea5e9);
    color: #fff;
    box-shadow: 0 6px 18px rgba(79, 70, 229, .22);
}
.pd-btn-primary:hover:not(:disabled) { color: #fff; filter: brightness(1.06); }
.pd-btn-ai {
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #4338ca;
}
.pd-btn-ai:hover:not(:disabled) { color: #4338ca; background: #e0e7ff; border-color: #a5b4fc; }

.pd-review {
    margin-top: 18px;
    padding: 16px;
    border-radius: 14px;
    border: 1px dashed #fca5a5;
    background: #fff7f7;
}
.pd-review h4 { margin: 0 0 10px; font-size: 14px; color: #b91c1c; }
.pd-review ul { margin: 0; padding-left: 4px; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.pd-review li { font-size: 13px; color: var(--c-text-sub, #5b6572); }
.pd-review li b { color: var(--c-text, #1f2933); }
.pd-review li .r-ipa { color: #0ea5e9; }

/* ---------- 练习卷 ---------- */
.pd-sheet-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
    margin-bottom: 10px;
}
.pd-sheet-field { display: flex; flex-direction: column; gap: 5px; }
.pd-sheet-field label { font-size: 12px; color: var(--c-text-muted, #9aa5b1); font-weight: 700; }
.pd-select {
    padding: 9px 12px;
    border: 1px solid var(--c-border, #e3e8ef);
    border-radius: 10px;
    background: var(--c-bg-card, #fff);
    color: var(--c-text, #1f2933);
    font-size: 13px;
    min-width: 150px;
}
.pd-sheet-btns { display: flex; gap: 8px; }
.pd-sheet-tip { font-size: 12.5px; color: var(--c-text-muted, #9aa5b1); line-height: 1.7; margin: 6px 0 14px; }

.pd-sheet-wrap {
    border-radius: 14px;
    background: var(--c-surface-soft, #f6f8fa);
    padding: 16px;
    overflow-x: auto;
}
.pd-sheet {
    background: #fff;
    color: #1f2933;
    border-radius: 10px;
    padding: 32px 36px;
    max-width: 820px;
    margin: 0 auto;
    box-shadow: 0 6px 24px rgba(15, 23, 42, .08);
    font-size: 14px;
    line-height: 1.9;
}
.pd-sheet-empty { text-align: center; color: #94a3b8; font-size: 13px; }
.pd-sheet h3 { margin: 0 0 4px; font-size: 20px; font-weight: 900; color: #1f2933; }
.pd-sheet .pd-sheet-meta { font-size: 12px; color: #64748b; margin-bottom: 18px; }
.pd-sheet .pd-sheet-sec { margin-top: 18px; }
.pd-sheet .pd-sheet-sec h4 { margin: 0 0 10px; font-size: 14px; color: #4f46e5; }
.pd-sheet ol { margin: 0; padding-left: 22px; }
.pd-sheet li { margin-bottom: 11px; }
.pd-sheet .blank { display: inline-block; min-width: 90px; border-bottom: 1px solid #94a3b8; margin: 0 4px; }
.pd-sheet .ans { color: #b91c1c; font-weight: 700; }
.pd-sheet .pd-sheet-answers {
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px dashed #cbd5e1;
    font-size: 12.5px;
    color: #475569;
}
.pd-sheet .pd-sheet-answers b { color: #1f2933; }
.pd-sheet .pd-sheet-answers.is-hidden { display: none; }

/* ---------- AI ---------- */
.pd-ai {
    margin-top: 20px;
    padding: 18px 20px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(99, 102, 241, .08), rgba(14, 165, 233, .06));
    border: 1px solid #c7d2fe;
}
.pd-ai-head { display: flex; align-items: center; gap: 12px; }
.pd-ai-icon { font-size: 26px; }
.pd-ai-head b { display: block; font-size: 15px; color: var(--c-text, #1f2933); }
.pd-ai-head small { display: block; font-size: 12px; color: var(--c-text-muted, #9aa5b1); margin-top: 2px; }
.pd-ai-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.pd-ai-status { margin-top: 10px; font-size: 12.5px; color: var(--c-text-muted, #9aa5b1); min-height: 18px; }
.pd-ai-status.is-ok { color: #16a34a; }
.pd-ai-status.is-err { color: #dc2626; }
.pd-ai-result {
    margin-top: 12px;
    padding: 16px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--c-border, #e3e8ef);
    font-size: 13.5px;
    line-height: 1.85;
    color: var(--c-text, #1f2933);
    white-space: normal;
}
.pd-ai-result .pd-ai-result-head { font-weight: 800; color: #4f46e5; margin-bottom: 6px; }
.pd-ai-result .pd-ai-result-disclaim { margin-top: 10px; font-size: 11.5px; color: var(--c-text-muted, #9aa5b1); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .pd-head { grid-template-columns: 1fr; padding: 20px; }
    .pd-head-card { justify-self: start; }
    .pd-learn-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .pd-head h1 { font-size: 23px; }
    .pd-options { grid-template-columns: 1fr; }
    .pd-sheet { padding: 22px 18px; }
    .pd-sound-label { font-size: 38px; }
}

/* ---------- 黑夜模式 ---------- */
[data-theme="dark"] .pd-head {
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(139, 92, 246, .22), transparent 55%),
        linear-gradient(135deg, rgba(99, 102, 241, .16), rgba(14, 165, 233, .10));
    border-color: #2a3444;
}
[data-theme="dark"] .pd-head h1 { color: #e6edf3; }
[data-theme="dark"] .pd-head-card { background: #1b2430; border-color: #2a3444; box-shadow: none; }
[data-theme="dark"] .pd-head-card-word { color: #a5b4fc; }
[data-theme="dark"] .pd-board { background: #131c27; border-color: #2a3444; }
[data-theme="dark"] .pd-mode { background: #1b2430; }
[data-theme="dark"] .pd-mode-btn.active { background: #26313f; color: #a5b4fc; box-shadow: none; }
[data-theme="dark"] .pd-cat { background: #1b2430; border-color: #2a3444; color: #9aa5b1; }
[data-theme="dark"] .pd-cat.active { background: #4f46e5; border-color: #4f46e5; color: #fff; }
[data-theme="dark"] .pd-sound-card { background: #1a2330; border-color: #2a3444; }
[data-theme="dark"] .pd-sound-label { color: #a5b4fc; }
[data-theme="dark"] .pd-words { background: #131c27; border-color: #2a3444; }
[data-theme="dark"] .pd-word-item { background: #1b2430; border-color: #2a3444; }
[data-theme="dark"] .pd-word-item:hover { background: rgba(99, 102, 241, .16); border-color: #4f46e5; }
[data-theme="dark"] .pd-word-item .w-word { color: #e6edf3; }
[data-theme="dark"] .pd-stat,
[data-theme="dark"] .pd-type-btn,
[data-theme="dark"] .pd-quiz-area { background: #1b2430; border-color: #2a3444; }
[data-theme="dark"] .pd-type-btn.active { background: rgba(99, 102, 241, .22); color: #a5b4fc; border-color: #4f46e5; }
[data-theme="dark"] .pd-option { background: #1b2430; border-color: #2a3444; color: #e6edf3; }
[data-theme="dark"] .pd-option.is-right { background: rgba(22, 163, 74, .18); color: #4ade80; border-color: #16a34a; }
[data-theme="dark"] .pd-option.is-wrong { background: rgba(239, 68, 68, .16); color: #f87171; border-color: #ef4444; }
[data-theme="dark"] .pd-nav-btn,
[data-theme="dark"] .pd-btn { background: #1b2430; border-color: #2a3444; color: #e6edf3; }
[data-theme="dark"] .pd-nav-btn:hover,
[data-theme="dark"] .pd-btn:hover:not(:disabled) { border-color: #6366f1; color: #a5b4fc; }
[data-theme="dark"] .pd-select { background: #1b2430; border-color: #2a3444; color: #e6edf3; }
[data-theme="dark"] .pd-sheet-wrap { background: #1b2430; }
[data-theme="dark"] .pd-review { background: rgba(239, 68, 68, .10); border-color: #b91c1c; }
[data-theme="dark"] .pd-review h4 { color: #f87171; }
[data-theme="dark"] .pd-ai { background: linear-gradient(135deg, rgba(99, 102, 241, .16), rgba(14, 165, 233, .10)); border-color: #3b3f8f; }
[data-theme="dark"] .pd-ai-result { background: #131c27; border-color: #2a3444; color: #e6edf3; }
[data-theme="dark"] .pd-btn-ai { background: rgba(99, 102, 241, .22); border-color: #4f46e5; color: #a5b4fc; }
[data-theme="dark"] .pd-btn-ai:hover:not(:disabled) { background: rgba(99, 102, 241, .32); color: #c7d2fe; }

/* ---------- 打印（只打印练习卷） ---------- */
@media print {
    @page { size: A4; margin: 14mm; }
    body * { visibility: hidden !important; }
    .pd-sheet, .pd-sheet * { visibility: visible !important; }
    .pd-sheet-wrap, .pd-board, .pd-panel {
        overflow: visible !important;
        padding: 0 !important;
        border: none !important;
        background: none !important;
        box-shadow: none !important;
    }
    .pd-sheet {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
        font-size: 13px;
    }
    .pd-sheet .pd-sheet-answers { color: #333; }
    .pd-ans-toggle { display: none !important; }
    .detail-tabs, .tab-panel, .related, .back-to-top,
    .pd-sheet-controls, .pd-sheet-tip, .pd-ai, nav { display: none !important; }
}
