/* ============================================================
   Duolingo 风格主题
   配色与圆角/描边/3D 按键均仿照多邻国官网与 App
   ============================================================ */
:root {
    /* 多邻国品牌色 */
    --green: #58cc02;          /* 亮绿（主） */
    --green-dark: #46a302;     /* 深绿（描边/按压） */
    --green-hover: #61e003;
    --green-btn-top: #7bf12f;
    --blue: #1cb0f6;           /* 亮蓝 */
    --blue-dark: #1899d6;
    --blue-btn-top: #7fd7f5;
    --yellow: #ffc800;
    --yellow-dark: #e5a700;
    --orange: #ff9600;
    --orange-dark: #e07f00;
    --red: #ff4b4b;
    --red-dark: #e04e4e;
    --purple: #ce82ff;
    --purple-dark: #a568cc;

    /* 中性与背景 */
    --text: #4b4b4b;
    --text-strong: #3c3c3c;
    --muted: #777777;
    --bg: #ffffff;
    --card-border: #e5e5e5;
    --card-subtle: #e5e5e5;   /* 细描边 / 卡边 */
    --border-dark: #afafaf; /* 强描边，对应 var(--ink) style 上使用 --border-dark */

    /* 难度色（多邻国语言配色） */
    --easy: var(--green);
    --medium: var(--yellow);
    --hard: var(--red);

    --radius: 16px;
    --radius-sm: 12px;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
    --font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
        Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

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

html, body { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }
.hidden { display: none !important; }

/* ============ 多邻国按压按钮（2px 深描边 + 底部阴影） ============ */
.btn {
    border: 2px solid var(--ink, #e5e5e5);
    border-bottom-width: 4px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 12px 22px;
    font-size: 16px;
    cursor: pointer;
    transition: filter 0.08s, transform 0.06s;
    background: #fff;
    color: var(--text);
}
.btn:hover { filter: brightness(0.96); }
.btn:active { transform: translateY(2px); }

.primary-btn {
    background: var(--green);
    border-color: var(--green-dark);
    border-bottom: 4px solid var(--green-dark);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 13px 26px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 0 var(--green-dark);
    transition: filter 0.08s, transform 0.06s;
}
.primary-btn:disabled {
    background: #b3d9a0;
    border-color: #9ac585;
    border-bottom-color: #9ac585;
    cursor: not-allowed;
    filter: none;
}
.primary-btn:active:not(:disabled) { transform: translateY(2px); }

.ghost-btn {
    background: #fff;
    border: 2px solid var(--card-subtle);
    border-bottom: 4px solid var(--card-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    cursor: pointer;
    transition: filter 0.08s, transform 0.06s;
}
.ghost-btn:hover { filter: brightness(0.96); }
.ghost-btn:active { transform: translateY(2px); }

/* ============ 遮罩层（多邻国明亮绿渐变 + 大卡片） ============ */
.overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, #2f8e0b 0%, var(--green) 45%, #a5e05a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.lang-panel {
    background: #fff;
    border-radius: 32px;
    padding: 28px 28px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
    border: 2px solid #fff;
    text-align: center;
    max-width: 420px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
.lang-panel .logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    display: block;
}
.lang-panel h1 { font-size: 27px; color: var(--green-dark); margin-bottom: 6px; letter-spacing: 0.3px; }
.lang-hint { color: var(--muted); font-size: 15px; margin-bottom: 22px; }
.brand-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 auto 14px;
    max-width: 340px;
}
.brand-row .brand-logo { object-fit: contain; flex: 0 0 auto; }
.brand-row .brand-logo.duo { height: 68px; width: 68px; }
.brand-row .brand-logo.bs { height: 54px; max-width: 210px; }
.brand-x { font-size: 26px; font-weight: 900; color: var(--text-strong); line-height: 1; flex: none; }
.brand-title { font-size: 27px; color: var(--green-dark); margin-bottom: 24px; letter-spacing: 0.3px; }
.select-hint { color: var(--muted); font-size: 14px; margin-top: 18px; }
.lang-buttons { display: flex; flex-direction: column; gap: 12px; }
.lang-btn {
    padding: 14px;
    border: 2px solid var(--card-subtle);
    border-bottom: 4px solid var(--card-subtle);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 15px;
    font-weight: 800;
    color: var(--text-strong);
    cursor: pointer;
    transition: all 0.12s;
}
.lang-btn:hover { border-color: var(--green); border-bottom-color: var(--green); }
.lang-btn.selected { border-color: var(--green); border-bottom-color: var(--green); background: #e9fad8; color: var(--green-dark); }

/* ============ 顶部导航（多邻国白底 + 细描边 + 徽章） ============ */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 2px solid var(--card-subtle);
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand .brand-logo { object-fit: contain; }
.brand .brand-logo.duo { height: 42px; }
.brand .brand-logo.bs { height: 32px; }
.brand .brand-x { font-size: 18px; font-weight: 900; color: var(--text-strong); line-height: 1; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.lang-indicator {
    background: var(--green-dark);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.5px;
}

/* ============ 标签页（多邻国胶囊 tab） ============ */
.tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 2px solid var(--card-subtle);
    max-width: 860px;
    margin: 0 auto;
}
.tab {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.4px;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.12s;
}
.tab:hover { background: var(--green-btn-top); }
.tab.active {
    background: var(--green);
    color: #fff;
    box-shadow: 0 3px 0 var(--green-dark);
}

.tab-panel { max-width: 860px; margin: 24px auto; padding: 0 20px; display: none; }
.tab-panel.active { display: block; }

/* ============ 题库 ============ */
.browse-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.count-label { font-weight: 800; font-size: 16px; color: var(--text-strong); }
.filter-row { display: flex; gap: 10px; }
select {
    padding: 10px 14px;
    border: 2px solid var(--card-subtle);
    border-bottom: 4px solid var(--card-subtle);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
}

.card-list { display: flex; flex-direction: column; gap: 14px; }
.quiz-card {
    background: #fff;
    border: 2px solid var(--card-subtle);
    border-bottom: 4px solid var(--card-subtle);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
    transition: all 0.15s;
}
.quiz-card:hover { border-color: var(--green); }
.quiz-card.ok { border-color: var(--easy); border-bottom-color: var(--easy); }
.quiz-card.no { border-color: var(--hard); border-bottom-color: var(--hard); }
.quiz-card .q-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.quiz-card .q-id {
    font-size: 12px;
    color: var(--muted);
    font-weight: 800;
    background: var(--green-btn-top);
    padding: 3px 10px;
    border-radius: 20px;
}
.quiz-card .q-text { font-size: 17px; font-weight: 800; color: var(--text-strong); margin-bottom: 12px; }
.quiz-card .q-answers { display: flex; flex-wrap: wrap; gap: 8px; }
.quiz-card .answer-chip {
    padding: 6px 12px;
    border-radius: 10px;
    background: #f7f7f7;
    font-size: 14px;
    border: 2px solid var(--card-subtle);
    color: var(--text-strong);
}
.quiz-card .correct-line { margin-top: 12px; color: var(--green-dark); font-size: 14px; font-weight: 800; }
.quiz-card .review-head { font-weight: 800; color: var(--text-strong); margin-bottom: 4px; }
.quiz-card .yours { font-size: 14px; color: var(--muted); margin-top: 4px; }

.diff-badge {
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 0.4px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}
.diff-Easy { background: var(--easy); }
.diff-Medium { background: var(--medium); color: #5a4a00; }
.diff-Difficult { background: var(--hard); }

.empty-tip { color: var(--muted); text-align: center; padding: 40px 0; font-size: 16px; }
.search-count { font-weight: 800; color: var(--text-strong); margin-bottom: 14px; }

/* ============ 分页 ============ */
.pagination { display: flex; justify-content: center; gap: 8px; margin: 22px 0; flex-wrap: wrap; }
.pagination button {
    border: 2px solid var(--card-subtle);
    border-bottom: 4px solid var(--card-subtle);
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.1s;
}
.pagination button:hover { filter: brightness(0.96); }
.pagination button.active { background: var(--green); border-color: var(--green-dark); border-bottom-color: var(--green-dark); color: #fff; }

/* ============ 查找 ============ */
.search-box { display: flex; gap: 10px; margin-bottom: 10px; }
.search-box input {
    flex: 1;
    padding: 14px;
    border: 2px solid var(--card-subtle);
    border-bottom: 4px solid var(--card-subtle);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: inherit;
    color: var(--text-strong);
}
.search-box input::placeholder { color: var(--muted); }
.search-desc { color: var(--muted); font-size: 14px; margin-bottom: 18px; }

/* ============ 测试配置 ============ */
#testSetup h2, #testResult h2 {
    font-size: 24px;
    color: var(--text-strong);
    margin-bottom: 18px;
    letter-spacing: 0.3px;
}
.setup-card {
    background: #fff;
    border: 2px solid var(--card-subtle);
    border-bottom: 4px solid var(--card-subtle);
    border-radius: var(--radius);
    padding: 26px 26px 30px;
    box-shadow: var(--shadow-card);
    max-width: 560px;
    margin: 0 auto;
}
.setup-block { margin-bottom: 24px; }
.setup-block label { font-weight: 800; display: block; margin-bottom: 12px; color: var(--text-strong); }
.hint { color: var(--muted); font-size: 13px; margin-top: 8px; line-height: 1.5; }
.count-slider-row { display: flex; align-items: center; gap: 16px; }
.count-slider-row input[type="range"] { flex: 1; min-width: 0; }
.count-slider-row b { font-size: 22px; font-weight: 800; color: var(--green-dark); min-width: 48px; text-align: center; }
.ratio-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 14px; font-weight: 700; color: var(--text); }
.ratio-row span { display: flex; align-items: baseline; gap: 5px; }
.ratio-row b { font-size: 18px; }
.ratio-row span:nth-child(1) b { color: var(--easy); }
.ratio-row span:nth-child(2) b { color: #c99700; }
.ratio-row span:nth-child(3) b { color: var(--hard); }
input[type="range"] { width: 100%; accent-color: var(--green); cursor: pointer; }
.accent-hint { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* 难度比例实时示意图 */
.ratio-bar {
    display: flex;
    height: 18px;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--card-subtle);
    background: var(--card-subtle);
}
.ratio-bar .seg { height: 100%; display: block; transition: width 0.12s ease; }
.ratio-bar .seg-easy { background: var(--easy); }
.ratio-bar .seg-medium { background: var(--medium); }
.ratio-bar .seg-hard { background: var(--hard); }

/* ============ 测试进行 ============ */
.test-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.test-head span { font-weight: 800; color: var(--text-strong); }
.progress-track {
    flex: 1;
    min-width: 120px;
    height: 18px;
    background: var(--card-subtle);
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid var(--card-subtle);
}
.progress-fill { height: 100%; width: 0; background: var(--green); transition: width 0.3s; border-radius: 20px; }

.question-card {
    background: #fff;
    border: 2px solid var(--card-subtle);
    border-bottom: 4px solid var(--card-subtle);
    border-radius: var(--radius);
    padding: 26px;
}
.question-card h3 { font-size: 22px; margin-bottom: 22px; color: var(--text-strong); line-height: 1.4; }
#testDiff { display: inline-block; margin-bottom: 12px; margin-top: 2px; }
.answer-list { display: flex; flex-direction: column; gap: 12px; }
.answer-list button {
    text-align: left;
    padding: 16px;
    border: 2px solid var(--card-subtle);
    border-bottom: 4px solid var(--card-subtle);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-strong);
    cursor: pointer;
    transition: all 0.12s;
}
.answer-list button:hover:not(:disabled) { border-color: var(--green); border-bottom-color: var(--green); }
.answer-list button.selected {
    border-color: var(--green-dark);
    border-bottom-color: var(--green-dark);
    background: #e9fad8;
    color: #2b7a00;
    font-weight: 800;
    box-shadow: inset 0 0 0 2px var(--green);
}
.answer-list button:disabled { cursor: default; }
.answer-list button.correct { border-color: var(--easy); border-bottom-color: var(--easy); background: #e9fad8; color: #2b7a00; font-weight: 800; }
.answer-list button.wrong { border-color: var(--hard); border-bottom-color: var(--hard); background: #ffe3e1; color: var(--hard); font-weight: 800; }
.answer-list button.neutral:disabled { opacity: 0.45; }

/* ============ 底部操作条（多邻国 CHECK / CONTINUE 模式） ============ */
.action-bar {
    position: sticky;
    bottom: 0;
    margin-top: 18px;
    background: #fff;
    border-top: 2px solid var(--card-subtle);
    padding: 14px 4px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-radius: 0 0 var(--radius) var(--radius);
    transition: background 0.15s;
}
.action-feedback { font-size: 17px; font-weight: 800; color: var(--text-strong); }
.action-buttons { display: flex; gap: 12px; }
.action-btn {
    border-radius: var(--radius-sm);
    padding: 13px 40px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;
    border: none;
    border-bottom-width: 4px;
    cursor: pointer;
    transition: filter 0.08s, transform 0.06s;
}
.action-btn:active { transform: translateY(2px); }
.action-blue {
    background: var(--blue);
    border-bottom: 4px solid var(--blue-dark);
    color: #fff;
}
.action-blue:disabled { background: #cfe9f7; border-bottom-color: #b9d9ea; color: #b9d9ea; cursor: not-allowed; }
.action-green {
    background: var(--green);
    border-bottom: 4px solid var(--green-dark);
    color: #fff;
}
.action-bar.bar-ok { background: #e9fad8; }
.action-bar.bar-ok .action-feedback { color: var(--green-dark); }
.action-bar.bar-no { background: #ffe3e1; }
.action-bar.bar-no .action-feedback { color: var(--hard); }

/* ============ 结果 ============ */
.result-ring { position: relative; width: 180px; height: 180px; margin: 18px auto 10px; }
.result-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.result-ring .ring-track { fill: none; stroke: var(--card-subtle); stroke-width: 12; }
.result-ring .ring-fill { fill: none; stroke: var(--green); stroke-width: 12; stroke-linecap: round; stroke-dasharray: 0 327; transition: stroke-dasharray 0.4s ease; }
.result-ring .ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.result-score { font-size: 44px; font-weight: 900; color: var(--green-dark); line-height: 1; }
.result-sub { font-size: 17px; font-weight: 800; color: var(--muted); }
.result-btns { display: flex; gap: 14px; margin-bottom: 22px; justify-content: center; }
#reviewList { margin-top: 18px; }
.mark {
    display: inline-block;
    width: 22px; height: 22px;
    line-height: 21px;
    text-align: center;
    border-radius: 50%;
    font-weight: 900;
    font-size: 14px;
    color: #fff;
    margin-right: 6px;
    vertical-align: -1px;
}
.mark-ok { background: var(--easy); }
.mark-no { background: var(--hard); }

/* ============ 手机端适配 ============ */
@media (max-width: 640px) {
    .topbar { padding: 8px 12px; }
    .brand .brand-logo.duo { height: 34px; }
    .brand .brand-logo.bs { height: 26px; }
    .brand { gap: 6px; }
    .language-btn, .lang-indicator { padding: 6px 12px; font-size: 13px; }
    .tabs { padding: 10px 12px; gap: 6px; overflow-x: auto; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { flex: 1; min-width: max-content; padding: 9px 14px; font-size: 14px; }
    .tab-panel { margin: 16px auto; padding: 0 12px; }
    .browse-head { flex-direction: column; align-items: stretch; }
    .filter-row select { width: 100%; }
    .ratio-row { flex-wrap: wrap; gap: 12px; }
    .count-slider-row b { font-size: 17px; }
    .result-ring { width: 150px; height: 150px; }
    .result-score { font-size: 36px; }
    .result-btns { flex-direction: column; }
    .result-btns .btn { width: 100%; }
    .search-box input { min-width: 0; }
    .action-bar { padding: 12px 14px; }
    .brand-title { font-size: 22px; }
    .brand-row .brand-logo.duo { height: 54px; width: 54px; }
    .brand-row .brand-logo.bs { height: 46px; }
}