/* ============================================================
   words.dreamanual.com — 单词学习应用
   基于 Dreamanual --dt-* token 体系（Arco 风格 + Tailwind v4 色板）
   ============================================================ */

/* ===== Token 层（与 dreamanual.com/tools 完全一致） ===== */
:root {
    --dt-bg: #f8fafc;
    --dt-raised: #FFFFFF;
    --dt-overlay: #FFFFFF;
    --dt-inset: #f1f5f9;
    --dt-fill2: #f1f5f9;
    --dt-brand: oklch(0.488 0.243 264.376);
    --dt-brand-lt: oklch(0.546 0.245 262.881);
    --dt-brand-bg: oklch(0.424 0.199 265.638);
    --dt-brand-sec: oklch(0.623 0.214 259.815);
    --dt-brand-acc: oklch(0.809 0.105 251.813);
    --dt-brand-surf: oklch(0.932 0.032 255.585);
    --dt-interact: oklch(0.623 0.214 259.815);
    --dt-interact-lt: oklch(0.707 0.165 254.624);
    --dt-interact-bg: oklch(0.546 0.245 262.881);
    --dt-interact-sec: oklch(0.809 0.105 251.813);
    --dt-interact-acc: oklch(0.932 0.032 255.585);
    --dt-interact-surf: oklch(0.970 0.014 254.604);
    --dt-text1: #0f172a;
    --dt-text2: #475569;
    --dt-text3: #64748b;
    --dt-text4: #94a3b8;
    --dt-text5: #cbd5e1;
    --dt-text-inv: #FFFFFF;
    --dt-border: #e2e8f0;
    --dt-border-str: #cbd5e1;
    --dt-card-border: #e2e8f0;
    --dt-error: #ef4444;
    --dt-warning: #f97316;
    --dt-success: #16a34a;
    --dt-info: #0284c7;
    --dt-error-bg: #fee2e2;
    --dt-warning-bg: #ffedd5;
    --dt-success-bg: #dcfce7;
    --dt-info-bg: #e0f2fe;
    --dt-focus: oklch(0.546 0.245 262.881);
    --dt-focus-light: oklch(0.623 0.214 259.815 / 0.10);
    --dt-interact-a04: oklch(0.623 0.214 259.815 / 0.04);
    --dt-interact-a06: oklch(0.623 0.214 259.815 / 0.06);
    --dt-interact-a12: oklch(0.623 0.214 259.815 / 0.12);
    --dt-interact-a20: oklch(0.623 0.214 259.815 / 0.20);

    --font-base: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, monospace;
    --font-en: 'Inter', -apple-system, sans-serif;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-base);
    background: var(--dt-bg);
    color: var(--dt-text1);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== 顶部导航 ===== */
.navbar {
    position: fixed; top: 0; left: 0; width: 100%; height: 60px;
    background: var(--dt-raised);
    border-bottom: 1px solid var(--dt-border);
    display: flex; align-items: center; padding: 0 24px;
    z-index: 1000; gap: 0;
}
.navbar-brand {
    display: flex; align-items: center; gap: 12px;
    margin-right: auto; flex-shrink: 0;
}
.navbar-brand .logo-icon {
    width: 28px; height: 28px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--dt-brand); border-radius: var(--radius-md);
    color: #fff;
}
.navbar-brand .logo-icon svg { width: 18px; height: 18px; }
.navbar-brand .brand-text {
    display: flex; align-items: baseline; gap: 8px;
}
.navbar-brand .brand-name {
    font-size: 16px; font-weight: 600; color: var(--dt-text1);
    font-family: var(--font-en);
}
.navbar-brand .brand-sub {
    font-size: 14px; font-weight: 400; color: var(--dt-text2);
}
.navbar-actions {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.navbar-link {
    font-size: 14px; color: var(--dt-text2); text-decoration: none;
    padding: 0 16px; height: 60px; display: flex; align-items: center;
    transition: color 0.2s; white-space: nowrap;
}
.navbar-link:hover { color: var(--dt-interact); }

/* ===== 主内容区 ===== */
.main {
    margin-top: 60px;
    padding: 32px 40px 60px;
    max-width: 1080px;
    margin-left: auto; margin-right: auto;
    display: flex; flex-direction: column; gap: 28px;
}

/* ===== 词库选择栏 ===== */
.deck-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.deck-bar-label {
    font-size: 14px; font-weight: 500; color: var(--dt-text2);
    white-space: nowrap;
}
.deck-select {
    height: 36px; padding: 0 36px 0 12px;
    border: 1px solid var(--dt-border); border-radius: var(--radius-md);
    background: var(--dt-raised); color: var(--dt-text1);
    font-size: 14px; font-family: inherit; cursor: pointer;
    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='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    transition: border-color 0.2s;
    min-width: 200px;
}
.deck-select:hover { border-color: var(--dt-border-str); }
.deck-select:focus { border-color: var(--dt-interact); outline: none; box-shadow: 0 0 0 2px var(--dt-focus-light); }

/* ===== 今日进度卡 ===== */
.today-card {
    background: var(--dt-raised);
    border: 1px solid var(--dt-card-border);
    border-left: 4px solid var(--dt-interact);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; flex-wrap: wrap;
}
.today-card.done { border-left-color: var(--dt-success); }
.today-info { display: flex; flex-direction: column; gap: 2px; }
.today-title { font-size: 16px; font-weight: 600; }
.today-sub { font-size: 13px; color: var(--dt-text3); }
.today-progress {
    display: flex; align-items: center; gap: 16px;
    min-width: 200px; flex: 1; max-width: 360px;
}
.progress-bar {
    flex: 1; height: 8px; background: var(--dt-inset);
    border-radius: 999px; overflow: hidden;
}
.progress-fill {
    height: 100%; width: 0%; border-radius: 999px;
    background: var(--dt-interact); transition: width 0.4s;
}
.progress-fill.done { background: var(--dt-success); }
.progress-text {
    font-size: 15px; font-weight: 700; color: var(--dt-interact);
    min-width: 42px; text-align: right; font-family: var(--font-mono);
}
.progress-text.done { color: var(--dt-success); }

/* ===== 区块标题 ===== */
.section { display: flex; flex-direction: column; gap: 14px; }
.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    flex-wrap: wrap; gap: 4px;
}
.section-head h2 {
    font-size: 17px; font-weight: 600; color: var(--dt-text1);
    display: flex; align-items: center; gap: 8px;
}
.section-head h2 svg { width: 18px; height: 18px; stroke: var(--dt-interact); }
.section-head .hint { font-size: 12px; color: var(--dt-text4); }

/* ===== 单词卡 ===== */
.word-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.word-card {
    background: var(--dt-raised);
    border: 1px solid var(--dt-card-border);
    border-radius: var(--radius-lg);
    padding: 20px; transition: box-shadow 0.15s, border-color 0.15s;
}
.word-card:hover { box-shadow: var(--shadow-md); border-color: var(--dt-border-str); }
.word-card.mastered {
    background: var(--dt-success-bg);
    border-color: #bbf7d0;
}
.word-card.review {
    background: var(--dt-warning-bg);
    border-color: #fed7aa;
}
.word-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.word-text {
    font-size: 22px; font-weight: 700; color: var(--dt-text1);
    letter-spacing: 0.2px;
}
.word-phonetic {
    font-size: 14px; color: var(--dt-text3);
    font-family: var(--font-mono);
}
.word-pos {
    font-size: 11px; font-weight: 600; color: var(--dt-interact);
    background: var(--dt-interact-surf);
    padding: 2px 8px; border-radius: 999px;
}
.word-meaning {
    font-size: 15px; font-weight: 500; color: var(--dt-text1);
    margin-top: 10px;
}
.word-example {
    font-size: 13px; color: var(--dt-text2);
    background: var(--dt-inset); border-radius: var(--radius-md);
    padding: 8px 12px; margin-top: 10px; font-style: italic;
}
.word-example-translation {
    font-size: 12px; color: var(--dt-text4); margin-top: 4px;
    font-style: normal;
}
.card-actions { display: flex; gap: 10px; margin-top: 16px; }
.card-status-tag {
    font-size: 13px; font-weight: 600; color: var(--dt-success);
    display: flex; align-items: center; gap: 6px; margin-top: 14px;
}
.word-card.review .card-status-tag { color: var(--dt-warning); }
.card-actions.hidden { display: none; }

/* ===== 按钮 ===== */
.btn {
    height: 38px; padding: 0 16px; border-radius: var(--radius-md);
    border: none; cursor: pointer; font-size: 14px; font-weight: 500;
    font-family: inherit; transition: all 0.15s; white-space: nowrap;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary {
    background: var(--dt-interact); color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--dt-interact-bg); }
.btn-secondary {
    background: var(--dt-fill2); color: var(--dt-text2);
}
.btn-secondary:hover:not(:disabled) { background: var(--dt-border); }
.btn-warning {
    background: var(--dt-warning-bg); color: var(--dt-warning);
}
.btn-warning:hover:not(:disabled) { filter: brightness(0.97); }
.btn-success {
    background: var(--dt-success); color: #fff;
}
.btn-success:hover:not(:disabled) { filter: brightness(1.06); }
.btn-text {
    background: transparent; color: var(--dt-text3);
    padding: 0 12px; height: 32px; font-size: 13px;
}
.btn-text:hover { color: var(--dt-interact); background: var(--dt-interact-surf); }
.btn-ghost {
    background: transparent; border: 1px solid var(--dt-border);
    color: var(--dt-text2);
}
.btn-ghost:hover { border-color: var(--dt-interact); color: var(--dt-interact); }
.btn-danger-ghost {
    background: transparent; border: 1px solid #fca5a5; color: var(--dt-error);
}
.btn-danger-ghost:hover { background: var(--dt-error-bg); }
.btn-full { flex: 1; }

/* ===== 再来一批 ===== */
.more-wrap { display: flex; justify-content: center; }
.btn-more {
    height: 42px; padding: 0 24px; border-radius: var(--radius-lg);
    border: 1.5px dashed var(--dt-interact); background: var(--dt-interact-surf);
    color: var(--dt-interact); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background 0.15s; font-family: inherit;
}
.btn-more:hover { background: var(--dt-interact-a12); }

/* ===== 复习列表 ===== */
.review-list { display: flex; flex-direction: column; gap: 10px; }
.review-item {
    background: var(--dt-raised);
    border: 1px solid var(--dt-card-border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.review-word {
    font-size: 16px; font-weight: 700; color: var(--dt-text1);
    min-width: 120px;
}
.review-phonetic {
    font-size: 12px; color: var(--dt-text4); font-weight: 400;
    display: block;
}
.review-meaning { font-size: 14px; color: var(--dt-text2); flex: 1; min-width: 120px; }
.review-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tag-round {
    font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
    background: var(--dt-inset); color: var(--dt-text3);
}
.tag-due {
    font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
    background: var(--dt-warning-bg); color: var(--dt-warning);
}
.tag-due.overdue { background: var(--dt-error-bg); color: var(--dt-error); }
.review-actions { display: flex; gap: 8px; }
.review-actions .btn { height: 34px; padding: 0 14px; font-size: 13px; }

/* ===== 空提示 ===== */
.empty-tip {
    text-align: center; color: var(--dt-text4); font-size: 14px;
    padding: 32px 0; background: var(--dt-raised);
    border: 1px solid var(--dt-card-border); border-radius: var(--radius-lg);
}

/* ===== 统计区 ===== */
.stats-wrap { display: flex; gap: 14px; flex-wrap: wrap; }
.stats-grid {
    flex: 1; min-width: 280px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.stat-card {
    background: var(--dt-raised); border: 1px solid var(--dt-card-border);
    border-radius: var(--radius-lg); padding: 16px 18px;
}
.stat-num { font-size: 26px; font-weight: 700; line-height: 1.2; font-family: var(--font-mono); }
.stat-label { font-size: 12px; color: var(--dt-text4); margin-top: 2px; }
.stat-card.brand .stat-num { color: var(--dt-brand); }
.stat-card.success .stat-num { color: var(--dt-success); }
.stat-card.warning .stat-num { color: var(--dt-warning); }
.stat-card.neutral .stat-num { color: var(--dt-text2); }

.ring-card {
    background: var(--dt-raised); border: 1px solid var(--dt-card-border);
    border-radius: var(--radius-lg); padding: 18px;
    min-width: 280px; display: flex; align-items: center; gap: 18px;
}
.ring-wrap { position: relative; width: 100px; height: 100px; flex: none; }
.ring-wrap svg { width: 100px; height: 100px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--dt-inset); stroke-width: 9; }
.ring-fg {
    fill: none; stroke: var(--dt-success); stroke-width: 9; stroke-linecap: round;
    stroke-dasharray: 282.74; stroke-dashoffset: 282.74;
    transition: stroke-dashoffset 0.6s;
}
.ring-text {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; color: var(--dt-text1); font-family: var(--font-mono);
}
.ring-info { flex: 1; }
.ring-info .ri-title { font-size: 14px; font-weight: 600; }
.ring-info .ri-sub { font-size: 12px; color: var(--dt-text4); margin-top: 4px; line-height: 1.5; }
.stat-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Toast ===== */
.toast {
    position: fixed; left: 50%; bottom: 32px;
    transform: translateX(-50%) translateY(20px);
    background: var(--dt-text1); color: #fff;
    font-size: 14px; padding: 12px 22px; border-radius: var(--radius-md);
    opacity: 0; pointer-events: none; transition: all 0.25s;
    z-index: 999; max-width: 90vw; text-align: center;
    box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--dt-error); }
.toast.ok { background: var(--dt-success); }

/* ===== Modal ===== */
.modal-mask {
    position: fixed; inset: 0; background: rgba(15,23,42,0.45);
    z-index: 2000; display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
    background: var(--dt-raised); border-radius: var(--radius-lg);
    padding: 24px; max-width: 400px; width: 100%;
    box-shadow: var(--shadow-lg);
}
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.modal p { font-size: 14px; color: var(--dt-text2); margin-bottom: 18px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ===== 登录页 ===== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--dt-bg); padding: 20px;
}
.login-card {
    background: var(--dt-raised); border: 1px solid var(--dt-card-border);
    border-radius: var(--radius-lg); padding: 40px 36px;
    width: 100%; max-width: 380px; box-shadow: var(--shadow-md);
}
.login-logo {
    width: 48px; height: 48px; border-radius: var(--radius-lg);
    background: var(--dt-brand); display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}
.login-logo svg { width: 24px; height: 24px; color: #fff; }
.login-title { font-size: 20px; font-weight: 600; text-align: center; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--dt-text4); text-align: center; margin-bottom: 28px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--dt-text2); }
.form-input {
    height: 40px; padding: 0 12px;
    border: 1px solid var(--dt-border); border-radius: var(--radius-md);
    font-size: 14px; font-family: inherit; background: var(--dt-raised);
    color: var(--dt-text1); transition: border-color 0.2s; outline: none;
}
.form-input:focus { border-color: var(--dt-interact); box-shadow: 0 0 0 2px var(--dt-focus-light); }
.form-input::placeholder { color: var(--dt-text5); }
.checkbox-label {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: 13px; color: var(--dt-text2);
}
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--dt-interact); cursor: pointer; }
.login-error {
    font-size: 13px; color: var(--dt-error); text-align: center;
    min-height: 18px;
}
.login-btn { width: 100%; height: 42px; font-size: 15px; }

/* ===== 加载态 ===== */
.loading-mask {
    position: fixed; inset: 0; background: rgba(248,250,252,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 1500; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.loading-mask.show { opacity: 1; pointer-events: auto; }
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--dt-border);
    border-top-color: var(--dt-interact);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== v2.0 导航栏 Tab ===== */
.navbar {
    gap: 0;
}
.navbar-tabs {
    display: flex; align-items: center; gap: 2px;
    margin: 0 auto;
}
.nav-tab {
    display: flex; align-items: center; gap: 6px;
    height: 60px; padding: 0 16px;
    border: none; background: transparent; cursor: pointer;
    font-size: 14px; font-weight: 500; font-family: inherit;
    color: var(--dt-text3); transition: color 0.15s;
    position: relative;
}
.nav-tab svg { width: 18px; height: 18px; stroke: currentColor; flex-shrink: 0; }
.nav-tab:hover { color: var(--dt-text1); }
.nav-tab.active { color: var(--dt-interact); }
.nav-tab.active::after {
    content: ''; position: absolute; bottom: 0; left: 12px; right: 12px;
    height: 2px; background: var(--dt-interact); border-radius: 2px 2px 0 0;
}
.nav-user {
    font-size: 13px; font-weight: 500; color: var(--dt-text2);
    padding: 0 8px; white-space: nowrap;
}

/* ===== Tab 内容容器 ===== */
.tab-content { display: none; }
.tab-content.active { display: flex; flex-direction: column; gap: 28px; }

/* ===== 设置页 ===== */
.settings-card {
    background: var(--dt-raised);
    border: 1px solid var(--dt-card-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.settings-row {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--dt-border);
    flex-wrap: wrap;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info { flex: 1; min-width: 180px; }
.settings-row-title {
    font-size: 14px; font-weight: 600; color: var(--dt-text1);
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.settings-row-desc {
    font-size: 12px; color: var(--dt-text4); margin-top: 2px;
}
.settings-row-actions { display: flex; gap: 8px; flex-shrink: 0; }
.settings-row.danger { background: var(--dt-error-bg); }
.settings-row.danger .settings-row-title { color: var(--dt-error); }

/* ===== 小号按钮 ===== */
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* ===== 用户徽章 ===== */
.user-badge {
    font-size: 11px; font-weight: 600; padding: 2px 8px;
    border-radius: 999px; white-space: nowrap;
}
.user-badge.admin {
    background: var(--dt-interact-surf); color: var(--dt-interact);
}
.user-badge.self {
    background: var(--dt-success-bg); color: var(--dt-success);
}

/* ===== 弹窗内表单 ===== */
.modal-form { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }

/* ===== 统计页占位 ===== */
.stats-placeholder { margin-top: 0; }
.stats-placeholder .empty-tip { border-style: dashed; }

/* ===== 移动端 ===== */
@media (max-width: 768px) {
    .navbar { padding: 0 12px; }
    .navbar-brand .brand-sub { display: none; }
    .nav-tab span { display: none; }
    .nav-tab { padding: 0 12px; }
    .nav-user { display: none; }
    .navbar-actions { gap: 4px; }
    .main { padding: 20px 16px 48px; gap: 24px; }
    .word-grid { grid-template-columns: 1fr; }
    .today-progress { max-width: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .ring-card { flex-direction: column; text-align: center; width: 100%; }
    .review-item { flex-direction: column; align-items: stretch; }
    .review-word { min-width: 0; }
    .review-actions { width: 100%; }
    .review-actions .btn { flex: 1; }
    .deck-select { width: 100%; }
    .deck-bar { flex-direction: column; align-items: stretch; }
    .settings-row { flex-direction: column; align-items: stretch; }
    .settings-row-actions { width: 100%; }
    .settings-row-actions .btn { flex: 1; }
}
