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

/* LexiPlay / Duolingo 规范：触感游戏化、品牌绿、浅绿底、2px 灰边、大圆角 */
:root {
    --primary-color: #58cc02;
    --primary-dark: #46a302;
    --primary-light: #e4ffce;
    --secondary-color: #1cb0f6;
    --secondary-dark: #1899d6;
    --accent-yellow: #ffc800;
    --accent-yellow-dark: #e5a400;
    --accent-orange: #ff9600;
    --accent-orange-dark: #e08500;
    --error-color: #ff4b4b;
    --error-dark: #ea2b2b;
    --success-color: #58cc02;
    --background: #f6fbf3;
    --background-wash: linear-gradient(165deg, #e8f8ff 0%, #e4ffce 38%, #fff8e0 100%);
    --surface: #ffffff;
    --text-primary: #3c3c3c;
    --text-secondary: #777777;
    --border: #e5e5e5;
    --shadow: 0 8px 0 rgba(0, 0, 0, 0.06);
    --shadow-card: 0 10px 0 rgba(70, 163, 2, 0.12);
    --tactile-depth: 4px;
    --radius-lg: 26px;
    --radius-md: 18px;
    --radius-pill: 999px;
    --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    /* 由 JS（visualViewport）在移动端键盘弹出时写入，避免输入区被遮挡 */
    --keyboard-inset: 0px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 弹层 / 底栏：轻微弹簧感（规范：Spring/Bounce） */
@keyframes sheetPopIn {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.96);
    }
    70% {
        transform: translateY(-4px) scale(1.01);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    65% {
        transform: scale(1.03);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

body {
    font-family: var(--font);
    background: var(--background-wash);
    background-color: var(--background);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.55;
    letter-spacing: -0.015em;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 登录页：仅 .active 时用 flex，避免 #id 覆盖 .page { display:none } 导致登录后仍占位 */
#login-page.page.active {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

#login-page .container {
    width: 100%;
}

.login-box {
    max-width: 420px;
    margin: 0 auto;
    padding: 36px 32px 40px;
    background: linear-gradient(180deg, #f9fff4 0%, var(--surface) 55%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    box-shadow: var(--shadow-card), 0 4px 24px rgba(0, 0, 0, 0.06);
}

.login-brand {
    text-align: center;
    margin-bottom: 8px;
}

.login-mascot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 12px;
    font-size: 40px;
    background: linear-gradient(145deg, var(--primary-light), #fff);
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    box-shadow: 0 var(--tactile-depth) 0 var(--primary-dark);
}

.login-brand h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.login-tagline {
    margin-top: 6px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.login-sub {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 0.95rem;
}

.tabs {
    display: flex;
    margin-bottom: 24px;
    padding: 4px;
    background: #eef1f4;
    border-radius: var(--radius-pill);
    gap: 4px;
}

.tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s;
}

.tab.active {
    color: var(--text-primary);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.25);
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s ease, filter 0.12s ease;
}

.btn:active {
    transform: translateY(var(--tactile-depth));
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    width: 100%;
    box-shadow: 0 var(--tactile-depth) 0 var(--primary-dark);
    letter-spacing: -0.01em;
    font-size: 0.95rem;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-primary:active {
    box-shadow: none;
}

.btn-secondary {
    background: var(--secondary-color);
    color: #fff;
    box-shadow: 0 var(--tactile-depth) 0 var(--secondary-dark);
    border-radius: var(--radius-md);
    width: auto;
}

.btn-secondary:hover {
    filter: brightness(1.05);
}

.btn-secondary:active {
    box-shadow: none;
}

.error-message {
    margin-top: 20px;
    padding: 14px 16px;
    background: #ffeceb;
    border: 2px solid var(--error-color);
    border-radius: var(--radius-md);
    color: var(--error-dark);
    font-weight: 700;
    display: none;
}

/* 主页面 */
.page {
    display: none;
}

.page.active {
    display: block;
}

.main-error-banner {
    background: linear-gradient(90deg, #ffe5e5, #fff5e5);
    color: #c62828;
    text-align: center;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    border-bottom: 2px solid var(--accent-yellow);
}

/* 导航 */
.navbar {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    padding: 12px 24px;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 var(--tactile-depth) 0 rgba(0, 0, 0, 0.04);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* 顶栏：始终只显示 📚 图标，完整名称由 .nav-brand[aria-label] 提供（读屏 / 悬停） */
.navbar .nav-brand {
    gap: 0;
    margin-inline-end: 16px;
}

.navbar .nav-brand .brand-name {
    display: none !important;
}

.logo {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
}

.nav-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.nav-item {
    padding: 10px 18px;
    border: 2px solid transparent;
    background: #eef1f4;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s, transform 0.12s;
}

.nav-item:hover {
    background: #e3e8ed;
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-dark);
    box-shadow: 0 var(--tactile-depth) 0 var(--primary-dark);
}

.nav-item.active:active {
    transform: translateY(var(--tactile-depth));
    box-shadow: none;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user-gear-cluster {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-nav-pk-invite {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--surface);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    padding: 0;
    font-family: inherit;
}

.btn-nav-pk-invite:hover {
    background: #eef1f4;
    border-color: var(--secondary-color);
}

.pk-invite-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--error-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 13px;
    text-align: center;
    border: 2px solid var(--surface);
    box-sizing: border-box;
    pointer-events: none;
}

.nav-user > .nav-user-avatar-wrap {
    flex-shrink: 0;
    line-height: 0;
    vertical-align: middle;
}

.nav-user-avatar-wrap--static {
    pointer-events: none;
}

.nav-user-avatar-wrap {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(88, 204, 2, 0.35);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.nav-user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nav-user-avatar-ph {
    font-size: 1.15rem;
    line-height: 1;
    opacity: 0.75;
    user-select: none;
}

.nav-user-summary-wrap {
    position: relative;
    flex-shrink: 0;
    min-width: 0;
}

.btn-daily-summary-mobile {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 2px solid rgba(88, 204, 2, 0.35);
    background: var(--primary-light);
    box-shadow: 0 2px 0 var(--primary-dark);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    flex-shrink: 0;
}

.btn-daily-summary-mobile:active {
    transform: translateY(1px);
    box-shadow: none;
}

.nav-user .username-inline {
    font-weight: 700;
    color: var(--text-primary);
    padding: 8px 14px;
    background: var(--primary-light);
    border-radius: var(--radius-pill);
    border: 2px solid rgba(88, 204, 2, 0.35);
    box-shadow: 0 2px 0 var(--primary-dark);
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    user-select: none;
    max-width: 12em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.daily-summary-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 260;
    min-width: min(320px, calc(100vw - 24px));
    max-width: min(380px, calc(100vw - 24px));
    padding: 0;
    margin: 0;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
}

.daily-summary-popover[hidden] {
    display: none !important;
}

.daily-summary-popover-inner {
    padding: 14px 16px 16px;
}

.daily-summary-title {
    margin: 0 0 10px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
}

.daily-summary-date {
    margin: 0 0 12px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.daily-summary-list {
    margin: 0;
    padding-left: 1.15em;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.daily-summary-list li {
    margin-bottom: 6px;
}

.daily-summary-list li:last-child {
    margin-bottom: 0;
}

.daily-summary-loading,
.daily-summary-empty,
.daily-summary-error {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.daily-summary-error {
    color: var(--error-dark);
}

.nav-user .btn-secondary {
    padding: 10px 18px;
    font-size: 0.9rem;
}

.brand-name-short {
    display: none;
}

.brand-name-tiny {
    display: none;
}

/* 底部 Tab：默认隐藏，由 max-width:1199px 与 min-width:1200px 规则切换 */
.mobile-tabbar {
    display: none;
}

.mobile-tab {
    flex: 1;
    min-width: 0;
    padding: 10px 6px;
    border: none;
    border-top: 2px solid var(--border);
    background: var(--surface);
    font-size: 0.72rem;
    font-weight: 800;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.mobile-tab.active {
    color: var(--primary-dark);
    background: #eef7e8;
}

.mobile-tab-more.active {
    color: var(--primary-dark);
    background: #eef7e8;
}

.mobile-more-sheet {
    display: none;
}

.mobile-more-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 180;
}

.mobile-more-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 190;
    max-height: min(70vh, 420px);
    overflow: auto;
    padding: 16px 18px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 2px solid var(--border);
    border-bottom: none;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
    animation: sheetPopIn 0.42s cubic-bezier(0.34, 1.35, 0.64, 1) both;
}

.mobile-more-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.mobile-more-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.mobile-more-close {
    border: none;
    background: #eef1f4;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-secondary);
}

.mobile-more-gamification {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 800;
    margin-bottom: 14px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    padding-block: 3px;
    padding-inline-end: 14px;
    box-sizing: content-box;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.mobile-more-gamification::-webkit-scrollbar {
    display: none;
}

.mobile-more-gamification > * {
    flex-shrink: 0;
}

.mobile-more-gamification .ng-level {
    padding: 6px 12px;
    background: linear-gradient(145deg, #fff4d6, #ffe8a8);
    border: 2px solid var(--accent-yellow);
    box-shadow: 0 2px 0 var(--accent-yellow-dark);
    border-radius: var(--radius-pill);
    color: #6d4c00;
}

.mobile-more-gamification .ng-xp {
    padding: 6px 12px;
    background: #eef7ff;
    border: 2px solid var(--secondary-color);
    box-shadow: 0 2px 0 var(--secondary-dark);
    border-radius: var(--radius-pill);
    color: var(--secondary-dark);
}

.mobile-more-gamification .ng-streak {
    padding: 6px 12px;
    background: #fff0e8;
    border: 2px solid var(--accent-orange);
    box-shadow: 0 2px 0 var(--accent-orange-dark);
    border-radius: var(--radius-pill);
    color: #b35c00;
}

.mobile-more-gamification .ng-checkin {
    padding: 6px 12px;
    background: #f3f6f8;
    border: 2px solid var(--border);
    box-shadow: 0 2px 0 #d0d0d0;
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.mobile-more-gamification .ng-checkin.ng-checkin-done {
    background: #e8f8ec;
    border-color: var(--primary-color);
    box-shadow: 0 2px 0 var(--primary-dark);
    color: var(--primary-dark);
}

.mobile-more-gamification .ng-pk {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    margin: 0;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    background: linear-gradient(145deg, #f4eefe, #ede7fa);
    border: 2px solid #b794f6;
    box-shadow: 0 2px 0 #9b6fd6;
    border-radius: var(--radius-pill);
    color: #5b2c92;
}

.mobile-more-gamification .ng-pk:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 #9b6fd6;
}

.mobile-more-gamification .ng-pk-badge {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: var(--radius-pill);
    background: var(--error-color);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    line-height: 12px;
    text-align: center;
    border: 2px solid var(--surface);
    box-sizing: border-box;
    pointer-events: none;
}

.mobile-more-link {
    display: block;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: #f8fafb;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
}

.mobile-more-link:last-of-type {
    margin-bottom: 0;
}

.mobile-more-link:active {
    background: #eef1f4;
}

/* 仅宽屏桌面隐藏底栏；宽度小于 1200px（含 iPad 竖/横屏）与手机一致用底栏 */
@media (min-width: 1200px) {
    .mobile-tabbar {
        display: none !important;
    }

    .mobile-more-sheet {
        display: none !important;
    }
}

/* 统计卡片 — 每张一点不同色相，更活泼 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-card {
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: 0 var(--tactile-depth) 0 rgba(0, 0, 0, 0.07);
}

.stat-card:nth-child(1) {
    background: linear-gradient(135deg, var(--primary-light), #fff);
    border-color: var(--border);
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #e3f5ff, #fff);
    border-color: var(--border);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #fff8e1, #fff);
    border-color: var(--border);
}

.stat-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--primary-dark);
}

.stat-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* 复习区：主栏 + 右侧错题（顶对齐：统一用 review-layout 上内边距，勿给主栏单独 margin-top） */
.review-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 20px 22px;
    align-items: start;
    max-width: 1100px;
    margin: 0 auto;
    padding-top: 24px;
}

.review-main-wrap {
    min-width: 0;
}

.review-container {
    max-width: 100%;
    margin: 0 0 40px;
}

.wrong-words-aside {
    position: sticky;
    top: 88px;
    align-self: start;
}

.wrong-words-card {
    background: linear-gradient(180deg, #fff8f8 0%, var(--surface) 38%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--error-color);
    box-shadow: 0 6px 0 var(--error-dark);
    padding: 20px 18px 22px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.wrong-words-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--error-dark);
    margin-bottom: 6px;
}

.wrong-words-sub {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 12px;
}

.wrong-words-list {
    list-style: none;
    max-height: min(50vh, 360px);
    overflow-y: auto;
    margin: 0;
    padding: 0;
}

.wrong-words-list li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 10px;
    margin-bottom: 8px;
    background: #fff5f5;
    border-radius: var(--radius-md);
    border: 2px solid #ffcdd2;
}

.wrong-words-list .ww-en {
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 1rem;
}

.wrong-words-list .ww-zh {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.wrong-words-empty {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary-dark);
    text-align: center;
    padding: 16px 8px;
}

@media (max-width: 900px) {
    .review-layout {
        grid-template-columns: 1fr;
        gap: 18px;
        padding-top: 16px;
    }

    .wrong-words-aside {
        position: static;
        width: 100%;
    }
}

/* 主轮结束 → 错题巩固确认弹层 */
.remedial-offer-modal {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top, 16px)) max(16px, env(safe-area-inset-right, 16px))
        max(16px, env(safe-area-inset-bottom, 16px)) max(16px, env(safe-area-inset-left, 16px));
}

.remedial-offer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.48);
}

.remedial-offer-card {
    position: relative;
    z-index: 1;
    max-width: 420px;
    width: 100%;
    background: linear-gradient(180deg, #f9fff4 0%, var(--surface) 40%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    box-shadow: 0 var(--tactile-depth) 0 var(--primary-dark), 0 16px 48px rgba(0, 0, 0, 0.18);
    padding: 24px 22px 22px;
    animation: modalPopIn 0.45s cubic-bezier(0.34, 1.35, 0.64, 1) both;
}

.remedial-offer-card h3 {
    margin: 0 0 12px;
    font-size: 1.2rem;
    color: var(--primary-dark);
}

.remedial-offer-body {
    margin: 0 0 20px;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.remedial-offer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

/* 从文章导入 → 确认导入结果 */
.article-import-result-modal {
    position: fixed;
    inset: 0;
    z-index: 2600;
    display: none;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top, 16px)) max(16px, env(safe-area-inset-right, 16px))
        max(16px, env(safe-area-inset-bottom, 16px)) max(16px, env(safe-area-inset-left, 16px));
}

.article-import-result-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.48);
}

.article-import-result-card {
    position: relative;
    z-index: 1;
    max-width: 420px;
    width: 100%;
    background: linear-gradient(180deg, #f0f7ff 0%, var(--surface) 42%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--secondary-color);
    box-shadow: 0 var(--tactile-depth) 0 var(--secondary-dark), 0 16px 48px rgba(0, 0, 0, 0.16);
    padding: 24px 22px 22px;
    animation: modalPopIn 0.45s cubic-bezier(0.34, 1.35, 0.64, 1) both;
}

.article-import-result-card h3 {
    margin: 0 0 16px;
    font-size: 1.2rem;
    color: var(--secondary-dark);
}

.article-import-result-dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 14px;
    margin: 0 0 14px;
    font-size: 0.95rem;
    line-height: 1.45;
}

.article-import-result-dl dt {
    margin: 0;
    font-weight: 700;
    color: var(--text-secondary);
}

.article-import-result-dl dd {
    margin: 0;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.article-import-result-dup-list {
    margin: 0 0 16px;
    padding: 10px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text-secondary);
    background: #f3f4f6;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
    max-height: 120px;
    overflow-y: auto;
}

.article-import-result-actions {
    display: flex;
    justify-content: flex-end;
}

.import-result-card.import-result-card--error {
    border-color: var(--error-color);
    background: linear-gradient(180deg, #fff8f8 0%, var(--surface) 42%);
    box-shadow: 0 var(--tactile-depth) 0 var(--error-dark), 0 16px 48px rgba(0, 0, 0, 0.12);
}

.import-result-card--error h3#import-result-title {
    color: var(--error-dark);
}

.import-result-text-wrap {
    margin-bottom: 16px;
}

.import-result-text {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-primary);
    font-weight: 600;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 顶栏 PK 邀约弹层 */
.pk-invite-modal {
    position: fixed;
    inset: 0;
    z-index: 2600;
    display: none;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top, 16px)) max(16px, env(safe-area-inset-right, 16px))
        max(16px, env(safe-area-inset-bottom, 16px)) max(16px, env(safe-area-inset-left, 16px));
}

.pk-invite-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.48);
}

.pk-invite-card {
    position: relative;
    z-index: 1;
    max-width: 420px;
    width: 100%;
    max-height: min(72vh, 520px);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #f0f9ff 0%, var(--surface) 38%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    box-shadow: 0 var(--tactile-depth) 0 var(--secondary-dark), 0 16px 48px rgba(0, 0, 0, 0.18);
    padding: 0;
    animation: modalPopIn 0.45s cubic-bezier(0.34, 1.35, 0.64, 1) both;
}

.pk-invite-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 12px;
    border-bottom: 2px solid var(--border);
}

.pk-invite-card-head h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--secondary-dark);
}

.pk-invite-close {
    border: none;
    background: #eef1f4;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.pk-invite-close:hover {
    background: #e3e8ed;
}

.pk-invite-body {
    padding: 16px 20px 22px;
    overflow-y: auto;
    font-size: 0.98rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.pk-invite-loading,
.pk-invite-empty {
    margin: 0;
    text-align: center;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 12px 4px;
}

.pk-invite-item {
    padding: 14px 14px 16px;
    margin-bottom: 12px;
    background: var(--surface);
    border: 2px solid #9fdcf9;
    border-radius: var(--radius-md);
}

.pk-invite-item:last-child {
    margin-bottom: 0;
}

.pk-invite-lead {
    margin: 0 0 8px;
    font-size: 1rem;
}

.pk-invite-meta {
    margin: 0 0 6px;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.pk-invite-expiry {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.pk-invite-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.pk-status-modal .pk-status-card {
    background: linear-gradient(180deg, #f4eefe 0%, var(--surface) 40%);
    box-shadow: 0 var(--tactile-depth) 0 #9b6fd6, 0 16px 48px rgba(0, 0, 0, 0.18);
}

.pk-status-modal .pk-invite-card-head h3 {
    color: #5b2c92;
}

.pk-status-item {
    padding: 14px 14px 16px;
    margin-bottom: 12px;
    background: var(--surface);
    border: 2px solid #d4b8f8;
    border-radius: var(--radius-md);
}

.pk-status-item:last-child {
    margin-bottom: 0;
}

.pk-status-lead {
    margin: 0 0 8px;
    font-size: 1rem;
}

.pk-status-line {
    margin: 0 0 6px;
    font-size: 0.92rem;
    color: var(--text-primary);
    font-weight: 600;
}

.pk-status-meta {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.pk-status-meta + .pk-status-meta {
    margin-top: 4px;
}

.review-box {
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--surface) 42%);
    padding: 32px 28px 36px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    box-shadow: 0 8px 0 var(--primary-dark);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 2px dashed var(--border);
}

.review-word-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px 12px;
    flex: 1;
    min-width: 0;
}

.word-review-phonetic {
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
}

.review-header-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px 12px;
    flex-shrink: 0;
    max-width: 100%;
}

.review-phonetic-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.review-phonetic-toggle input {
    margin: 0;
    cursor: pointer;
}

.word-english {
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
}

.word-progress {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    background: var(--secondary-color);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    box-shadow: 0 var(--tactile-depth) 0 var(--secondary-dark);
}

.review-due-hint {
    margin: 0 0 12px;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    line-height: 1.4;
}

.review-due-hint-carryover {
    background: #fff8e6;
    color: #b45309;
    border: 1px solid #fbbf24;
}

.review-due-hint-scheduled {
    background: #eef6ff;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.review-due-hint-bonus {
    background: #f3f4f6;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.word-chinese {
    font-size: 1.35rem;
    margin-bottom: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.word-example {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    padding: 16px;
    background: #f3faff;
    border-radius: var(--radius-md);
    border-left: 5px solid var(--secondary-color);
}

.word-input {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    position: relative;
}

.underline-input-wrapper {
    position: relative;
    flex: 1;
    min-height: 60px;
}

.mobile-word-capture {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: none;
    opacity: 0;
    cursor: text;
    z-index: 2;
    font-size: 16px;
}

.mobile-word-capture:focus {
    outline: none;
}

.word-input input {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-family: inherit;
}

.word-input input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.word-input .btn-primary {
    width: auto;
    min-width: 120px;
    flex-shrink: 0;
}

.word-message {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 1.05rem;
    font-weight: 800;
    display: none;
    border: 2px solid transparent;
}

.word-message.success {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary-color);
    display: block;
}

.word-message.error {
    background: #ffeceb;
    color: var(--error-dark);
    border-color: var(--error-color);
    display: block;
}

.review-complete {
    text-align: center;
    padding: 48px 24px;
    background: linear-gradient(180deg, #fff9e6, #fff);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    box-shadow: 0 8px 0 var(--accent-yellow-dark);
}

.complete-icon {
    font-size: 4.5rem;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.1));
}

.review-complete h2 {
    color: var(--primary-dark);
    margin-bottom: 10px;
    font-weight: 800;
    font-size: 1.5rem;
}

.review-complete p {
    color: var(--text-secondary);
    font-weight: 600;
}

.review-session-summary {
    margin-top: 20px;
    text-align: left;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.review-session-summary[hidden] {
    display: none !important;
}

.review-summary-inner {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}

.review-summary-section {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 12px;
}

.review-summary-section:last-child {
    margin-bottom: 0;
}

.review-summary-section strong {
    color: var(--primary-dark);
    font-weight: 800;
}

.review-summary-tip {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.review-empty-actions {
    margin: 20px auto 0;
    max-width: 420px;
    text-align: center;
}

.review-empty-actions .btn-primary {
    padding: 14px 28px;
    font-weight: 700;
}

.review-empty-hint {
    margin-top: 12px;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: left;
}

.review-complete .btn-secondary {
    margin-top: 24px;
    padding: 14px 32px;
}

/* 单词列表 */
.word-list {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 2px solid #f0f0f0;
}

.word-item:nth-child(even) {
    background: #fafafa;
}

.word-item:last-child {
    border-bottom: none;
}

.word-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.word-item-english {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.word-item-phonetic {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    font-family: "Lucida Sans Unicode", "DejaVu Sans", serif;
    letter-spacing: 0.01em;
}

.word-item-chinese {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.word-item-carryover-tag {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #b45309;
    background: #fff8e6;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #fbbf24;
    vertical-align: middle;
}

.word-item-next-review {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--secondary-dark);
    margin-top: 6px;
}

.word-item-stats {
    display: flex;
    gap: 16px;
}

.word-stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--secondary-dark);
    font-variant-numeric: tabular-nums;
}

.word-stat-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

/* 导入 */
#import-section h2,
#progress-section h2,
#mastered-section h2,
#discover-section h2 {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.03em;
}

/* 系统词库（家长勾选导入） */
.wordbank-panel {
    max-width: 100%;
    margin: 0 0 20px;
    padding: 24px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.wordbank-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.wordbank-phases {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wordbank-phase-btn {
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    border: 2px solid var(--border);
    background: var(--surface);
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.wordbank-phase-btn:hover {
    border-color: var(--secondary-color);
    color: var(--text-primary);
}

.wordbank-phase-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.wordbank-search {
    flex: 1;
    min-width: 180px;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
}

.wordbank-search:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.2);
}

.wordbank-meta {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 12px;
}

.wordbank-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.wordbank-selected-count {
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 0.9rem;
}

.wordbank-list-wrap {
    margin-bottom: 16px;
}

.wordbank-list {
    max-height: 320px;
    overflow: auto;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: #fafcff;
    padding: 8px 10px;
}

.wordbank-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 10px;
    font-size: 0.92rem;
    line-height: 1.4;
}

.wordbank-row:nth-child(even) {
    background: rgba(28, 176, 246, 0.06);
}

.wordbank-row label {
    display: flex;
    flex: 1;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
}

.wordbank-row .wb-en {
    font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
    font-weight: 800;
    min-width: 0;
    word-break: break-word;
}

.wordbank-row .wb-zh {
    color: var(--text-secondary);
    flex: 1;
}

.wordbank-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-weight: 600;
}

.wordbank-load-more {
    width: 100%;
    margin-top: 10px;
}

.wordbank-import-btn {
    width: 100%;
}

.import-simple-panel {
    max-width: 600px;
    margin: 0 auto;
}

.import-simple-options {
    margin-bottom: 12px;
}

.import-simple-check {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.45;
}

.import-json-desc code {
    font-size: 0.85em;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.06);
}

.wordbank-row .wb-bank-tag {
    flex-shrink: 0;
    align-self: center;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(28, 176, 246, 0.12);
    color: var(--secondary-color);
    border: 1px solid rgba(28, 176, 246, 0.35);
}

.import-json-panel {
    max-width: 600px;
    margin: 32px auto 0;
    padding-top: 28px;
    border-top: 2px dashed var(--border);
}

.import-json-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 800;
}

.import-json-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.5;
    font-weight: 600;
}

.import-article-editor-area {
    margin-bottom: 14px;
}

.import-article-editor-area .import-json-textarea {
    margin-bottom: 0;
}

.import-article-pick-wrap {
    min-height: 180px;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: #fafbfc;
    box-sizing: border-box;
}

.import-article-pick-lead {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 12px;
    line-height: 1.45;
}

.import-article-pick-toolbar {
    display: flex;
    align-items: center;
    margin: 0 0 10px;
    gap: 8px;
}

.import-article-select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.import-article-select-all-label input {
    width: 1.05rem;
    height: 1.05rem;
    cursor: pointer;
    flex-shrink: 0;
}

.import-article-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
}

button.import-article-chip {
    margin: 0;
    padding: 6px 12px;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    line-height: 1.25;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
}

button.import-article-chip:hover {
    border-color: #93c5fd;
    color: var(--text-primary);
}

button.import-article-chip--selected {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1e40af;
}

button.import-article-chip--selected:hover {
    background: #bfdbfe;
    border-color: #1d4ed8;
    color: #1e3a8a;
}

.import-article-vip-extract-wrap {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: rgba(124, 58, 237, 0.06);
    border: 1px solid rgba(124, 58, 237, 0.22);
    box-sizing: border-box;
}
.import-article-vip-extract-lead {
    margin: 0 0 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
}
.import-article-vip-extract-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.import-article-vip-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-secondary);
    cursor: pointer;
    margin: 0;
}
.import-article-vip-label input {
    margin-top: 3px;
    flex-shrink: 0;
}
.import-article-vip-label input:disabled + span {
    opacity: 0.55;
    cursor: not-allowed;
}

.import-article-spacy-wrap {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: rgba(28, 176, 246, 0.08);
    border: 1px solid rgba(28, 176, 246, 0.25);
    box-sizing: border-box;
}
.import-article-spacy-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-secondary);
    cursor: pointer;
    margin: 0;
}
.import-article-spacy-label input {
    margin-top: 3px;
    flex-shrink: 0;
}

.import-article-unmatched-wrap {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
    background: var(--surface);
    box-sizing: border-box;
}

.import-article-unmatched-lead {
    margin: 0 0 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.45;
}

.import-article-unmatched {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    align-content: flex-start;
}

.import-article-unmatched-sep {
    align-self: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    opacity: 0.85;
    user-select: text;
}

.import-article-unmatched-chip {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.3;
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    background: rgba(128, 128, 128, 0.12);
    background: color-mix(in srgb, var(--text-secondary) 10%, transparent);
    opacity: 0.92;
}

.import-json-textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    line-height: 1.45;
    resize: vertical;
    min-height: 180px;
    margin-bottom: 14px;
}

.import-json-textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.2);
}

.import-json-btn {
    width: 100%;
}

.message {
    margin-top: 20px;
    padding: 14px;
    border-radius: var(--radius-md);
    text-align: center;
    display: none;
    font-weight: 800;
}

.message.success {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 2px solid var(--primary-color);
    display: block;
}

.message.error {
    background: #ffeceb;
    color: var(--error-dark);
    border: 2px solid var(--error-color);
    display: block;
}

.message.info {
    background: #e8f4fc;
    color: #0d47a1;
    border: 2px solid #64b5f6;
    display: block;
}

@media (max-width: 1199px) {
    #main-page {
        padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px) + var(--keyboard-inset, 0px));
    }

    .container {
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }

    .nav-menu-desktop {
        display: none !important;
    }

    .navbar .nav-gamification {
        display: none !important;
    }

    .mobile-tabbar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 120;
        align-items: stretch;
        background: var(--surface);
        border-top: 2px solid var(--border);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 calc(-1 * var(--tactile-depth)) 0 rgba(0, 0, 0, 0.05);
    }

    .mobile-more-sheet.is-open {
        display: block;
    }

    /* 顶栏：仅品牌 + 用户区，无横向标签（尽量压低高度与宽度占用） */
    .navbar {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        padding: 3px 8px;
        padding-top: max(2px, env(safe-area-inset-top, 0px));
        border-bottom-width: 2px;
        box-shadow: 0 2px 0 rgba(0, 0, 0, 0.04);
    }

    .nav-brand {
        flex-shrink: 0;
        max-width: none;
        gap: 0;
        min-width: 0;
    }

    .nav-brand .logo {
        display: block;
        font-size: 1.45rem;
        line-height: 1;
    }

    .nav-item {
        flex: 0 0 auto;
        padding: 7px 11px;
        font-size: 0.78rem;
    }

    .nav-user {
        flex-shrink: 0;
        width: auto;
        gap: 4px;
    }

    .nav-user-avatar-wrap {
        width: 30px;
        height: 30px;
    }

    .nav-user-avatar-ph {
        font-size: 1.05rem;
    }

    .nav-user .username-inline {
        display: none;
    }

    .btn-daily-summary-mobile {
        display: inline-flex;
        width: 32px;
        height: 32px;
        border-radius: 8px;
        border-width: 1px;
        font-size: 1rem;
    }

    .daily-summary-popover {
        position: fixed;
        left: 12px;
        right: 12px;
        top: auto;
        bottom: calc(56px + env(safe-area-inset-bottom, 0px));
        max-height: min(52vh, 420px);
        overflow-y: auto;
        min-width: 0;
        max-width: none;
    }

    .navbar .btn-gear {
        width: 32px;
        height: 32px;
        font-size: 1.05rem;
        border-radius: 8px;
        border-width: 1px;
    }

    .navbar .btn-nav-pk-invite {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        border-radius: 8px;
        border-width: 1px;
    }

    .navbar .pk-invite-badge {
        min-width: 15px;
        height: 15px;
        font-size: 0.6rem;
        line-height: 11px;
        top: -2px;
        right: -2px;
    }

    .nav-user .btn-secondary {
        padding: 4px 8px;
        font-size: 0.72rem;
        font-weight: 700;
        border-width: 1px;
        box-shadow: 0 2px 0 var(--primary-dark);
    }

    .nav-user .btn-secondary:active {
        box-shadow: none;
    }

    /* 三列一排，减少纵向占用 */
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin: 10px 0 12px;
    }

    .stat-card {
        padding: 10px 6px;
        gap: 6px;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .stat-icon {
        font-size: 1.35rem;
    }

    .stat-value {
        font-size: 1.15rem;
    }

    .stat-label {
        font-size: 0.6rem;
        line-height: 1.15;
    }

    .review-layout {
        padding-top: 10px;
    }

    .review-container {
        margin: 0 0 28px;
    }

    .review-box {
        padding: 18px 14px 22px;
    }

    .word-input {
        flex-direction: column;
    }

    .word-input .btn-primary {
        width: 100%;
    }
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: sectionIn 0.42s cubic-bezier(0.34, 1.25, 0.64, 1) both;
}

@keyframes sectionIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.99);
    }
    70% {
        transform: translateY(-2px) scale(1);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 例句 + 朗读 */
.word-example-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #e8f7fe, #f5fcff);
    border-radius: var(--radius-md);
    border: 2px solid #9fdcf9;
}

#current-word-example {
    font-size: 1.05rem;
    color: var(--text-primary);
    flex: 1;
    line-height: 1.55;
    font-weight: 600;
}

.btn-speak {
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.15rem;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
    box-shadow: 0 var(--tactile-depth) 0 var(--secondary-dark);
}

.btn-speak:hover {
    filter: brightness(1.08);
}

.btn-speak:active {
    transform: translateY(var(--tactile-depth)) scale(0.94);
    box-shadow: none;
}

.btn-speak:disabled {
    opacity: 0.52;
    cursor: not-allowed;
    filter: grayscale(0.35);
}

.btn-speak-loading.btn-speak,
.discovery-example-block .btn-speak-loading.btn-speak {
    opacity: 1 !important;
    filter: none !important;
    cursor: wait !important;
    position: relative;
    color: transparent !important;
}

.btn-speak-loading.btn-speak::after,
.discovery-example-block .btn-speak-loading.btn-speak::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-speak-tts-spin 0.7s linear infinite;
}

@keyframes btn-speak-tts-spin {
    to {
        transform: rotate(360deg);
    }
}

.textbook-line-row .btn-speak-loading.textbook-speak-line::after {
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
}

.underline-input {
    flex: 1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    background: #fff;
    cursor: text;
    min-height: 60px;
    pointer-events: none;
    width: 100%;
    box-sizing: border-box;
}

.underline-input-wrapper:focus-within .underline-input {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.2);
}

.underline-input:focus {
    outline: none;
}

.underline-char {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 38px;
    border-bottom: 4px solid #b0b0b0;
    text-align: center;
    position: relative;
    border-radius: 2px;
}

.underline-char.filled {
    border-bottom-color: var(--primary-color);
    color: var(--primary-dark);
}

.underline-char.empty {
    color: transparent;
}

.underline-char.fixed {
    border-bottom: none;
    min-width: 0.35em;
    color: var(--text-secondary);
    font-weight: 800;
    align-self: flex-end;
    padding-bottom: 2px;
}

.underline-char.fixed.underline-fixed-space {
    min-width: 0.5em;
}

.underline-cursor {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 22px;
    background-color: var(--secondary-color);
    border-radius: 2px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.25;
    }
}

/* 管理员 */
.btn-gear {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--surface);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}

.btn-gear:hover {
    background: #eef1f4;
    border-color: var(--primary-color);
}

.btn-gear-fixed {
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 12px));
    right: max(12px, env(safe-area-inset-right, 12px));
    z-index: 200;
}

.admin-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top, 20px));
    overflow-y: auto;
}

.admin-panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 760px;
    width: 100%;
    padding: 22px 24px 28px;
    margin-bottom: 40px;
    box-shadow: 0 var(--tactile-depth) 0 rgba(0, 0, 0, 0.08), 0 12px 40px rgba(0, 0, 0, 0.16);
    border: 2px solid var(--border);
    animation: modalPopIn 0.4s cubic-bezier(0.34, 1.35, 0.64, 1) both;
}

.admin-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.admin-panel-head h2 {
    margin: 0;
    font-size: 1.25rem;
}

.admin-close {
    border: none;
    background: #eef1f4;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.admin-close:hover {
    background: #e3e8ed;
}

.admin-notice {
    background: #fff3e0;
    color: #bf360c;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.admin-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.admin-section .form-group {
    margin-bottom: 14px;
}

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.admin-subtitle {
    font-size: 1.05rem;
    margin: 20px 0 10px;
}

.admin-table-wrap {
    overflow-x: auto;
    margin-bottom: 8px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
}

.admin-table th {
    background: #f5f5f5;
    font-weight: 700;
}

.admin-toggle {
    cursor: pointer;
    user-select: none;
}

.btn-admin-pw {
    padding: 6px 10px;
    font-size: 0.85rem;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}

.btn-admin-pw:hover {
    border-color: var(--primary-color);
    color: var(--primary-dark);
}

.admin-invite-once {
    background: #e8f5e9;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 16px;
}

.admin-code-display {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 1rem;
    word-break: break-all;
    margin: 8px 0;
    font-weight: 700;
    color: var(--primary-dark);
}

/* 导航条：等级 / XP / 连续打卡（单行横向滚动，避免窄屏换行） */
.nav-gamification {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-primary);
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    /* visible：避免药丸底部 2px box-shadow 被裁切（勿用 overflow-y: hidden） */
    overflow-y: visible;
    padding-block: 3px;
    /* PK 角标 right:-6px 会超出药丸，避免被 overflow-x 裁切 */
    padding-inline-end: 14px;
    box-sizing: content-box;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.nav-gamification::-webkit-scrollbar {
    display: none;
}

.nav-gamification > * {
    flex-shrink: 0;
}

/* 桌面顶栏：游戏化区占满中间空隙、药丸靠右，与右侧消息/用户区保持 12px（沿用 .navbar 的 gap） */
@media (min-width: 1200px) {
    .navbar .nav-gamification {
        flex: 1 1 auto;
        min-width: 0;
        margin-inline-start: 12px;
        justify-content: flex-end;
    }
}

.nav-gamification .ng-level {
    padding: 6px 12px;
    background: linear-gradient(145deg, #fff4d6, #ffe8a8);
    border: 2px solid var(--accent-yellow);
    box-shadow: 0 2px 0 var(--accent-yellow-dark);
    border-radius: var(--radius-pill);
    color: #6d4c00;
}

.nav-gamification .ng-xp {
    padding: 6px 12px;
    background: #eef7ff;
    border: 2px solid var(--secondary-color);
    box-shadow: 0 2px 0 var(--secondary-dark);
    border-radius: var(--radius-pill);
    color: var(--secondary-dark);
}

.nav-gamification .ng-streak {
    padding: 6px 12px;
    background: #fff0e8;
    border: 2px solid var(--accent-orange);
    box-shadow: 0 2px 0 var(--accent-orange-dark);
    border-radius: var(--radius-pill);
    color: #b35c00;
}

.nav-gamification .ng-checkin {
    padding: 6px 10px;
    background: #f3f6f8;
    border: 2px solid var(--border);
    box-shadow: 0 2px 0 #d0d0d0;
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.nav-gamification .ng-checkin.ng-checkin-done {
    background: #e8f8ec;
    border-color: var(--primary-color);
    box-shadow: 0 2px 0 var(--primary-dark);
    color: var(--primary-dark);
}

/*
 * 中等宽度以下：已完成打卡显示为「✓ 打卡」（DOM 仍为完整文案，供读屏）
 * 极窄屏规则已并入 max-width: 1200px
 */
@media (max-width: 1200px) {
    .nav-gamification .ng-checkin.ng-checkin-done,
    .mobile-more-gamification .ng-checkin.ng-checkin-done {
        font-size: 0;
        line-height: 0;
        color: transparent;
    }

    .nav-gamification .ng-checkin.ng-checkin-done::after,
    .mobile-more-gamification .ng-checkin.ng-checkin-done::after {
        content: '✓ 打卡';
        font-weight: 800;
        color: var(--primary-dark);
    }

    .nav-gamification .ng-checkin.ng-checkin-done::after {
        font-size: 0.8rem;
        line-height: 1.25;
    }

    .mobile-more-gamification .ng-checkin.ng-checkin-done::after {
        font-size: 0.78rem;
        line-height: 1.25;
    }
}

/* 顶栏游戏化区：略收紧药丸，减轻窄屏横向压力（仍配合单行滚动） */
@media (max-width: 1200px) {
    .nav-gamification .ng-level,
    .nav-gamification .ng-xp,
    .nav-gamification .ng-streak {
        padding: 5px 8px;
        font-size: 0.82rem;
    }

    .nav-gamification .ng-checkin {
        padding: 5px 8px;
        font-size: 0.76rem;
    }

    .nav-gamification .ng-pk {
        padding: 5px 8px;
        font-size: 0.76rem;
    }
}

.nav-gamification .ng-pk {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    margin: 0;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    background: linear-gradient(145deg, #f4eefe, #ede7fa);
    border: 2px solid #b794f6;
    box-shadow: 0 2px 0 #9b6fd6;
    border-radius: var(--radius-pill);
    color: #5b2c92;
}

.nav-gamification .ng-pk:hover {
    filter: brightness(1.03);
}

.nav-gamification .ng-pk:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 #9b6fd6;
}

.nav-gamification .ng-pk-badge {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--error-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 13px;
    text-align: center;
    border: 2px solid var(--surface);
    box-sizing: border-box;
    pointer-events: none;
}

/* 用户设置浮层 */
.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 1950;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top, 20px));
    overflow-y: auto;
}

.settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.settings-panel {
    position: relative;
    z-index: 1;
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 100%;
    padding: 0;
    margin-bottom: 40px;
    box-shadow: 0 var(--tactile-depth) 0 rgba(0, 0, 0, 0.08), 0 12px 40px rgba(0, 0, 0, 0.16);
    border: 2px solid var(--border);
    animation: modalPopIn 0.4s cubic-bezier(0.34, 1.35, 0.64, 1) both;
}

.settings-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 2px solid var(--border);
}

.settings-panel-head h2 {
    margin: 0;
    font-size: 1.2rem;
}

.settings-close {
    border: none;
    background: #eef1f4;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.settings-close:hover {
    background: #e3e8ed;
}

.settings-panel-body {
    padding: 18px 20px 24px;
    max-height: min(78vh, 720px);
    overflow-y: auto;
}

.settings-block {
    margin-bottom: 22px;
}

.settings-block:last-of-type {
    margin-bottom: 0;
}

.settings-pending-words-toggle {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(28, 176, 246, 0.06);
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.45;
}

.settings-pending-words-toggle:hover {
    background: rgba(28, 176, 246, 0.1);
}

.settings-pending-words-chevron {
    display: inline-block;
    transition: transform 0.15s ease;
    flex-shrink: 0;
    margin-top: 2px;
    font-size: 0.75rem;
    opacity: 0.85;
}

.settings-pending-words-toggle.is-open .settings-pending-words-chevron {
    transform: rotate(90deg);
}

.settings-pending-words-toggle-text {
    flex: 1;
    min-width: 0;
}

.settings-pending-words-panel {
    margin-top: 10px;
}

.settings-pending-words-list {
    margin-bottom: 10px;
    max-height: min(52vh, 420px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.settings-pending-batch-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.02);
}

.settings-pending-select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.settings-pending-selected-count {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    flex: 1;
    min-width: 5rem;
}

.settings-pending-delete-btn {
    flex-shrink: 0;
}

.settings-pending-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.02);
}

.settings-pending-row--batch {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
}

.settings-pending-cb-wrap {
    padding-top: 2px;
    flex-shrink: 0;
}

.settings-pending-cb {
    width: 1.05rem;
    height: 1.05rem;
    cursor: pointer;
}

.settings-pending-row-main {
    flex: 1;
    min-width: 0;
}

.settings-pending-line1 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
}

.settings-pending-en {
    font-weight: 800;
    font-size: 0.95rem;
}

.settings-pending-zh {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.settings-pending-meta {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.25;
}

.settings-subtitle {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.settings-hint {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.settings-avatar-upload-hint {
    margin: 0 0 10px;
}

.settings-avatar-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.settings-avatar-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    background: #eef1f4;
}

.settings-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px dashed var(--border);
    background: #f3f6f8;
    font-size: 2rem;
}

.settings-avatar-actions {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.settings-avatar-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.settings-avatar-label {
    cursor: pointer;
    margin: 0;
}

/* 头像裁剪弹层 */
.avatar-crop-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.avatar-crop-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.avatar-crop-dialog {
    position: relative;
    z-index: 1;
    max-width: 400px;
    width: 100%;
    padding: 20px 20px 16px;
    border-radius: var(--radius-lg, 12px);
    background: var(--surface, #fff);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.avatar-crop-dialog h3 {
    margin: 0 0 8px;
    font-size: 1.15rem;
}

.avatar-crop-hint {
    margin: 0 0 14px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.avatar-crop-viewport {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto 12px;
    border-radius: 50%;
    overflow: hidden;
    background: #e8ebed;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
    touch-action: none;
    cursor: grab;
}

.avatar-crop-viewport:active {
    cursor: grabbing;
}

.avatar-crop-viewport img {
    position: absolute;
    left: 0;
    top: 0;
    max-width: none;
    height: auto;
    user-select: none;
    pointer-events: none;
}

.avatar-crop-zoom-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.avatar-crop-zoom-row label {
    flex-shrink: 0;
    font-size: 0.9rem;
}

.avatar-crop-zoom-row input[type='range'] {
    flex: 1;
    min-width: 0;
}

.avatar-crop-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.settings-goal-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.settings-month-goal-input {
    width: 100px;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-weight: 700;
}

.settings-progress-wrap {
    margin-top: 8px;
}

.settings-progress-bar {
    height: 10px;
    border-radius: 999px;
    background: #eef1f4;
    overflow: hidden;
    margin-bottom: 8px;
}

.settings-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-color), #7dd84a);
    transition: width 0.25s ease;
}

.settings-duel-input {
    flex: 1;
    min-width: 120px;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
}

.settings-duel-wager {
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-weight: 700;
}

.settings-duel-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.settings-duel-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: #f8fafb;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.settings-duel-meta {
    flex: 1;
    min-width: 0;
    font-weight: 700;
}

.settings-duel-status {
    color: var(--text-secondary);
    font-weight: 600;
}

.settings-duel-actions {
    width: 100%;
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.settings-duel-btn {
    padding: 8px 14px;
    font-size: 0.88rem;
}

.settings-duel-empty {
    list-style: none;
    color: var(--text-secondary);
    padding: 8px 0;
}

.settings-duel-pk-range {
    flex: 1 1 100%;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.35;
}

.settings-message {
    margin-top: 16px;
    font-size: 0.92rem;
    color: var(--text-secondary);
}

.settings-message-error {
    color: #c62828;
    font-weight: 700;
}

.settings-goal-bonus-hint {
    color: var(--text-primary);
    font-weight: 600;
    background: #e8f4fd;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 2px solid #90caf9;
}

.leaderboard-table .lb-user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.leaderboard-table .lb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.leaderboard-table .lb-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #eef1f4;
    border: 2px solid var(--border);
    font-size: 1rem;
    flex-shrink: 0;
}

.leaderboard-table .lb-username {
    font-weight: 700;
}

/* 排行榜页 */
.leaderboard-page h2 {
    margin-bottom: 8px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.leaderboard-intro {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 0.95rem;
}

/* 排行榜页：月度群体挑战赛跑 */
.monthly-pool-race-wrap {
    margin-bottom: 24px;
}

/* 排行榜页：每月 1v1 PK 风云榜 */
.monthly-pk-board-wrap {
    margin-bottom: 24px;
}

.monthly-pk-board {
    padding: 16px 18px 18px;
    border-radius: var(--radius-lg);
    border: 2px dashed rgba(255, 87, 34, 0.4);
    background: linear-gradient(145deg, rgba(255, 193, 7, 0.09) 0%, rgba(33, 150, 243, 0.07) 50%, rgba(156, 39, 176, 0.06) 100%);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.05);
}

.monthly-pk-head {
    margin-bottom: 14px;
}

.monthly-pk-title {
    margin: 0 0 6px;
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.monthly-pk-tagline {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.45;
    font-weight: 600;
}

.monthly-pk-section {
    margin-top: 14px;
}

.monthly-pk-section-title {
    margin: 0 0 10px;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
}

.monthly-pk-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.monthly-pk-card {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.55);
}

.monthly-pk-vs {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.35;
}

.monthly-pk-x {
    opacity: 0.85;
    font-size: 0.9em;
}

.monthly-pk-meta {
    margin: 0 0 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.monthly-pk-outcome {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
}

.monthly-pk-outcome.monthly-pk-tie {
    color: #6d4c41;
}

.monthly-pk-outcome.monthly-pk-ongoing {
    color: #1565c0;
}

.monthly-pk-empty {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-style: italic;
    line-height: 1.45;
}

.monthly-pk-name.monthly-pk-user-me,
.monthly-pk-winner.monthly-pk-user-me {
    background: rgba(28, 176, 246, 0.15);
    border-radius: 4px;
    padding: 0 4px;
}

.monthly-pk-winner {
    font-weight: 800;
}

.mp-race {
    background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px 18px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.04);
}

.mp-race-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 14px;
}

.mp-race-title {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.mp-race-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 800;
    margin-right: 4px;
}

.mp-race-badge--prep {
    background: #fff3e0;
    color: #e65100;
    border: 2px solid #ffcc80;
}

.mp-race-badge--go {
    background: #e8f5e9;
    color: #1b5e20;
    border: 2px solid var(--primary-color);
}

.mp-race-desc {
    flex: 1 1 100%;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.mp-race-join {
    flex-shrink: 0;
}

.mp-race-body {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.mp-race-lanes {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mp-lane {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(0, 3fr) auto;
    align-items: center;
    gap: 12px;
}

.mp-lane-me {
    background: rgba(88, 204, 2, 0.08);
    border-radius: var(--radius-md);
    padding: 4px 8px;
    margin: -4px -8px;
}

.mp-lane-user {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-weight: 700;
    font-size: 0.88rem;
}

.mp-lane-user img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.mp-lane-user .mp-lane-avatar-ph {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #eef1f4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.mp-lane-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-lane-track {
    position: relative;
    height: 22px;
    border-radius: 999px;
    background: #eef1f4;
    border: 2px solid #dde3e8;
    overflow: visible;
}

.mp-lane-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #b8e986, var(--primary-color));
    opacity: 0.45;
    pointer-events: none;
}

.mp-lane-pin {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) scaleX(-1);
    font-size: 1.1rem;
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
    z-index: 2;
}

.mp-lane-days {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-secondary);
    white-space: nowrap;
}

.mp-race-finish {
    flex-shrink: 0;
    width: 88px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    background: linear-gradient(145deg, #fff9e6, #ffe8a8);
    border: 2px solid var(--accent-yellow);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 0 var(--accent-yellow-dark);
}

.mp-race-pool-ico {
    font-size: 1.75rem;
    line-height: 1;
}

.mp-race-pool-xp {
    font-size: 0.9rem;
    font-weight: 800;
    color: #6d4c00;
    text-align: center;
    word-break: break-all;
}

.mp-race-empty {
    font-size: 0.92rem;
    color: var(--text-secondary);
    padding: 8px 0;
}

@media (max-width: 640px) {
    .mp-lane {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .mp-race-body {
        flex-direction: column;
    }

    .mp-race-finish {
        width: 100%;
        flex-direction: row;
        justify-content: center;
    }
}

.settings-duel-select {
    min-width: 140px;
}

.settings-duel-row {
    flex-wrap: wrap;
}

.leaderboard-opt-in-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.leaderboard-opt-in-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.leaderboard-loading {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.leaderboard-table-wrap {
    overflow-x: auto;
    margin-bottom: 28px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border);
    box-shadow: var(--shadow);
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
    background: #f3f6f9;
    font-weight: 800;
    font-size: 0.88rem;
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

.leaderboard-row-me {
    background: var(--primary-light);
}

.leaderboard-row-me td {
    font-weight: 800;
}

.lb-you {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 800;
    background: var(--primary-color);
    color: #fff;
    border-radius: var(--radius-pill);
    vertical-align: middle;
}

.leaderboard-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.achievements-section-title {
    margin-bottom: 12px;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.achievement-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 var(--tactile-depth) 0 rgba(0, 0, 0, 0.06);
}

.achievement-card.locked {
    opacity: 0.55;
    filter: grayscale(0.35);
}

.achievement-card .ach-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.achievement-card .ach-title {
    font-weight: 800;
    margin-bottom: 4px;
}

.achievement-card .ach-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.achievement-card .ach-when {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.achievements-empty {
    color: var(--text-secondary);
    padding: 12px 0;
}

@media (max-width: 640px) {
    .nav-gamification {
        width: 100%;
        justify-content: center;
    }
}

/* ---------- 学习地图（按已掌握词数里程碑） ---------- */
.learning-map-panel {
    margin: 0 0 24px;
    padding: 22px 22px 20px;
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--surface) 55%);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 var(--tactile-depth) 0 rgba(0, 0, 0, 0.06);
}

.learning-map-heading {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.learning-map-intro {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 18px;
}

.learning-map {
    position: relative;
    padding: 8px 0 4px;
    min-height: 120px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.learning-map-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: min(100%, 720px);
    margin: 0 auto;
}

.learning-map-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0;
    min-height: 148px;
    padding: 4px 0;
}

.learning-map-row--rtl {
    flex-direction: row-reverse;
}

.lm-seg--h {
    flex: 1 1 12px;
    min-width: 12px;
    max-width: 56px;
    height: 0;
    border-top: 3px dashed #c8d4c0;
    align-self: center;
    margin-bottom: 28px;
    opacity: 0.95;
}

.lm-row-join {
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
}

.lm-row-join--to-rtl {
    justify-content: flex-end;
    padding-right: min(11%, 72px);
}

.lm-row-join--to-rtl .lm-row-join-curve {
    width: 52px;
    height: 100%;
    border-left: 3px dashed #c8d4c0;
    border-bottom: 3px dashed #c8d4c0;
    border-bottom-left-radius: 16px;
    box-sizing: border-box;
}

.lm-row-join--to-ltr {
    justify-content: flex-start;
    padding-left: min(11%, 72px);
}

.lm-row-join--to-ltr .lm-row-join-curve {
    width: 52px;
    height: 100%;
    border-right: 3px dashed #c8d4c0;
    border-bottom: 3px dashed #c8d4c0;
    border-bottom-right-radius: 16px;
    box-sizing: border-box;
}

.learning-map-node {
    position: relative;
    flex: 0 0 auto;
    width: 118px;
    max-width: 28vw;
    min-width: 88px;
}

.learning-map-node-box {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.learning-map-node-level {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--secondary-dark);
    background: #eef7ff;
    border: 2px solid var(--secondary-color);
    border-radius: var(--radius-pill);
    padding: 2px 8px;
    margin-bottom: 6px;
    box-shadow: 0 2px 0 var(--secondary-dark);
}

.learning-map-node-bubble {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    border: 2px solid var(--border);
    box-sizing: border-box;
    transition: transform 0.2s cubic-bezier(0.34, 1.35, 0.64, 1), box-shadow 0.2s ease, filter 0.2s ease;
}

.learning-map-node-icon {
    font-size: 2rem;
    line-height: 1;
}

.learning-map-node--unlocked .learning-map-node-bubble {
    background: linear-gradient(160deg, #fff 0%, var(--primary-light) 45%, #c8f090 100%);
    border-color: var(--primary-color);
    box-shadow: 0 var(--tactile-depth) 0 var(--primary-dark);
}

.learning-map-node--locked .learning-map-node-bubble {
    background: linear-gradient(160deg, #e8e8e8 0%, #c8c8c8 100%);
    border-color: #9e9e9e;
    box-shadow: 0 var(--tactile-depth) 0 #757575;
    filter: grayscale(0.35);
}

.learning-map-node--locked .learning-map-node-count,
.learning-map-node--locked .learning-map-node-title,
.learning-map-node--locked .learning-map-node-level {
    color: var(--text-secondary);
    opacity: 0.92;
}

/* 未解锁：半透明「布」遮挡（亚麻纹理 + 雾面） */
.learning-map-node-veil {
    position: absolute;
    inset: -2px;
    z-index: 4;
    border-radius: 20px;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            -32deg,
            rgba(255, 255, 255, 0.22) 0px,
            rgba(255, 255, 255, 0.22) 5px,
            rgba(180, 186, 198, 0.14) 5px,
            rgba(180, 186, 198, 0.14) 10px
        ),
        linear-gradient(165deg, rgba(245, 246, 250, 0.72) 0%, rgba(210, 214, 224, 0.55) 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(0.5px);
}

/* 下一目标：整卡外圈（盖在遮罩外侧，未解锁时仍可见） */
.learning-map-node--next {
    outline: 3px solid var(--secondary-color);
    outline-offset: 3px;
    border-radius: 22px;
    animation: mapNodeNextPulse 2s ease-in-out infinite;
}

@keyframes mapNodeNextPulse {
    0%,
    100% {
        outline-offset: 3px;
    }
    50% {
        outline-offset: 6px;
    }
}

.learning-map-node:active .learning-map-node-bubble {
    transform: scale(0.96);
}

.learning-map-node-count {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
}

.learning-map-node--unlocked .learning-map-node-count {
    color: var(--primary-dark);
}

.learning-map-node-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-top: 2px;
    line-height: 1.25;
}

.learning-map-hint {
    margin: 16px 0 0;
    padding: 12px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.75);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
}

@media (max-width: 480px) {
    .learning-map-node-bubble {
        width: 64px;
        height: 64px;
    }

    .learning-map-node-icon {
        font-size: 1.65rem;
    }

    .learning-map-node {
        width: 78px;
        min-width: 72px;
        max-width: 22vw;
    }

    .lm-seg--h {
        min-width: 4px;
        max-width: 20px;
    }

    .lm-row-join--to-rtl {
        padding-right: 4px;
    }

    .lm-row-join--to-ltr {
        padding-left: 4px;
    }

    .lm-row-join--to-rtl .lm-row-join-curve,
    .lm-row-join--to-ltr .lm-row-join-curve {
        width: 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .learning-map-node--next {
        animation: none;
    }
}

/* ---------- 单词学习 Discovery Card（DESIGN 4.2） ---------- */
.discover-page {
    max-width: 560px;
    margin: 0 auto;
}

.discover-intro {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.discovery-search-wrap {
    margin-bottom: 18px;
}

.discovery-search-field {
    position: relative;
}

.discovery-search-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 50;
    max-height: min(52vh, 320px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: var(--surface);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.discovery-search-suggestions[hidden] {
    display: none !important;
}

.discovery-suggest-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    line-height: 1.35;
}

.discovery-suggest-item:hover,
.discovery-suggest-item:focus-visible {
    background: rgba(28, 176, 246, 0.12);
    outline: none;
}

.discovery-suggest-en {
    font-weight: 800;
}

.discovery-suggest-zh {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 2px;
}

.discovery-suggest-hint {
    padding: 10px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.discovery-search-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.discovery-top-controls {
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 10px 14px;
    margin-bottom: 22px;
}

.discovery-level-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
}

@media (min-width: 420px) {
    .discovery-level-label {
        text-align: left;
    }
}

.discovery-select-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 10px;
    margin-bottom: 4px;
}

.discovery-level-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.discovery-level-btn {
    padding: 8px 14px;
    font-size: 0.88rem;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    line-height: 1.2;
    min-height: 36px;
    box-sizing: border-box;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.discovery-level-btn:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

.discovery-level-btn.is-active {
    background: #16a34a;
    color: #fff;
    border-color: #15803d;
}

.discovery-level-btn.is-active:hover {
    background: #15803d;
    color: #fff;
    border-color: #166534;
}

.discovery-shuffle-btn {
    padding: 8px 14px;
    font-size: 0.88rem;
    font-weight: 700;
    border: 2px solid #1d4ed8;
    border-radius: var(--radius-md);
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    line-height: 1.2;
    min-height: 36px;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}

.discovery-shuffle-btn:hover {
    background: #1d4ed8;
    border-color: #1e40af;
    color: #fff;
}

.discovery-shuffle-btn:active {
    filter: brightness(0.95);
}

.discovery-empty {
    text-align: center;
    padding: 36px 20px;
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-weight: 600;
}

.discovery-root {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 22px;
}

.discovery-card-wrap {
    perspective: 800px;
    margin-top: 4px;
}

.discovery-card {
    text-align: center;
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--surface) 38%);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 var(--tactile-depth) 0 rgba(0, 0, 0, 0.08);
    animation: discoveryCardPop 0.48s cubic-bezier(0.34, 1.35, 0.64, 1) both;
}

@keyframes discoveryCardPop {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96) rotateX(6deg);
    }
    70% {
        transform: translateY(-4px) scale(1.01) rotateX(0deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .discovery-card {
        animation: none;
    }
}

.discovery-card-body {
    padding: 28px 20px 32px;
}

.discovery-card-word-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 14px;
    margin-bottom: 8px;
}

.discovery-card-word {
    margin: 0;
    font-size: clamp(2rem, 8vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    line-height: 1.15;
}

.discovery-card-word-row .btn-speak {
    width: 52px;
    height: 52px;
    font-size: 1.35rem;
}

.discovery-card-word-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.discovery-import-btn {
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    min-height: 40px;
    box-sizing: border-box;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}

.discovery-import-btn--add {
    background: #2563eb;
    color: #fff;
    border: 2px solid #1d4ed8;
}

.discovery-import-btn--add:hover {
    background: #1d4ed8;
    border-color: #1e40af;
    color: #fff;
}

.discovery-import-btn--add:active {
    filter: brightness(0.95);
}

.discovery-import-btn--muted {
    background: var(--surface);
    color: var(--text-secondary);
    border: 2px solid var(--border);
}

.discovery-import-btn--muted:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.discovery-import-btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    filter: grayscale(0.15);
}

.discovery-card-phonetic {
    margin: 0 0 20px;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.discovery-card-phonetic--empty {
    font-weight: 600;
    font-style: italic;
    opacity: 0.85;
}

.discovery-examples {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    min-height: calc(2 * 6.75rem + 12px);
}

.discovery-example-block {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 14px 16px;
    min-height: 6.75rem;
    box-sizing: border-box;
    background: linear-gradient(135deg, #e8f7fe, #f5fcff);
    border-radius: var(--radius-md);
    border: 2px solid #9fdcf9;
}

.discovery-example-block--placeholder {
    background: transparent;
    border: 2px dashed rgba(0, 0, 0, 0.1);
    padding: 14px 16px;
}

.discovery-example-block-body {
    flex: 1;
    min-width: 0;
}

.discovery-example-line {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.55;
    word-break: break-word;
}

.discovery-example-line--en {
    color: var(--text-primary);
}

.discovery-example-line--cn {
    margin-top: 8px;
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.discovery-example-block .btn-speak {
    flex-shrink: 0;
}

.discovery-example-block .btn-speak:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.4);
}

.discovery-card-na {
    margin: 0;
    padding: 14px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: #f5f5f5;
    border-radius: var(--radius-md);
    border: 2px dashed var(--border);
}

.discovery-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 12px;
}

.discovery-bottom-nav {
    margin-top: 14px;
    padding-top: 6px;
}

.discovery-nav-btn {
    min-width: 108px;
}

.discovery-counter {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--primary-dark);
    min-width: 5em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
    .discovery-toolbar {
        flex-direction: column;
    }

    .discovery-nav-btn {
        width: 100%;
        max-width: 100%;
    }
}

/* ==================== 新功能样式 ==================== */

.btn-danger-outline {
    background: transparent;
    color: var(--error-color);
    /* outline 不占 box model 高度，保持和实心按钮相同高度 */
    outline: 2px solid var(--error-color);
    outline-offset: -2px;
    border: none;
    box-shadow: 0 var(--tactile-depth) 0 var(--error-dark);
}
.btn-danger-outline:hover {
    background: #fff0f0;
}
.btn-danger-outline:active {
    transform: translateY(var(--tactile-depth));
    box-shadow: none;
}

/* 错题顺序控制 */
.wrong-order-control {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wrong-order-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.wrong-order-btns {
    display: flex;
    gap: 6px;
}
.wrong-order-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.wrong-order-btn input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.wrong-order-btn span {
    display: block;
    width: 100%;
    text-align: center;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    user-select: none;
}
.wrong-order-btn input[type="radio"]:checked + span {
    background: var(--secondary-color);
    border-color: var(--secondary-dark);
    box-shadow: 0 var(--tactile-depth) 0 var(--secondary-dark);
    color: #fff;
}

.admin-words-details {
    margin: 20px 0 10px;
}
.admin-words-details > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.admin-words-details > summary::-webkit-details-marker {
    display: none;
}
.admin-words-details-summary .admin-subtitle {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.admin-words-details-summary .admin-subtitle::before {
    content: '▸';
    font-size: 0.75em;
    opacity: 0.7;
    transition: transform 0.15s ease;
}
.admin-words-details[open] .admin-words-details-summary .admin-subtitle::before {
    transform: rotate(90deg);
}
.admin-words-details .admin-config-section {
    margin-top: 10px;
}

.admin-words-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
    margin-bottom: 14px;
}
.admin-words-toolbar .admin-config-group {
    margin-bottom: 0;
}
.admin-words-search-wrap {
    flex: 1 1 180px;
    min-width: 160px;
}
.admin-words-toolbar .btn-danger-outline {
    padding: 8px 14px;
    font-size: 0.9rem;
}
.admin-words-col-cb {
    width: 36px;
    text-align: center;
}
.admin-word-delete {
    padding: 4px 10px;
    font-size: 0.82rem;
}

/* 词库搜索（无难度tab版） */
.wordbank-toolbar-search {
    flex-direction: column;
    gap: 8px;
}
.wordbank-search-full {
    width: 100%;
    max-width: 100%;
}
.wordbank-hint-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 24px 0;
    text-align: center;
}

/* 词条难度标签颜色 */
.wb-level-primary { background: #e7ffd6; color: #2d7a00; }
.wb-level-junior { background: #d6eeff; color: #0050a0; }
.wb-level-senior { background: #f0e7ff; color: #6000b8; }
.wb-level-gre { background: #fff0d6; color: #a05000; }
.wb-level-other { background: #f0f0f0; color: #555; }

/* 例句预览 */
.wb-ex {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

/* 文章 / 图片 / 共用选词：单卡片外壳 */
.import-wordflow-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.import-wordflow-section {
    padding: 24px;
    margin: 0;
}
.import-wordflow-section + .import-wordflow-section {
    border-top: 1px solid var(--border);
}

.import-nc-lesson-label,
.import-article-source-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* 课文与图片：同一组「填入来源」，标签 + 全宽控件 + 说明 */
.import-article-sources {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 14px;
}
.import-article-source-block .import-nc-lesson-select {
    margin-bottom: 0;
}

.import-nc-lesson-select {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
    cursor: pointer;
    box-sizing: border-box;
}

.import-nc-lesson-select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.2);
}

.import-nc-lesson-select:disabled {
    opacity: 0.65;
    cursor: wait;
}

.import-nc-lesson-hint {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
    line-height: 1.45;
    margin: 0 0 12px;
}
.import-article-source-block .import-article-source-hint {
    margin: 6px 0 0;
}
.import-article-source-file-btn {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
    cursor: pointer;
    box-sizing: border-box;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.import-article-source-file-btn:hover {
    border-color: var(--secondary-color);
}
.import-article-source-file-btn:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.2);
}
.import-article-source-file-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}
.article-import-result {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f7f7f7;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}
/* 摘要条在选词区下方、主按钮上方 */
.import-wordflow-section--article .article-import-result {
    margin-top: 14px;
}
.import-article-primary-btn {
    width: 100%;
    margin-top: 14px;
    box-sizing: border-box;
}
.article-result-title {
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.article-result-spacy-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.88em;
}
.article-result-words {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.article-result-word {
    display: inline-block;
    padding: 3px 10px;
    background: var(--primary-light);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-dark);
}

/* 词汇导入（VIP） */
.import-vocab-panel {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
/* 选词 / 未匹配与文本框同区：浅色底、不另起白卡片 */
.import-wordflow-card .import-article-editor-area .import-article-pick-wrap {
    border: none;
    background: rgba(0, 0, 0, 0.035);
    min-height: 0;
    margin-top: 0;
}
.import-wordflow-card .import-article-editor-area .import-article-unmatched-wrap {
    border: none;
    background: rgba(0, 0, 0, 0.04);
    margin-top: 10px;
}
.vip-badge {
    display: inline-block;
    padding: 2px 10px;
    background: var(--accent-yellow);
    color: #6b4a00;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 800;
    vertical-align: middle;
    margin-left: 6px;
    box-shadow: 0 2px 0 var(--accent-yellow-dark);
}
.import-vocab-options {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}
.import-vocab-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.import-vocab-select {
    padding: 8px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
}
.import-vocab-queue-row {
    flex-wrap: wrap;
}
.import-vocab-queue-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}
.import-vocab-queue-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}
.import-locked-hint {
    margin-top: 12px;
    padding: 12px 16px;
    background: #fff8e5;
    border: 1px solid var(--accent-yellow);
    border-radius: var(--radius-md);
    color: #7a5500;
    font-size: 0.9rem;
}

/* 套餐提示 */
.plan-hint {
    font-size: 0.88rem;
    font-weight: 600;
}
.plan-hint.vip { color: var(--primary-dark); }
.plan-hint.free { color: var(--text-secondary); }

/* 管理员套餐标签 */
.plan-badge-vip {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent-yellow);
    color: #6b4a00;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 800;
}
.plan-badge-free {
    display: inline-block;
    padding: 2px 8px;
    background: #eee;
    color: #666;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
}
.btn-admin-plan {
    margin-left: 6px;
    padding: 4px 10px;
    border: 2px solid var(--secondary-color);
    background: transparent;
    color: var(--secondary-dark);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}
.btn-admin-plan:hover {
    background: #e5f7ff;
}

/* 管理员 DeepSeek 配置区 */
.admin-config-section {
    background: #f9f9f9;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
}
.admin-config-group {
    margin-top: 10px;
    margin-bottom: 10px;
}
.admin-config-save {
    width: auto;
    padding: 10px 24px;
}

/* loading 动画 */
.loading-dots::after {
    content: '';
    animation: dots 1.2s steps(3, end) infinite;
}
@keyframes dots {
    0%   { content: ''; }
    33%  { content: '.'; }
    66%  { content: '..'; }
    100% { content: '...'; }
}

/* 课文学习 */
.textbook-page {
    padding-bottom: 32px;
}
.textbook-intro {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.45;
    margin-bottom: 14px;
    max-width: 52rem;
}
.textbook-catalog {
    margin-top: 8px;
}
.textbook-catalog-hint {
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-secondary);
    margin: 0 0 14px;
    padding: 10px 12px;
    background: #f5f9f7;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.textbook-catalog-hint strong {
    color: var(--primary-dark);
    font-weight: 800;
}
.textbook-corpus-block {
    margin-bottom: 28px;
}
.textbook-corpus-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.textbook-book-block {
    margin-bottom: 18px;
    padding-left: 12px;
    border-left: 3px solid var(--primary-color);
}
.textbook-book-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.textbook-unit-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.textbook-unit-btn {
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: #fff;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    max-width: 100%;
    transition: border-color 0.15s, background 0.15s;
}
.textbook-unit-btn:hover {
    border-color: var(--secondary-color);
    background: #f0fbff;
}
.textbook-catalog-loading,
.textbook-catalog-empty {
    color: var(--text-secondary);
    padding: 16px 0;
}
.textbook-reader-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}
.textbook-reader-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.textbook-reader-title {
    font-size: 1.1rem;
    font-weight: 800;
    flex: 1;
    min-width: 0;
    margin: 0;
}
.textbook-fullread-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.textbook-fullread-start-btn {
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    border: 2px solid var(--secondary-color);
    background: #fff;
    color: var(--secondary-dark);
    cursor: pointer;
    white-space: nowrap;
}
.textbook-fullread-start-btn:hover {
    background: #f0fbff;
}
.textbook-fullread-icon-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.textbook-fullread-icon-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    border: 2px solid var(--secondary-color);
    background: #fff;
    color: var(--secondary-dark);
    cursor: pointer;
    flex-shrink: 0;
}
.textbook-fullread-icon-btn:hover {
    background: #f0fbff;
}
.textbook-fullread-icon-btn .tb-fr-svg {
    display: block;
    pointer-events: none;
}
.textbook-fullread-icon-btn--exit {
    border-color: var(--border);
    color: var(--text-secondary);
}
.textbook-fullread-icon-btn--exit:hover {
    border-color: #bbb;
    color: #555;
    background: #f5f5f5;
}
/** 全文朗读进行中：退出为红色；退出后移除该类恢复灰色 */
.textbook-fullread-icon-btn--exit.textbook-fullread-exit--active {
    border-color: #d32f2f;
    color: #c62828;
    background: #fff8f8;
}
.textbook-fullread-icon-btn--exit.textbook-fullread-exit--active:hover {
    border-color: #b71c1c;
    color: #b71c1c;
    background: #ffebee;
}
.textbook-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.textbook-back-btn {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: #fff;
    cursor: pointer;
}
.textbook-back-btn:hover {
    border-color: var(--secondary-color);
}
.textbook-line {
    margin-bottom: 0;
    padding: 8px 10px;
    background: #fafafa;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.textbook-line.textbook-line--speaking {
    background: #e8f5e9;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(46, 160, 67, 0.18);
}
.textbook-line-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.textbook-line-row .btn-speak.textbook-speak-line {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 0.72rem;
    margin-top: 1px;
    box-shadow: 0 2px 0 var(--secondary-dark);
}
.textbook-en-line {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text-primary);
}
.textbook-zh-wrap {
    margin-top: 4px;
    padding-left: 36px;
}
.textbook-zh-toggle {
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--secondary-dark);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px 0;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.textbook-zh-text {
    margin-top: 4px;
    font-size: 0.92rem;
    color: #444;
    line-height: 1.45;
}
.textbook-token {
    display: inline;
    border-radius: 6px;
    padding: 1px 2px;
    margin: 0 -2px;
    cursor: pointer;
    transition: background 0.12s;
}
.textbook-token--word:hover,
.textbook-token--word.tb-token--active {
    background: rgba(28, 176, 246, 0.28);
    box-shadow: 0 0 0 1px rgba(28, 176, 246, 0.35);
}
.textbook-token--word:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 1px;
}
.textbook-word-tooltip {
    position: fixed;
    z-index: 9000;
    max-width: min(320px, calc(100vw - 24px));
    padding: 10px 12px;
    background: #1a2330;
    color: #f0f4f8;
    font-size: 0.88rem;
    line-height: 1.45;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    pointer-events: auto;
}
.textbook-word-tooltip .tb-tip-actions {
    margin-top: 10px;
}
.textbook-word-tooltip .tb-tip-nlp-btn {
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(159, 220, 249, 0.45);
    background: rgba(28, 176, 246, 0.22);
    color: #c8ecfc;
    cursor: pointer;
}
.textbook-word-tooltip .tb-tip-nlp-btn:hover {
    background: rgba(28, 176, 246, 0.35);
}
.textbook-word-tooltip .tb-tip-nlp-hint {
    margin-top: 8px;
    font-size: 0.72rem;
    color: #7a8a9c;
    line-height: 1.35;
}
.textbook-word-tooltip .tb-tip-nlp-done {
    margin: 8px 0 0;
    font-size: 0.8rem;
    color: #9aa8b8;
}
.textbook-word-tooltip .tb-tip-en {
    font-weight: 700;
    color: #9fdcf9;
    margin-bottom: 4px;
}
.textbook-word-tooltip .tb-tip-zh {
    color: #e8eef5;
}
.textbook-word-tooltip .tb-tip-meta {
    margin-top: 6px;
    font-size: 0.8rem;
    color: #9aa8b8;
}
.textbook-word-tooltip .tb-tip-loading {
    color: #c5d0dc;
    animation: tb-tip-pulse 0.9s ease-in-out infinite;
}
@keyframes tb-tip-pulse {
    50% {
        opacity: 0.55;
    }
}
.textbook-word-tooltip .tb-tip-feedback {
    font-weight: 600;
    line-height: 1.45;
}
.textbook-word-tooltip .tb-tip-feedback--ok {
    color: #b8f5c8;
}
.textbook-word-tooltip .tb-tip-feedback--warn {
    color: #ffe08a;
}
.textbook-word-tooltip .tb-tip-feedback--error {
    color: #ffb4b4;
}
