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

:root {
    /* Color / glass / shadow tokens live in tokens.css (theme-aware).
       Keep only structural fallbacks here so dark mode is not overwritten. */
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 10px;
    --radius-pill: 980px;
    --header-h: 56px;
    --transition: 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", "PingFang SC", "微软雅黑", sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* 作者样式里的 display 会盖过浏览器默认的 [hidden]{display:none}。
   这一条压过所有不带 !important 的 display。
   仍写了 display:!important、特异度不低于本条的选择器，要在原文件补 [hidden]。
   英语舱情景托盘的 scrim 故意在 [hidden] 下靠 opacity 显隐，特异度更高，保持原样。 */
[hidden] {
    display: none !important;
}

/* Ambient wash — something for glass blur to sample (no neon) */
.app-ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background: var(--bg);
}

.app-ambient::before,
.app-ambient::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 1;
    will-change: transform;
}

.app-ambient::before {
    width: min(72vw, 720px);
    height: min(72vw, 720px);
    top: -18%;
    left: -12%;
    background: radial-gradient(circle at 40% 40%, var(--ambient-a), transparent 68%);
}

.app-ambient::after {
    width: min(64vw, 640px);
    height: min(64vw, 640px);
    right: -14%;
    bottom: -10%;
    background: radial-gradient(circle at 55% 45%, var(--ambient-b), transparent 70%);
}

.app-ambient__spot {
    position: absolute;
    width: min(48vw, 480px);
    height: min(48vw, 480px);
    top: 38%;
    left: 42%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, var(--ambient-c), transparent 72%);
    filter: blur(72px);
    opacity: 0.95;
}

@media (prefers-reduced-motion: reduce) {
    .app-ambient::before,
    .app-ambient::after,
    .app-ambient__spot {
        filter: blur(48px);
    }
}

/* ========== 布局 ========== */
.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: transparent;
}

/* ========== 顶部导航 ========== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: var(--header-h);
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: var(--text);
    flex-shrink: 0;
    border-bottom: var(--hairline);
    box-shadow: var(--shadow);
    z-index: 100;
}

.header-brand { flex-shrink: 0; }

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

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    border: 1px solid var(--border);
}

.logo-text-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.logo-text {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.5px;
}

.logo-sub {
    font-size: 11px;
    opacity: 0.75;
    font-weight: 400;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    min-width: 0;
}

.header-nav-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-trailing {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    flex-shrink: 0;
}

.intro-btn[hidden],
#authLoginBtn[hidden] {
    display: none !important;
}

.user-menu[hidden] {
    display: none !important;
}

.intro-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.12);
    color: white;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
    backdrop-filter: blur(8px);
}

.intro-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.5);
}

/* display:flex 会盖掉 UA [hidden]，登录后「登录」按钮会继续露出来 */
#authLoginBtn[hidden],
.app-header .intro-btn[hidden] {
    display: none !important;
}

#userMenu[hidden],
.app-header .user-menu[hidden] {
    display: none !important;
}

body.auth-logged-in #authLoginBtn {
    display: none !important;
}

.intro-btn-compact {
    padding: 6px 10px;
    font-size: 12px;
}

/* 学员菜单：单胶囊 + 下拉（结构由 apple-cupertino 精修） */
.user-menu {
    position: relative;
    flex-shrink: 0;
}

.user-menu-trigger {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 10px 0 6px;
    border: none;
    border-radius: var(--radius-pill, 980px);
    background: transparent;
    color: inherit;
    font-family: inherit;
    cursor: pointer;
}

.user-menu-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.user-menu-label {
    font-size: 12px;
    font-weight: 600;
    max-width: 108px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-chevron {
    display: inline-flex;
    opacity: 0.55;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 200;
    min-width: 168px;
    padding: 6px;
    border-radius: 14px;
}

.user-menu-item {
    appearance: none;
    display: flex;
    width: 100%;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 1600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.auth-modal[hidden] {
    display: none !important;
}

.auth-dialog {
    position: relative;
    width: min(420px, 100%);
    background: var(--glass);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 28px 28px 24px;
    animation: authDialogIn 0.28s cubic-bezier(0.2, 0.8, 0.3, 1.1);
}

.auth-dialog-wide {
    width: min(640px, 100%);
}

.auth-role-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent);
    line-height: 1.4;
}

.auth-role-badge[hidden] {
    display: none !important;
}

.auth-desk-body {
    max-height: min(60vh, 480px);
    overflow: auto;
}

.auth-desk-hero {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    border: 1px solid var(--border);
}

.auth-desk-hero p {
    margin: 0 0 4px;
    font-size: 13px;
    color: var(--text);
}

.auth-desk-h {
    margin: 16px 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.auth-desk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-desk-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-muted);
}

.auth-desk-loading {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-desk-empty {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.auth-desk-score-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.auth-desk-score-bar label {
    font-size: 12px;
    font-weight: 650;
    color: var(--text-secondary);
}

.auth-desk-score-bar .auth-input {
    flex: 1 1 140px;
    min-width: 120px;
    margin: 0;
}

.auth-desk-scoreboard {
    margin-bottom: 8px;
}

.auth-desk-board-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.auth-desk-board-meta strong {
    color: var(--text);
}

.auth-desk-table-wrap {
    overflow: auto;
    max-height: min(36vh, 320px);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.auth-desk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.auth-desk-table th,
.auth-desk-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-light, var(--border));
    white-space: nowrap;
}

.auth-desk-table th {
    position: sticky;
    top: 0;
    background: color-mix(in srgb, var(--surface) 92%, var(--primary-light));
    font-weight: 700;
    color: var(--text-secondary);
    z-index: 1;
}

.auth-desk-table tbody tr:hover td {
    background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.auth-desk-rank {
    display: inline-flex;
    min-width: 1.6em;
    font-weight: 800;
    color: var(--primary);
}

.auth-desk-rank.is-muted {
    font-weight: 500;
    color: var(--text-muted);
}

.auth-desk-off {
    font-style: normal;
    font-size: 11px;
    color: var(--text-muted);
}

.auth-desk-board-note {
    margin: 8px 0 0;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-muted);
}

.auth-desk-task-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.auth-desk-task-form .auth-input,
.auth-desk-task-form .auth-desk-tarea {
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.auth-desk-task-form #authDeskTaskTitle,
.auth-desk-task-form #authDeskTaskBrief,
.auth-desk-task-form #authDeskTaskPublish {
    grid-column: 1 / -1;
}

.auth-desk-tarea {
    resize: vertical;
    min-height: 56px;
    font: inherit;
}

.auth-desk-task-list {
    margin-bottom: 8px;
}

.auth-desk-task-cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-desk-task-card {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 90%, var(--primary-light));
}

.auth-desk-task-meta {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
}

.auth-desk-task-brief {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.auth-desk-code {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-style: normal;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.auth-desk-task-ops {
    flex-shrink: 0;
}

.auth-desk-task-ops .auth-btn {
    padding: 6px 10px;
    font-size: 12px;
}

[data-role-gate].is-role-hidden,
[data-role-gate][hidden] {
    display: none !important;
}

@keyframes authDialogIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-dialog-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: all var(--transition);
}

.auth-dialog-close:hover {
    color: var(--primary);
    transform: rotate(90deg);
}

.auth-dialog-kicker {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.auth-dialog-title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.auth-dialog-sub {
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.auth-dialog-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-dialog-form label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 4px;
}

.auth-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-warm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.auth-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 75, 140, 0.12);
}

.auth-dialog-err {
    min-height: 1.2em;
    margin: 4px 0 0;
    font-size: 12px;
    color: #b91c1c;
}

.auth-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.auth-btn {
    padding: 9px 16px;
    border-radius: 980px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
}

.auth-btn-primary {
    background: #0071E3;
    color: #fff;
}

.auth-btn-primary:hover {
    background: #0077ED;
}

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

.auth-btn-ghost {
    background: var(--bg-warm);
    border-color: var(--border);
    color: var(--text-secondary);
}

.auth-btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.auth-records-wrap {
    max-height: min(50vh, 360px);
    overflow: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

.auth-records-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.auth-records-table th,
.auth-records-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.auth-records-table th {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    opacity: 1;
    flex-shrink: 1;
    min-width: 0;
    max-width: min(280px, 42vw);
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.03);
    border: var(--hairline);
}

.header-status .status-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-tertiary);
    flex-shrink: 0;
    box-shadow: none;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 22%, transparent);
}

.status-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent);
}

/* ========== 视图（模块）切换 ========== */
.view:not(.active) {
    display: none !important;
}

.view {
    flex: 1;
    min-height: 0;
}

.view.active {
    display: flex !important;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* 子内容按真实高度撑开，避免被 flex 压扁后无法滑动 */
.view.active > * {
    flex-shrink: 0;
}

.view-home {
    background: transparent;
}

.view-home.active {
    display: block;
    overflow-y: auto;
}

/* 模块顶部返回栏 */
.module-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: var(--glass);
    backdrop-filter: blur(25px) saturate(190%);
    -webkit-backdrop-filter: blur(25px) saturate(190%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.module-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
    border-radius: 980px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
}

.module-back:hover {
    border-color: rgba(0, 113, 227, 0.28);
    color: var(--primary);
    background: var(--primary-light);
}

@media (max-width: 1180px) {
    .module-bar {
        padding: 10px 16px;
        gap: 10px;
        flex-wrap: wrap;
    }
    .module-back {
        min-height: 40px;
    }
}

.module-bar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.module-bar-icon { font-size: 18px; line-height: 1; }

/* 即将上线占位页 */
.coming-soon {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 40px;
}

.coming-soon-icon { font-size: 64px; line-height: 1; }

.coming-soon h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.coming-soon p {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 540px;
    line-height: 1.8;
}

.coming-soon .soon-sub {
    font-size: 13px;
    color: var(--text-muted);
}

.coming-soon-btn {
    margin-top: 12px;
    padding: 10px 26px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.coming-soon-btn:hover { background: var(--primary-hover); }

/* ========== 主工作台：文档侧栏 + 编辑器 + AI ========== */
.workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* 左侧文档侧栏 */
.doc-sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border-light);
    min-height: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-header h2 {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.sidebar-header h2 svg { color: var(--primary); }

.sidebar-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-xs);
    background: var(--primary);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.sidebar-new-btn:hover {
    background: var(--primary-hover);
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px;
    padding: 8px 12px;
    background: var(--bg-warm);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.sidebar-search:focus-within {
    border-color: var(--primary);
}

.sidebar-search input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    color: var(--text);
}

/* 编辑器主区 */
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    min-width: 0;
    min-height: 0;
}

/* 页脚入口已并入顶栏，保留兼容样式但隐藏 */
.home-foot {
    display: none !important;
}

.home-foot-inner {
    max-width: 920px;
    margin: 0 auto;
}

.foot-head {
    text-align: center;
    margin-bottom: 22px;
}

.foot-kicker {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.foot-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.foot-nav-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 720px) {
    .foot-nav-grid {
        grid-template-columns: 1fr;
    }
}

.foot-nav-card {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    padding: 16px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        border-color var(--transition);
}

.foot-nav-card::after {
    content: "";
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    margin-left: auto;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    opacity: 0.55;
    transition: opacity var(--transition), border-color var(--transition), transform var(--transition);
}

.foot-nav-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
    box-shadow: var(--shadow-md);
}

.foot-nav-card:hover::after {
    opacity: 1;
    border-color: var(--primary);
    transform: rotate(-45deg) translate(1px, 1px);
}

.foot-nav-card:active {
    transform: translateY(0);
}

.foot-nav-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .foot-nav-card,
    .foot-nav-card::after {
        transition: none;
    }
    .foot-nav-card:hover {
        transform: none;
    }
}

.foot-nav-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
}

.foot-nav-card--teacher .foot-nav-icon {
    background: var(--accent-light);
    color: var(--accent);
}

.foot-nav-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.foot-nav-body strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.foot-nav-body em {
    font-style: normal;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.foot-usecase {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.foot-item {
    display: flex;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--radius);
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--hairline);
    box-shadow: var(--shadow);
}

.foot-item > span { font-size: 22px; }
.foot-item strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
.foot-item p { color: var(--text-secondary); font-size: 12.5px; line-height: 1.6; }

.foot-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin: 0;
}

/* 兼容旧类名（若别处仍引用） */
.foot-admin-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}

.foot-tech { display: none; }

/* ========== 编辑器面板细节 ========== */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-warm);
    gap: 16px;
}

.panel-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.panel-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.doc-title-input {
    flex: 1;
    border: none;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    outline: none;
    background: transparent;
    min-width: 0;
}

.doc-title-input::placeholder { color: var(--text-muted); }

.panel-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.doc-id-badge {
    font-size: 11px;
    color: var(--primary);
    background: var(--primary-light);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.header-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.header-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.header-action-btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.header-action-btn.primary:hover {
    background: var(--primary-hover);
}

/* 工具栏 */
.toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-warm);
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.toolbar-btn {
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition);
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: var(--border-light);
    color: var(--text);
}

.toolbar-btn.accent {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.toolbar-btn.accent:hover {
    background: #d4e5f7;
}

.toolbar-sep {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 4px;
}

.toolbar-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--surface);
    font-size: 13px;
    color: var(--text);
    outline: none;
    cursor: pointer;
    min-width: 160px;
}

.template-group {
    margin-left: auto;
}

/* 编辑器 */
.editor {
    flex: 1;
    padding: 24px 28px;
    border: none;
    outline: none;
    font-size: 15px;
    line-height: 1.9;
    color: var(--text);
    background: var(--surface);
    resize: none;
    font-family: inherit;
}

.editor::placeholder {
    color: var(--text-muted);
    line-height: 1.8;
}

.editor-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-warm);
}

.footer-hint {
    color: var(--text-muted);
    opacity: 0.7;
}

.save-status {
    margin-left: auto;
    color: var(--primary);
    font-weight: 600;
}

/* ========== AI 面板 ========== */
.ai-panel {
    width: 420px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    flex-shrink: 0;
    border-left: 1px solid var(--border-light);
    box-shadow: -4px 0 16px rgba(26, 75, 140, 0.04);
}

.ai-header {
    padding: 16px 18px;
    background: linear-gradient(135deg, var(--primary-light) 0%, #f5f9ff 100%);
    border-bottom: 1px solid var(--border-light);
}

.ai-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #2d6cb5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.ai-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.ai-mode-switch {
    display: flex;
    gap: 0;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border);
}

.mode-btn {
    flex: 1;
    padding: 8px 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border-radius: var(--radius-xs);
    white-space: nowrap;
}

.mode-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px rgba(26, 75, 140, 0.3);
}

.mode-btn:hover:not(.active) {
    background: var(--bg);
    color: var(--text);
}

/* AI 模式内容 */
.ai-mode-content {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.ai-mode-content.active {
    display: flex;
}

/* 对话 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-warm);
}

.message {
    display: flex;
    gap: 10px;
    max-width: 100%;
    animation: fadeIn 0.3s ease;
}

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

.message.user { flex-direction: row-reverse; }

.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
}

.message.ai .msg-avatar {
    background: linear-gradient(135deg, var(--primary), #2d6cb5);
    color: white;
}

.message.user .msg-avatar {
    background: var(--text-secondary);
    color: white;
    font-size: 10px;
}

.msg-content {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.65;
    max-width: 88%;
}

.message.ai .msg-content {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow);
}

.message.user .msg-content {
    background: linear-gradient(135deg, #dbeafe, #e8f1fb);
    border-bottom-right-radius: 4px;
}

.msg-content p { margin-bottom: 8px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content ul { margin: 6px 0; padding-left: 18px; }
.msg-content li { margin-bottom: 4px; font-size: 13px; }

.chat-input-area {
    padding: 14px 16px;
    border-top: 1px solid var(--border-light);
    background: var(--surface);
}

.quick-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.quick-btn {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-warm);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-weight: 500;
}

.quick-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    background: var(--bg-warm);
    transition: border-color var(--transition);
}

.chat-input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(26, 75, 140, 0.1);
}

.send-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), #2d6cb5);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(26, 75, 140, 0.35);
}

/* 润色 / 翻译 */
.mode-body {
    padding: 20px 18px;
    flex: 1;
}

.mode-body.scrollable {
    overflow-y: auto;
}

.mode-description {
    margin-bottom: 18px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 12px 14px;
    background: var(--bg-warm);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.style-selector, .direction-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.style-option, .dir-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--surface);
}

.style-option:hover, .dir-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.style-option:has(input:checked),
.dir-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary);
}

.style-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.style-label, .dir-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.style-desc, .dir-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.dir-option {
    flex-direction: column;
    gap: 4px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--primary), #2d6cb5);
    color: white;
    border-color: transparent;
    width: 100%;
    padding: 13px;
    font-weight: 600;
}

.action-btn.primary:hover {
    box-shadow: 0 4px 14px rgba(26, 75, 140, 0.35);
    transform: translateY(-1px);
}

.action-btn:hover:not(.primary) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* 结果区 */
.mode-result {
    border-top: 1px solid var(--border-light);
    padding: 16px 18px;
    background: var(--bg-warm);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.text-btn {
    padding: 5px 14px;
    border: 1px solid var(--primary);
    border-radius: var(--radius-xs);
    background: var(--surface);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.text-btn:hover {
    background: var(--primary);
    color: white;
}

.result-content {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
    white-space: pre-wrap;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    max-height: 280px;
    overflow-y: auto;
}

/* ========== 文档面板 ========== */
/* ========== 文档侧栏列表 ========== */
.docs-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 8px 12px;
    min-height: 0;
}

.docs-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.docs-empty p {
    margin-top: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.docs-empty .sub {
    font-size: 12px;
    color: var(--text-muted);
}

.doc-card {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.doc-card:hover {
    background: var(--bg-warm);
}

.doc-card.active {
    background: var(--primary-light);
    border-color: var(--primary);
}

.doc-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-light), #dbeafe);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.doc-card.active .doc-card-icon {
    background: var(--primary);
    color: white;
}

.doc-card-info {
    flex: 1;
    min-width: 0;
}

.doc-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-card-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.doc-card-del {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--transition);
}

.doc-card:hover .doc-card-del {
    opacity: 1;
}

.doc-card-del:hover {
    color: #dc2626;
    background: #fef2f2;
}

/* ========== 加载 & Toast ========== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner { text-align: center; }

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 14px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-spinner p {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.toast.ice {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid rgba(26, 75, 140, 0.28);
    box-shadow: 0 4px 20px rgba(26, 75, 140, 0.12);
}

.toast.warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fcd34d;
    box-shadow: 0 4px 20px rgba(180, 83, 9, 0.12);
}

.toast.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== 响应式 ========== */
@media (max-width: 1200px) {
    .doc-sidebar { width: 220px; }
    .ai-panel { width: 360px; }
}

@media (max-width: 900px) {
    .doc-sidebar { display: none; }
    .header-status { display: none; }
    .logo-sub { display: none; }
}

@media (max-width: 600px) {
    .app-header { padding: 0 12px; }
    .intro-btn span { display: none; }
}

/* 安卓：地址栏不占安全区，100vh 会把底栏算进去，按钮被浏览器挡住。 */
@media (max-width: 720px) {
    .app-header {
        padding: 0 8px;
        gap: 6px;
    }
    .header-actions,
    .header-trailing,
    .header-nav-primary {
        gap: 4px;
    }
    .logo-text {
        font-size: 15px;
    }
    .module-bar {
        padding: 8px 10px;
    }
    .module-bar-title {
        flex: 1;
        min-width: 0;
        font-size: 14px;
        line-height: 1.35;
    }
    .view.active {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    input,
    textarea,
    select {
        font-size: 16px;
    }
    .toast {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        width: calc(100% - 32px);
        max-width: 420px;
        padding: 12px 14px;
        text-align: center;
    }
    /* 负字距在安卓 WebView 里会把汉字叠成乱码 */
    h1, h2, h3, h4,
    .module-bar-title,
    .hero-title-main,
    .hero-title-sub {
        letter-spacing: 0;
    }
    .app-header,
    .module-bar {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    button,
    .tap-to-speak-btn,
    [data-dlg-speak],
    #fiSttBtn {
        touch-action: manipulation;
    }
}

/* ========== v1 前缀：返回新版课堂 ========== */
.v2-return-banner {
    display: none;
    flex-shrink: 0;
    background: linear-gradient(90deg, var(--primary, #1a4b8c), #1e5bb8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    z-index: 101;
}

html.softip-on-v1 .v2-return-banner {
    display: block;
}

.v2-return-banner__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.92);
}

.v2-return-banner__link {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.v2-return-banner__link:hover {
    text-decoration-thickness: 2px;
}

.v2-return-banner__hint {
    opacity: 0.88;
}

/* ========== 离线提示条 ========== */
.offline-banner {
    background: linear-gradient(90deg, #fef3c7, #fde68a);
    border-bottom: 2px solid #f59e0b;
    padding: 12px 24px;
    flex-shrink: 0;
    z-index: 99;
}

.offline-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 14px;
    color: #92400e;
}

.offline-banner-inner strong {
    white-space: nowrap;
}

.offline-banner-inner code {
    background: rgba(0,0,0,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.offline-urls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.offline-link {
    color: #0071E3;
    font-weight: 600;
    text-decoration: none;
    padding: 4px 10px;
    background: var(--surface-2);
    border-radius: 980px;
    border: 1px solid rgba(0, 113, 227, 0.28);
    font-size: 13px;
}

.offline-link:hover {
    background: rgba(0, 113, 227, 0.08);
}

.offline-link.highlight {
    background: #0071E3;
    color: white;
    border-color: #0071E3;
}

.offline-retry-btn {
    margin-left: auto;
    padding: 6px 16px;
    border: 1px solid rgba(255, 149, 0, 0.45);
    border-radius: 980px;
    background: rgba(255, 149, 0, 0.08);
    color: #B06000;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.offline-retry-btn:hover {
    background: rgba(255, 149, 0, 0.14);
}

.speak-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary) !important;
    font-weight: 600;
}

.rate-select {
    min-width: 72px !important;
    padding: 6px 6px !important;
    font-size: 12px !important;
}

.speak-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid var(--primary);
    border-radius: 16px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.speak-btn:hover {
    background: var(--primary);
    color: white;
}

.speak-btn.speaking {
    background: var(--primary);
    color: white;
    animation: pulse-speak 1.2s ease infinite;
}

.speak-btn.small {
    padding: 4px 10px;
    font-size: 11px;
    margin-top: 8px;
}

@keyframes pulse-speak {
    0%, 100% { box-shadow: 0 0 0 0 rgba(26, 75, 140, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(26, 75, 140, 0); }
}

.mic-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-warm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
}

.mic-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.mic-btn.listening {
    background: #fef2f2;
    border-color: #f87171;
    color: #dc2626;
    animation: pulse-mic 1s ease infinite;
}

@keyframes pulse-mic {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.result-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.msg-content .msg-speak-btn {
    margin-top: 6px;
}

/* 口语练习 */
.oral-body { padding-bottom: 24px; }

.oral-target-box {
    background: var(--bg-warm);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 20px;
}

.oral-target-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.icon-text-btn {
    border: none;
    background: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.icon-text-btn:hover {
    background: var(--primary-light);
}

.oral-target-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    background: var(--surface);
    margin-bottom: 10px;
}

.oral-target-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 75, 140, 0.1);
}

.oral-speak-ref {
    width: 100%;
    justify-content: center;
    border-radius: var(--radius-xs);
}

.oral-record-area {
    text-align: center;
    padding: 16px 0 12px;
}

.oral-mic-btn {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    background: linear-gradient(135deg, var(--primary-light), white);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0 auto 10px;
    transition: all var(--transition);
}

.oral-mic-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(26, 75, 140, 0.2);
}

.oral-mic-btn.recording {
    border-color: #dc2626;
    background: linear-gradient(135deg, #fef2f2, white);
    color: #dc2626;
    animation: pulse-mic 1s ease infinite;
}

.oral-mic-label {
    font-size: 10px;
    font-weight: 700;
}

.oral-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.oral-transcript-box {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 16px;
}

.oral-transcript-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.oral-transcript {
    margin-top: 6px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    font-style: italic;
}

.oral-actions {
    display: flex;
    gap: 10px;
}

.oral-actions .action-btn {
    flex: 1;
}

.oral-actions .action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ========== 口语质量报告 ========== */
.oral-quality-box {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.quality-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.quality-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.quality-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 64px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    line-height: 1.1;
}

.quality-score .score-num {
    font-size: 26px;
    font-weight: 800;
}

.quality-score .score-label {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
}

.quality-score.excellent { background: rgba(52, 199, 89, 0.12); color: #248A3D; }
.quality-score.good { background: rgba(0, 113, 227, 0.1); color: #0071E3; }
.quality-score.fair { background: rgba(255, 149, 0, 0.12); color: #B06000; }
.quality-score.poor { background: rgba(255, 59, 48, 0.1); color: #FF3B30; }

.quality-metrics {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 14px;
}

.metric-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.metric-label {
    width: 76px;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-weight: 600;
}

.metric-note {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 10px;
}

.metric-bar-wrap {
    flex: 1;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}

.metric-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.metric-bar.excellent { background: #34C759; }
.metric-bar.good { background: #0071E3; }
.metric-bar.fair { background: #FF9500; }
.metric-bar.poor { background: #FF3B30; }

.metric-value {
    width: 52px;
    text-align: right;
    flex-shrink: 0;
    font-weight: 700;
    color: var(--text);
}

.metric-value small {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 10px;
}

.wpm-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 2px;
}

.wpm-tag.good { background: #e6f7ed; color: #0f7a3d; }
.wpm-tag.mid { background: #fff4e0; color: #b8730a; }
.wpm-tag.low { background: #fdecec; color: #c0392b; }
.wpm-tag.na { background: var(--border-light); color: var(--text-muted); }

.quality-diff {
    border-top: 1px dashed var(--border);
    padding-top: 12px;
}

.quality-diff-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.quality-diff-label small {
    font-weight: 400;
    color: var(--text-muted);
}

.quality-words {
    line-height: 2;
    font-size: 14px;
}

.qw {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    margin: 1px;
}

.qw-ok { background: #e6f7ed; color: #0f7a3d; }
.qw-miss { background: #fdecec; color: #c0392b; text-decoration: line-through; }
.qw-extra { background: #fff4e0; color: #b8730a; font-style: italic; }

.quality-extra {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.quality-tip {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--bg-warm);
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
}


/* SoftIP home pulse */
.home-pulse-bar {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 88%, var(--primary-light));
    box-shadow: var(--shadow);
}
/* 单行长条：标题、任务、操作同排 */
.home-pulse-inner {
    display: flex;
    flex-wrap: nowrap;
    gap: 14px;
    align-items: center;
}
.home-pulse-title {
    flex: 0 0 auto;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
}
.home-pulse-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}
.home-pulse-chips:empty {
    display: none;
}
.home-pulse-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.home-pulse-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.home-pulse-chip:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}
.home-pulse-chip em {
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--primary);
}
.home-pulse-chip.is-done {
    opacity: 0.72;
}
.home-pulse-empty {
    font-size: 12px;
    color: var(--text-muted);
}
.home-pulse-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    margin-left: auto;
    flex: 0 0 auto;
}
.home-pulse-join {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}
.home-pulse-input {
    width: 88px;
    padding: 7px 8px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    font: inherit;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.home-pulse-btn {
    padding: 7px 12px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}
.home-pulse-btn:hover {
    transform: translateY(-1px);
}
.home-pulse-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.home-pulse-btn.ghost {
    background: transparent;
}

/* 手机：脉搏条禁止单行硬挤，标题/操作分排 */
@media (max-width: 720px) {
    .home-pulse-bar {
        padding: 12px;
        overflow: hidden;
    }
    .home-pulse-inner {
        flex-wrap: wrap;
        gap: 10px;
        align-items: stretch;
    }
    .home-pulse-title {
        width: 100%;
        font-size: 13px;
    }
    .home-pulse-chips {
        width: 100%;
        flex-wrap: wrap;
        overflow: visible;
    }
    .home-pulse-actions {
        width: 100%;
        margin-left: 0;
        flex-wrap: wrap;
        gap: 8px;
    }
    .home-pulse-btn {
        flex: 1 1 auto;
        min-height: 40px;
        white-space: nowrap;
    }
    .home-pulse-join {
        flex: 1 1 100%;
        min-width: 0;
        display: flex;
    }
    .home-pulse-input {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        min-height: 40px;
    }
    .home-pulse-join .home-pulse-btn {
        flex: 0 0 auto;
    }
}
.auth-desk-join-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.auth-desk-prog,
.auth-desk-mine {
    display: inline-block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}
.auth-desk-mine.is-done {
    color: #248A3D;
    font-weight: 700;
}
.auth-desk-mine.is-started {
    color: var(--primary);
}
.ca-row-click {
    cursor: pointer;
}
.ca-row-click:hover,
.ca-row-click:focus-visible {
    background: color-mix(in srgb, var(--primary-light) 70%, transparent);
    outline: none;
}
