/* ============================================================
   多多兔学习工具箱 · 单词选义
   复用 wordgame 样式 + 4 选 1 选项
   ============================================================ */

.hidden { display: none !important; }

/* ---------- 配置面板 ---------- */
.config-panel {
    background: rgba(225, 245, 254, 0.6);
    padding: 1.5rem 1.8rem;
    border-radius: 30px;
    border: 2px solid rgba(66, 165, 245, 0.15);
    margin-bottom: 1.5rem;
}
.config-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}
.form-group { flex: 1 1 auto; min-width: 140px; }

/* ---------- 自定义下拉 ---------- */
.custom-select-wrapper { position: relative; width: 100%; }
.custom-select-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.6rem 1.2rem;
    border-radius: 60px;
    border: 2px solid rgba(66, 165, 245, 0.2);
    background: white;
    font-family: inherit;
    font-weight: 600;
    color: #0d2b3e;
    font-size: 0.95rem;
    cursor: pointer;
    min-height: 46px;
    box-sizing: border-box;
}
.custom-select-btn .arrow { color: #42a5f5; font-size: 0.75rem; }
.custom-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px;
    border: 2px solid rgba(66, 165, 245, 0.2);
    box-shadow: 0 8px 32px rgba(66, 165, 245, 0.15);
    padding: 0.3rem 0;
    list-style: none;
    margin: 0;
    z-index: 100;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}
.custom-select-options.open { display: block; }
.custom-select-options li {
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    color: #0d2b3e;
    font-size: 0.95rem;
    cursor: pointer;
}
.custom-select-options li:hover { background: #e3f2fd; }
.custom-select-options li.active { background: #cae67f; }

/* ---------- 模式 Tab ---------- */
.mode-tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
    justify-content: center;
}
.mode-tab {
    padding: 10px 24px;
    border-radius: 40px;
    border: 2px solid #e2ecf6;
    background: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    color: #52627a;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.mode-tab.active {
    background: linear-gradient(135deg, #42a5f5, #1e88e5);
    color: #fff;
    border-color: #1e88e5;
}

/* ---------- 单词输入区 ---------- */
.words-input-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}
.words-input-grid input {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #e2ecf6;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    text-align: center;
    color: #1a73c7;
    font-weight: 600;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}
.words-input-grid input:focus {
    border-color: #42a5f5;
    background: #f0f7ff;
}
.words-input-grid input.filled {
    background: #e3f2fd;
    border-color: #90caf9;
}

/* ---------- 题目显示 ---------- */
.problem-display {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 30px;
    margin: 20px 0;
    border: 2px solid #e2ecf6;
}
.question-meaning {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a73c7;
    margin-bottom: 12px;
}
.question-number-hint {
    color: #9bb3c9;
    font-size: 0.9rem;
    margin-top: 20px;
}

/* ---------- 双音标按钮 ---------- */
.phonetic-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.phonetic-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 40px;
    border: 2px solid transparent;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.phonetic-btn .pb-flag {
    font-size: 1.1rem;
    font-weight: 800;
}
.phonetic-btn .pb-text {
    font-family: 'Lucida Sans Unicode', 'Arial Unicode MS', sans-serif;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
}
.phonetic-btn .pb-icon {
    font-size: 1.4rem;
    margin-left: 2px;
    opacity: 0.9;
}
.phonetic-btn:active { transform: scale(0.96); }
.phonetic-btn-us {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-color: #64b5f6;
    color: #0d47a1;
}
.phonetic-btn-us:hover {
    background: linear-gradient(135deg, #bbdefb, #90caf9);
    border-color: #42a5f5;
    box-shadow: 0 6px 18px rgba(66, 165, 245, 0.3);
    transform: translateY(-2px);
}
.phonetic-btn-uk {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-color: #ef9a9a;
    color: #b71c1c;
}
.phonetic-btn-uk:hover {
    background: linear-gradient(135deg, #ffcdd2, #ef9a9a);
    border-color: #e57373;
    box-shadow: 0 6px 18px rgba(239, 83, 80, 0.3);
    transform: translateY(-2px);
}

/* ---------- 4 选 1 选项 ---------- */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin: 20px 0;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}
.option-btn {
    padding: 18px 16px;
    border-radius: 18px;
    border: 2px solid #e2ecf6;
    background: #fff;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a73c7;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 64px;
    box-sizing: border-box;
    text-align: center;
    word-break: break-word;
    line-height: 1.4;
}
.option-btn:hover:not(.disabled) {
    border-color: #42a5f5;
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(66, 165, 245, 0.15);
}
.option-btn.disabled {
    cursor: default;
}
.option-btn.correct {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-color: #4caf50;
    color: #1b5e20;
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.25);
}
.option-btn.wrong {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-color: #ef5350;
    color: #c62828;
}
.option-btn.excluded {
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #bdbdbd;
    text-decoration: line-through;
    cursor: not-allowed;
}
.option-btn.excluded::after {
    content: '✕';
    margin-left: 8px;
    color: #bdbdbd;
    font-weight: 400;
}

/* ---------- 全文反馈（答后显示） ---------- */
.answer-reveal {
    max-width: 640px;
    margin: 16px auto 0;
    padding: 0 16px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.25s, max-height 0.3s;
}
.answer-reveal.show {
    opacity: 1;
    max-height: 600px;
}
.answer-reveal .ar-result {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 8px;
}
.answer-reveal .ar-result.ok { color: #27ae60; }
.answer-reveal .ar-result.err { color: #e74c3c; }
.answer-reveal .ar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a73c7;
    margin-bottom: 4px;
}
.answer-reveal .ar-meta {
    font-size: 0.85rem;
    color: #7a8ba0;
    margin-bottom: 10px;
}
.answer-reveal .ar-content {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-left: 4px solid #4caf50;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.95rem;
    color: #52627a;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* ---------- 底部操作行 ---------- */
.action-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.action-row .btn {
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 40px;
}
.hint-remaining {
    font-size: 0.8rem;
    color: #f48427;
    margin-top: 6px;
    text-align: center;
    min-height: 1em;
}
.hint-remaining.free {
    color: #27ae60;
    font-weight: 600;
}

/* ---------- 进度条 ---------- */
.progress-wrapper { margin: 20px 0; }
.progress-track {
    height: 12px;
    background: #eef4fb;
    border-radius: 20px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #42a5f5, #1e88e5);
    width: 0;
    transition: width 0.3s;
}

/* ---------- 统计行 ---------- */
.stats-row {
    display: flex;
    justify-content: space-around;
    gap: 12px;
    padding: 16px;
    background: #f7fafd;
    border-radius: 20px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.stats-row .stat-item { font-size: 0.9rem; color: #52627a; }
.stats-row .stat-value { font-weight: 700; color: #1a73c7; font-size: 1.1rem; }

/* ---------- 结果页 ---------- */
.result-card {
    text-align: center;
    padding: 30px;
    background: #fff;
    border-radius: 24px;
    border: 2px solid #e2ecf6;
}
.result-card .big-icon { font-size: 3.5rem; display: block; margin-bottom: 12px; }
.result-card h2 { font-size: 1.6rem; color: #1a73c7; margin-bottom: 20px; }
.result-stats {
    text-align: left;
    background: #f7fafd;
    padding: 20px;
    border-radius: 16px;
    line-height: 1.9;
    font-size: 0.95rem;
    margin-bottom: 20px;
}
.result-stats .stat-label { color: #7a8ba0; }
.result-stats .stat-value { color: #1a73c7; font-weight: 700; }
.result-stats hr { border: none; border-top: 1px dashed #d5dee7; margin: 12px 0; }

.wrong-list { text-align: left; margin: 20px 0; }
.wrong-list h3 { font-size: 1.1rem; margin-bottom: 12px; color: #52627a; }
.wrong-list table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.wrong-list th, .wrong-list td {
    padding: 8px 12px;
    border-bottom: 1px solid #eef4fb;
    text-align: left;
}
.wrong-list th { background: #f7fafd; color: #7a8ba0; font-weight: 600; }
.wrong-list td.correct-answer { color: #27ae60; font-weight: 700; }
.wrong-list td.wrong-answer { color: #e74c3c; }

.reward-tip {
    margin-top: 12px;
    padding: 12px 16px;
    background: #fef9e7;
    border-radius: 16px;
    border: 1px dashed #f39c12;
    font-size: 0.85rem;
    color: #7d6608;
    text-align: center;
}
.reward-tip a { color: #e67e22; text-decoration: underline; margin-left: 4px; }

/* ---------- 自选单词弹窗 ---------- */
.modal-overlay {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    z-index: 9999;
    overflow-y: auto;
}
.modal-overlay.open { display: block; }
.modal-box {
    background: white;
    border-radius: 24px;
    padding: 1.5rem;
    max-width: 760px;
    width: 90%;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;
}
.modal-title {
    font-size: 1.15rem; font-weight: 700; color: #0d2b3e;
    margin-bottom: 1rem;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-title .count { font-size: 0.85rem; color: #1e88e5; }
.word-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
    overflow-y: auto;
    padding: 8px 4px;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: #90caf9 #f0f7ff;
}
.word-grid::-webkit-scrollbar { width: 8px; }
.word-grid::-webkit-scrollbar-track { background: #f0f7ff; border-radius: 8px; }
.word-grid::-webkit-scrollbar-thumb { background: #90caf9; border-radius: 8px; }
.word-grid::-webkit-scrollbar-thumb:hover { background: #42a5f5; }

.word-checkbox {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 8px 6px;
    border: 2px solid rgba(66, 165, 245, 0.2);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0d2b3e;
    background: white;
    transition: 0.15s;
    user-select: none;
    text-align: center;
    word-break: break-word;
}
.word-checkbox .meaning { font-size: 0.7rem; color: #90a4ae; font-weight: 400; margin-top: 2px; }
.word-checkbox:hover { border-color: #42a5f5; }
.word-checkbox.checked {
    background: linear-gradient(135deg, #42a5f5, #1e88e5);
    color: white;
    border-color: #1e88e5;
}
.word-checkbox.checked .meaning { color: rgba(255,255,255,.85); }

/* ---------- 移动端 ---------- */
@media (max-width: 576px) {
    .question-meaning { font-size: 1.4rem; }
    .config-row { flex-direction: column; }
    .form-group { width: 100%; }
    .modal-overlay { padding: 20px 0; }
    .modal-box { width: 94%; top: 10px; max-height: 90vh; }
    .words-input-grid { grid-template-columns: repeat(2, 1fr); }
    #pickWords, #randWords { flex: 1 1 100% !important; width: 100% !important; margin-top: 4px; }
    #pickWords button, #randWords button { width: 100% !important; justify-content: center; }

    .options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .option-btn {
        padding: 14px 10px;
        font-size: 0.95rem;
        min-height: 56px;
    }
    .phonetic-btn { padding: 10px 14px; font-size: 0.92rem; min-height: 46px; gap: 6px; }
    .phonetic-btn .pb-text { font-size: 0.95rem; }
    .phonetic-btn .pb-icon { font-size: 1.2rem; }
}