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

/* ?????????????? */
:root {
    --gradient-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-bg-h: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    --icon-blue: #0079ff;
    --icon-filter-blue: brightness(0) saturate(100%) invert(32%) sepia(98%) saturate(1500%) hue-rotate(206deg) brightness(102%) contrast(101%);
    /* 拼音含拉丁字母+声调组合符：须用拉丁字体优先栈；勿把 CJK Sans 放在 DejaVu/Liberation 之前，否则 Linux 部署易丢声调 */
    --font-pinyin: "Segoe UI", "Segoe UI Symbol", "Noto Sans", "Arial Unicode MS", "DejaVu Sans", "Roboto", "Helvetica Neue", Arial, "Liberation Sans", "Ubuntu", Cantarell, ui-sans-serif, system-ui, sans-serif;
}

/* ?????????????PWA ????????*/
html {
    min-height: 100%;
    min-height: 100dvh;
    height: 100%;
    background: #fff;
    background-attachment: fixed;
    -webkit-text-size-adjust: 100%;
    scrollbar-width: none;
}
html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #fff;
    background-attachment: fixed;
    display: flex;
    flex-wrap: wrap;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    padding: 0;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    scrollbar-width: none;
}
body::-webkit-scrollbar {
    display: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: visible;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#appPage {
    width: 100%;
    height: 100%;
    padding-bottom: 0px;
    margin-bottom: 0px;
}

/* ?????????? */
.app-header {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: max(5px, env(safe-area-inset-top));
    padding-bottom: 5px;
}

header {
    background: #fff;
    color: #222;
    padding: 20px 30px;
    padding-left: max(15px, env(safe-area-inset-left));
    padding-right: max(15px, env(safe-area-inset-right));
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 250;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 6px 20px rgba(0, 0, 0, 0.25);
}
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
    z-index: 210;
}

.header-title {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    gap: 6px;
}
.header-logo-wrap {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    cursor: pointer;
}
.header-logo {
    height: 1.8em;
    width: auto;
    display: inline-block;
    vertical-align: middle;
}
.header-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: #e53935;
    border-radius: 9px;
    border: 2px solid #fff;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}
.header-notification-badge:hover {
    background: #c62828;
    transform: scale(1.05);
}
.header-logo-fallback {
    font-size: 1em;
    line-height: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-user-info {
    color: #333;
    font-size: 14px;
}

.btn-header-logout {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
}
.btn-icon-logout {
    padding: 8px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon-logout svg {
    display: block;
}

/* ???????????? / X?????? */
.nav-toggle-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    gap: 5px;
    transition: transform 0.2s;
}
.nav-toggle-btn:hover {
    background: transparent;
}
.nav-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: #000;
    border-radius: 1px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.nav-toggle-btn.open .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle-btn.open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}
.nav-toggle-btn.open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

header h1,
.header-title {
    font-size: 2.5em;
    margin: 0;
    color: #222;
}

/* ==================== ????==================== */
.navbar {
    background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, #f5f5f9 100%);
    padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
    border-bottom: 1px solid rgba(102, 126, 234, 0.15);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 14px 0;
}

.navbar .nav-item.tab-btn {
    padding: 10px 18px;
    min-height: 44px;
    background: transparent;
    border: 1px solid #e2e4e8;
    color: #555;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.navbar .nav-item.tab-btn:hover {
    background: rgba(102, 126, 234, 0.08);
    border-color: rgba(102, 126, 234, 0.35);
    color: #667eea;
}

.navbar .nav-item.tab-btn.active {
    background: var(--gradient-bg);
    color: white;
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
}

.navbar .nav-item.tab-btn.active:hover {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.5);
}

/* ???? .tabs / .tab-btn ?? */
.tabs,
.tabs-nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.tab-btn {
    padding: 12px 24px;
    min-height: 44px;
    min-width: 44px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    color: #333;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    z-index: 2;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
    transform: translateY(-2px);
}

/* 导航图标 - 无背景 */
.nav-item-icon-left {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2em;
    margin-right: 8px;
    font-size: 1.1em;
    line-height: 1;
}
.nav-item-icon-left img {
    width: 1.1em;
    height: 1.1em;
    object-fit: contain;
    filter: var(--icon-filter-blue);
    vertical-align: middle;
}
.tab-btn.active .nav-item-icon-left img {
    filter: brightness(0) invert(1);
}

/* 智能工具：图标为 free trial.png，尺寸与其它导航图标一致；PNG 不使用 SVG 滤镜 */
.tab-btn-nav-deepseek .nav-icon-free-trial {
    width: 1.1em;
    height: 1.1em;
    object-fit: contain;
    object-position: center;
    filter: none !important;
    vertical-align: middle;
}
.tab-btn-nav-deepseek.active .nav-icon-free-trial {
    filter: none !important;
}

.tab-btn.active {
    background: var(--gradient-bg);
    color: white;
    border-color: #667eea;
}

main {
    padding: 0 30px 0;
    margin-bottom: 0;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
/* ????????????*/
main:has(#practice.tab-content.active) {
    padding: 0 15px 15px;
}
/* DeepSeek：桌面全屏由 #deepseek top 控制顶距；main 顶内边距为 0 */
main:has(#deepseek.tab-content.active) {
    padding: 0;
}
.tab-content {
    display: none;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: visible;
    animation: fadeIn 0.3s;
}

/* ???????????????? */
#practice.tab-content.active {
    flex: none;
    min-height: 0;
    overflow: visible;
}
#practice .character-practice-content {
    flex: none;
    min-height: 0;
    overflow: visible;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== DEEPSEEK ???? ==================== */
#deepseek.tab-content.active {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    gap: 12px;
    /* ????????????????????????? */
    background: #ffffff;
    position: fixed;
    /* ?????????????header */
    top: max(64px, env(safe-area-inset-top));
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    max-width: none !important;
    height: auto;
    z-index: 100;
    animation: none;
    overscroll-behavior: none;
}

/* DeepSeek 页面仅允许对话框纵向滚动 */
body:has(#deepseek.tab-content.active),
main:has(#deepseek.tab-content.active) {
    overflow-y: hidden;
}

#deepseek.tab-content.active .deepseek-layout,
#deepseek.tab-content.active .deepseek-main,
#deepseek.tab-content.active .deepseek-sidebar,
#deepseek.tab-content.active .deepseek-history-list {
    overflow-y: hidden;
}

/* ????/ iPad?DeepSeek ??????????PWA ????????????DeepSeek ????? */
@media (max-width: 1400px) {
    #deepseek.tab-content.active {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        width: 100%;
        min-height: calc(100vh - 50px);
        min-height: calc(100dvh - 50px);
    }
}

/* ???????????DeepSeek ??min-height ??????? header ?? */
@media (max-width: 1400px) {
    header:has(#mainNav.open) ~ main #deepseek.tab-content.active,
    header:has(.tabs-nav.open) ~ main #deepseek.tab-content.active {
        min-height: calc(100vh - 320px);
        min-height: calc(100dvh - 320px);
    }
    /* 主导航展开时隐藏底部固定输入，避免与下拉导航重叠 */
    header:has(#mainNav.open) ~ main #deepseek .deepseek-input-wrap,
    header:has(.tabs-nav.open) ~ main #deepseek .deepseek-input-wrap {
        display: none !important;
    }
    header:has(#mainNav.open) ~ main #deepseek .deepseek-messages,
    header:has(.tabs-nav.open) ~ main #deepseek .deepseek-messages {
        padding-bottom: 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    /* 历史侧栏打开时：主导航展开不再使用 -320px 压扁高度，避免底部整体上移 */
    header:has(#mainNav.open) ~ main #deepseek.tab-content.active:has(.deepseek-layout.deepseek-sidebar-open),
    header:has(.tabs-nav.open) ~ main #deepseek.tab-content.active:has(.deepseek-layout.deepseek-sidebar-open) {
        min-height: calc(100vh - 50px);
        min-height: calc(100dvh - 50px);
    }
    /* 保持历史侧栏位置稳定：导航展开时不再额外下推侧栏和遮罩 */
    header:has(#mainNav.open) ~ main #deepseek .deepseek-layout.deepseek-sidebar-open .deepseek-sidebar,
    header:has(.tabs-nav.open) ~ main #deepseek .deepseek-layout.deepseek-sidebar-open .deepseek-sidebar {
        top: 0;
        max-height: 100vh;
        max-height: 100dvh;
    }
    header:has(#mainNav.open) ~ main #deepseek .deepseek-layout.deepseek-sidebar-open .deepseek-sidebar-overlay,
    header:has(.tabs-nav.open) ~ main #deepseek .deepseek-layout.deepseek-sidebar-open .deepseek-sidebar-overlay {
        top: 0;
    }
}

/* ????????????max-width: 1400px??????????????*/
@media (min-width: 1401px) {
    #deepseek.tab-content.active {
        top: calc(160px + env(safe-area-inset-top, 0px));
        left: 50%;
        transform: translateX(-50%);
        width: 100% !important;
        max-width: 1400px !important;
    }
    .deepseek-layout {
        padding-top: 0px;
        padding-bottom: 0px;
    }
}

#deepseek .section-header {
    flex-shrink: 0;
    margin-bottom: 8px;
}
#deepseek .section-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #202124;
    margin: 0;
    letter-spacing: -0.01em;
}

.deepseek-layout {
    position: relative;
    width: 100%;
    max-width: none;
    margin: 0;
    padding-top: 0px;
    display: flex;
    flex-direction: row;
    gap: 18px;
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    overflow: visible;
    box-sizing: content-box;
}

/* ????????????????? */
.deepseek-sidebar-toggle,
.deepseek-sidebar-overlay {
    display: none;
}

#deepseekSidebarOverlay {
    top: 0px;
    margin-top: 0px;
    margin-bottom: 0px;
    padding-bottom: 0px;
    width: 100%;
    height: 100%;
    vertical-align: bottom;
}

/* web ??>1400px????????iPad ??????????*/
@media (min-width: 1401px) {
    .deepseek-sidebar-overlay {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
    .deepseek-sidebar {
        padding-top: 0;
    }
    /* Web：新对话主按钮 — 点击区域、对齐与悬停统一 */
    .deepseek-sidebar .btn.deepseek-new-chat {
        margin: 0;
        min-height: 40px;
        padding: 0 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        box-sizing: border-box;
        font-weight: 600;
        letter-spacing: 0.02em;
        line-height: 1.2;
        box-shadow: none;
        transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    }
    .deepseek-sidebar .btn.deepseek-new-chat:hover {
        transform: translateY(-2px);
        box-shadow: none;
    }
    .deepseek-sidebar .btn.deepseek-new-chat:focus-visible {
        outline: 2px solid rgba(26, 115, 232, 0.55);
        outline-offset: 2px;
    }
}

/* 桌面常驻历史栏：顶/底各 10px 外边距；勿设 height:100%，否则 flex 拉伸会吞掉上下 margin、贴死底边 */
aside.deepseek-sidebar {
    width: 212px;
    flex-shrink: 0;
    align-self: stretch;
    min-height: 0;
    margin-top: 10px;
    margin-bottom: 10px; /* 非抽屉态：与布局底留白 10px（stretch 高度 = 行高 − 上下 margin） */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 14px;
    padding: 0 14px 20px 14px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8eaed;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    overflow: hidden;
    overscroll-behavior: contain;
}

/* 历史抽屉打开（侧边栏状态）：顶/底均贴齐布局边，与遮罩一致 */
.deepseek-layout.deepseek-sidebar-open aside.deepseek-sidebar {
    margin-top: 0;
    margin-bottom: 0;
}

.deepseek-sidebar-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 10px 0 4px;
}

.deepseek-sidebar-header .deepseek-new-chat {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.deepseek-sidebar > .deepseek-new-chat {
    margin: 0;
    width: 100%;
}

.deepseek-sidebar-header + .deepseek-new-chat {
    display: none;
}

.deepseek-sidebar-header .deepseek-user-avatar-btn {
    flex-shrink: 0;
}

/* 侧栏「+ 新对话」：透明底、仅描边 */
.deepseek-sidebar .btn.btn-primary.deepseek-new-chat {
    background: transparent;
    background-image: none;
    color: #1a73e8;
    border: 1.5px solid #1a73e8;
    box-shadow: none;
}

.deepseek-sidebar .btn.btn-primary.deepseek-new-chat:hover {
    background: rgba(26, 115, 232, 0.08);
    color: #1557b0;
    border-color: #1557b0;
    box-shadow: none;
}

.deepseek-sidebar .btn.btn-primary.deepseek-new-chat:active {
    background: rgba(26, 115, 232, 0.14);
}

.deepseek-new-chat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    margin: 0;
    width: 100%;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    padding: 0 12px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.deepseek-new-chat-icon,
.deepseek-new-chat-icon img {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* 侧栏描边按钮：图标与描边同色（Chat.svg 原色为深色） */
.deepseek-sidebar .deepseek-new-chat-icon img {
    filter: brightness(0) saturate(100%) invert(35%) sepia(90%) saturate(2000%) hue-rotate(200deg);
}

.deepseek-new-chat:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(26, 115, 232, 0.25);
}

.deepseek-user-avatar-btn {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    line-height: 0;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.deepseek-user-avatar-btn:hover {
    transform: scale(1.04);
}

.deepseek-user-avatar-btn:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 3px;
}

.deepseek-sidebar-settings-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f3f5f7;
    border: 1px solid #e8eaed;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.deepseek-sidebar-settings-icon {
    display: block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    filter: brightness(0) saturate(100%) invert(38%) sepia(6%) saturate(500%) hue-rotate(182deg);
}

/* 智能工具：头像设置层（参考 DeepSeek App 侧滑设置） */
.deepseek-user-settings-layer {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 350;
    pointer-events: none;
}

.deepseek-layout.deepseek-user-settings-open .deepseek-user-settings-layer {
    display: block;
    pointer-events: auto;
}

.deepseek-user-settings-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.deepseek-user-settings-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(360px, calc(100% - 24px));
    max-width: calc(100% - 24px);
    max-height: calc(100% - 24px);
    background: #fff;
    box-shadow: 8px 0 36px rgba(0, 0, 0, 0.14);
    transform: translate(-50%, calc(-50% + 12px)) scale(0.96);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 14px 16px 20px;
    box-sizing: border-box;
    border-radius: 18px;
    border: 1px solid #e8eaed;
    overflow: hidden;
}

.deepseek-layout.deepseek-user-settings-open .deepseek-user-settings-panel {
    transform: translate(-50%, -50%) scale(1);
}

.deepseek-user-settings-top {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 40px;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.deepseek-user-settings-back {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f3f5f7;
    font-size: 28px;
    font-weight: 500;
    line-height: 1;
    color: #202124;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px 2px 0;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.deepseek-user-settings-back:hover {
    background: #e8eaed;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}

.deepseek-user-settings-back:active {
    transform: scale(0.96);
    background: #dde3e8;
}

.deepseek-user-settings-back:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

.deepseek-user-settings-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 17px;
    font-weight: 600;
    color: #202124;
    white-space: nowrap;
    pointer-events: none;
}

.deepseek-user-settings-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e8eaed;
    flex-shrink: 0;
}

.deepseek-user-settings-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    background: linear-gradient(135deg, #5b6eea, #4b5fd4);
    box-shadow: 0 2px 12px rgba(91, 110, 234, 0.35);
}

.deepseek-user-settings-display {
    font-size: 16px;
    font-weight: 600;
    color: #202124;
    line-height: 1.3;
}

.deepseek-user-settings-account {
    font-size: 12px;
    color: #5f6368;
    margin-top: 4px;
    word-break: break-all;
}

.deepseek-user-settings-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.deepseek-user-settings-item-model {
    padding: 4px 2px 8px;
    margin-bottom: 2px;
    border-bottom: 1px solid #eceff1;
}

.deepseek-user-settings-item-model .deepseek-model-wrap {
    gap: 8px;
}

.deepseek-user-settings-item-model .deepseek-model-label {
    font-size: 12px;
    color: #5f6368;
}

.deepseek-user-settings-item-model .deepseek-model-select {
    font-size: 13px;
    border-radius: 12px;
    background-color: #fff;
}

.deepseek-user-settings-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 12px;
    border: none;
    border-radius: 12px;
    background: transparent;
    font-size: 15px;
    color: #202124;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 0.15s ease;
}

.deepseek-user-settings-item:hover {
    background: #f1f3f4;
}

.deepseek-user-settings-item:active {
    background: #e8eaed;
}

.deepseek-user-settings-item-danger {
    color: #c5221f;
}

.deepseek-user-settings-item-icon {
    display: flex;
    width: 26px;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.88;
}

.deepseek-user-settings-item-icon img {
    display: block;
}

.deepseek-history-label {
    font-size: 11px;
    font-weight: 600;
    color: #80868b;
    padding: 2px 0 8px 0;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.deepseek-history-list {
    flex: 1;
    min-height: 0;
    margin-bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    padding-right: 2px;
    scrollbar-width: none;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: contain;
}
.deepseek-history-list::-webkit-scrollbar {
    display: none;
}

.deepseek-sidebar-bottom {
    flex-shrink: 0;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-top: 10px;
    padding-bottom: 20px;
}

.deepseek-model-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.deepseek-model-label {
    font-size: 11px;
    font-weight: 600;
    color: #80868b;
    letter-spacing: 0.04em;
}

.deepseek-model-select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #3c4043;
    background: #f8f9fa;
    border: 1px solid #dadce0;
    border-radius: 10px;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.deepseek-model-select:hover {
    border-color: #bdc1c6;
    background-color: #f1f3f4;
}

.deepseek-model-select:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.deepseek-history-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    font-size: 13px;
    color: #3c4043;
    background: #f8f9fa;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s ease, color 0.15s ease;
    outline: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    user-select: none;
    -webkit-user-select: none;
}
.deepseek-history-item:focus {
    outline: none;
    box-shadow: none;
}
.deepseek-history-item:active {
    outline: none;
    box-shadow: none;
    background: #e8eaed;
}
.deepseek-history-item:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

.deepseek-history-item:hover {
    background: #f1f3f4;
}

.deepseek-history-item.active {
    background: #e8f0fe;
    color: #1557b0;
    font-weight: 500;
    box-shadow: inset 0 0 0 1px rgba(26, 115, 232, 0.35);
}

.deepseek-history-empty {
    font-size: 13px;
    color: #80868b;
    padding: 14px 0;
    margin: 0;
    line-height: 1.5;
}

.deepseek-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 50px;
    padding: 0px 12px;
    background: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
    overscroll-behavior: contain;
}

.deepseek-messages {
    border-radius: 0;
    padding: 12px 16px;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: transparent;
    border: none;
    scroll-behavior: smooth;
    scrollbar-width: none;
    overscroll-behavior: contain;
}
.deepseek-messages.deepseek-streaming {
    scroll-behavior: auto;
}
.deepseek-messages::-webkit-scrollbar {
    display: none;
}

.deepseek-message {
    margin-bottom: 20px;
    line-height: 1.6;
    max-width: 100%;
}
.deepseek-message:last-child {
    margin-bottom: 0;
}

.deepseek-message.user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.deepseek-message.user .deepseek-role {
    text-align: right;
    margin-right: 2px;
}
.deepseek-message.user > .deepseek-bubble {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    color: #fff;
    max-width: 78%;
    box-shadow: 0 2px 6px rgba(26, 115, 232, 0.25);
    border-radius: 16px 16px 4px 16px;
}

.deepseek-message.assistant {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.deepseek-message.assistant .deepseek-role {
    text-align: left;
    margin-left: 2px;
}
.deepseek-message.assistant > .deepseek-bubble {
    background: #fff;
    border: none;
    max-width: 88%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-radius: 16px 16px 16px 4px;
}

.deepseek-bubble {
    display: inline-block;
    padding: 14px 18px;
    border-radius: 16px;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.6;
}
.deepseek-bubble p {
    margin: 0 0 0.5em 0;
}
.deepseek-bubble p:last-child {
    margin-bottom: 0;
}
.deepseek-bubble strong {
    font-weight: 600;
}
.deepseek-bubble em {
    font-style: normal;
}

.deepseek-bubble .deepseek-reply-img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 10px 0 0 0;
    border: 1px solid #e8eaed;
}

.deepseek-story-btn-wrap {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,.06);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}
.deepseek-story-btn-wrap.deepseek-wrong-copy-actions {
    justify-content: flex-start;
    gap: 8px 12px;
}
.deepseek-wrong-copy-page-link {
    font-size: 13px;
    font-weight: 500;
    color: #1a73e8;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
    line-height: 1.35;
    align-self: center;
}
.deepseek-wrong-copy-page-link:hover {
    color: #1557b0;
}
.deepseek-wrong-copy-page-link.deepseek-wrong-copy-print-direct {
    color: #5b21b6;
}
.deepseek-wrong-copy-page-link.deepseek-wrong-copy-print-direct:hover {
    color: #4c1d95;
}
.deepseek-story-btn-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.deepseek-story-btn-icon-only {
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 0;
    padding: 2px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0;
}
.deepseek-story-btn.deepseek-story-btn-icon-only {
    gap: 0;
}
.deepseek-story-btn-share.deepseek-story-btn-icon-only,
.deepseek-story-btn-collect.deepseek-story-btn-icon-only {
    background: transparent !important;
    color: #1a73e8 !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}
.deepseek-story-btn-share.deepseek-story-btn-icon-only:hover,
.deepseek-story-btn-collect.deepseek-story-btn-icon-only:hover {
    background: transparent !important;
    color: #1557b0 !important;
    border: none !important;
    box-shadow: none !important;
}
.deepseek-story-btn-share.deepseek-story-btn-icon-only:focus,
.deepseek-story-btn-collect.deepseek-story-btn-icon-only:focus,
.deepseek-story-btn-share.deepseek-story-btn-icon-only:active,
.deepseek-story-btn-collect.deepseek-story-btn-icon-only:active {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}
.deepseek-story-btn-icon-only > span:not(.deepseek-story-btn-icon) {
    display: none !important;
}
.deepseek-story-btn-icon-only .deepseek-story-btn-icon,
.deepseek-story-btn-icon-only .deepseek-story-btn-icon svg {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
}
.deepseek-story-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
    background: #667eea !important;
    color: #fff !important;
    border: none;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    flex: 0 0 auto;
}
@media (max-width: 480px) {
    .deepseek-story-btn-wrap { flex-wrap: nowrap; gap: 6px; }
    .deepseek-story-btn-wrap.deepseek-wrong-copy-actions {
        flex-wrap: wrap;
        gap: 8px 10px;
    }
    .deepseek-story-btn { flex: 1; min-width: 0; padding: 6px 10px; font-size: 12px; }
    .deepseek-story-btn-print { flex: 0 0 auto !important; min-width: 0; padding: 6px 12px !important; }
    .deepseek-story-btn-icon-only {
        flex: 0 0 auto !important;
        width: auto;
        height: auto;
        padding: 4px !important;
        background: transparent !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
}
.deepseek-story-btn > span:not(.deepseek-story-btn-icon) { display: inline-flex !important; }
.deepseek-story-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}
.deepseek-story-btn > span:not(.deepseek-story-btn-icon) {
    display: inline !important;
}
.deepseek-story-btn-icon svg {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    flex-shrink: 0;
    object-fit: contain;
}
@media (max-width: 480px) {
    .deepseek-story-btn-icon { width: 14px; height: 14px; }
    .deepseek-story-btn-icon svg { width: 14px; height: 14px; min-width: 14px; min-height: 14px; }
    .deepseek-story-btn-icon-only .deepseek-story-btn-icon,
    .deepseek-story-btn-icon-only .deepseek-story-btn-icon svg {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        min-height: 20px !important;
    }
}
.deepseek-story-btn:hover {
    background: #5a67d8 !important;
}
.deepseek-story-btn-share {
    background: #10b981 !important;
}
.deepseek-story-btn-share:hover {
    background: #059669 !important;
}
.deepseek-story-btn-collect {
    background: #f59e0b !important;
}
.deepseek-story-btn-collect:hover {
    background: #d97706 !important;
}

/* 错字抄写按钮（DeepSeek 回复下方） */
.deepseek-wrong-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: 13px;
    text-decoration: none;
    color: #1a73e8;
    border: 1px solid #1a73e8;
    border-radius: 8px;
    transition: all 0.2s;
}
.deepseek-wrong-copy-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.deepseek-wrong-copy-btn-icon svg {
    width: 15px;
    height: 15px;
    display: block;
}
.deepseek-wrong-copy-btn:hover {
    background: #e8f0fe;
    color: #1557b0;
}

/* 错字抄写弹窗 */
.wrong-copy-modal-content {
    max-width: 640px;
}
.wrong-copy-modal-title {
    margin: 0 0 8px 0;
    font-size: 1.2rem;
    font-weight: 600;
}
.wrong-copy-modal-desc {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #5f6368;
}
.wrong-copy-modal-grid {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 16px;
}
/* 错字抄写弹窗：与打印一致的样式（第一列错字，后四列空田字格） */
.wrong-copy-modal-print-style .wrong-copy-print-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.wrong-copy-modal-print-style .wrong-copy-print-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    align-items: stretch;
    cursor: pointer;
    transition: opacity 0.2s;
}
.wrong-copy-modal-print-style .wrong-copy-print-row:hover {
    opacity: 0.85;
}
.wrong-copy-modal-print-style .wrong-copy-print-row:first-child .wrong-copy-print-sixian {
    border-top: 1px solid #000;
}
.wrong-copy-print-cell:last-child .wrong-copy-print-sixian,
.wrong-copy-print-cell:last-child .wrong-copy-print-tianze {
    border-right-color: #000;
}
.wrong-copy-print-tianze {
    width: 80px;
    height: 72px;
    min-width: 80px;
    border: 2px solid #333;
    border-top-color: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #fff;
}
.wrong-copy-print-tianze::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1px solid rgba(0, 0, 0, 0.3);
}
.wrong-copy-print-tianze::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    border-left: 1px solid rgba(0, 0, 0, 0.3);
}
.wrong-copy-print-pinyin {
    font-size: 26px;
    color: #333;
    font-family: var(--font-pinyin);
    line-height: 1.35;
    margin-bottom: 2px;
    z-index: 1;
    transform: translateY(-2px);
}
.wrong-copy-print-char {
    font-size: 52px;
    font-family: KaiTi, "楷体", "STKaiti", serif;
    z-index: 1;
}
.wrong-copy-print-tianze-empty {
    background: #fafafa;
}
.wrong-copy-modal-actions {
    display: flex;
    gap: 12px;
}

/* 聊天内故事分享弹窗 */
.deepseek-story-share-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.deepseek-story-share-modal.show {
    display: flex;
}
.deepseek-story-share-box {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.deepseek-story-share-box h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
}
.deepseek-story-share-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.deepseek-story-share-opt {
    padding: 12px 16px;
    text-align: left;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
}
.deepseek-story-share-opt:hover {
    background: #f8fafc;
}
.deepseek-story-share-close {
    margin-top: 12px;
    width: 100%;
    padding: 10px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

/* 故事查看弹窗（当前页内显示，不跳转） */
.deepseek-story-viewer-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99999;
    align-items: stretch;
    justify-content: center;
    padding: 16px;
}
.deepseek-story-viewer-modal.show {
    display: flex;
}
.deepseek-story-viewer-box {
    background: #fff;
    border-radius: 12px;
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.deepseek-story-viewer-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.deepseek-story-viewer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    line-height: 1.8;
    font-size: 16px;
    color: #333;
}
.deepseek-story-viewer-body .story-viewer-title {
    text-align: center;
    font-size: 1.4em;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 16px 0;
}
.deepseek-story-viewer-body .story-viewer-content {
    text-align: justify;
}
.deepseek-story-viewer-body .story-viewer-content p {
    margin: 0 0 12px 0;
    text-indent: 2em;
}
.deepseek-story-viewer-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
}
.deepseek-story-viewer-btn-print {
    background: #667eea;
    color: #fff;
}
.deepseek-story-viewer-btn-print:hover {
    background: #5a67d8;
}
.deepseek-story-viewer-btn-close {
    background: #f1f5f9;
    color: #475569;
}
.deepseek-story-viewer-btn-close:hover {
    background: #e2e8f0;
}

/* 打印时只显示故事正文，隐藏弹窗边框和按钮 */
@media print {
    .deepseek-story-viewer-modal { background: transparent !important; padding: 0 !important; align-items: flex-start !important; }
    .deepseek-story-viewer-modal .deepseek-story-viewer-box { max-height: none !important; box-shadow: none !important; }
    .deepseek-story-viewer-modal .deepseek-story-viewer-header { display: none !important; }
    .deepseek-story-viewer-modal .deepseek-story-viewer-body { color: #000 !important; }
}

.deepseek-role {
    font-size: 11px;
    font-weight: 600;
    color: #80868b;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.deepseek-input {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 20px;
    border: 1px solid #dadce0;
    background: #f8fafc;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.deepseek-usage-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: rgba(37, 99, 235, 0.08);
    color: #1a73e8;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.18);
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
}
.deepseek-usage-icon svg {
    pointer-events: none;
}
.deepseek-usage-icon:hover {
    background: rgba(37, 99, 235, 0.16);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
}
.deepseek-usage-icon:focus {
    outline: none;
}
.deepseek-usage-icon:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

.deepseek-usage-modal {
    max-height: 70vh;
    overflow: auto;
}
.deepseek-usage-tip {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}
.deepseek-usage-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.deepseek-usage-summary .item {
    padding: 6px 8px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    font-size: 12px;
}
.deepseek-usage-summary .label {
    color: #6b7280;
    margin-bottom: 2px;
}
.deepseek-usage-summary .value {
    font-weight: 600;
    color: #111827;
}
.deepseek-usage-charts {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.deepseek-usage-charts .chart-block {
    padding: 8px 10px;
    border-radius: 10px;
    background: #111827;
    border: none;
}
.deepseek-usage-charts .chart-title {
    font-size: 12px;
    color: #e5e7eb;
    margin-bottom: 6px;
}
.deepseek-usage-table-wrap {
    margin-top: 8px;
}
.deepseek-usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.deepseek-usage-table th,
.deepseek-usage-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 4px 6px;
}
.deepseek-usage-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #4b5563;
}

/* 独立用量页 usage.html：标题在左，返回图标在右上 */
.usage-standalone-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color, #e8eaed);
}
.usage-standalone-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: var(--bg-secondary, #f1f3f4);
    cursor: pointer;
    flex-shrink: 0;
    color: inherit;
}
.usage-standalone-back-btn:hover {
    background: #e8eaed;
}
.usage-standalone-back-icon {
    display: inline-flex;
    line-height: 0;
}
.usage-standalone-heading {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    text-align: left;
}
.usage-standalone-sr-title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.usage-standalone-subheader {
    position: relative;
}
main#usage.usage-standalone.tab-content.active {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 20px; /* 覆盖 #usage.tab-content.active 的 padding-top:0，整体下移 20px */
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
    min-height: 100vh;
}

/* iPad / 平板（与主站 ≤1400px 平板布局同档）：用量页在通用 20px 基础上再下移 20px */
@media (max-width: 1400px) and (min-width: 600px) {
    main#usage.usage-standalone.tab-content.active {
        padding-top: 40px;
    }
}

/* 用量统计：宽度占满；顶/底留白由与各板块统一的 .tab-content.active 规则控制 */
#usage.tab-content {
    padding-top: 0;
    width: 100%;
}
#usage .section-header {
    margin-top: 0;
    margin-bottom: 8px;
}
#usage .usage-remark {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: #64748b;
}
#usage #usageContent {
    margin-top: 0;
    width: 100%;
}
#usage .usage-page {
    width: 100%;
}
/* 用量图表卡片内月份筛选（深色背景） */
.usage-chart-month-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    max-width: 100%;
}
.usage-chart-card .usage-month-label {
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    margin: 0;
    white-space: nowrap;
}
.usage-chart-card .usage-month-select {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: #cbd5e1;
    padding: 6px 0 6px 25px;
    margin: 0 0;
    min-width: 7.5rem;
    max-width: min(46vw, 11rem);
    border: none;
    border-radius: 8px;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: background-color 0.15s ease;
}
.usage-chart-card .usage-month-select:hover {
    background-color: rgba(255, 255, 255, 0.06);
}
.usage-chart-card .usage-month-select:focus {
    outline: none;
}
.usage-chart-card .usage-month-select:focus-visible {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
}
.usage-chart-card .usage-month-select option {
    background: #1e293b;
    color: #f8fafc;
}
.usage-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 768px) {
    #usage .usage-header-actions {
        flex-wrap: nowrap;
        gap: 6px;
    }
    /* 用量明细表：移动端完整显示，时间列缩短、表格紧凑 */
    #usage .usage-table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #usage .usage-table {
        table-layout: fixed;
        width: 100%;
        font-size: 12px;
    }
    #usage .usage-table th,
    #usage .usage-table td {
        padding: 6px 8px;
    }
    #usage .usage-table .usage-time {
        width: 22%;
        white-space: normal;
        word-break: normal;
        line-height: 1.35;
    }
    #usage .usage-table .usage-num,
    #usage .usage-table .usage-cost {
        width: 18%;
    }
    #usage .usage-header-actions .btn {
        white-space: nowrap;
        flex: 1 1 0%;
        min-width: 0;
        font-size: 13px;
        padding-left: 10px;
        padding-right: 10px;
    }
    /* 免费领取按钮：小屏下不收缩，内容完整显示 */
    #usage .usage-header-actions .btn-free-claim {
        flex: 0 0 auto;
        min-width: fit-content;
    }
}

/* 免费领取按钮：喜庆红金配色 + 左侧礼物图标；宽度自适应内容完整显示 */
.btn-free-claim {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    color: #fff !important;
    border: 1px solid #d4af37 !important;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
    padding-left: 14px;
    padding-right: 14px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: fit-content;
}
.btn-free-claim:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%) !important;
    border-color: #d4af37 !important;
    box-shadow: 0 4px 14px rgba(231, 76, 60, 0.4), 0 0 12px rgba(212, 175, 55, 0.25);
}
.btn-free-claim .btn-free-claim-icon {
    margin-right: 6px;
    font-size: 14px;
    line-height: 1;
    vertical-align: -2px;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.8));
}

/* 鐢ㄩ噺缁熻椤?- 閲嶆柊璁捐甯冨眬 */
.usage-page {
    max-width: 900px;
}
.usage-summary-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.usage-card {
    padding: 14px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
}
.usage-card-balance {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #93c5fd;
}
.usage-card-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}
.usage-card-label-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.usage-card-label-icon img {
    display: block;
    width: 16px;
    height: 16px;
    filter: var(--icon-filter-blue);
}
.usage-card-value {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
}
.usage-charts {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.usage-chart-card {
    padding: 14px;
    border-radius: 12px;
    background: #0f172a;
    border: 1px solid #1e293b;
}
.usage-chart-title {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 10px;
}
.usage-chart-canvas {
    position: relative;
    width: 100%;
    max-width: none;
}
.usage-bar-overlay {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
}
.usage-chart-canvas canvas {
    width: 100% !important;
    max-width: none;
    height: 200px !important;
}
.usage-bar-tooltip {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10000;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.5;
    color: #e2e8f0;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    pointer-events: none;
    white-space: nowrap;
}
.usage-bar-tooltip strong {
    color: #f8fafc;
}
.usage-detail-section {
    margin: 18px 0;
}
.usage-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: #202124;
    margin: 0 0 6px 0;
    padding: 10px 12px;
    user-select: none;
    background: #f1f3f4;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.usage-detail-header:hover {
    background: #e8eaed;
}
.usage-detail-toggle-icon {
    margin-left: 10px;
    margin-right: 10px;
    font-size: 12px;
    color: #202124;
    opacity: 0.8;
    flex-shrink: 0;
}
.usage-detail-title {
    margin: 0;
    margin-left: 10px;
    margin-right: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #202124;
}
.usage-table-scroll {
    overflow-x: auto;
    border-radius: 10px;
    border: none;
}
.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.usage-table th,
.usage-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
}
.usage-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}
.usage-table tbody tr:hover {
    background: #f8fafc;
}
.usage-time { white-space: nowrap; }
.usage-num { text-align: right; }
.usage-cost { text-align: right; }
.usage-footer {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 12px;
}

.usage-load-more {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6px 0 6px;
    color: #94a3b8;
    cursor: pointer;
    font-size: 12px;
    user-select: none;
    transition: color 0.15s ease, transform 0.15s ease;
}
.usage-load-more:hover {
    color: #64748b;
    transform: translateY(1px);
}
.usage-load-more-icon {
    position: relative;
    width: 14px;
    height: 14px;
    padding-top: 9px;
    padding-bottom: 9px;
}
.usage-load-more-icon::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 3px;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    border-radius: 2px;
}

/* 鐢ㄩ噺缁熻椤甸潰 - 鏂板竷灞€ */
.usage-page {
    max-width: 100%;
    overflow: hidden;
}
.usage-summary-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.usage-card {
    padding: 14px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.2s;
}
.usage-card:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.usage-card-balance {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #93c5fd;
}
.usage-card-label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}
.usage-card-value {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}
.usage-charts {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.usage-chart-card {
    padding: 12px 14px;
    border-radius: 12px;
    background: #0f172a;
    border: 1px solid #1e293b;
}
.usage-chart-title {
    font-size: 13px;
    color: #cbd5e1;
    margin-bottom: 8px;
}
.usage-chart-title-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.usage-chart-ym {
    font-size: 12px;
    color: #94a3b8;
}
.usage-chart-canvas {
    display: block;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}
.usage-chart-canvas canvas {
    display: block;
    width: 100% !important;
    height: 200px !important;
    /* 提高移动端显示清晰度，避免缩放模糊 */
    image-rendering: -webkit-optimize-contrast;
}
.usage-detail-section {
    margin-bottom: 12px;
}
.usage-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    padding: 8px 0;
    cursor: pointer;
    user-select: none;
}
.usage-detail-header:hover {
    color: #1e293b;
}
.usage-detail-toggle-icon {
    margin-left: 10px;
    margin-right: 10px;
    font-size: 12px;
    color: #64748b;
}
.usage-detail-title {
    margin-left: 10px;
    margin-right: 10px;
    font-size: 14px;
    font-weight: 600;
    color: inherit;
}
.usage-detail-body {
    margin-top: 4px;
}
.usage-table-scroll {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
}
.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.usage-table th {
    background: #f8fafc;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #475569;
}
.usage-table td {
    padding: 8px 12px;
    border-top: 1px solid #f1f5f9;
}
.usage-table .usage-time {
    white-space: nowrap;
}
.usage-table .usage-num,
.usage-table .usage-cost {
    text-align: right;
}
.usage-footer {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 12px;
}

/* ????????????????+ ??????*/
@keyframes deepseek-clear-breathe {
    0%, 100% { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset, 0 0 16px rgba(197, 34, 31, 0.25), 0 0 32px rgba(197, 34, 31, 0.12); }
    50% { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset, 0 0 24px rgba(197, 34, 31, 0.45), 0 0 48px rgba(197, 34, 31, 0.25); }
}
.deepseek-sidebar .deepseek-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    margin-top: 0;
    margin-bottom: 0px;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
    color: #c5221f;
    background: rgba(252, 232, 230, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(197, 34, 31, 0.2);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset,
                0 0 16px rgba(197, 34, 31, 0.25),
                0 0 32px rgba(197, 34, 31, 0.12);
    animation: deepseek-clear-breathe 2.5s ease-in-out infinite;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.deepseek-sidebar .deepseek-clear-btn:hover {
    color: #b71c1c;
    background: rgba(252, 232, 230, 0.9);
    animation: none;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset,
                0 0 28px rgba(197, 34, 31, 0.5),
                0 0 48px rgba(197, 34, 31, 0.25);
}
.deepseek-sidebar .deepseek-clear-btn svg,
.deepseek-sidebar .deepseek-clear-btn img {
    flex-shrink: 0;
}
.deepseek-sidebar .deepseek-clear-btn img {
    filter: brightness(0) saturate(100%) invert(18%) sepia(98%) saturate(7000%) hue-rotate(0deg);
}

.deepseek-input textarea {
    flex: 1;
    min-height: 52px;
    max-height: 200px;
    resize: none;
    padding: 12px 4px;
    border-radius: 12px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.55;
    transition: box-shadow 0.2s;
}
.deepseek-input textarea::placeholder {
    color: #80868b;
}
.deepseek-input textarea:focus {
    outline: none;
    box-shadow: none;
}

.deepseek-input-wrap {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
/* 历史对话侧栏打开时隐藏底部输入白框（#deepseek 在 layout 外层，勿写成 layout 内的 #deepseek） */
.deepseek-layout.deepseek-sidebar-open .deepseek-input-wrap {
    display: none !important;
}
.deepseek-input-actions {
    padding: 0 4px 4px;
}
.deepseek-print-last-test-btn {
    font-size: 13px;
    padding: 8px 16px;
    background: #f8f9fa;
    color: #5f6368;
    border: 1px solid #dadce0;
}
.deepseek-print-last-test-btn:hover {
    background: #e8eaed;
    color: #202124;
}
.deepseek-send-icon {
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 0;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #1a73e8;
    transition: transform 0.15s ease, color 0.15s ease;
}
.deepseek-send-icon svg,
.deepseek-send-icon img {
    flex-shrink: 0;
}
.deepseek-send-icon img {
    filter: var(--icon-filter-blue);
}

.deepseek-send-icon:hover {
    transform: scale(1.08);
}

.deepseek-send-icon:active {
    transform: scale(0.85) translate(1px, -1px) rotate(8deg);
    color: #1558b0;
}

/* DEEPSEEK ??????*/
.deepseek-empty-hint {
    color: #5f6368;
    font-size: 15px;
    line-height: 1.6;
    padding: 20px 0 12px 0;
    margin: 0;
}

.deepseek-guide {
    margin-top: 0px;
    padding-top: 24px;
    padding-bottom: 24px;
    border-top: 1px solid #e8eaed;
}

.deepseek-guide-title {
    font-size: 13px;
    font-weight: 600;
    color: #5f6368;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
}

.deepseek-guide-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.deepseek-guide-item {
    display: block;
    font-size: 14px;
    color: #0079ff;
    line-height: 1.6;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}
.deepseek-guide-item:hover {
    color: #0066dd;
    transform: translateX(4px);
}
.deepseek-guide-item:focus-visible {
    outline: 2px solid #0079ff;
    outline-offset: 2px;
}

.deepseek-guide-edit-link {
    font-size: 12px;
    font-weight: 400;
    color: #0079ff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.deepseek-guide-edit-link:hover {
    text-decoration: underline;
}
.deepseek-guide-edit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    margin-top: 0px;
}
.deepseek-guide-edit-link svg {
    display: block;
    vertical-align: middle;
}

/* 编辑推荐问题弹窗 */
.guide-prompts-edit-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.guide-prompts-edit-modal.show {
    display: flex;
}
.guide-prompts-edit-box {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.guide-prompts-edit-box h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}
.guide-prompts-edit-hint {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: #64748b;
}
.guide-prompts-edit-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.guide-prompts-edit-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.guide-prompts-edit-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 48px;
}
.guide-prompts-edit-del {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    color: #64748b;
    line-height: 1;
}
.guide-prompts-edit-del:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}
.guide-prompts-edit-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: #333;
    font-size: 1.8em;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    font-weight: 500;
}

.btn.deepseek-new-chat {
    padding: 6px 0;
    margin: 0 35px;
    border-radius: 999px;
}

.btn-primary {
    background: var(--gradient-bg);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.search-bar {
    margin-bottom: 20px;
}

.search-bar-with-layout,
.section-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-bar-input,
.toolbar-input {
    flex: 1;
    min-width: 140px;
}

.toolbar-input {
    max-width: 200px;
    padding: 8px 12px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.toolbar-input:hover {
    background: #fff;
    border-color: #b8bcc4;
}
.toolbar-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    background: #fff;
}

.search-bar-select,
.toolbar-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

/* 各板块：顶距由 main 统一为导航底向下 10px，此处仅保留下边距；不含 DeepSeek 全屏页 */
#users.tab-content.active,
#students.tab-content.active,
#characters.tab-content.active,
#lessons.tab-content.active,
#mastery.tab-content.active,
#usage.tab-content.active,
#profile.tab-content.active,
#practice.tab-content.active {
    padding-top: 0;
    padding-bottom: 20px;
    box-sizing: border-box;
}

#reports.tab-content.active {
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
}

/* 学习报告 / 学习记录：锚点滚动时避免被顶栏遮挡（≤1400px 布局） */
#reports.tab-content.active,
#mastery.tab-content.active {
    scroll-margin-top: 90px;
}

.operation-logs-hint {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px;
    line-height: 1.5;
}

.user-list-table .user-row-actions-wrap {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
}

/* 用户管理：操作日志 / 充值 TOKEN 等纯图标按钮 */
.user-admin-action-icon-btn {
    padding: 6px 8px;
    line-height: 0;
    vertical-align: middle;
}
.user-admin-action-icon-btn-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.user-admin-action-icon-btn-inner img {
    display: block;
}
.user-admin-action-icon-btn.btn-primary .user-admin-action-icon-btn-inner img {
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.user-oplogs-modal .user-oplogs-list-wrap {
    max-height: min(50vh, 480px);
    overflow: auto;
    width: 100%;
}

.operation-logs-list-wrap {
    overflow-x: auto;
    width: 100%;
}

.operation-logs-table .op-log-time {
    white-space: nowrap;
    font-size: 13px;
}

.operation-logs-table .op-log-path code {
    word-break: break-all;
    font-size: 12px;
}

.operation-logs-table .op-log-detail-pre {
    margin: 0;
    max-width: 360px;
    max-height: 120px;
    overflow: auto;
    font-size: 11px;
    line-height: 1.4;
    text-align: left;
    background: #f8f9fa;
    padding: 6px 8px;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 用户管理：搜索框 + 内嵌图标按钮（移动端显示图标，桌面端显示「搜索」文字按钮） */
#users .user-toolbar-search-wrap {
    position: relative;
    flex: 1;
    min-width: 140px;
    max-width: 200px;
}
#users .user-toolbar-search-wrap .toolbar-input {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}
#users .user-toolbar-search-icon-btn {
    display: none;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #5f6368;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
#users .user-toolbar-search-icon-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.08);
}
#users .user-toolbar-search-icon-btn:active {
    background: rgba(102, 126, 234, 0.14);
}
#users .user-toolbar-search-icon-btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

#users .user-toolbar-filters-row {
    display: inline-flex;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 12px;
    min-width: 0;
}
#users .user-toolbar-filters-row .toolbar-select {
    flex: 1 1 auto;
    min-width: 0;
}

/* 用户管理 WEB：工具栏搜索、下拉、排布、主按钮统一 40px 高 */
@media (min-width: 769px) {
    #users .section-toolbar {
        align-items: center;
    }

    #users .user-toolbar-search-wrap .toolbar-input {
        height: 40px;
        min-height: 40px;
        padding: 0 12px;
        box-sizing: border-box;
        line-height: 1.3;
    }

    #users .section-toolbar > .btn.user-toolbar-search-text-btn,
    #users .section-toolbar > .btn.btn-primary {
        height: 40px;
        min-height: 40px;
        padding: 0 16px;
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    #users .section-toolbar .toolbar-select {
        height: 40px;
        min-height: 40px;
        padding: 0 44px 0 12px;
        box-sizing: border-box;
        line-height: normal;
    }

    #users .user-layout-switch {
        height: 40px;
        box-sizing: border-box;
        align-items: stretch;
    }

    #users .user-layout-switch .btn-layout {
        min-height: 0;
        flex: 1 1 0;
        padding: 0 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }
}

.search-bar-label {
    font-size: 14px;
    color: #555;
}

/* ??????????????????*/
.search-bar input,
.search-bar-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid #dadce0;
    border-radius: 10px;
    font-size: 15px;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.search-bar input:hover,
.search-bar-input:hover {
    background: #fff;
    border-color: #b8bcc4;
}

.search-bar input:focus,
.search-bar-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    background: #fff;
}

.search-bar-with-layout {
    position: relative;
}

.search-bar-with-layout .search-bar-input {
    padding-left: 40px;
}

.search-bar-with-layout::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat center;
    pointer-events: none;
}

.search-bar-with-layout:focus-within::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
}

.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
}

.filters select,
.filters input {
    padding: 10px;
    padding-right: 44px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}
.filters input {
    padding-right: 10px;
}

.my-library-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.my-library-toolbar .character-library-summary {
    margin: 0;
}
/* ?????????? + ?????? */
.search-box-with-btn {
    display: inline-flex;
    align-items: stretch;
    gap: 10px;
}
.search-box-with-btn .search-input-wrap {
    min-width: 180px;
}
.search-box-with-btn .btn-search-inline {
    padding: 0 18px;
    height: 40px;
    min-height: 40px;
    line-height: 38px;
    box-sizing: border-box;
    border: 1px solid #dadce0;
    border-radius: 10px;
    background: #fff;
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.search-box-with-btn .btn-search-inline:hover {
    background: #eef2ff;
    border-color: #667eea;
    color: #5b21b6;
}
.search-box-with-btn .btn-search-inline:active {
    background: #e0e7ff;
}
.filters .search-box-with-btn .btn-search-inline {
    height: 40px;
    min-height: 40px;
    line-height: 38px;
}

.search-input-wrap {
    position: relative;
    display: inline-block;
    min-width: 180px;
}
.search-input-wrap .search-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--icon-blue);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.search-input-wrap .search-input-icon svg,
.search-input-wrap .search-input-icon img {
    display: block;
}
.search-input-wrap .search-input-icon img {
    filter: var(--icon-filter-blue);
}
.search-input-wrap:focus-within .search-input-icon {
    color: #667eea;
}
.filters .search-input-wrap {
    min-width: 160px;
}
.filters .search-input-wrap input,
.search-input-wrap input {
    padding: 10px 14px 10px 40px;
    border: 1px solid #dadce0;
    border-radius: 10px;
    font-size: 15px;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.search-input-wrap input:hover {
    background: #fff;
    border-color: #b8bcc4;
}
.search-input-wrap input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    background: #fff;
}

.search-input-wrap .my-library-search-input,
.search-input-wrap input[id^="myLibrarySearch"],
.search-input-wrap input[id="characterSearch"] {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}
.character-library-summary {
    margin: 0 0 16px 0;
    /* 略小字号，长文案如「公共字库（共 1990 个汉字，已显示 45 个）」更易单行或省空间 */
    font-size: clamp(10px, 0.48rem + 0.75vw, 12px);
    color: #555;
    font-weight: 500;
    line-height: 1.35;
    white-space: nowrap;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
#characterLibrarySummary {
    margin-left: 15px;
}
#myLibrarySummary {
    margin-left: 10px;
}

/* ??????????*/
.character-section-title-hidden {
    display: none;
}
/* ????????????*/
.character-section-header {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}
.character-section-header .character-tabs-center-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    padding-top: 10px;
    padding-bottom: 0px;
    margin-top: 0px;
    margin-bottom: 0px;
}
/* ??????????/ ???? ???? */
.character-management-tabs {
    display: inline-flex;
}
.character-tabs-switch {
    display: inline-flex;
    background: #e8eaed;
    border-radius: 12px;
    padding: 5px;
    gap: 0;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
.character-tabs-switch .sub-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 88px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: #5f6368;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
}
.character-tabs-switch .sub-tab-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.character-tabs-switch .sub-tab-icon img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(42%) sepia(0%) saturate(0%) hue-rotate(180deg) brightness(92%) contrast(88%);
}
.character-tabs-switch .sub-tab-btn.active .sub-tab-icon img {
    filter: var(--icon-filter-blue);
}
.character-tabs-switch .sub-tab-btn:hover:not(.active) {
    color: #202124;
    background: rgba(255,255,255,0.5);
}
.character-tabs-switch .sub-tab-btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}
.character-tabs-switch .sub-tab-btn.active {
    background: #fff;
    color: #667eea;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.character-tabs-switch .sub-tab-btn.active:hover {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}
.character-toolbar .toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.character-toolbar .toolbar-select {
    min-width: 160px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 14px;
}
.character-sub-panel {
    margin-top: 0px;
}

/* ?????????????????? */
.character-filters-wrap {
    position: relative;
    margin-bottom: 12px;
    width: 100%;
}
.character-filters-toggle {
    display: none;
}

/* ?????????????????main ???? */
main:has(#characters.tab-content.active) .character-filters-wrap {
    margin-left: -30px;
    margin-right: -30px;
    width: calc(100% + 60px);
    padding-left: 30px;
    padding-right: 30px;
    box-sizing: border-box;
}

/* ?????????????????????*/
.character-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    border: none;
}
.character-filters-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.character-filters-main {
    flex: 1;
    min-width: 0;
}
.character-filters-search {
    flex-shrink: 0;
}
.character-filters select {
    padding: 6px 28px 6px 10px;
    height: 40px;
    min-height: 40px;
    box-sizing: border-box;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    background-color: #fafafa;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-width: 8em;
    flex: 1 1 auto;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.character-filters select:hover {
    border-color: #b8bcc4;
    background-color: #fff;
}
.character-filters select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    background-color: #fff;
}
.character-filters .search-input-wrap {
    min-width: 80px;
    flex: 1 1 auto;
}
.character-filters .search-input-wrap input {
    padding: 6px 10px 6px 36px;
    font-size: 14px;
    border-radius: 8px;
    min-height: 40px;
    height: 40px;
    box-sizing: border-box;
}
.character-filters .search-box-with-btn .btn-search-inline {
    padding: 0 12px;
    height: 40px;
    min-height: 40px;
    line-height: 38px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid #dadce0;
    background: #fff;
    color: #667eea;
}
.character-filters .search-box-with-btn .btn-search-inline:hover {
    border-color: #667eea;
    background: #eef2ff;
}

/* ??????????????X??xxx?? */
.character-filters select#lessonFilter,
.character-filters select#myLessonFilter {
    min-width: 12em;
}

/* ?????????????? */
.my-library-list {
    margin-top: 10px;
    margin-bottom: 10px;
}
.my-library-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.my-library-load-more-bar {
    text-align: center;
    padding: 10px;
    background: #fafafa;
    border: 1px solid #eee;
    border-top: none;
    border-radius: 0 0 10px 10px;
}
.my-library-load-more-bar .usage-load-more {
    display: inline-flex;
    align-items: center;
    gap: 1em;
}
.my-library-load-more-bar .usage-load-more:hover {
    background: transparent;
}
.my-library-table {
    width: 100%;
    min-width: 880px;
    border-collapse: collapse;
    font-size: 14px;
    background: white;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
}
.my-library-table th,
.my-library-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}
.my-library-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}
.my-library-table tbody tr:hover {
    background: #f8f9fa;
    cursor: pointer;
}
.my-library-table th:first-child,
.my-library-table td.my-library-num {
    width: 48px;
    text-align: right;
}
.my-library-table td.my-library-load-more {
    text-align: center;
    padding: 10px;
    background: #fafafa;
    cursor: default;
}
.my-library-table tr:has(td.my-library-load-more):hover {
    background: transparent;
    cursor: default;
}
.my-library-table td.my-library-load-more .usage-load-more {
    display: inline-flex;
    align-items: center;
    gap: 1em;
}
.my-library-table td.my-library-load-more .usage-load-more:hover {
    background: transparent;
}

.deepseek-typing .deepseek-bubble {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.deepseek-typing-dots {
    display: inline-flex;
    gap: 4px;
}
.deepseek-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #9e9e9e;
    opacity: 0.4;
    animation: deepseek-typing-bounce 1s infinite ease-in-out;
}
.deepseek-typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}
.deepseek-typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes deepseek-typing-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.3; }
    40% { transform: translateY(-4px); opacity: 0.9; }
}

.deepseek-typing-text {
    font-size: 13px;
    color: #757575;
}

/* ????????????????/??/??/??/??????*/
.character-tile-tags {
    font-size: 10px;
    color: #666;
    margin-top: 4px;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ==================== ??/?????????? ==================== */
.layout-switch-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.user-layout-label {
    font-size: 14px;
    color: #555;
    white-space: nowrap;
}

.user-layout-switch {
    display: inline-flex;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.user-layout-switch .btn-layout {
    padding: 6px 14px;
    font-size: 13px;
    border: none;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
    margin: 0;
    border-radius: 0;
    min-height: 36px;
}

.user-layout-switch .btn-layout:first-child {
    border-right: 1px solid #ddd;
}

.user-layout-switch .btn-layout:hover {
    background: #eee;
}

.user-layout-switch .btn-layout.active {
    background: var(--gradient-bg);
    color: white;
}

/* 用户管理：移动端筛选/分页下拉与工具栏排布 */
@media (max-width: 768px) {
    #users .section-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    #users .user-toolbar-search-wrap {
        max-width: none;
        width: 100%;
        flex: 0 0 auto;
    }

    #users .user-toolbar-search-icon-btn {
        display: inline-flex;
    }

    #users .user-toolbar-search-text-btn {
        display: none !important;
    }

    #users .user-toolbar-filters-row {
        display: flex;
        flex-direction: row;
        width: 100%;
        flex: 0 0 auto;
        gap: 10px;
        align-items: stretch;
    }

    #users .section-toolbar .toolbar-select {
        max-width: none;
        width: 100%;
        flex: 0 0 auto;
        min-width: 0;
        min-height: 48px;
        padding: 12px 14px;
        padding-right: 44px;
        font-size: 16px;
        line-height: 1.35;
        border: 1px solid #dadce0;
        border-radius: 10px;
        background-color: #f8f9fb;
        color: #202124;
        box-sizing: border-box;
        -webkit-tap-highlight-color: transparent;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 12 12'%3E%3Cpath fill='%235f6368' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
        background-position: right 14px center;
        background-size: 14px;
    }

    #users .section-toolbar .toolbar-select:focus {
        outline: none;
        border-color: #667eea;
        background-color: #fff;
        box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.22);
    }

    /* 角色 + 条数并排时覆盖上面的 width:100% */
    #users .user-toolbar-filters-row .toolbar-select {
        flex: 1 1 0;
        min-width: 0;
        width: auto;
        max-width: none;
    }

    #users .section-toolbar .layout-switch-group {
        display: none;
    }

    /* 与全局 #userSearchInput 区分：限定在用户管理内保证触控与宽度；右侧留白给内嵌搜索图标 */
    #users #userSearchInput {
        max-width: none;
        width: 100%;
        min-height: 48px;
        padding: 12px 48px 12px 14px;
        font-size: 16px;
        border-radius: 10px;
        box-sizing: border-box;
    }

    #users .section-toolbar > .btn,
    #users .section-toolbar > .btn-primary {
        width: 100%;
        min-height: 48px;
        box-sizing: border-box;
    }
}

/* ????????????*/
/* ?????????? */
#students .card-grid,
#students .student-list-wrap {
    width: 100%;
    max-width: 100%;
}

.student-list-wrap,
.user-list-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 0;
}

.student-list-table,
.user-list-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 14px;
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.student-list-table th,
.student-list-table td,
.user-list-table th,
.user-list-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.student-list-table th,
.user-list-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.student-list-table tbody tr:hover,
.user-list-table tbody tr:hover {
    background: #f8f9fa;
}

.student-list-table .badge,
.user-list-table .badge {
    font-size: 12px;
}

.user-list-table {
    min-width: 980px;
}

.user-list-table .user-list-col-library,
.user-list-table .user-list-col-online {
    white-space: nowrap;
}

.user-list-table .user-list-library-cap {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.user-list-table .user-lib-cap-sep {
    color: #9aa0a6;
    font-weight: 400;
}

.user-list-table .user-lib-cap-note {
    color: #80868b;
    font-size: 13px;
}

/* 最后登录 / 注册时间：日期一行、时间一行 */
.user-list-table th.user-list-col-datetime,
.user-list-table td.user-list-col-datetime {
    max-width: 118px;
    width: 118px;
    box-sizing: border-box;
    font-size: 12px;
    line-height: 1.35;
    padding: 10px 6px;
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}

.user-list-table th.user-list-col-datetime {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-list-table td.user-list-col-datetime {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.user-list-datetime-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    line-height: 1.2;
}

.user-list-datetime-date {
    font-weight: 500;
}

.user-list-datetime-time {
    font-size: 11px;
    color: var(--text-tertiary, #80868b);
}

.user-list-datetime-missing {
    color: var(--text-tertiary, #9aa0a6);
    font-weight: 400;
}

.user-list-table .user-list-col-actions {
    white-space: nowrap;
    width: 1%;
    vertical-align: middle;
}

.user-list-table .user-list-col-actions .btn-sm {
    padding: 6px 10px;
    font-size: 13px;
    flex-shrink: 0;
}

.user-list-table .user-list-token-balance {
    font-variant-numeric: tabular-nums;
}

.user-admin-card-actions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
}

/* 用户管理：查看朋友圈分享截图 */
.admin-moments-screenshot-modal .admin-moments-screenshot-wrap {
    text-align: center;
    max-height: min(70vh, 620px);
    overflow: auto;
    margin: 12px 0;
}
.admin-moments-screenshot-img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e0e0e0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.admin-moments-screenshot-img-broken {
    display: none;
}
.admin-moments-screenshot-loaderr {
    margin: 12px 0 0;
    font-size: 13px;
    color: #c5221f;
    line-height: 1.5;
    text-align: left;
}
.admin-moments-screenshot-hint {
    margin: 0;
    font-size: 12px;
    color: var(--text-tertiary, #80868b);
    line-height: 1.5;
    word-break: break-all;
}
.admin-moments-screenshot-hint code {
    font-size: 11px;
    background: var(--bg-secondary, #f1f3f4);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ?????????? */
.lesson-list-wrap {
    width: 100%;
    overflow-x: auto;
}

.lesson-list-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.lesson-list-table th,
.lesson-list-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.lesson-list-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.lesson-list-table tbody tr:hover {
    background: #f8f9fa;
}

.lesson-list-table .btn-sm {
    margin-right: 4px;
}

/* ??????- ???? */
.character-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 12px;
}

.character-tile {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.character-tile:hover {
    border-color: #667eea;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.25);
    transform: translateY(-2px);
}

.character-tile-char {
    font-size: 2.2em;
    line-height: 1.2;
    color: #333;
    font-family: "KaiTi", "??", "STKaiti", serif;
}
.character-tile-unmastered-dot {
    display: block;
    width: 6px;
    height: 6px;
    margin-top: 4px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 50%;
    background: #e53935;
    flex-shrink: 0;
}

.character-tile-pinyin {
    font-size: 0.75em;
    color: #666;
    margin-bottom: 4px;
    font-family: var(--font-pinyin);
    line-height: 1.35;
}

/* ?????? / ???? */
.character-pagination {
    margin-top: 20px;
    padding: 12px 0;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.character-load-more-wrap {
    text-align: center;
}
.character-tile-enter {
    animation: cp-tile-fade-in 0.35s ease-out forwards;
}

.character-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    color: #555;
    font-size: 14px;
}

.btn-pagination {
    padding: 6px 14px;
    min-width: 72px;
}

.btn-pagination:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== ???????????????????????==================== */
#characterPractice.tab-content.active {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.character-practice-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
    z-index: auto;
}
/* ????????*/
.practice-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}
.practice-block {
    background: #fafbfc;
    border: 1px solid #e8eaed;
    border-radius: 14px;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.practice-block-title {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
}

.character-practice-section .section-header {
    flex-shrink: 0;
    margin-bottom: 12px;
}
.character-practice-content {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 8px 24px 8px;
    -webkit-overflow-scrolling: touch;
}
#characterPractice.tab-content {
    position: relative;
    z-index: auto;
}
.cp-blocks {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    min-width: 0;
}
.cp-main-block {
    background: #fafbfc;
    border: 1px solid #e8eaed;
    border-radius: 14px;
    padding: 22px 26px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
    min-width: 0;
}
.cp-main-block.cp-card-wrongchars {
    padding-top: 0px;
    padding-bottom: 0px;
}
.cp-main-block.cp-link-form-block {
    max-width: 400px;
}
.cp-title {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    color: #1a1a1a;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.cp-literacy-growth-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}
.cp-literacy-growth-head .cp-title {
    margin-bottom: 0;
}
.cp-literacy-days-select {
    min-width: 120px;
    max-width: 100%;
}
.cp-literacy-growth-hint {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: #5f6368;
    line-height: 1.45;
}
.cp-literacy-chart-wrap {
    width: 100%;
    min-width: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e8eaed;
    background: #fafbfc;
}
.cp-literacy-chart-wrap canvas {
    display: block;
    vertical-align: top;
}
/* 学习报告：标题 + 分享（学生上下文由隐藏 select 与「学习记录」下拉同步） */
#reports .report-student-select-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
#reports .report-student-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
}
/* 学习报告「分享」：图标+文字，无下划线 */
#reports .report-share-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px 2px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--icon-blue);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    line-height: 1.35;
    text-decoration: none;
}
#reports .report-share-action:hover {
    color: #0066dc;
    text-decoration: none;
}
#reports .report-share-action:focus {
    outline: none;
}
#reports .report-share-action:focus-visible {
    outline: 2px solid rgba(102, 126, 234, 0.45);
    outline-offset: 2px;
    border-radius: 4px;
}
#reports .report-share-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}
#reports .report-share-action-icon img {
    width: 1.15em;
    height: 1.15em;
    object-fit: contain;
    vertical-align: middle;
    filter: var(--icon-filter-blue);
}

/* 学习记录：选学生 +「添加记录」与上方工具条同高 */
#mastery .mastery-student-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
}
#mastery .mastery-student-toolbar select,
#mastery .mastery-student-toolbar .btn {
    min-height: 42px;
    box-sizing: border-box;
    font-size: 14px;
}
#mastery .mastery-student-toolbar .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
}
#mastery .mastery-student-toolbar select {
    min-width: 200px;
    max-width: 100%;
    padding: 0 12px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #fff;
    line-height: normal;
    vertical-align: middle;
}

/* 学习记录：总字数 / 平均分 / 已掌握 / 需加强 — 四宫格概览 */
#mastery .mastery-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 0 0 24px;
    box-sizing: border-box;
}

#mastery .mastery-stat-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin: 0;
    padding: 14px 16px 14px 18px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--border-color, #e8eaed);
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
    border-left: 4px solid #667eea;
    min-width: 0;
}

#mastery .mastery-stat-card--total {
    border-left-color: #5c6bc0;
}
#mastery .mastery-stat-card--avg {
    border-left-color: #0891b2;
}
#mastery .mastery-stat-card--ok {
    border-left-color: #16a34a;
}
#mastery .mastery-stat-card--weak {
    border-left-color: #ea580c;
}

#mastery .mastery-stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #5f6368);
    line-height: 1.35;
    letter-spacing: 0.02em;
}

#mastery .mastery-stat-value {
    font-size: clamp(1.5rem, 4vw, 1.85rem);
    font-weight: 700;
    line-height: 1.15;
    color: var(--text-primary, #202124);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

#mastery .mastery-stat-unit {
    margin-left: 4px;
    font-size: 0.55em;
    font-weight: 600;
    color: var(--text-tertiary, #80868b);
    vertical-align: 0.08em;
}

#mastery .mastery-stat-desc {
    font-size: 12px;
    color: var(--text-tertiary, #80868b);
    line-height: 1.4;
    margin-top: 2px;
}

@media (max-width: 900px) {
    #mastery .mastery-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 20px;
    }
}

@media (max-width: 380px) {
    #mastery .mastery-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* 学习报告：成长曲线与下方识字报告间距 */
#reports .report-literacy-growth-wrap {
    margin-bottom: 16px;
}
.profile-practice-summary {
    display: none;
    font-size: 14px;
    color: #5f6368;
    margin: 0 0 14px 0;
    font-weight: 500;
}
/* ??????????? */
.cp-test-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 0 14px 0;
}
.cp-test-mode-row,
.cp-test-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}
.cp-test-row-label {
    font-size: 13px;
    font-weight: 600;
    color: #5f6368;
    min-width: 72px;
    flex-shrink: 0;
}
.profile-test-mode-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    flex: 1;
    min-width: 0;
}
.profile-test-mode-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #202124;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.profile-test-mode-option input {
    margin: 0;
    cursor: pointer;
}
.cp-test-start-row {
    padding: 0 14px 4px;
    display: flex;
    justify-content: center;
}
.cp-test-start-btn {
    width: 100%;
    max-width: 200px;
    padding: 12px 20px;
    border-radius: 999px;
    margin-top: 15px;
}
.cp-test-filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    flex: 1;
    min-width: 0;
}
.cp-test-filter {
    min-width: 88px;
    max-width: 140px;
    flex: 1 1 0;
}
/* ?????????????flex ????????????*/
.cp-test-filter-group .cp-test-filter {
    max-width: 100%;
}
.cp-test-filter-group .cp-test-score-range-wrap {
    flex: 1 1 0;
    min-width: 88px;
    max-width: 100%;
}
.cp-test-filter-group .cp-test-score-range-wrap select {
    width: 100%;
}
.cp-test-score-range-wrap {
    display: inline-flex;
    align-items: center;
}
.cp-filter-select.cp-test-filter {
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid #dadce0;
}
/* ???????*/
.cp-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    margin: 0 0 14px 0;
}
.profile-test-mode-label {
    font-size: 13px;
    color: #5f6368;
    font-weight: 500;
    margin-right: 2px;
    flex-shrink: 0;
}
.cp-actions-row .btn-primary {
    margin-left: auto;
    max-width: 100%;
    box-sizing: border-box;
}
.cp-hint {
    display: none;
    font-size: 13px;
    color: #5f6368;
    line-height: 1.55;
    margin: 0 0 18px 0;
}
.cp-test-history-block {
    width: 100%;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e8eaed;
}
.cp-test-history-block .test-history-header {
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #202124;
    margin: 0 0 6px 0;
    padding: 10px 12px;
    user-select: none;
    background: #f1f3f4;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.cp-test-history-block .test-history-header:hover {
    background: #e8eaed;
}
.cp-test-history-block .test-history-header .test-history-toggle-icon {
    font-size: 12px;
    opacity: 0.8;
    flex-shrink: 0;
}
.cp-test-history-block .test-history-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.cp-test-history-block .test-history-refresh-btn {
    border: none;
    background: transparent;
    padding: 2px;
    cursor: pointer;
    color: #5f6368;
    border-radius: 4px;
}
.cp-test-history-block .test-history-refresh-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #202124;
}
.cp-test-history-block .test-history-header.collapsed + .test-history-body {
    display: none;
}
.cp-test-history-block .test-history-body {
    padding: 12px 0 0 0;
    width: 100%;
}
.cp-test-history-block .profile-test-history-list,
.cp-test-history-block .test-history-table {
    width: 100%;
}
/* ???????????*/
.cp-test-history-block .test-history-desc {
    font-size: 13px;
    color: #5f6368;
    margin: 0 0 12px 0;
    line-height: 1.5;
}
.cp-test-history-block .profile-test-history-empty {
    font-size: 13px;
    color: #5f6368;
    padding: 16px 0;
    margin: 0;
    line-height: 1.5;
}
/* ?????? */
.cp-test-history-block .test-history-table {
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto;
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.cp-test-history-block .test-history-table thead {
    background: #f8f9fa;
}
.cp-test-history-block .test-history-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: #202124;
    border-bottom: 2px solid #e8eaed;
    white-space: nowrap;
}
.cp-test-history-block .test-history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eceef0;
    color: #3c4043;
    vertical-align: middle;
}
.cp-test-history-block .test-history-table tbody tr:hover {
    background: #f8f9fa;
}
.cp-test-history-block .test-history-table tbody tr:last-child td {
    border-bottom: none;
}
/* ??????????????*/
.cp-test-history-block .test-history-table td .btn-link,
.cp-test-history-block .test-history-table td .btn-link-sm {
    font-size: 13px;
    color: #1a73e8;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    text-decoration: none;
}
.cp-test-history-block .test-history-table td .btn-link:hover,
.cp-test-history-block .test-history-table td .btn-link-sm:hover {
    text-decoration: underline;
}
.cp-test-history-block .test-detail-body {
    margin-top: 10px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 6px;
    overflow-x: auto;
}
.cp-test-history-block .test-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.cp-test-history-block .test-detail-table th,
.cp-test-history-block .test-detail-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid #eceef0;
}
.cp-test-history-block .test-detail-table thead th {
    font-weight: 600;
    color: #5f6368;
    background: #f1f3f4;
}
.cp-test-history-block .test-detail-table tbody tr:last-child td {
    border-bottom: none;
}
/* ??????????????*/
.cp-test-history-block .profile-test-history-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
/* 我的收藏（学习记录中） */
.collected-story-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #e8eaed;
    gap: 12px;
}
.collected-story-item:last-child { border-bottom: none; }
.collected-story-link {
    flex: 1;
    color: #1a73e8;
    text-decoration: none;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
}
.collected-story-link:hover { text-decoration: none; }
.collected-story-date {
    flex-shrink: 0;
    font-size: 12px;
    color: #5f6368;
}

.profile-test-history-hint {
    font-size: 13px;
    color: #5f6368;
    margin: 0 0 10px 0;
    line-height: 1.5;
}
/* 学习记录 - 我的收藏列表 */
.collected-story-item {
    padding: 10px 0;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.collected-story-item:last-child { border-bottom: none; }
.collected-story-link {
    color: #1a73e8;
    text-decoration: none;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    touch-action: manipulation;
}
.collected-story-link:hover { text-decoration: none; }
.collected-story-date {
    color: #5f6368;
    font-size: 12px;
    flex-shrink: 0;
}
/* 我的收藏（学习记录中的故事列表） */
.collected-story-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #e8eaed;
}
.collected-story-item:last-child { border-bottom: none; }
.collected-story-link {
    flex: 1;
    color: #1a73e8;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    touch-action: manipulation;
    min-height: 44px;
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: rgba(0,0,0,0.08);
}
.collected-story-link:hover { text-decoration: none; }
.collected-story-date {
    font-size: 12px;
    color: #5f6368;
    flex-shrink: 0;
}

/* 我的收藏列表 */
.collected-story-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 8px;
    border-bottom: 1px solid #e8eaed;
    gap: 4px;
}
.collected-story-item:last-child {
    border-bottom: none;
}
.collected-story-main {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}
.collected-story-main .collected-story-date {
    margin-left: auto;
    flex-shrink: 0;
}
.collected-story-link {
    flex: 0 0 auto;
    color: #1a73e8;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    touch-action: manipulation;
    display: inline-flex;
    align-items: center;
    -webkit-tap-highlight-color: rgba(0,0,0,0.05);
    transition: color 0.2s ease, transform 0.2s ease;
}
.collected-story-link:hover {
    color: #1557b0;
    transform: translateX(4px);
}
.collected-story-date {
    font-size: 12px;
    color: #5f6368;
    flex-shrink: 0;
}
.collected-story-delete {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    margin: 0;
    font-size: 0;
    line-height: 0;
    color: inherit;
    background: transparent !important;
    border: none !important;
    border-radius: 0;
    box-shadow: none !important;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: opacity 0.15s ease;
    user-select: none;
    vertical-align: middle;
}
.collected-story-delete-icon {
    display: block;
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(45%) sepia(8%) saturate(300%) hue-rotate(180deg);
    pointer-events: none;
}
.collected-story-delete:hover {
    background: transparent !important;
}
.collected-story-delete:hover .collected-story-delete-icon {
    filter: brightness(0) saturate(100%) invert(27%) sepia(85%) saturate(2878%) hue-rotate(346deg) brightness(91%) contrast(95%);
}
.collected-story-delete:active {
    opacity: 0.75;
}
.collected-story-delete:focus:not(:focus-visible) {
    outline: none;
}
.collected-story-delete:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
    border-radius: 4px;
}
/* iPad：收藏列表禁用横向滚动，避免触摸被识别为滚动导致链接无法打开 */
#collectedStoriesList {
    overflow-x: visible;
    -webkit-overflow-scrolling: auto;
}
#collectedStoriesList .collected-story-link {
    -webkit-tap-highlight-color: rgba(0,0,0,0.08);
}
/* 手机端：收藏列表不显示收藏时间，节省横向空间 */
@media (max-width: 768px) {
    #collectedStoriesList .collected-story-date {
        display: none !important;
    }
}
.profile-practice-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: #202124;
    margin: 22px 0 14px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #e8eaed;
}
.profile-practice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
}
.cp-practice-load-more {
    text-align: center;
    padding: 20px 0 12px;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cp-practice-load-more .btn {
    min-width: 120px;
}
.cp-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity 0.2s, transform 0.2s;
}
.cp-load-more-btn:hover:not(:disabled) {
    transform: translateY(-2px);
}
.cp-load-more-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}
.cp-load-more-btn .cp-load-more-icon {
    flex-shrink: 0;
    vertical-align: middle;
    transition: transform 0.3s;
}
.cp-load-more-btn:not(:disabled):hover .cp-load-more-icon {
    transform: translateY(2px);
}
.cp-load-more-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #667eea;
    font-size: 14px;
}
.cp-load-more-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(102, 126, 234, 0.25);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: cp-spin 0.7s linear infinite;
}
@keyframes cp-spin {
    to { transform: rotate(360deg); }
}
.cp-load-more-text {
    color: #666;
    font-size: 14px;
}
.cp-practice-load-more.cp-load-more-fade-out {
    opacity: 0;
    transition: opacity 0.2s ease-out;
}
.cp-public-library-wrap {
    margin-top: 8px;
}
/* ???????????????? */
main:has(#practice.tab-content.active) .cp-card-public .cp-public-library-wrap {
    margin-left: -26px;
    margin-right: -26px;
    width: calc(100% + 52px);
    padding-left: 26px;
    padding-right: 26px;
    box-sizing: border-box;
}
.cp-card-public {
    overflow: visible;
}
.cp-public-library-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    min-width: 0;
    max-width: 100%;
}
.cp-public-library-header .profile-practice-subtitle {
    margin: 0;
}
.cp-public-library-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
}
.cp-filter-select,
.cp-filter-input {
    padding: 8px 12px;
    border: 1px solid #dadce0;
    border-radius: 10px;
    font-size: 14px;
    background-color: #fafafa;
    min-width: 0;
    max-width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.cp-filter-select {
    padding-right: 44px;
}
.cp-filter-input:hover {
    background: #fff;
    border-color: #b8bcc4;
}
.cp-filter-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    background: #fff;
}
.cp-filter-input {
    min-width: 100px;
    max-width: 140px;
}
.profile-practice-tile {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.profile-practice-tile.cp-tile-enter {
    animation: cp-tile-fade-in 0.35s ease-out forwards;
}
@keyframes cp-tile-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.profile-practice-tile:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.18);
    transform: translateY(-2px);
}
.profile-practice-tile .character-tile-pinyin {
    font-size: 0.68em;
    color: #5f6368;
    margin-bottom: 2px;
}
.profile-practice-tile .character-tile-char {
    font-size: 1.75em;
    color: #202124;
    font-family: "KaiTi", "??", "STKaiti", serif;
}
.profile-practice-tile .practice-dot {
    display: block;
    width: 6px;
    height: 6px;
    margin-top: 4px;
    margin-left: auto;
}

/* ==================== 错字抄写 ==================== */
.wrong-copy-content {
    padding: 20px 16px 32px;
    min-height: 200px;
}
.wrong-copy-blocks {
    --wc-title: clamp(1.15rem, 0.4rem + 2.2vw, 1.35rem);
    --wc-desc: clamp(0.8125rem, 0.72rem + 0.45vw, 0.875rem);
    --wc-pinyin: clamp(1.125rem, 0.55rem + 2.5vw, 1.75rem);
    --wc-char: clamp(2.25rem, 1.25rem + 6vw, 4rem);
    --wc-badge: clamp(0.625rem, 0.55rem + 0.35vw, 0.6875rem);
    width: 100%;
    max-width: 100%;
    margin: 0;
}
.wrong-copy-header {
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
}
.wrong-copy-header > .wrong-copy-title { flex: 1 1 100%; margin: 0 0 8px 0; }
.wrong-copy-header > .wrong-copy-desc { flex: 1 1 100%; margin: 0 0 12px 0; }
.wrong-copy-title {
    margin: 0 0 8px 0;
    font-size: var(--wc-title);
    font-weight: 600;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.wrong-copy-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #667eea;
}
.wrong-copy-title-icon svg {
    width: 1.15em;
    height: 1.15em;
    display: block;
}
.wrong-copy-desc {
    margin: 0;
    font-size: var(--wc-desc);
    color: #5f6368;
    line-height: 1.6;
}
.wrong-copy-print-btn {
    flex-shrink: 0;
}
.wrong-copy-print-quick {
    background: #f1f3f4;
    color: #5f6368;
    border: 1px solid #dadce0;
}
.wrong-copy-print-quick:hover {
    background: #e8eaed;
    color: #202124;
}
.wrong-copy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 20px;
}
.wrong-copy-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.wrong-copy-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}
.wrong-copy-card:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.25);
}
.wrong-copy-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
/* 四线格：拼音单独放在田字格上方 */
.wrong-copy-sixian {
    width: 88px;
    height: 48px;
    position: relative;
    border: none;
    border-left: 1px solid #000;
    border-right: 1px solid #000;
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wrong-copy-sixian .wrong-copy-sixian-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-bottom: 1px solid rgba(51,51,51,0.5);
    pointer-events: none;
}
/* 四线格上中下三格等高：线1=顶，线2=1/3，线3=2/3，线4=底 */
.wrong-copy-sixian .wrong-copy-sixian-line-2 { top: 16px; border-bottom-style: dashed; }
.wrong-copy-sixian .wrong-copy-sixian-line-3 { top: 32px; border-bottom-style: dashed; }
.wrong-copy-sixian .wrong-copy-sixian-line-4 { top: 48px; border-bottom-color: #000; }
.wrong-copy-pinyin {
    font-size: var(--wc-pinyin);
    color: #333;
    line-height: 1.35;
    position: relative;
    z-index: 1;
    transform: translateY(-2px);
    font-family: var(--font-pinyin);
}
.wrong-copy-tianze {
    width: 88px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #000;
    border-radius: 0 0 4px 4px;
    position: relative;
    background: linear-gradient(to right, #333 1px, transparent 1px),
                linear-gradient(to bottom, #333 1px, transparent 1px);
    background-size: 50% 50%;
    background-position: 0 0, 0 0;
    background-origin: border-box;
}
.wrong-copy-tianze::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 0;
    border-top: 1px solid rgba(51,51,51,0.4);
}
.wrong-copy-tianze::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 0;
    border-left: 1px solid rgba(51,51,51,0.4);
}
.wrong-copy-char {
    font-size: var(--wc-char);
    line-height: 1;
    color: #1a1a1a;
    font-family: "KaiTi", "楷体", "STKaiti", serif;
    position: relative;
    z-index: 1;
}
.wrong-copy-badge {
    margin-top: 10px;
    font-size: var(--wc-badge);
    padding: 2px 8px;
    border-radius: 999px;
}
.wrong-copy-badge-wrong {
    color: #e53935;
    background: rgba(229, 57, 53, 0.1);
}
.wrong-copy-badge-weak {
    color: #f57c00;
    background: rgba(245, 124, 0, 0.12);
}
.wrong-copy-empty-card {
    padding: 40px 24px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px dashed #dadce0;
}
.wrong-copy-empty-card .profile-empty-hint {
    margin: 0;
    color: #5f6368;
}
/* 移动端：错字抄写四线格拼音为 Web 端的 1.3 倍；左侧田字格示范字为 Web 端 1.5 倍；拼音较 Web 默认 translateY(-2px) 下移 3px → translateY(1px) */
@media (max-width: 768px) {
    .wrong-copy-blocks {
        --wc-pinyin: clamp(1.4625rem, 0.715rem + 3.25vw, 2.275rem);
        --wc-char: clamp(3.375rem, 1.875rem + 9vw, 6rem);
    }
    .wrong-copy-pinyin {
        transform: translateY(1px);
    }
    .wrong-copy-print-pinyin {
        font-size: 33.8px;
        transform: translateY(1px);
    }
    .wrong-copy-print-char {
        font-size: 78px;
    }
}
@media (max-width: 480px) {
    .wrong-copy-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 16px;
    }
    .wrong-copy-sixian {
        width: 72px;
        height: 40px;
    }
    /* 40px高，上中下各约13px */
    .wrong-copy-sixian .wrong-copy-sixian-line-2 { top: 13px; }
    .wrong-copy-sixian .wrong-copy-sixian-line-3 { top: 27px; }
    .wrong-copy-sixian .wrong-copy-sixian-line-4 { top: 40px; }
    .wrong-copy-tianze {
        width: 72px;
        height: 68px;
    }
    /* 窄屏略收紧上限以贴合田字格；示范字为窄屏基准 clamp 的 1.5 倍；拼音为原窄屏 clamp 的 1.3 倍 */
    .wrong-copy-blocks {
        --wc-char: clamp(3rem, 1.5rem + 8.25vw, 5.25rem);
        --wc-pinyin: clamp(1.3rem, 0.65rem + 2.86vw, 1.95rem);
    }
}
.profile-my-chars {
    margin: 18px 0;
}
.profile-my-chars-wrap {
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e8eaed;
    overflow: hidden;
}
.profile-my-chars-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
}
.profile-my-chars-header:hover {
    background: #eef0f2;
}
.profile-my-chars-label {
    font-size: 13px;
    color: #5f6368;
    font-weight: 500;
}
.profile-my-chars-toggle {
    font-size: 12px;
    color: #5f6368;
    opacity: 0.8;
}
.profile-my-chars-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 0 14px 10px 14px;
    transition: max-height 0.2s ease;
}
.profile-my-chars-body.profile-my-chars-collapsed {
    max-height: 76px;
    overflow: hidden;
}
.profile-my-chars-empty,
.profile-practice-empty {
    font-size: 14px;
    color: #80868b;
    padding: 14px 0;
}
.profile-mastered-char {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    font-size: 1.05em;
    color: #202124;
    font-family: "KaiTi", "??", serif;
}
/* ????*/
.profile-wrong-chars {
    margin: 18px 0;
}
.profile-wrong-chars-empty {
    font-size: 14px;
    color: #80868b;
    padding: 14px 0;
}
.profile-wrong-chars-wrap {
    background: transparent;
    border-radius: 0;
    border: none;
    overflow: visible;
}
.profile-wrong-chars-header {
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #202124;
    margin: 0 0 6px 0;
    padding: 10px 12px;
    padding-top: 10px;
    padding-bottom: 10px;
    user-select: none;
    background: #f1f3f4;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.profile-wrong-chars-header:hover {
    background: #e8eaed;
}
.profile-wrong-chars-label {
    font-size: 14px;
    font-weight: 600;
    color: #202124;
}
.profile-wrong-chars-toggle {
    font-size: 12px;
    opacity: 0.8;
    flex-shrink: 0;
    color: #202124;
}
.profile-wrong-chars-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 12px;
    margin-bottom: 0px;
    padding: 10px 0 12px 0;
    text-align: center;
    transition: max-height 0.2s ease;
}
.profile-wrong-chars-body.profile-wrong-chars-collapsed {
    max-height: 76px;
    overflow: visible;
}
.cp-clear-wrong-btn {
    margin: 8px 14px 12px;
    display: block;
}
.profile-wrong-char {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    background: #ffe0e0;
    border: 1px solid #FF0000;
    border-radius: 8px;
    font-size: 1.05em;
    color: #FF0000;
    font-family: "KaiTi", "??", serif;
    cursor: pointer;
}
.profile-wrong-char:hover {
    background: #ffcccc;
    border-color: #FF0000;
}
.profile-wrong-char.selected {
    background: #e3f2fd;
    border-color: #64b5f6;
}
/* ??????*/
.profile-wrong-chars {
    margin: 18px 0;
}
.profile-wrong-chars-empty {
    font-size: 14px;
    color: #80868b;
    padding: 14px 0;
}
.profile-wrong-chars-wrap {
    background: transparent;
    border-radius: 0;
    border: none;
    overflow: visible;
}
.profile-wrong-chars-header {
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #202124;
    margin: 0 0 6px 0;
    padding: 10px 12px;
    padding-top: 10px;
    padding-bottom: 10px;
    user-select: none;
    background: #f1f3f4;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.profile-wrong-chars-header:hover {
    background: #e8eaed;
}
.profile-wrong-chars-label {
    font-size: 14px;
    font-weight: 600;
    color: #202124;
}
.profile-wrong-chars-toggle {
    font-size: 12px;
    opacity: 0.8;
    flex-shrink: 0;
    color: #202124;
}
.profile-wrong-chars-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 12px;
    margin-top: 10px;
    margin-bottom: 0px;
    padding: 0 0 10px 0;
    padding-top: 10px;
    text-align: center;
    transition: max-height 0.2s ease;
}
.profile-wrong-chars-body.profile-wrong-chars-collapsed {
    max-height: 76px;
    overflow: visible;
}
.profile-wrong-char {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    background: #ffe0e0;
    border: 1px solid #FF0000;
    border-radius: 8px;
    font-size: 1.05em;
    color: #FF0000;
    font-family: "KaiTi", "??", serif;
    cursor: pointer;
}
.profile-wrong-char:hover {
    background: #ffcccc;
    border-color: #FF0000;
}
.profile-wrong-char.selected {
    background: #e3f2fd;
    border-color: #64b5f6;
}
.cp-literacy-block {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #e8eaed;
}
.cp-literacy-title {
    font-size: 1.05em;
    font-weight: 600;
    color: #202124;
    margin: 0 0 12px 0;
}
.cp-literacy-block .literacy-breakdown-section {
    margin-bottom: 14px;
}
.cp-literacy-block .literacy-breakdown-section h4 {
    font-size: 13px;
    color: #5f6368;
    margin: 0 0 8px 0;
}
.cp-literacy-block .literacy-collapse-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.cp-literacy-block .literacy-collapse-head h4 {
    margin: 0;
    flex: 1;
    min-width: 0;
    text-align: left;
    font-size: 13px;
    color: #5f6368;
}
.cp-literacy-block .literacy-collapse-title-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    vertical-align: middle;
}
.cp-literacy-block .literacy-collapse-title-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: middle;
    filter: var(--icon-filter-blue);
}
.cp-literacy-block .literacy-collapse-title-text {
    min-width: 0;
}
.cp-literacy-block .literacy-collapse-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #1967d2;
    background: #e8f0fe;
    border: 1px solid #c6dafc;
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.cp-literacy-block .literacy-collapse-btn:hover {
    background: #d2e3fc;
}
.cp-literacy-block .literacy-collapse-icon {
    display: inline-block;
    font-size: 10px;
    line-height: 1;
    transition: transform 0.2s ease;
}
.cp-literacy-block .literacy-collapse.is-collapsed .literacy-collapse-icon {
    transform: rotate(-90deg);
}
.cp-literacy-block .literacy-collapse.is-collapsed .literacy-collapse-body {
    display: none;
}
.cp-literacy-block .literacy-table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border-collapse: collapse;
    font-size: 12px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e8eaed;
    table-layout: fixed;
}
.cp-literacy-block .literacy-table th,
.cp-literacy-block .literacy-table td {
    padding: 8px 12px;
    text-align: center;
    border-bottom: 1px solid #e8eaed;
    white-space: nowrap;
}
@media (min-width: 768px) {
    .cp-literacy-block .literacy-table th,
    .cp-literacy-block .literacy-table td {
        padding: 10px 14px;
    }
}
.cp-literacy-block .literacy-lesson-table th:nth-child(4),
.cp-literacy-block .literacy-lesson-table td.lit-lesson-cell {
    text-align: left;
    white-space: normal;
    /* 横排：避免窄列下逐字断行呈「竖排」观感；长词仍可在词间换行 */
    word-break: keep-all;
    overflow-wrap: break-word;
    line-height: 1.4;
    vertical-align: middle;
    writing-mode: horizontal-tb;
}
.cp-literacy-block .literacy-table th {
    background: #f1f3f4;
    font-weight: 600;
    color: #202124;
}
/* 优化列宽：年级/学期/单元按内容定宽，课文列占剩余空间，认识总数/识字率按数字宽度 */
.cp-literacy-block .literacy-grade-table th:nth-child(1),
.cp-literacy-block .literacy-grade-table td:nth-child(1) {
    width: 52px;
    max-width: 52px;
}
.cp-literacy-block .literacy-grade-table th:nth-last-child(2),
.cp-literacy-block .literacy-grade-table td:nth-last-child(2) {
    width: 88px;
    max-width: 88px;
}
.cp-literacy-block .literacy-grade-table th:last-child,
.cp-literacy-block .literacy-grade-table td:last-child {
    width: 68px;
    max-width: 68px;
}
.cp-literacy-block .literacy-grade-semester-table th:nth-child(2),
.cp-literacy-block .literacy-grade-semester-table td:nth-child(2) {
    width: 52px;
    max-width: 52px;
}
.cp-literacy-block .literacy-unit-table th:nth-child(1),
.cp-literacy-block .literacy-unit-table td:nth-child(1),
.cp-literacy-block .literacy-unit-table th:nth-child(2),
.cp-literacy-block .literacy-unit-table td:nth-child(2),
.cp-literacy-block .literacy-unit-table th:nth-child(3),
.cp-literacy-block .literacy-unit-table td:nth-child(3) {
    width: 52px;
    max-width: 52px;
}
.cp-literacy-block .literacy-unit-table th:nth-child(4),
.cp-literacy-block .literacy-unit-table td:nth-child(4) {
    width: 88px;
    max-width: 88px;
}
.cp-literacy-block .literacy-unit-table th:last-child,
.cp-literacy-block .literacy-unit-table td:last-child {
    width: 68px;
    max-width: 68px;
}
.cp-literacy-block .literacy-breakdown-section:has(.literacy-lesson-table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}
/* 按课文表：Web 端比例（年级/学期/单元 15%×3；课文 25%；认识/总数、识字率各 15%）；移动端见 max-width:560px */
.cp-literacy-block .literacy-lesson-table th,
.cp-literacy-block .literacy-lesson-table td {
    padding: 8px 10px;
    max-width: none;
}
.cp-literacy-block .literacy-lesson-table th:nth-child(1),
.cp-literacy-block .literacy-lesson-table td:nth-child(1),
.cp-literacy-block .literacy-lesson-table th:nth-child(2),
.cp-literacy-block .literacy-lesson-table td:nth-child(2),
.cp-literacy-block .literacy-lesson-table th:nth-child(3),
.cp-literacy-block .literacy-lesson-table td:nth-child(3) {
    width: 15%;
}
.cp-literacy-block .literacy-lesson-table th:nth-child(4),
.cp-literacy-block .literacy-lesson-table td.lit-lesson-cell {
    width: 25%;
    min-width: 0;
}
.cp-literacy-block .literacy-lesson-table th:nth-child(5),
.cp-literacy-block .literacy-lesson-table td:nth-child(5) {
    width: 15%;
}
.cp-literacy-block .literacy-lesson-table th:nth-child(6),
.cp-literacy-block .literacy-lesson-table td:nth-child(6) {
    width: 15%;
}
@media (min-width: 768px) {
    .cp-literacy-block .literacy-lesson-table th,
    .cp-literacy-block .literacy-lesson-table td {
        padding: 10px 12px;
    }
}
/* 屏幕空间不足时，年级/单元仅显示数字并收窄列宽；按课文表移动端规则见下方 max-width:560px */
@media (max-height: 700px), (max-width: 560px) {
    .cp-literacy-block .literacy-table .lit-prefix,
    .cp-literacy-block .literacy-table .lit-suffix {
        display: none;
    }
    .cp-literacy-block .literacy-table {
        table-layout: fixed;
    }
    .cp-literacy-block .literacy-grade-table th:nth-child(1),
    .cp-literacy-block .literacy-grade-table td:nth-child(1) {
        width: 40px;
        max-width: 40px;
    }
    .cp-literacy-block .literacy-grade-semester-table th:nth-child(2),
    .cp-literacy-block .literacy-grade-semester-table td:nth-child(2) {
        width: 40px;
        max-width: 40px;
    }
    .cp-literacy-block .literacy-unit-table th:nth-child(1),
    .cp-literacy-block .literacy-unit-table td:nth-child(1),
    .cp-literacy-block .literacy-unit-table th:nth-child(2),
    .cp-literacy-block .literacy-unit-table td:nth-child(2),
    .cp-literacy-block .literacy-unit-table th:nth-child(3),
    .cp-literacy-block .literacy-unit-table td:nth-child(3) {
        width: 40px;
        max-width: 40px;
    }
}
/* 移动端：按课文表整表宽度贴合视口，六列同屏可见（无横向滚动） */
@media (max-width: 560px) {
    .cp-literacy-block .literacy-breakdown-section:has(.literacy-lesson-table) {
        overflow-x: visible;
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }
    .cp-literacy-block .literacy-lesson-table {
        min-width: 0;
        width: 100%;
        max-width: 100%;
        font-size: 10px;
        table-layout: fixed;
    }
    .cp-literacy-block .literacy-lesson-table th,
    .cp-literacy-block .literacy-lesson-table td {
        padding: 4px 2px;
    }
    .cp-literacy-block .literacy-lesson-table th {
        white-space: normal;
        line-height: 1.2;
        word-break: keep-all;
    }
    .cp-literacy-block .literacy-lesson-table td:nth-child(1),
    .cp-literacy-block .literacy-lesson-table td:nth-child(2),
    .cp-literacy-block .literacy-lesson-table td:nth-child(3),
    .cp-literacy-block .literacy-lesson-table td:nth-child(5),
    .cp-literacy-block .literacy-lesson-table td:nth-child(6) {
        white-space: normal;
        line-height: 1.25;
    }
    .cp-literacy-block .literacy-lesson-table th:nth-child(1),
    .cp-literacy-block .literacy-lesson-table td:nth-child(1),
    .cp-literacy-block .literacy-lesson-table th:nth-child(2),
    .cp-literacy-block .literacy-lesson-table td:nth-child(2),
    .cp-literacy-block .literacy-lesson-table th:nth-child(3),
    .cp-literacy-block .literacy-lesson-table td:nth-child(3) {
        width: 10%;
    }
    .cp-literacy-block .literacy-lesson-table th:nth-child(4),
    .cp-literacy-block .literacy-lesson-table td.lit-lesson-cell {
        width: 30%;
        line-height: 1.25;
    }
    .cp-literacy-block .literacy-lesson-table th:nth-child(5),
    .cp-literacy-block .literacy-lesson-table td:nth-child(5) {
        width: 20%;
    }
    .cp-literacy-block .literacy-lesson-table th:nth-child(6),
    .cp-literacy-block .literacy-lesson-table td:nth-child(6) {
        width: 20%;
    }
    .report-literacy-card {
        padding-left: 2px;
        padding-right: 2px;
    }
}
@media (max-width: 380px) {
    .cp-literacy-block .literacy-lesson-table {
        font-size: 9px;
    }
    .cp-literacy-block .literacy-lesson-table th,
    .cp-literacy-block .literacy-lesson-table td {
        padding: 3px 1px;
    }
}

/* 学习情报公开分享页（/learning-share.html，无需登录） */
.learning-share-body {
    margin: 0;
    background: #f8f9fa;
    min-height: 100dvh;
    box-sizing: border-box;
}
.learning-share-page {
    max-width: 920px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    box-sizing: border-box;
}
.learning-share-header {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px 16px;
    margin-bottom: 20px;
    min-width: 0;
    text-align: center;
}
.learning-share-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.learning-share-logo-link:focus-visible {
    outline: 2px solid rgba(102, 126, 234, 0.45);
    outline-offset: 3px;
    border-radius: 6px;
}
.learning-share-logo {
    height: 40px;
    width: auto;
    max-width: min(200px, 55vw);
    display: block;
    object-fit: contain;
    object-position: center;
}
.learning-share-logo-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 28px;
    line-height: 1;
}
.learning-share-title {
    margin: 0;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    font-size: 1.12rem;
    font-weight: 600;
    color: #202124;
    line-height: 1.35;
    text-align: center;
}
.learning-share-loading {
    text-align: center;
    padding: 40px 16px;
    color: #80868b;
    font-size: 14px;
}
.learning-share-error {
    padding: 16px;
    background: #fce8e6;
    color: #c5221f;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}
.learning-share-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}
@media (min-width: 600px) {
    .learning-share-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
.learning-share-stat-card {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    padding: 12px 14px;
    text-align: center;
    box-sizing: border-box;
}
.learning-share-stat-label {
    display: block;
    font-size: 12px;
    color: #5f6368;
    margin-bottom: 6px;
}
.learning-share-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: #202124;
}
.learning-share-growth-card {
    margin-bottom: 18px;
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 14px 12px 16px;
    box-sizing: border-box;
}
/* 学习情报分享页：成长曲线与页面同为平面背景，无白卡片框 */
.learning-share-page .learning-share-growth-card {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}
.learning-share-chart-wrap {
    width: 100%;
    min-width: 0;
}
.learning-share-literacy .cp-literacy-block {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.modal-content:has(.learning-share-result-modal) {
    max-width: min(96vw, 520px);
    width: min(96vw, 520px);
    text-align: left;
    align-items: stretch;
    justify-content: center; /* 关闭钮绝对定位，主体在卡片内垂直居中 */
}
#modalBody:has(.learning-share-result-modal) {
    justify-content: center;
    align-items: stretch;
    align-self: stretch;
    text-align: left;
    padding: 0 16px 8px;
    width: 100%;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-height: 0;
}
.report-literacy-card {
    margin-bottom: 0;
    padding-left: 5px;
    padding-right: 5px;
}
.report-literacy-card .cp-literacy-block {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    max-width: 100%;
    overflow-x: visible;
}
.profile-empty-hint {
    font-size: 14px;
    color: #5f6368;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

/* ==================== ???????? ==================== */
#profile .section-header {
    margin-bottom: 16px;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
}
#profile .section-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #202124;
}
.profile-notification-badge-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: background 0.2s;
}
.profile-notification-badge-wrap:hover {
    background: #f1f3f4;
}
.profile-notification-icon {
    display: block;
    filter: var(--icon-filter-blue);
}
.profile-notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: #e53935;
    border-radius: 9px;
    border: 2px solid #fff;
    box-sizing: border-box;
}
.profile-center {
    width: 100%;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}
.profile-blocks {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
/* 游客「注册并保留体验数据」：紧挨在账号信息卡片下方 */
.profile-guest-upgrade-below {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: -4px;
}
.profile-guest-upgrade-below .btn-primary.profile-footer-btn {
    border-radius: 9999px;
    padding-left: 1.35rem;
    padding-right: 1.35rem;
}
.profile-block {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 14px;
    padding: 22px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.profile-block h3 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8eaed;
}
.profile-block-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8eaed;
}
.profile-block-header h3 {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex: 1;
}
.profile-edit-icon-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #5f6368;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.profile-edit-icon-btn img {
    filter: var(--icon-filter-blue);
}
.profile-edit-icon-btn:hover {
    background: #f1f3f4;
    color: #202124;
}
.profile-edit-icon-btn.profile-edit-icon-btn-cancel:hover {
    background: #fce8e6;
    color: #c5221f;
}
.profile-block p {
    margin: 0 0 10px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #3c4043;
}
.profile-block p:last-of-type {
    margin-bottom: 0;
}
.profile-block .form-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e8eaed;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.profile-loading,
.profile-empty {
    font-size: 15px;
    color: #5f6368;
    padding: 20px 0;
    text-align: center;
}

/* 个人中心 系统消息块 */
.profile-notification-header-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
    vertical-align: middle;
}
.profile-notification-header-icon img {
    filter: var(--icon-filter-blue);
}
.profile-notifications-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.profile-notification-item {
    padding: 12px 0;
    border-bottom: 1px solid #e8eaed;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.profile-notification-item:hover {
    background: #f8f9fa;
}
.profile-notification-item:last-child {
    border-bottom: none;
}
.profile-notification-item-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-notification-item-inner .profile-notification-title {
    flex: 1;
    min-width: 0;
}
.profile-notification-item-inner .profile-notification-time {
    flex-shrink: 0;
    margin-left: 8px;
}
.profile-notification-unread-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e53935;
}
.profile-notification-title {
    font-weight: 600;
    color: #202124;
}
.profile-notification-content {
    color: #5f6368;
    line-height: 1.5;
    margin-top: 6px;
    margin-bottom: 4px;
}
.profile-notification-content-collapsed {
    display: none;
}
.profile-notification-toggle {
    flex-shrink: 0;
    font-size: 10px;
    color: #80868b;
    transition: transform 0.2s;
}
.profile-notification-time {
    font-size: 12px;
    color: #80868b;
}
.profile-notification-item-inner .profile-notification-time {
    font-size: 12px;
    color: #80868b;
}
.profile-notification-item.read .profile-notification-title {
    color: #80868b;
    font-weight: 500;
}

/* 个人中心 TOKENS 用量信息块 */
.profile-usage-remark {
    font-size: 12px;
    color: #64748b;
    margin: -8px 0 12px 0;
}
.profile-usage-detail-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: #0079ff;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.profile-usage-detail-link:hover {
    background: rgba(0, 121, 255, 0.1);
    color: #0079ff;
}
.profile-usage-detail-link svg {
    display: block;
}
.profile-usage-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.profile-usage-card {
    padding: 12px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.profile-usage-card-balance {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #93c5fd;
}
.profile-usage-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
}
.profile-usage-label-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.profile-usage-label-icon img {
    display: block;
    width: 16px;
    height: 16px;
    filter: var(--icon-filter-blue);
}
.profile-usage-value {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}

/* 个人中心：我的字库容量 */
.profile-library-cap-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.profile-library-cap-stats {
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
}
.profile-library-cap-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 0;
    min-width: 0;
}
.profile-library-cap-label {
    font-size: 13px;
    font-weight: 500;
    color: #5f6368;
}
.profile-library-cap-label-max {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.profile-library-cap-label-text {
    flex-shrink: 0;
}
.profile-library-cap-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.profile-library-cap-qr-btn,
.profile-library-cap-info-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #5f6368;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.profile-library-cap-info-btn:hover,
.profile-library-cap-qr-btn:hover {
    background: rgba(26, 115, 232, 0.08);
    color: #1a73e8;
}
.profile-library-cap-info-btn img,
.profile-library-cap-qr-btn img {
    display: block;
    filter: var(--icon-filter-blue);
    opacity: 0.92;
}
.profile-library-cap-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.profile-library-cap-title-info-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}
.profile-library-cap-title-info-btn img {
    width: 16px;
    height: 16px;
}
.profile-library-cap-expand-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.library-cap-qr-modal {
    max-width: 420px;
    text-align: center;
    padding-top: 14px;
    padding-bottom: 18px;
}
.library-cap-qr-wrap {
    margin-top: 4px;
}
.library-cap-qr-preview-img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
}
.library-cap-qr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    justify-content: center;
}
.library-cap-qr-actions .btn {
    flex: 1 1 auto;
    min-width: 5.5rem;
}
.library-cap-expand-modal {
    max-width: 420px;
    text-align: left;
}
.library-cap-expand-title {
    margin: 0 0 12px;
    font-size: 1.15rem;
}
.library-cap-expand-p {
    margin: 0 0 12px;
    line-height: 1.55;
    color: var(--text-secondary, #5f6368);
    font-size: 14px;
    text-align: justify;
    text-justify: inter-ideograph;
}
.library-cap-expand-rules {
    margin: 0 0 14px;
    padding-left: 1.2em;
    line-height: 1.6;
    color: var(--text-secondary, #5f6368);
    font-size: 14px;
}
.library-cap-expand-rules li {
    margin-bottom: 6px;
}
/* 扩容规则：已完成左侧 ✓，未完成左侧 × */
.library-cap-rules-checked {
    list-style: none;
    padding-left: 0;
}
.library-cap-rules-checked li {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 8px;
    line-height: 1.55;
}
.library-cap-rule-mark {
    flex: 0 0 1.35em;
    width: 1.35em;
    min-width: 1.35em;
    text-align: center;
    font-weight: 700;
    line-height: inherit;
}
.library-cap-rule-mark-on {
    color: #137333;
}
.library-cap-rule-mark-off {
    color: #c5221f;
}
.library-cap-rule-text {
    flex: 1;
    min-width: 0;
}
.library-cap-done {
    color: #137333;
    font-weight: 600;
}
.library-cap-invite-intro {
    margin-bottom: 12px !important;
}
.library-cap-expand-link-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.library-cap-link-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: stretch;
}
.library-cap-share-btn {
    min-width: 3.5rem;
}
.library-cap-expand-link-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid var(--border-color, #dadce0);
    border-radius: 6px;
    background: var(--bg-secondary, #f8f9fa);
}
.library-cap-expand-wechat-hint {
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-tertiary, #80868b);
}
.library-cap-moments-done-wrap {
    margin-top: 4px !important;
    text-align: center;
}
.btn.library-cap-moments-done-btn {
    border-radius: 9999px;
    padding-left: 1.35rem;
    padding-right: 1.35rem;
}
.library-cap-moments-upload-block {
    margin-top: 8px;
}
.library-cap-moments-upload-label {
    margin-bottom: 8px !important;
}
.library-cap-moments-upload-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.library-cap-file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.library-cap-file-label {
    cursor: pointer;
    margin: 0;
}
.library-cap-file-name {
    font-size: 13px;
    color: var(--text-secondary, #5f6368);
    word-break: break-all;
    flex: 1;
    min-width: 120px;
}
.profile-library-cap-expand-icon {
    display: block;
    width: 16px;
    height: 16px;
    object-fit: contain;
    filter: var(--icon-filter-blue);
    opacity: 0.92;
}
.profile-library-cap-value-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}
.profile-library-cap-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}
.profile-library-cap-value-used {
    color: #1a73e8;
}
.profile-library-cap-value-max {
    color: #334155;
}
.profile-library-cap-suffix {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
}
.profile-library-cap-meter {
    height: 10px;
    border-radius: 999px;
    background: #e8eaed;
    overflow: hidden;
}
.profile-library-cap-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #667eea 0%, #1a73e8 100%);
    transition: width 0.35s ease;
    min-width: 0;
}
.profile-library-cap-fill-warn {
    background: linear-gradient(90deg, #f59e0b 0%, #ea580c 100%);
}
.profile-library-cap-fill-full {
    background: linear-gradient(90deg, #dc2626 0%, #b91c1c 100%);
}
.profile-library-cap-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #5f6368;
    text-align: justify;
    text-justify: inter-ideograph;
}
/* 个人中心底部：修改密码、退出登录（居中，左侧图标） */
.profile-footer {
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid #e8eaed;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}
.profile-footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.profile-footer-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.profile-footer-btn-icon svg,
.profile-footer-btn-icon img {
    display: block;
    width: 18px;
    height: 18px;
    filter: var(--icon-filter-blue);
}
.profile-empty {
    color: #80868b;
}
.profile-info-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}
.profile-info-row:last-child {
    margin-bottom: 0;
}
.profile-info-label {
    min-width: 64px;
    font-size: 13px;
    color: #5f6368;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.profile-info-label-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}
.profile-info-label-icon img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    opacity: 0.85;
    filter: var(--icon-filter-blue);
}
.profile-form-label-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
}
.profile-form-label-icon img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    opacity: 0.85;
    filter: var(--icon-filter-blue);
}
.profile-block .form-group label {
    display: inline-flex;
    align-items: center;
}
.profile-account-readonly {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
}
.profile-account-readonly .profile-form-label-icon {
    margin-right: 4px;
}
.profile-info-value {
    font-size: 14px;
    color: #202124;
}
.profile-info-list {
    margin-bottom: 0;
}
.profile-info-list .profile-info-row {
    margin-bottom: 10px;
}
.profile-info-list .profile-info-row:last-child {
    margin-bottom: 0;
}
.profile-block .form-group {
    margin-bottom: 14px;
}
.profile-block .form-group:last-of-type {
    margin-bottom: 0;
}
.profile-block #profileFormError {
    margin-bottom: 12px;
}
.profile-region-cascade {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
}
.profile-region-cascade .profile-region-select {
    flex: 1;
    min-width: 100px;
}
.profile-region-select {
    width: 100%;
    max-width: 240px;
    padding: 10px 12px;
    padding-right: 44px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background-color: #fff;
    cursor: pointer;
}
.profile-region-select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}
/* ????/ iPad?????????????? */
@media (max-width: 1400px) {
    .character-practice-content {
        padding: 6px 6px 20px 6px;
    }
    /* ???????????????????*/
    .cp-blocks {
        gap: 16px;
    }
    .cp-blocks .cp-main-block {
        padding: 16px 18px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    .cp-blocks .cp-main-block.cp-card-wrongchars {
        padding-top: 0;
        padding-bottom: 0;
    }
    .cp-card-history .cp-test-history-block {
        border-top: none;
        margin-top: 0;
        padding-top: 0;
    }
    .cp-card-history .cp-test-history-block .test-history-header {
        margin-top: 0;
    }
    .cp-test-actions {
        gap: 10px;
    }
    .cp-test-mode-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    /* 出题范围：年级/学期/单元/课文与桌面一致横向排列，避免「课文」单独占一行 */
    .cp-test-filter-row {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 12px;
    }
    .cp-test-row-label {
        min-width: auto;
    }
    .cp-test-mode-row .profile-test-mode-options {
        gap: 8px 12px;
    }
    .cp-test-start-row {
        padding: 0 12px 4px;
    }
    .cp-test-start-btn {
        width: 100%;
        max-width: none;
    }
    .cp-test-filter-group {
        flex-wrap: wrap;
    }
    .cp-test-filter {
        max-width: none;
        flex: 1;
        min-width: 80px;
    }
    .cp-actions-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 0;
        max-width: 100%;
        border: none;
        background: transparent;
        border-radius: 0;
    }
    .cp-actions-row .profile-test-mode-options {
        flex-wrap: wrap;
        gap: 10px 14px;
    }
    .cp-actions-row .btn-primary {
        margin-left: 0;
    }
    .profile-practice-grid {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
        gap: 8px;
    }
    .profile-my-chars-wrap .profile-my-chars-header {
        padding: 10px 12px;
    }
    .profile-my-chars-body.profile-my-chars-collapsed {
        max-height: 76px;
    }
    .cp-public-library-header,
    .cp-public-library-filters {
        max-width: 100%;
    }
    /* ??????????????????padding 18px??*/
    main:has(#practice.tab-content.active) .cp-card-public .cp-public-library-wrap {
        margin-left: -18px;
        margin-right: -18px;
        width: calc(100% + 36px);
        padding-left: 18px;
        padding-right: 18px;
    }
    /* ????????*/
    .profile-block {
        padding: 18px 20px;
        border-radius: 12px;
    }
    .profile-block h3 {
        font-size: 1rem;
        margin-bottom: 14px;
        padding-bottom: 10px;
    }
    .profile-block .form-actions {
        flex-direction: column;
        margin-top: 14px;
        padding-top: 14px;
    }
    .profile-block .form-actions .btn {
        width: 100%;
    }
}

/* ?????? - ?????????????? 10px ??.close */
.character-detail-modal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 30px;
    padding-bottom: 30px;
    min-height: min(20vh, calc((80vh - 80px) / 3));
    overflow: hidden;
}

.character-detail-modal h2 {
    margin-bottom: 16px;
}

.character-detail-modal svg {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    padding-right: 0;
    text-align: left;
}

.character-detail-body {
    display: flex;
    flex-wrap: wrap;
    gap: 60px;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 0;
    margin-top: 0;
    width: min(500px, 100%);
    max-width: 500px;
    height: 350px;
}

/* WEB ??>1400px?????????????????iPad ??????????*/
@media (min-width: 1401px) {
    /* ????????????*/
    #appPage header.app-header,
    #appPage header {
        position: fixed;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        max-width: 1400px;
        z-index: 250;
    }
    #appPage main {
        padding-top: 160px;
    }
    /* 功课练习：main:has(#practice) 的 padding 简写特异性更高，会盖掉上面的顶占位，需单独恢复 */
    #appPage main:has(#practice.tab-content.active) {
        padding-top: 160px;
    }
    /* 智能工具：取消 main 顶占位（#deepseek 自身已处理顶距；历史侧栏开/关均避免与头部之间多一条空白） */
    #appPage main:has(#deepseek.tab-content.active) {
        padding-top: 0;
    }
    /* 学习报告 / 学习记录：宽屏固定顶栏占位，scroll-margin 与 main 占位对齐 */
    #reports.tab-content.active,
    #mastery.tab-content.active {
        scroll-margin-top: 160px;
    }
    .nav-toggle-btn {
        display: none !important;
    }
    #mainNav.tabs-nav,
    .tabs.tabs-nav {
        display: flex !important;
        flex-direction: row;
        flex-wrap: wrap;
        overflow: visible;
        max-height: none;
        gap: 10px;
        padding: 12px 0;
        margin: 0 -4px;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        justify-content: center;
    }
    #mainNav .tab-btn,
    .tabs-nav .tab-btn {
        min-height: 44px;
        padding: 12px 24px;
        border-radius: 25px;
        border-bottom: none;
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
    /* 个人中心 WEB 端排版优化 */
    #profile .profile-center {
        max-width: 680px;
    }
    #profile .profile-blocks {
        gap: 24px;
    }
    #profile .profile-block {
        padding: 26px 28px;
    }
    #profile .profile-block-header {
        margin-bottom: 18px;
        padding-bottom: 14px;
    }
    #profile .profile-info-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px 32px;
    }
    #profile .profile-info-row {
        margin-bottom: 0;
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 12px 16px;
        align-items: baseline;
        min-width: 0;
    }
    #profile .profile-info-label {
        min-width: 72px;
        font-size: 14px;
    }
    #profile .profile-info-value {
        font-size: 15px;
        overflow: visible;
        text-overflow: ellipsis;
    }
    #profile .profile-block h3 {
        font-size: 1.15rem;
        margin-bottom: 18px;
        padding-bottom: 14px;
    }
    #profile .profile-usage-cards {
        gap: 14px;
    }
    #profile .profile-usage-card {
        padding: 14px 16px;
    }
    #profile .profile-footer {
        margin-top: 12px;
        padding-top: 24px;
        gap: 16px;
    }
}

/* WEB ??>1400px??????????????????????iPad ???????? */
@media (min-width: 1401px) {
    .character-detail-body {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        flex-wrap: nowrap;
    }
    .rice-grid-wrap {
        align-items: flex-start;
        flex-shrink: 0;
    }
    /* 并列排布：与四线格同宽，避免 200px 四线格在 189px 列内溢出偏斜 */
    .character-detail-body .rice-grid-wrap {
        margin-left: 0;
    }
    .character-detail-right {
        display: flex;
        flex-direction: column;
        gap: 0px;
        width: 200px;
        min-width: 0;
        justify-content: center;
        align-items: center;
    }
    /* 汉字详情并列：田字格与四线格顶齐；整块在固定高度内垂直居中（中间行 auto，上下 1fr 均分余量） */
    .character-detail-modal .character-detail-body {
        display: grid;
        grid-template-columns: auto auto;
        grid-template-rows: 1fr auto 1fr;
        column-gap: 60px;
        row-gap: 0;
        align-items: start;
        justify-content: center;
    }
    .character-detail-modal .character-detail-body .rice-grid-wrap {
        grid-row: 2;
        grid-column: 1;
        align-items: center;
        justify-content: flex-start;
    }
    .character-detail-modal .character-detail-body .character-detail-right {
        grid-row: 2;
        grid-column: 2;
        justify-content: flex-start;
    }
}

.rice-grid-wrap {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 0;
    margin-left: 20px;
}

/* ??????*/
.sixian-ge-wrap {
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
}

/* ??????????+?????????*/
.sixian-ge {
    width: 200px;
    height: 56px;
    position: relative;
    border: none;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 8px;
    box-sizing: border-box;
    /* 拼音垂直锚点：第二、三条线（虚线）之间的中线，对齐四线三格书写区 */
    --sixian-pinyin-mid-y: 27px;
}

.sixian-ge-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-bottom: 1px solid rgba(0, 121, 255, 0.5);
    pointer-events: none;
}
.sixian-ge-line-1 { top: 0; }
.sixian-ge-line-2 { top: 18px; border-bottom-style: dashed; }
.sixian-ge-line-3 { top: 36px; border-bottom-style: dashed; }
.sixian-ge-line-4 { top: 54px; }

/* 拼音：水平居中；垂直对齐两虚线间中线（translateY(-50%)） */
.sixian-ge-pinyin {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--sixian-pinyin-mid-y, 27px);
    transform: translateY(-50%);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-align: center;
    display: block;
    font-size: 32px;
    line-height: 1.2;
    color: #1a1a1a;
    font-family: var(--font-pinyin);
    pointer-events: none;
    z-index: 0;
    white-space: normal;
    word-break: break-word;
}

/* 发音按钮固定在左侧，避免影响拼音居中 */
.btn-pronounce {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: 50%;
    z-index: 2;
    border: none;
    background: rgba(0, 121, 255, 0.85);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    box-sizing: border-box;
    overflow: visible;
}
.btn-pronounce svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}
.btn-pronounce:hover {
    background: #0079ff;
    color: #fff;
}
.btn-pronounce:active {
    transform: translateY(-50%) scale(0.96);
}

.detail-section-title {
    font-size: 16px;
    color: #333;
    margin: 0 0 10px 0;
    font-weight: 600;
}

/* ?????????????????????????*/
.character-detail-hide-title {
    display: none;
}
/* ?????????????????????????????*/
.mastery-test-hide-title {
    display: none;
}

.rice-grid {
    width: 200px;
    height: 200px;
    position: relative;
    border: 2px solid #333;
    overflow: hidden;
}

/* ???????????? */
.hanzi-writer-in-grid {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* ???????????????????????*/
.rice-grid-char-static {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 120px;
    line-height: 1;
    color: #1a1a1a;
    font-family: "KaiTi", "??", "STKaiti", serif;
    pointer-events: none;
}

/* ????????????*/
.rice-grid-lines {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.rice-grid-lines line {
    stroke: #999;
    stroke-width: 1;
    stroke-dasharray: 6 4;
}

.rice-grid-label {
    display: none;
    text-align: center;
    font-size: 12px;
    color: #666;
    margin: 8px 0 0 0;
}

.hanzi-writer-loading {
    font-size: 12px;
    color: #888;
    text-align: center;
    padding: 80px 10px 0;
}

.btn-replay {
    padding: 6px 14px;
    font-size: 13px;
    margin-top: 10px;
}

.btn-replay.btn-icon-replay {
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-replay.btn-icon-replay svg {
    display: block;
}

.character-detail-info {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
    text-align: left;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}
.character-detail-info .polyphonic-reading {
    display: inline;
    margin-right: 2px;
    font-family: var(--font-pinyin);
}
.character-detail-info .pinyin-inline {
    font-family: var(--font-pinyin);
}

/* 表格等场景中的拼音列：拉丁字体 + lang 避免部署环境丢声调 */
td.pinyin-cell {
    font-family: var(--font-pinyin);
}

.character-detail-info p {
    margin: 8px 0;
    color: #444;
    line-height: 1.6;
}

/* 汉字详情弹窗：拼音与四线格水平居中；详情字段块整体水平居中、区内文案左对齐；并列时右列与田字格同宽、无负边距偏移 */
.character-detail-modal .character-detail-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-left: 0px;
    padding-top: 10px;
    margin-left: 0;
    padding-bottom: 0px;
}
.character-detail-modal .sixian-ge-wrap {
    width: 200px;
    max-width: 100%;
    align-self: center;
}
.character-detail-modal .sixian-ge {
    justify-content: flex-start;
    padding-left: 8px;
    padding-right: 8px;
    box-sizing: border-box;
}
.character-detail-modal .character-detail-info {
    flex: 0 0 auto;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0px;
    padding-left: 0px;
    padding-right: 0px;
    width: fit-content;
    max-width: min(320px, 100%);
    box-sizing: border-box;
}

.character-detail-actions {
    display: flex;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

/* ?????? */
.mastered-characters-block {
    margin: 20px 0;
    padding: 16px;
    background: #f0f9f0;
    border-radius: 12px;
    border: 1px solid #c8e6c9;
}
.mastered-characters-block h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #2e7d32;
}
.practice-icp {
    margin: 20px 0 4px;
    text-align: center;
    font-size: 12px;
}

.practice-icp a {
    color: #94a3b8;
    text-decoration: none;
}

.practice-icp a:hover {
    color: #64748b;
    text-decoration: underline;
}
.mastered-summary {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #555;
}
.mastered-characters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.mastered-char {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    font-size: 1.5em;
    background: white;
    border: 1px solid #a5d6a7;
    border-radius: 8px;
    color: #1b5e20;
}

.card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.report-literacy-card {
    padding-left: 5px;
    padding-right: 5px;
}

/* 学习报告：去除卡片化视觉，改为平面列表样式 */
#reportsList .report-flat,
#reportsList .report-item-flat {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

#reportsList .report-item-flat {
    padding: 14px 0;
    border-bottom: 1px solid #e8eaed;
}

#reportsList .report-item-flat h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: #202124;
}

#reportsList .report-item-flat p {
    margin: 4px 0;
    color: #5f6368;
    line-height: 1.55;
}

#reportsList .report-item-flat .actions {
    margin-top: 10px;
}

.student-card {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.student-card:hover,
.student-card:focus-visible {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.student-detail-title {
    text-align: center;
    margin: 0 0 1.25em 0;
    font-size: 1.4em;
}
.student-detail-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 28px;
    margin-bottom: 4px;
}
.student-detail-body p {
    margin: 0;
    padding: 6px 0;
    font-size: 15px;
}
.student-detail-body p.student-detail-avatar-row {
    grid-column: 1 / -1;
}
.student-detail-avatar {
    max-width: 80px;
    max-height: 80px;
    border-radius: 8px;
    vertical-align: middle;
}

.student-detail-learning {
    border-top: 1px solid #eee;
    padding-top: 12px;
}
.student-detail-test-empty {
    color: #888;
    margin: 8px 0;
    font-size: 14px;
}
.student-detail-test-table-wrap {
    max-height: 280px;
    overflow-y: auto;
    margin-top: 8px;
}
.student-detail-test-table-wrap .test-history-table {
    font-size: 12px;
}
.student-detail-test-table-wrap .test-history-table th,
.student-detail-test-table-wrap .test-history-table td {
    padding: 6px 8px;
}

.student-detail-char-table-wrap {
    margin-top: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}
.student-detail-char-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.student-detail-char-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
}
.student-detail-char-table th {
    text-align: left;
    padding: 8px 10px;
    font-weight: 600;
}
.student-detail-char-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #eceef0;
}
.student-detail-char-table tbody tr:last-child td {
    border-bottom: none;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.card p {
    color: #666;
    margin: 5px 0;
    line-height: 1.6;
}

.card .actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--gradient-bg);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.stat-card h3 {
    font-size: 2.5em;
    margin: 10px 0;
}

.stat-card p {
    font-size: 1.1em;
    opacity: 0.9;
}

.modal {
    display: none;
    position: fixed;
    z-index: 15000;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: modalBackdropIn 0.25s ease;
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
@keyframes modalBackdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    margin: auto;
    padding: 0;
    padding-top: 15px;
    padding-bottom: 15px;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.04);
    width: min(550px, calc(100vw - 40px));
    max-width: calc(100vw - 24px);
    min-height: 240px;
    height: auto;
    max-height: min(90vh, calc(100dvh - 24px));
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    animation: modalContentIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-overflow-scrolling: touch;
}
@keyframes modalContentIn {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.modal-content:has(.change-password-form) {
    overflow: hidden;
    border-radius: 16px;
    min-height: 0;
    height: auto;
    justify-content: flex-start;
    align-items: stretch;
    /* 顶/底留白：随视口高度伸缩，并纳入安全区 */
    padding-top: max(
        clamp(10px, 2.8dvh, 24px),
        calc(6px + env(safe-area-inset-top, 0px))
    );
    padding-bottom: max(
        clamp(12px, 3.2dvh, 28px),
        calc(10px + env(safe-area-inset-bottom, 0px))
    );
    width: min(
        420px,
        calc(100dvw - max(32px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px) + 16px))
    );
    max-width: min(
        420px,
        calc(100dvw - max(32px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px) + 16px))
    );
    box-sizing: border-box;
}
.modal-content:has(.change-password-form) .modal-title-center {
    margin: 0 0 clamp(10px, 2dvh, 16px) 0;
    font-size: 1.2rem;
}
#modalBody:has(.change-password-form) {
    justify-content: flex-start;
    align-items: center;
    padding: 0 20px 0;
    flex: 0 0 auto;
    overflow: visible;
}

/* 矮屏：压缩修改密码弹窗上下留白，避免空白占比过大 */
@media (max-height: 520px) {
    .modal-content:has(.change-password-form) {
        padding-top: max(8px, calc(4px + env(safe-area-inset-top, 0px)));
        padding-bottom: max(8px, calc(6px + env(safe-area-inset-bottom, 0px)));
    }
    .modal-content:has(.change-password-form) .modal-title-center {
        margin-bottom: 8px;
    }
    .change-password-form .form-actions {
        margin-top: 12px;
        padding-top: 10px;
    }
}

/* 简短提示（如无题可测「无所不知」）：高度随内容，不撑 min-height */
.modal-content:has(.modal-message-compact) {
    height: auto;
    min-height: 0;
    max-height: min(90vh, calc(100dvh - 24px));
    justify-content: flex-start;
    align-items: stretch;
    padding-top: 20px;
    padding-bottom: 20px;
    width: min(420px, calc(100vw - 40px));
}
#modalBody:has(.modal-message-compact) {
    justify-content: flex-start;
    align-items: center;
    padding: 4px 0 0;
    width: 100%;
    box-sizing: border-box;
}
.modal-message-compact {
    width: 100%;
    max-width: 100%;
    padding: 0 8px;
    box-sizing: border-box;
}
.modal-message-compact-text {
    margin: 0 0 14px 0;
    font-size: 15px;
    line-height: 1.55;
    color: #333;
    text-align: center;
}
.modal-message-compact-actions {
    margin-top: 0;
}

/* ?????????????? */
.modal-content:has(.mastery-test-modal) {
    height: auto;
    min-height: 0;
    max-height: 90vh;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* WEB 端弹窗完整显示：内容从顶部开始，支持滚动 */
@media (min-width: 769px) {
    .modal {
        padding: 20px;
    }
    .modal-content {
        justify-content: flex-start;
        overflow-y: auto;
        max-height: 90vh;
    }
    .modal-content:has(.mastery-test-modal),
    .modal-content:has(.character-detail-modal),
    .modal-content:has(.recharge-modal) {
        justify-content: flex-start;
        overflow-y: auto;
    }
    #modalBody {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }
    #modalBody:has(.modal-message-compact) {
        flex: 0 0 auto;
        overflow: visible;
    }
    /* 修改密码：WEB 端宽度随视口缩放 */
    .modal-content:has(.change-password-form) {
        width: min(
            480px,
            calc(100dvw - max(64px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px) + 40px))
        );
        max-width: min(
            480px,
            calc(100dvw - max(64px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px) + 40px))
        );
        box-sizing: border-box;
    }
}

/* 矮屏/横屏：弹窗尽量占满可用高度 */
@media (max-height: 500px) {
    .modal-content {
        max-height: calc(100dvh - 16px);
    }
}

/* 超窄屏手机 */
@media (max-width: 360px) {
    .modal {
        padding: 8px;
    }
    .modal-content {
        width: calc(100vw - 16px);
        max-width: none;
        padding: max(44px, calc(20px + env(safe-area-inset-top))) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
        border-radius: 14px;
    }
    .modal-content:has(.change-password-form) {
        width: calc(100vw - 16px);
        max-width: none;
    }
}

/* 修改密码：平板/窄窗（与 WEB 断点衔接） */
@media (min-width: 481px) and (max-width: 768px) {
    .modal-content:has(.change-password-form) {
        width: min(
            440px,
            calc(100dvw - max(40px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px) + 24px))
        );
        max-width: min(
            440px,
            calc(100dvw - max(40px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px) + 24px))
        );
    }
}

/* 充值弹窗布局 */
.modal-content:has(.recharge-modal) {
    height: auto;
    min-height: 0;
    max-height: 90vh;
    padding: 30px 25px 30px 25px;
    text-align: left;
    align-items: stretch;
    justify-content: flex-start;
}
.recharge-modal {
    width: 100%;
    min-width: 0;
}
.recharge-modal-title {
    margin: 0 0 12px 0;
    font-size: 1.25rem;
    color: #1a1a1a;
}
.recharge-modal-desc {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}
.recharge-modal-field {
    margin-bottom: 20px;
}
.recharge-modal-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}
.recharge-modal-field input {
    width: 100%;
    max-width: 200px;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    box-sizing: border-box;
}
.recharge-modal-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}
.recharge-modal-actions {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    justify-content: flex-end;
    gap: 12px;
}

.character-edit-form-wrap {
    width: 80%;
    margin: 0 auto;
}

.close {
    position: absolute;
    left: auto;
    top: 15px;
    right: 15px;
    font-size: 24px;
    font-weight: 400;
    color: #888;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    padding: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    vertical-align: middle;
    z-index: 10;
    border: none;
    border-radius: 50%;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.close:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.06);
}
.close:active {
    background: rgba(0, 0, 0, 0.1);
}

#modalBody {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    padding-top: 0;
    padding-bottom: 0;
    gap: 0;
    vertical-align: middle;
    background: #fff;
}
.modal-content:has(.report-pdf-preview-modal) {
    max-width: min(96vw, 900px);
    width: min(96vw, 900px);
    justify-content: flex-start;
    align-items: stretch;
    text-align: left;
}
#modalBody:has(.report-pdf-preview-modal) {
    justify-content: flex-start;
    align-items: stretch;
    align-self: stretch;
    width: 100%;
    max-width: 100%;
    padding: 0 12px 16px;
    box-sizing: border-box;
}
@media (min-width: 769px) {
    #modalBody:has(.report-pdf-preview-modal) {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }
}
.report-pdf-preview-modal {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.report-pdf-preview-frame-wrap {
    width: 100%;
    height: min(70vh, 640px);
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #3a3a3a;
}
.report-pdf-preview-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
.report-pdf-preview-actions {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.modal-content:has(#systemMessagesModalContent) {
    container-type: inline-size;
}
#modalBody:has(#systemMessagesModalContent) {
    justify-content: flex-start;
    padding: 24px 20px 28px;
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    box-sizing: border-box;
    background: #fff;
}
#systemMessagesModalContent {
    width: 100%;
    min-width: 0;
    text-align: left;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
}
#systemMessagesModalContent h3 {
    margin: 0 0 20px 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: 0.02em;
    padding-bottom: 14px;
    border-bottom: 1px solid #e8eaed;
    line-height: 1.4;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}
#systemMessagesModalContent .profile-notifications-list {
    margin: 0;
    padding: 4px 0 0;
    max-height: min(60vh, 400px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
#systemMessagesModalContent .profile-notification-item {
    padding: 16px 0;
    border-bottom: 1px solid #eef0f2;
    background: #fff;
}
#systemMessagesModalContent .profile-notification-item:hover {
    background: #fff;
}
#systemMessagesModalContent .profile-notification-item:last-child {
    border-bottom: none;
}
#systemMessagesModalContent .profile-notification-item-inner {
    gap: 10px;
    align-items: flex-start;
}
#systemMessagesModalContent .profile-notification-item-inner .profile-notification-title {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    color: #202124;
    word-break: break-word;
}
#systemMessagesModalContent .profile-notification-item-inner .profile-notification-time {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 12px;
    color: #9aa0a6;
    white-space: nowrap;
}
#systemMessagesModalContent .profile-notification-item.read .profile-notification-item-inner .profile-notification-title {
    color: #5f6368;
    font-weight: 500;
}
#systemMessagesModalContent .profile-notification-content {
    margin-top: 10px;
    padding: 10px 0 0 0;
    font-size: 13px;
    color: #5f6368;
    line-height: 1.65;
    word-break: break-word;
    background: transparent;
    border: none;
    border-radius: 0;
}
#systemMessagesModalContent .profile-loading,
#systemMessagesModalContent .profile-empty {
    padding: 40px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #5f6368;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}
#systemMessagesModalContent .form-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e8eaed;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}
#systemMessagesModalContent .form-actions .btn.btn-primary {
    width: 50%;
    max-width: 100%;
    box-sizing: border-box;
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
    border-radius: 9999px;
    box-shadow: none;
}
#systemMessagesModalContent .form-actions .btn.btn-primary:hover {
    background: rgba(102, 126, 234, 0.08);
    box-shadow: none;
    transform: none;
}
#systemMessagesModalContent .form-actions .btn.btn-primary:active {
    background: rgba(102, 126, 234, 0.14);
}
@media (max-width: 768px) {
    #systemMessagesModalContent .form-actions .btn.btn-primary {
        width: 50cqw;
        max-width: 100%;
    }
}
#modalBody:has(.mastery-test-modal) {
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-left: 20px;
    padding-right: 20px;
}

/* ????/???? */
.message-modal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.message-modal-backdrop {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    animation: fadeIn 0.2s ease;
}
.message-modal-box {
    position: relative;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
    width: min(440px, calc(100vw - 32px));
    min-width: 280px;
    max-width: 440px;
    padding: 24px 24px 20px;
    animation: messageModalIn 0.25s ease;
}
@keyframes messageModalIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.message-modal-text {
    color: #333;
    font-size: 15px;
    line-height: 1.55;
    margin: 0 0 20px 0;
    white-space: pre-wrap;
    word-break: break-word;
}
.message-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}
.message-modal-buttons .btn {
    min-width: 72px;
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.message-modal-buttons .btn-primary {
    background: transparent;
    border: 1px solid #667eea;
    color: #667eea;
}
.message-modal-buttons .btn-primary:hover {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1a73e8;
}
.message-modal-buttons .btn-default {
    background: #fff;
    border: 1px solid #ddd;
    color: #555;
}
.message-modal-buttons .btn-default:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.modal-title-center {
    text-align: center;
    margin: 0 0 1em 0;
}

.change-password-modal {
    width: min(400px, 100%);
    max-width: 400px;
    padding: 8px 0 20px 0;
    text-align: left;
}
.change-password-modal-title {
    font-size: 1.35em;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    text-align: center;
}
.change-password-modal-hint {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0 0 20px 0;
    text-align: center;
}
.change-password-modal .form-group {
    margin-bottom: 16px;
}
.change-password-modal .form-group:last-of-type {
    margin-bottom: 0;
}
.change-password-modal .form-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e8eaed;
    justify-content: flex-end;
    gap: 12px;
}
.change-password-modal .form-actions .btn-primary,
.change-password-form .form-actions .btn-primary {
    border-radius: 999px;
    background: transparent;
    border: 1px solid #667eea;
    color: #667eea;
}
.change-password-modal .form-actions .btn-primary:hover,
.change-password-form .form-actions .btn-primary:hover {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1a73e8;
    box-shadow: none;
    transform: none;
}

/* ????????????????????0%??*/
.change-password-form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.change-password-form .cp-field {
    width: 100%;
}
.change-password-form .cp-field-wrap {
    margin-bottom: 12px;
}
.change-password-form .cp-field-wrap:last-of-type {
    margin-bottom: 0;
}
.change-password-form .cp-field {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid #d6dbe3;
    border-radius: 9999px;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.change-password-form .cp-field:hover {
    border-color: #c3c9d4;
    background: #ffffff;
}
.change-password-form .cp-field:focus-within {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.16);
}
.change-password-form .cp-field:focus-within .cp-field-label {
    color: #1a73e8;
}
.change-password-form .cp-field:focus-within .cp-field-icon {
    color: #1a73e8;
}
.change-password-form .cp-field input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    font-size: 15px;
    font-weight: 500;
    color: #202124;
    letter-spacing: 0.01em;
    line-height: 1.45;
    padding: 10px 0;
    background: transparent;
    text-align: left;
    caret-color: #1a73e8;
}
.change-password-form .cp-field input::placeholder {
    color: #9aa0a6;
    font-weight: 400;
}
.change-password-form .cp-field input:-webkit-autofill,
.change-password-form .cp-field input:-webkit-autofill:hover,
.change-password-form .cp-field input:-webkit-autofill:focus,
.change-password-form .cp-field input:-webkit-autofill:active {
    -webkit-text-fill-color: #202124;
    box-shadow: 0 0 0 1000px #fff inset;
    transition: background-color 9999s ease-in-out 0s;
}
.change-password-form .cp-field-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #80868b;
    font-size: 14px;
    flex-shrink: 0;
    text-align: left;
    justify-content: flex-start;
    cursor: pointer;
    margin: 0;
    font-weight: inherit;
}
.change-password-form .cp-field-text {
    text-align: left;
}
/* 聚焦输入或已有内容时隐藏标签汉字，为密码输入腾出空间 */
.change-password-form .cp-field:focus-within .cp-field-text,
.change-password-form .cp-field:has(input:not(:placeholder-shown)) .cp-field-text {
    display: none;
}
.change-password-form .cp-field-icon {
    color: #9aa0a6;
    flex-shrink: 0;
}
.change-password-form .form-actions {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e8eaed;
    justify-content: flex-end;
    gap: 12px;
}
.form-error {
    font-size: 13px;
    color: #dc3545;
    margin-top: 6px;
    min-height: 0;
    display: none;
}
.form-error.form-error-visible {
    display: block;
}

/* ?????????????? */
.mastery-test-modal {
    width: min(420px, 100%);
    min-width: 0;
    max-width: min(420px, 100%);
    margin: 0 auto;
    align-self: center;
    padding: 0;
    text-align: center;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}
.mastery-test-modal .modal-title-center {
    font-size: 1.35em;
    margin-bottom: 16px;
    color: #333;
}
.mastery-test-progress {
    font-size: 15px;
    color: #666;
    margin: 10px 0;
    padding: 0;
    font-weight: 500;
    text-align: center;
    height: 44px;
    line-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mastery-test-pinyin-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
    cursor: pointer;
    margin-bottom: 25px;
    width: 100%;
    user-select: none;
}
.mastery-test-pinyin-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #1a73e8;
}
.mastery-test-char-pinyin-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 1;
    min-height: 200px;
}
.mastery-test-char-pinyin-wrap .mastery-test-pinyin {
    order: 1;
}
.mastery-test-char-pinyin-wrap .mastery-test-char {
    order: 2;
}
.mastery-test-char {
    font-size: 9em;
    line-height: 1.1;
    color: #333;
    font-family: "KaiTi", "??", "STKaiti", serif;
    margin: 0;
    min-height: 1.2em;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: none;
}

@media (max-width: 768px) {
    .mastery-test-modal .mastery-test-char-pinyin-wrap {
        gap: 5px;
    }
    .mastery-test-modal .mastery-test-char {
        margin-top: 0;
    }
}

.mastery-test-pinyin {
    font-size: 2.4em;
    color: #1a73e8;
    margin: 0;
    letter-spacing: 0.05em;
    padding: 0;
    font-family: var(--font-pinyin);
    line-height: 1.35;
}
#masteryTestPinyinEl {
    margin: 0;
    padding: 0;
}
.mastery-test-pinyin-voice-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 0px;
    height: 40px;
}
.mastery-test-pinyin-voice-row .mastery-test-pinyin {
    padding-top: 0;
    margin: 0;
    flex-shrink: 0;
    height: 40px;
    line-height: 40px;
    font-size: 1.6em;
    display: flex;
    align-items: center;
}
.mastery-test-pinyin-voice-row .mastery-test-voice-wave-wrap {
    margin-top: 0;
    padding: 0;
    flex-shrink: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mastery-test-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.mastery-test-actions-main {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.mastery-test-voice-row {
    display: flex;
    justify-content: center;
    width: 100%;
}
.mastery-test-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1 1 0;
    min-width: 0;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 10px;
}
.mastery-test-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mastery-test-btn-icon svg {
    vertical-align: middle;
}
.mastery-test-actions .btn-primary {
    background: linear-gradient(135deg, #43a047, #66bb6a);
    border: none;
    box-shadow: 0 4px 12px rgba(67, 160, 71, 0.35);
}
.mastery-test-actions .btn-primary:hover {
    background: linear-gradient(135deg, #388e3c, #5caf63);
    box-shadow: 0 6px 16px rgba(56, 142, 60, 0.45);
}
.mastery-test-actions .btn:not(.btn-primary) {
    background: linear-gradient(135deg, #ef5350, #e53935);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.35);
}
.mastery-test-actions .btn:not(.btn-primary):hover {
    background: linear-gradient(135deg, #e53935, #c62828);
    box-shadow: 0 6px 16px rgba(198, 40, 40, 0.45);
}
.mastery-test-actions .mastery-test-voice-btn {
    border-radius: 9999px;
}
.mastery-test-voice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    gap: 0;
    background: transparent;
    border: none;
    color: #1e88e5;
    border-radius: 50%;
    font-size: 13px;
    box-shadow: none;
}
.mastery-test-voice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mastery-test-voice-icon svg {
    vertical-align: middle;
    width: 32px;
    height: 32px;
}
.mastery-test-voice-btn:hover {
    background: rgba(30, 136, 229, 0.08);
    color: #1565c0;
}
.mastery-test-voice-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.mastery-test-voice-hint {
    margin: 12px 0 0 0;
    font-size: 14px;
    color: #c62828;
    text-align: center;
}
.mastery-test-pinyin-voice-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 0px;
    height: 40px;
}
.mastery-test-pinyin-voice-row .mastery-test-pinyin {
    padding-top: 0;
    margin: 0;
    height: 40px;
    line-height: 40px;
    font-size: 1.6em;
    display: flex;
    align-items: center;
}
.mastery-test-pinyin-voice-row .mastery-test-voice-wave-wrap {
    margin-top: 0;
    padding: 0;
    flex-shrink: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mastery-test-voice-wave-wrap {
    margin-top: 12px;
    padding: 8px 12px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.mastery-test-voice-wave {
    display: block;
    width: 100%;
    max-width: 200px;
    height: 40px;
    margin: 0 auto;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}
@media (max-width: 480px) {
    #modalBody:has(.mastery-test-modal) {
        padding-left: 12px;
        padding-right: 12px;
    }
    .mastery-test-modal {
        padding: 0 8px 0 8px;
    }
    .mastery-test-modal .modal-title-center {
        font-size: 1.2em;
    }
    .mastery-test-progress {
        font-size: 14px;
        margin: 10px 0;
        padding-bottom: 0;
    }
    .mastery-test-pinyin-toggle {
        font-size: 13px;
        margin-bottom: 10px;
    }
    .mastery-test-modal .mastery-test-char {
        font-size: 6.5em;
        margin: 0 0 8px 0;
    }
    .mastery-test-pinyin {
        font-size: 2em;
        color: #1a73e8;
        margin-bottom: 0px;
    }
    .mastery-test-actions {
        gap: 12px;
        width: 100%;
    }
    .mastery-test-actions-main {
        gap: 10px;
    }
    .mastery-test-actions .btn {
        padding: 12px 10px;
        font-size: 15px;
    }
    .mastery-test-voice-btn {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }
    .change-password-modal {
        padding: 4px 0 16px 0;
    }
    .change-password-modal-title {
        font-size: 1.2em;
    }
    .change-password-modal-hint {
        font-size: 12px;
        margin-bottom: 16px;
    }
    .change-password-modal .form-actions,
    .change-password-form .form-actions {
        flex-direction: column;
        margin-top: 20px;
        padding-top: 16px;
    }
    .change-password-modal .form-actions .btn,
    .change-password-form .form-actions .btn {
        width: 100%;
    }
}

/* ????????????*/
.pending-invite-modal-desc {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}
.pending-invite-modal-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pending-invite-modal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
}
.pending-invite-modal-name {
    font-weight: 500;
    color: #333;
}

/* ???????????*/
.pending-invites-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    font-size: 14px;
    background: #f0f7ff;
    border-bottom: 1px solid #d0e3ff;
}

/* ==================== ?????? ==================== */
.add-student-modal {
    width: 100%;
    max-width: 520px;
}

.add-student-modal-title {
    margin: 0 0 12px 0;
    font-size: 1.35em;
    color: #333;
    font-weight: 600;
}

.add-student-hint {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

.add-student-search-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.add-student-search-row {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    gap: 12px;
}

.add-student-search-row-inline {
    grid-template-columns: auto 1fr auto 1fr;
    gap: 12px 16px;
}

.add-student-label {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.add-student-input {
    padding: 10px 14px;
    border: 1px solid #dadce0;
    border-radius: 10px;
    font-size: 14px;
    min-width: 0;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.add-student-input:hover {
    background: #fff;
    border-color: #b8bcc4;
}

.add-student-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    background: #fff;
}

.add-student-actions {
    margin-top: 6px;
}

.add-student-actions .btn {
    min-width: 100px;
}

.add-student-results-section {
    margin-top: 20px;
}

.add-student-results-heading {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.modal-content .add-student-results {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 0;
    background: #fafafa;
}


.add-student-empty {
    color: #888;
    font-size: 14px;
    padding: 20px 16px;
    margin: 0;
    text-align: center;
}

.add-student-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    background: #fff;
}

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

.add-student-item span:first-child {
    flex: 1;
    min-width: 0;
}

.add-student-action {
    flex-shrink: 0;
}

.add-student-action .btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.add-student-tag {
    font-size: 12px;
    color: #17a2b8;
    margin-left: 6px;
}

/* ??????????????????????????RTL ?? */
.form-group-name {
    direction: ltr;
}
input[name="real_name"],
input[name="name"],
#addStudentSearchName {
    direction: ltr !important;
    text-align: left !important;
}

/* ????/ iPad????????? */
@media (max-width: 1400px) {
    .add-student-search-row {
        grid-template-columns: 1fr;
    }

    .add-student-search-row-inline {
        grid-template-columns: 1fr;
    }

    .add-student-search-row-inline .add-student-label:not(:first-child) {
        margin-top: 8px;
    }

    .add-student-modal-title {
        font-size: 1.2em;
    }

    .modal-content .add-student-results {
        max-height: 220px;
    }
}

.form-group {
    margin-bottom: 20px;
    margin-top: 20px;
}
.form-group.login-role-toggle-wrap {
    justify-content: flex-start;
    vertical-align: middle;
    text-align: center;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* ????????????????????*/
select,
.form-group select,
.search-bar-select,
.toolbar-select,
.filters select,
.cp-filter-select,
.profile-region-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 44px;
    text-overflow: ellipsis;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin: 5px 5px 5px 0;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.progress-bar {
    width: 100%;
    height: 25px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-bg-h);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 500;
}

/* ==================== ?????? ==================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1 1 100%;
    width: 100%;
    min-height: 100vh;
    background: #fff;
    padding: 20px;
}

.login-box {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo-wrap {
    text-align: center;
    margin-bottom: 16px;
    min-height: 100px;
}
.login-logo {
    max-width: 200px;
    height: auto;
    display: inline-block;
}
.login-logo-fallback {
    font-size: 80px;
    line-height: 1;
}
.login-brand-tagline {
    margin: 12px 0 0;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: #334155;
    letter-spacing: 0.12em;
}
.login-box h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
}

.login-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.login-tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
}

.login-tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.login-tab-btn:hover {
    color: #667eea;
}

.login-switch-hint {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: #666;
}
.login-switch-hint a {
    color: #667eea;
    text-decoration: none;
}
.login-switch-hint a:hover {
    text-decoration: underline;
}

/* ??/??????????????placeholder */
.login-input-wrap {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    border: 2px solid #e0e0e0;
    border-radius: 9999px;
    background: #fff;
    transition: border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
    min-height: 48px;
    overflow: hidden;
}
.login-input-wrap:focus-within {
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.16);
}
.login-input-icon {
    flex-shrink: 0;
    padding-left: 14px;
    margin-right: 0;
    font-size: 1.1em;
    line-height: 1;
    color: var(--icon-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.login-input-icon img {
    width: 1.1em;
    height: 1.1em;
    object-fit: contain;
    opacity: 0.85;
    filter: var(--icon-filter-blue);
}
.login-input-wrap input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 12px 14px 12px 8px;
    font-size: 14px;
    font-family: inherit;
    background: transparent;
}
.login-input-wrap input:-webkit-autofill,
.login-input-wrap input:-webkit-autofill:hover,
.login-input-wrap input:-webkit-autofill:focus,
.login-input-wrap input:-webkit-autofill:active {
    -webkit-text-fill-color: #222;
    box-shadow: 0 0 0 1000px #fff inset;
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    transition: background-color 9999s ease-out 0s;
}
.login-input-wrap input:-moz-autofill {
    box-shadow: 0 0 0 1000px #fff inset;
}
.login-input-wrap input:focus {
    outline: none;
}

/* 邮箱验证码图标：Shield Done + 蓝色 */
.login-email-code-icon img {
    filter: var(--icon-filter-blue);
}

/* 登录验证码（与账号栏样式一致） */
.login-captcha-wrap {
    margin-bottom: 16px;
}
.login-captcha-row {
    display: flex;
    align-items: center;
    border: 2px solid #e0e0e0;
    border-radius: 9999px;
    background: #fff;
    min-height: 48px;
    overflow: hidden;
    transition: border-color 0.3s;
}
.login-captcha-row .login-input-icon {
    padding-left: 14px;
    padding-right: 6px;
}
.login-captcha-icon img {
    filter: var(--icon-filter-blue);
    opacity: 0.85;
}
.login-captcha-icon {
    opacity: 0.85;
}
.login-captcha-row:focus-within {
    border-color: #667eea;
}
.login-captcha-left {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    min-width: 100px;
    padding: 0 12px;
}
.login-captcha-question {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}
.btn-captcha-refresh img {
    filter: var(--icon-filter-blue);
}
.btn-captcha-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.7;
}
.btn-captcha-refresh:hover {
    opacity: 1;
}
#sendRegisterCodeBtn,
#guestUpgradeSendCodeBtn {
    width: max-content;
    max-width: 100%;
    flex-shrink: 0;
    padding-left: 4px;
    padding-right: 10px;
    white-space: nowrap;
    box-sizing: border-box;
}

/* 注册/游客升级：邮箱与「验证」并排时，保证输入区独立伸缩，避免按钮压住邮箱文字 */
.login-input-wrap.register-email-with-verify {
    gap: 8px;
    padding-right: 10px;
}
.login-input-wrap.register-email-with-verify > .register-email-icon-input {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
}
.login-input-wrap.register-email-with-verify > .register-email-icon-input > .login-input-icon {
    flex-shrink: 0;
}
.login-input-wrap.register-email-with-verify > .register-email-icon-input > input {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    padding-right: 0;
}
.guest-upgrade-modal {
    width: min(400px, 100%);
    max-width: 400px;
    padding: 8px 24px 24px;
}
.guest-upgrade-modal .modal-title-center {
    font-size: 1.35em;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}
.guest-upgrade-hint {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0 0 20px 0;
}
.guest-upgrade-modal .form-group.login-input-wrap {
    margin-bottom: 16px;
}
.guest-upgrade-modal .register-error-tip {
    margin-bottom: 16px;
}

/* 字库满 90 字建议注册弹窗 */
.modal-content:has(.guest-library-full-modal) {
    height: auto;
    min-height: 0;
    max-height: 90vh;
    margin: 0;
}
.guest-library-full-modal {
    width: min(360px, calc(100vw - 32px));
    padding: 25px 10px 20px;
    text-align: center;
}
.guest-library-full-title {
    font-size: 1.25em;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px 0;
}
.guest-library-full-desc {
    font-size: 15px;
    line-height: 1.6;
    color: #444;
    margin: 0 0 8px 0;
}
.guest-library-full-hint {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0 0 24px 0;
}
.guest-library-full-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}
.guest-library-full-actions .btn {
    padding: 12px 24px;
    font-size: 15px;
}
@media (min-width: 480px) {
    .guest-library-full-actions {
        flex-direction: row;
        justify-content: center;
        gap: 16px;
    }
    .guest-library-full-actions .btn {
        min-width: 120px;
    }
}

/* 登录验证弹窗（点登入后弹出） */
.modal-content:has(.login-verify-modal) {
    height: auto;
    min-height: 0;
    max-height: 90vh;
    margin: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}
.login-verify-modal {
    padding: 24px 28px 28px;
    min-width: 340px;
    width: 100%;
}
.login-verify-modal .modal-title-center {
    font-size: 1.5em;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
}
.login-verify-hint {
    font-size: 16px;
    color: #666;
    margin: 0 0 20px 0;
}
.login-verify-captcha-row,
.login-verify-input {
    min-height: 54px;
    padding: 14px 18px;
    box-sizing: border-box;
}
.login-verify-captcha-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-top: 0px;
    padding-bottom: 0px;
    border: 2px solid #e0e0e0;
    border-radius: 9999px;
    background: #fff;
}
.login-verify-question {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}
.login-verify-input {
    width: 100%;
    border: 2px solid #e0e0e0;
    border-radius: 9999px;
    font-size: 18px;
}
.login-verify-input:focus {
    outline: none;
    border-color: #667eea;
}
.login-verify-modal .form-actions .btn {
    font-size: 16px;
    padding: 12px 24px;
}
.login-verify-modal .form-actions .btn-primary {
    border-radius: 9999px;
}

/* 移动端：验证区宽度为弹窗 90%，输入区触控友好（16px 避免 iOS 自动放大） */
@media (max-width: 768px) {
    .modal-content:has(.login-verify-modal) .login-verify-modal {
        width: 90%;
        max-width: 100%;
        min-width: 0;
        margin-left: auto;
        margin-right: auto;
        padding: 18px 14px 20px;
        box-sizing: border-box;
    }
    .login-verify-modal .login-verify-captcha-row,
    .login-verify-modal .login-verify-input {
        min-height: 48px;
        padding: 12px 16px;
        font-size: 16px;
    }
    .login-verify-modal .login-verify-captcha-row {
        padding-top: 0;
        padding-bottom: 0;
        gap: 8px;
    }
    .login-verify-modal .login-verify-question {
        font-size: 16px;
        min-width: 0;
    }
    .login-verify-modal .login-verify-hint {
        font-size: 14px;
        margin-bottom: 14px;
    }
    .login-verify-modal .modal-title-center {
        font-size: 1.25em;
    }
    .login-verify-modal .form-actions .btn {
        min-height: 48px;
        padding: 12px 20px;
    }
}

.login-captcha-row input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 12px 14px 12px 8px;
    font-size: 14px;
    font-family: inherit;
    background: transparent;
}
.login-captcha-row input:focus {
    outline: none;
}

/* ??/???????????/?????????????*/
.login-role-toggle-wrap.login-input-wrap {
    padding: 4px;
    min-height: 48px;
    border: 2px solid #e0e0e0;
    border-radius: 9999px;
    overflow: hidden;
    background: #f8f9fa;
    transition: border-color 0.3s;
}
.login-role-toggle-wrap.login-input-wrap:focus-within {
    border-color: #667eea;
}
.login-role-toggle {
    display: flex;
    width: 100%;
    min-height: 40px;
    border-radius: 9999px;
    background: transparent;
    padding: 0;
    gap: 2px;
}
.form-group label.login-role-toggle-option {
    margin-bottom: 0;
}
.login-role-toggle-option {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 6px;
    line-height: 1;
    min-height: 40px;
    min-width: min-content;
    white-space: nowrap;
    padding: 10px 18px;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    text-align: center;
    vertical-align: middle;
    box-sizing: border-box;
}
/* ????????????????? */
.login-role-toggle-option:first-of-type,
.login-role-toggle-option:last-of-type {
    border-radius: 9999px;
}

.login-role-icon img {
    filter: var(--icon-filter-blue);
    display: block;
    width: 1.4em;
    height: 1.4em;
    object-fit: contain;
    vertical-align: middle;
}
.login-role-inner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
    flex-shrink: 0;
}
.login-role-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4em;
    height: 1.4em;
    line-height: 1;
}
.login-role-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.login-role-toggle input:checked + .login-role-toggle-option {
    background: #fff;
    color: #667eea;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(102, 126, 234, 0.25), 0 0 12px rgba(102, 126, 234, 0.35);
}
.login-role-toggle-option:hover {
    color: #333;
}
.login-role-toggle input:checked + .login-role-toggle-option:hover {
    color: #5568d3;
}
.login-role-toggle input:focus-visible + .login-role-toggle-option {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ?????????????? */
.login-success-tip {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.login-success-tip.show {
    opacity: 1;
}

/* ????????*/
.login-error-tip {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.login-error-tip.show {
    display: block;
}

/* ???????????????? */
.register-invite-tip {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #e8f4fd;
    border-radius: 8px;
    font-size: 14px;
    color: #0c5460;
}
.register-invite-tip.show {
    border: 1px solid #b8daff;
}

.invite-link-hint {
    margin: 12px 0;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}
.invite-link-label {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}
.invite-link-error {
    color: #c00;
    font-size: 14px;
    margin: 8px 0;
}

.register-error-tip {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    font-size: 14px;
}
.register-error-tip.show {
    display: block;
}

.btn-block {
    width: 100%;
    margin-top: 0px;
}
.btn-guest-login {
    margin-top: 10px;
    background: #f1f3f5;
    color: #495057;
    border: 1px solid #dce1e6;
}
.btn-guest-login:hover {
    background: #e9ecef;
}

/* ??????????????48px???? 999px */
.login-box .btn {
    border-radius: 999px;
    padding: 14px 14px;
    min-height: 48px;
    height: 48px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==================== ????/ PAD ???? - ????????iPad ?? 1366px??==================== */
@media (max-width: 1400px) {
    body {
        padding: 0;
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .container {
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        width: 100%;
        max-width: none;
    }
}

/* ????/ iPad??????+ ???? */
@media (max-width: 1400px) {

    header {
        padding: 6px 16px 2px;
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
        overflow: visible;
    }

    /* ???????HEAD ??????*/
    .nav-toggle-btn {
        display: flex;
        align-self: center;
    }

    /* ?????????????????? */
    #mainNav.tabs-nav,
    .tabs.tabs-nav {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        overflow: hidden;
        max-height: 0;
        gap: 0;
        padding: 0;
        margin: 0;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        padding-top: 0;
        padding-bottom: 0;
        z-index: 200;
        background: #e8e8e8;
        border-radius: 0;
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.12);
        border-top: 2px solid #bbb;
        opacity: 1;
        visibility: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0s linear 0.4s;
        pointer-events: none;
    }
    #mainNav.tabs-nav.open,
    .tabs.tabs-nav.open {
        max-height: calc(100vh - 100px);
        overflow-y: auto;
        overflow-x: hidden;
        padding-top: 12px;
        padding-bottom: env(safe-area-inset-bottom, 12px);
        opacity: 1;
        visibility: visible;
        scrollbar-width: none;
        -ms-overflow-style: none;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0s linear 0s;
        pointer-events: auto;
    }
    #mainNav.tabs-nav.open::-webkit-scrollbar,
    .tabs.tabs-nav.open::-webkit-scrollbar {
        display: none;
    }
    #mainNav .tab-btn,
    .tabs-nav .tab-btn {
        flex-shrink: 0;
        min-height: 48px;
        padding: 14px 20px;
        font-size: 17px;
        font-weight: 600;
        white-space: nowrap;
        justify-content: center;
        align-items: center;
        gap: 10px;
        border: none;
        border-radius: 0;
        border-bottom: none;
        background: transparent;
        color: #333;
        text-decoration: none;
        display: flex;
        width: 100%;
        box-sizing: border-box;
        -webkit-tap-highlight-color: transparent;
        position: relative;
    }
    #mainNav .nav-item-icon-left,
    .tabs-nav .nav-item-icon-left {
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 1.2em;
        margin-right: 8px;
        font-size: 1.1em;
        line-height: 1;
    }
    #mainNav .tab-btn::after,
    .tabs-nav .tab-btn::after {
        content: '';
        position: absolute;
        left: 5%;
        bottom: 0;
        width: 90%;
        height: 1px;
        background: rgba(0, 0, 0, 0.08);
    }
    #mainNav .tab-btn:last-child::after,
    .tabs-nav .tab-btn:last-child::after {
        display: none;
    }
    #mainNav .tab-btn:hover,
    .tabs-nav .tab-btn:hover {
        background: transparent;
        color: #333;
        transform: none;
    }
    #mainNav .tab-btn.active,
    .tabs-nav .tab-btn.active {
        background: transparent;
        color: #667eea;
        font-weight: 700;
    }

    .header-row {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    .header-title,
    header h1 {
        font-size: 1.5em;
        margin: 0;
    }

    .header-actions {
        justify-content: space-between;
        flex-wrap: wrap;
        align-items: center;
    }

    .header-user-info {
        font-size: 13px;
        word-break: break-all;
        flex: 1;
        min-width: 0;
    }

    .btn-header-logout {
        min-height: 44px;
        padding: 10px 18px;
    }

    /* ??????????????*/
    .navbar {
        padding-left: max(5px, env(safe-area-inset-left));
        padding-right: max(5px, env(safe-area-inset-right));
    }

    .navbar-inner {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px;
        padding: 12px 0;
    }

    .navbar-inner::-webkit-scrollbar {
        display: none;
    }

    .navbar .nav-item.tab-btn {
        flex-shrink: 0;
        padding: 9px 16px;
        font-size: 14px;
    }

    main {
        padding: 0 8px;
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
        padding-bottom: 0;
        margin-bottom: 0;
    }
    main:has(#practice.tab-content.active) {
        padding: 0 4px;
        padding-left: max(4px, env(safe-area-inset-left));
        padding-right: max(4px, env(safe-area-inset-right));
        padding-bottom: 0;
        margin-bottom: 0;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }
    #profile .section-header {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    /* 学习报告：移动端标题行左侧、分享入口右上角 */
    #reports .section-header {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    #reports .section-header h2 {
        flex: 1;
        min-width: 0;
        margin: 0;
    }
    #reports .report-student-toolbar {
        flex-shrink: 0;
        justify-content: flex-end;
        margin-left: auto;
    }

    .section-header h2 {
        font-size: 1.4em;
    }

    .section-header > div {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
    }

    .btn {
        min-height: 44px;
        padding: 12px 18px;
        font-size: 15px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    #reports .report-share-action {
        min-height: 44px;
        font-size: 15px;
        padding: 8px 4px;
        box-sizing: border-box;
    }

    #mastery .mastery-student-toolbar select,
    #mastery .mastery-student-toolbar .btn {
        min-height: 44px;
        font-size: 15px;
    }
    #mastery .mastery-student-toolbar .btn {
        padding-top: 0;
        padding-bottom: 0;
        padding-left: 18px;
        padding-right: 18px;
    }

    .btn-pronounce {
        padding-left: 12px;
        padding-right: 12px;
    }

    .search-bar {
        margin-bottom: 16px;
    }

    .search-bar input,
    .search-bar-input {
        padding: 12px 16px 12px 40px;
        font-size: 16px; /* ?? iOS ????????*/
    }

    .filters {
        gap: 10px;
        margin-bottom: 16px;
    }

    .filters select,
    .filters input {
        padding: 12px 14px;
        padding-right: 44px;
        font-size: 16px;
        min-height: 48px;
    }
    .filters input {
        padding-right: 14px;
    }

    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .card {
        padding: 16px;
    }

    .card .actions {
        flex-wrap: wrap;
    }

    .card .actions .btn {
        flex: 1;
        min-width: 80px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    #mastery .section-header {
        margin-bottom: 10px;
    }

    #mastery .mastery-stats-grid {
        margin-bottom: 12px;
        gap: 10px;
    }

    #mastery .mastery-stat-card {
        padding: 12px 14px;
    }

    #mastery .mastery-stat-value {
        font-size: 1.5rem;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card h3 {
        font-size: 2em;
    }

    /* ???????????? */
    .character-library-grid {
        grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
        gap: 10px;
    }

    .character-tile {
        padding: 6px;
    }

    .character-tile-char {
        font-size: 1.8em;
    }

    /* ??????????????? */
    .character-filters-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 10px 14px;
        margin-bottom: 6px;
        font-size: 14px;
        font-weight: 600;
        color: #667eea;
        background: #f0f4ff;
        border: 1px solid #d0d9f7;
        border-radius: 8px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: background 0.2s, border-color 0.2s;
    }
    .character-filters-toggle-icon {
        display: inline-flex;
        flex-shrink: 0;
        color: inherit;
    }
    .character-filters-toggle-icon img {
        filter: var(--icon-filter-blue);
    }
    .character-filters-toggle:hover {
        background: #e8eeff;
        border-color: #667eea;
    }
    .character-filters-wrap.character-filters-collapsed .character-filters {
        display: none;
    }
    .character-filters-wrap.character-filters-collapsed .character-filters-toggle {
        margin-bottom: 0;
    }

    /* ??????????????? */
    main:has(#characters.tab-content.active) .character-filters-wrap {
        margin-left: calc(-1 * max(8px, env(safe-area-inset-left)));
        margin-right: calc(-1 * max(8px, env(safe-area-inset-right)));
        width: calc(100% + max(8px, env(safe-area-inset-left)) + max(8px, env(safe-area-inset-right)));
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
        box-sizing: border-box;
    }

    /* ?????????????????????*/
    .character-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .character-filters-row {
        width: 100%;
    }
    .character-filters-main {
        flex: none;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    /* ????????????????????????3??2??????*/
    .character-filters select {
        flex: 1 1 0;
        min-width: 5.5em;
        padding: 8px 28px 8px 10px;
        font-size: 14px;
        min-height: 44px;
        background-position: right 8px center;
    }
    /* 课文筛选与年级/学期/单元等同排横排，不再单独占满一行 */
    .character-filters select#lessonFilter,
    .character-filters select#myLessonFilter {
        flex: 1 1 12em;
        min-width: min(100%, 10em);
        max-width: 100%;
    }
    .character-filters .search-input-wrap {
        flex: 1;
        min-width: 0;
        max-width: none;
    }
    .character-filters .search-box-with-btn {
        width: 100%;
    }
    .character-filters .search-box-with-btn input {
        font-size: 14px;
        min-height: 40px;
        height: 40px;
        box-sizing: border-box;
    }

    /* DEEPSEEK ?????????????????? */
    @keyframes deepseek-toggle-breathe {
        0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 12px rgba(26, 115, 232, 0.2), 0 0 24px rgba(26, 115, 232, 0.1); }
        50% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 20px rgba(26, 115, 232, 0.45), 0 0 40px rgba(26, 115, 232, 0.25); }
    }
    @keyframes deepseek-arrow-breathe {
        0%, 100% { opacity: 0.7; filter: drop-shadow(0 0 4px rgba(26, 115, 232, 0.3)); }
        50% { opacity: 1; filter: drop-shadow(0 0 12px rgba(26, 115, 232, 0.6)); }
    }
    .deepseek-layout {
        position: relative;
        gap: 12px;
        flex: 1;
        height: 100%;
        min-height: 0;
        overflow: visible;
    }

    .deepseek-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        left: -20px;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        padding: 0;
        background: #fff;
        border: none;
        border-radius: 50%;
        cursor: pointer;
        z-index: 150;
        outline: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 12px rgba(26, 115, 232, 0.2), 0 0 24px rgba(26, 115, 232, 0.1);
        -webkit-tap-highlight-color: transparent;
        -webkit-appearance: none;
        appearance: none;
        user-select: none;
        -webkit-user-select: none;
        transition: left 0.25s ease-out, background 0.2s, box-shadow 0.2s;
        animation: deepseek-toggle-breathe 2.5s ease-in-out infinite;
    }
    .deepseek-sidebar-toggle:focus,
    .deepseek-sidebar-toggle:active {
        outline: none;
    }
    .deepseek-sidebar-toggle:hover {
        animation: none;
        background: #f8f9fa;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12), 0 0 24px rgba(26, 115, 232, 0.35);
    }
    .deepseek-layout.deepseek-sidebar-open .deepseek-sidebar-toggle {
        left: 220px;
        width: 36px;
        height: 36px;
        background: transparent;
        border: none;
        border-radius: 50%;
        box-shadow: none;
        animation: none;
        z-index: 303;
        transition: left 0.25s ease-out, background 0s, box-shadow 0s, border-radius 0s;
    }
    .deepseek-layout.deepseek-sidebar-open .deepseek-sidebar-toggle:hover {
        background: transparent;
        box-shadow: none;
    }
    .deepseek-sidebar-toggle .deepseek-toggle-arrow {
        color: #5f6368;
        transition: color 0.2s, transform 0.25s ease, opacity 0.2s, filter 0.2s;
    }
    .deepseek-sidebar-toggle:hover .deepseek-toggle-arrow {
        color: #1a73e8;
    }
    .deepseek-layout.deepseek-sidebar-open .deepseek-sidebar-toggle .deepseek-toggle-arrow {
        color: #1a73e8;
        transform: rotate(180deg);
        animation: deepseek-arrow-breathe 2.5s ease-in-out infinite;
    }
    .deepseek-layout.deepseek-sidebar-open .deepseek-sidebar-toggle:hover .deepseek-toggle-arrow {
        animation: none;
        opacity: 1;
        filter: none;
    }
    .deepseek-sidebar-toggle:focus-visible {
        outline: 2px solid #1a73e8;
        outline-offset: 2px;
    }
    .deepseek-layout.deepseek-sidebar-open .deepseek-sidebar-toggle:focus,
    .deepseek-layout.deepseek-sidebar-open .deepseek-sidebar-toggle:active {
        outline: none;
    }

    .deepseek-sidebar-overlay {
        display: none;
        position: absolute;
        inset: 0;
        background: rgba(0,0,0,0.55);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 301;
        -webkit-tap-highlight-color: transparent;
    }
    .deepseek-layout.deepseek-sidebar-open .deepseek-sidebar-overlay {
        display: flex;
        flex-wrap: nowrap;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        position: absolute;
        inset: 0;
        z-index: 301;
    }

    aside.deepseek-sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        margin-top: 0;
        margin-bottom: 0;
        width: 260px;
        max-width: 85vw;
        transform: translateX(-100%);
        transition: transform 0.25s ease-out;
        z-index: 302;
        border-radius: 0;
        background: #fff;
        box-shadow: 2px 0 12px rgba(0,0,0,0.12);
        padding-top: 0;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        padding-right: 10px;
        padding-bottom: 20px;
        padding-left: 14px;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        min-height: 0;
    }
    .deepseek-sidebar .deepseek-new-chat,
    .deepseek-sidebar .deepseek-history-label {
        flex-shrink: 0;
    }
    .deepseek-sidebar .deepseek-history-list {
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;
    }
    .deepseek-sidebar .deepseek-sidebar-bottom {
        margin-top: auto;
        padding-top: 10px;
        padding-bottom: 30px;
    }
    .deepseek-sidebar .deepseek-clear-btn {
        flex-shrink: 0;
        margin-top: 0;
        margin-bottom: 0;
    }
    .deepseek-layout.deepseek-sidebar-open .deepseek-sidebar {
        transform: translateX(0);
    }

    /* ?????????????? */
    #deepseek .section-header {
        margin-bottom: 8px;
    }

    /* ????????????????*/
    .deepseek-main {
        padding: 0;
        border-radius: 0;
        border: none;
        box-shadow: none;
        background: transparent;
        flex: 1;
        min-height: 0;
    }

    /* 历史侧栏收起时：去掉桌面继承的列间距，避免主区顶部多余空隙 */
    .deepseek-layout:not(.deepseek-sidebar-open) .deepseek-main {
        gap: 0;
        padding-top: 0;
    }

    .deepseek-messages {
        padding: 12px 10px;
        min-height: 0;
        flex: 1 1 0;
        border: none;
        border-radius: 0;
        background: transparent;
    }

    .deepseek-bubble {
        padding: 12px 14px;
    }

    /* ???????????? */
    #deepseek .deepseek-input-wrap {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
        flex-direction: column;
        gap: 10px;
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        background: #fff;
        border-radius: 22px;
        overflow: hidden;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
        z-index: 100;
    }
    #deepseek .deepseek-input-wrap .deepseek-input {
        flex-direction: row;
        align-items: flex-end;
        gap: 10px;
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
    /* ???????????????????????????????????? */
    #deepseek .deepseek-messages {
        padding-top: 0px;
        /* 预留固定输入框高度 + 50px 间距，避免最后一条消息被底部输入框遮挡 */
        padding-bottom: max(166px, calc(166px + env(safe-area-inset-bottom)));
    }
    .deepseek-layout.deepseek-sidebar-open .deepseek-messages {
        padding-bottom: 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    #deepseek .deepseek-input textarea {
        flex: 1;
        min-height: 44px;
        max-height: 120px;
        font-size: 16px;
        padding: 12px 14px;
        border-radius: 22px;
        border: none;
        background: transparent;
        outline: none;
        box-shadow: none;
    }
    #deepseek .deepseek-input textarea:focus {
        outline: none;
        box-shadow: none;
    }
    .deepseek-usage-icon {
        width: 32px;
        height: 32px;
    }

    .deepseek-usage-modal {
        padding: 8px 4px;
    }
    #deepseek .deepseek-input .btn {
        width: 40px;
        height: 40px;
        padding: 0;
        min-width: 0;
        border-radius: 999px;
    }

    .btn.deepseek-new-chat {
        padding: 6px 0;
        margin: 0 35px;
        border-radius: 999px;
    }

    .deepseek-new-chat {
        min-height: 26px;
        border-radius: 999px;
    }

    .deepseek-history-item {
        border-radius: 8px;
        padding: 8px 10px;
    }

    .modal-content {
        width: min(560px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
        margin: auto;
        border-radius: 16px;
        min-height: 0;
        max-height: min(94vh, calc(100dvh - 24px));
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 20px max(15px, env(safe-area-inset-right)) 0px max(15px, env(safe-area-inset-left));
    }

    .modal-content:has(.modal-message-compact) {
        width: min(420px, calc(100vw - 32px));
        max-width: calc(100vw - 24px);
        min-height: 0;
    }

    /* ?????????? / iPad ?????????? */
    .modal-content:has(.character-detail-modal) {
        width: min(500px, calc(100vw - 32px));
        max-width: min(500px, calc(100vw - 48px));
    }

    /* ????????????+ ??????? */
    .modal-content:has(.mastery-test-modal) {
        width: min(420px, calc(100vw - 48px));
        max-width: min(420px, calc(100vw - 48px));
        height: auto;
        min-height: 0;
        max-height: 90vh;
        align-items: center;
    }

    .close {
        left: auto;
        right: 15px;
        top: 15px;
        font-size: 26px;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }


.form-group input,
.form-group select,
.form-group textarea {
        padding: 14px 16px;
        font-size: 16px;
        min-height: 48px;
    }

    .form-actions {
        flex-wrap: wrap;
    }

    .form-actions .btn {
        flex: 1;
        min-width: 100px;
    }

    .login-container {
        padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
        align-items: center;
        justify-content: center;
        min-height: 100dvh;
        min-height: 100vh;
        box-sizing: border-box;
    }

    /* 移动端登入框：卡面比例、间距与输入区高度 */
    .login-box {
        width: 100%;
        max-width: min(400px, calc(100vw - 32px));
        padding: 20px 18px 22px;
        border-radius: 16px;
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    }

    .login-logo-wrap {
        min-height: 0;
        margin-bottom: 12px;
    }

    .login-logo {
        max-width: 148px;
    }

    .login-logo-fallback {
        font-size: 66px;
    }

    .login-brand-tagline {
        margin-top: 8px;
        font-size: 1.05rem;
        letter-spacing: 0.1em;
    }

    .login-tabs {
        margin-bottom: 16px;
        gap: 8px;
    }

    .login-tab-btn {
        min-height: 42px;
        padding: 10px 12px;
        font-size: 15px;
    }

    .login-box h1 {
        font-size: 1.6em;
    }

    /* 全局 .form-group 上下各 20px 在登入页叠得过高，仅登入盒内收紧 */
    .login-box .form-group {
        margin-top: 0;
        margin-bottom: 12px;
    }

    .login-box .login-input-wrap,
    .login-box .login-captcha-row {
        min-height: 50px;
        border-radius: 9999px;
    }

    .login-box .login-input-wrap input,
    .login-box .login-captcha-row input {
        font-size: 16px;
        padding: 12px 14px 12px 6px;
    }

    .login-box .login-input-icon {
        padding-left: 12px;
    }

    .login-box .login-captcha-left {
        min-width: 88px;
        padding: 0 8px;
    }

    .login-box .login-captcha-question {
        font-size: 14px;
    }

    .login-box .btn {
        border-radius: 999px;
        padding: 0 16px;
        min-height: 50px;
        height: auto;
        box-sizing: border-box;
    }

    .login-box .btn-block + .btn-guest-login {
        margin-top: 8px;
    }

    .login-box .login-switch-hint {
        margin-top: 12px;
        font-size: 13px;
    }

    /* ??/????????*/
    #userSearchInput {
        width: 100%;
        min-width: 0;
        padding: 12px 14px;
        font-size: 16px;
    }

    .user-layout-switch .btn-layout {
        padding: 10px 14px;
        min-height: 44px;
    }

    .student-list-table th,
    .student-list-table td,
    .user-list-table th,
    .user-list-table td {
        padding: 10px 8px;
        font-size: 13px;
    }

    #students .card-grid,
    #students .student-list-wrap {
        margin-left: -8px;
        margin-right: -8px;
        width: calc(100% + 16px);
        max-width: none;
    }

    .student-list-wrap,
    .user-list-wrap {
        margin-left: -8px;
        margin-right: -8px;
        padding-left: 8px;
        padding-right: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .search-bar-with-layout .search-bar-input {
        min-width: 100%;
    }

    .message-modal-box {
        min-width: 280px;
        max-width: calc(100vw - 16px);
        margin: 16px 8px;
    }

    /* ????????*/
    .rice-grid-wrap {
        margin-top: 20px;
    }
    .rice-grid {
        width: 160px;
        height: 160px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .sixian-ge {
        width: 200px;
        height: 48px;
        padding: 0 6px;
        gap: 6px;
        --sixian-pinyin-mid-y: 22.5px;
    }
    .sixian-ge-line-2 { top: 15px; border-bottom-style: dashed; }
    .sixian-ge-line-3 { top: 30px; border-bottom-style: dashed; }
    .sixian-ge-line-4 { top: 46px; }
    .sixian-ge-pinyin {
        font-size: 28px;
        line-height: 1.2;
        padding: 0;
    }
    .sixian-ge .btn-pronounce {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        padding: 0;
        flex-shrink: 0;
        box-sizing: border-box;
        overflow: visible;
    }
    .sixian-ge .btn-pronounce svg {
        width: 14px;
        height: 14px;
        min-width: 14px;
        min-height: 14px;
        flex-shrink: 0;
        object-fit: contain;
        display: block;
    }

    .hanzi-writer-in-grid {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .hanzi-writer-in-grid > div {
        margin: 0 auto;
    }

    .rice-grid-char-static {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 96px;
        line-height: 1;
        margin: 0;
        padding: 0;
        transform: none;
        box-sizing: border-box;
    }

    /* ?????? - ???????????????????????/??????*/
    .character-detail-modal {
        min-height: 0;
        padding: 22px 0 0;
        justify-content: flex-start;
        overflow: visible;
        width: 100%;
        box-sizing: border-box;
    }

    .character-detail-body {
        flex-direction: column;
        align-items: center;
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 0;
        gap: 20px;
        margin-bottom: 0px;
        padding-top: 30px;
        flex-shrink: 0;
    }

    .character-detail-body .rice-grid-wrap {
        margin-left: 0;
        margin-top: 0;
        flex-shrink: 0;
    }

    .character-detail-body .rice-grid {
        width: 160px;
        height: 160px;
        flex-shrink: 0;
    }

    .character-detail-body .rice-grid-char-static {
        font-size: 96px;
    }

    .character-detail-body .sixian-ge-wrap,
    .character-detail-body .sixian-ge {
        width: 100%;
        max-width: 200px;
        flex-shrink: 0;
    }

    .character-detail-body .sixian-ge-pinyin {
        font-size: 30px;
        line-height: 1.2;
    }

    .character-detail-right {
        width: 100%;
        max-width: 100%;
        gap: 12px;
        flex-shrink: 0;
    }

    .character-detail-info {
        max-width: 100%;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px 16px;
    }
    .character-detail-info p {
        margin: 0;
        font-size: 14px;
    }
    .character-detail-info .character-detail-radical-row {
        margin-top: 0px;
        margin-bottom: 0px;
        height: 22px;
    }

    /* 汉字与详情竖向排布时：详情区与四线格同宽，右缘与四线格右缘对齐（含笔画数、字义、难度等） */
    .character-detail-modal .character-detail-right {
        align-items: center;
    }
    .character-detail-modal .character-detail-info {
        margin-left: auto;
        margin-right: auto;
        min-width: 0;
        width: 100%;
        max-width: 200px;
        text-align: left;
        margin-top: 0px;
        padding-left: 0px;
        padding-right: 0px;
        box-sizing: border-box;
    }

    .character-detail-actions {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
        margin-top: 8px;
    }
    .character-detail-actions .btn {
        min-height: 44px;
        padding: 10px 16px;
    }

    /* ?????? */
    .pending-invites-banner {
        padding: 12px 16px;
        font-size: 13px;
    }

    .pending-invites-banner .invite-item {
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 8px;
    }
}

/* Web 端汉字详情弹窗：内容垂直居中（不影响手机端） */
@media (min-width: 769px) and (max-width: 1400px) {
    .character-detail-modal {
        min-height: min(20vh, calc((80vh - 80px) / 3));
        padding-top: 0;
        padding-bottom: 15px;
        justify-content: center;
    }
}

/* 字详情弹窗（功课练习点字）：移动端高度随内容，避免 min-height 撑满一屏 */
@media (max-width: 768px) {
    .modal-content:has(.character-detail-modal) {
        min-height: 0;
        justify-content: flex-start;
    }
    #modalBody:has(.character-detail-modal) {
        flex: 0 0 auto;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .character-detail-modal {
        flex: 0 0 auto;
        width: 100%;
        max-width: 560px;
        margin-left: auto;
        margin-right: auto;
        padding-bottom: 15px;
    }
}

/* ?????? 360px ?? */
@media (max-width: 480px) {
    .header-title,
    header h1 {
        font-size: 1.35em;
    }

    .navbar .nav-item.tab-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .section-header h2 {
        font-size: 1.25em;
    }

    /* ??????????????? */
    .character-filters-main {
        gap: 6px;
    }
    .character-filters .search-box-with-btn .btn-search-inline {
        height: 40px;
        min-height: 40px;
        padding: 0 12px;
    }

    .character-library-grid {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
        gap: 8px;
    }

    .character-tile-char {
        font-size: 1.6em;
    }

    /* ?????? - ????????*/
    .character-detail-body .rice-grid {
        width: 140px;
        height: 140px;
    }
    .character-detail-body .rice-grid-char-static {
        font-size: 84px;
    }
    .character-detail-body .sixian-ge-pinyin {
        font-size: 26px;
        line-height: 1.2;
    }
    .character-detail-info p {
        font-size: 13px;
    }
}

/* PWA：底部「安装应用」提示（本机 / 主屏幕） */
.pwa-add-home-tip {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-sizing: border-box;
}
.pwa-add-home-tip-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    max-width: min(480px, 100%);
}
.pwa-add-home-tip-head {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    text-align: center;
}
.pwa-add-home-tip-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}
.pwa-add-home-tip-countdown {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.92;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.15);
    line-height: 1.2;
}
.pwa-add-home-tip-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    opacity: 0.98;
    text-align: left;
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.14);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.pwa-add-home-tip-btns {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}
.pwa-install-btn,
.pwa-add-home-tip-close {
    flex: 1 1 auto;
    min-height: 40px;
    min-width: min(140px, 42%);
    max-width: 220px;
    padding: 0 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pwa-install-btn {
    background: #fff;
    color: #667eea;
    border: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}
.pwa-add-home-tip-close {
    border: 1px solid rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.22);
    color: #fff;
}
@media (max-width: 360px) {
    .pwa-add-home-tip {
        padding-top: 12px;
        padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
    }
    .pwa-add-home-tip-inner {
        gap: 10px;
    }
    .pwa-add-home-tip-desc {
        font-size: 12px;
        padding: 8px 10px;
        line-height: 1.5;
    }
    .pwa-install-btn,
    .pwa-add-home-tip-close {
        flex: 1 1 100%;
        max-width: none;
        min-width: 0;
    }
}
