/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 柔和渐变配色方案 */
    --primary-color: #6366f1;
    --primary-hover: #5558e3;
    --primary-light: #e0e3ff;

    --secondary-color: #10b981;
    --secondary-hover: #059669;
    --secondary-light: #d1fae5;

    --danger-color: #f43f5e;
    --danger-hover: #e11d48;

    --warning-color: #f59e0b;
    --warning-hover: #d97706;

    /* 背景颜色 */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;

    /* 文字颜色 */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* 边框颜色 */
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

    /* 间距 */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* 字体 */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== 导航栏 ==================== */
.navbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.brand-icon {
    font-size: 1.75rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

/* ==================== 容器 ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
}

/* ==================== 主内容区域 ==================== */
.main {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1.4fr;
    gap: var(--spacing-xl);
    align-items: start;
}

/* ==================== 列通用样式 ==================== */
.column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xs);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.task-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 10px;
    border-radius: var(--radius-full);
}

/* ==================== 番茄钟核心区域 ==================== */
.timer-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    box-shadow: var(--shadow-md);
    text-align: center;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.timer-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #8b5cf6, var(--secondary-color));
}

.timer-ring {
    position: relative;
    width: 260px;
    height: 260px;
    margin: 0 auto var(--spacing-xl);
}

.ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 10;
}

.ring-progress {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

.timer-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.time {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Inter', monospace;
    letter-spacing: -3px;
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--primary-light), #ddd6fe);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: var(--spacing-md);
    box-shadow: var(--shadow-sm);
}

/* 控制按钮 */
.timer-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: var(--spacing-md) var(--spacing-sm);
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-family);
}

.btn:hover {
    transform: translateY(-3px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.25rem;
}

.btn-text {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-tertiary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

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

.btn-quaternary {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.btn-quaternary:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
}

/* 模式切换 */
.mode-switcher {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-full);
}

.mode-btn {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all 0.25s ease;
}

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

.mode-btn-active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

/* ==================== 任务管理区域 ==================== */
.task-input-wrapper {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    background: var(--bg-card);
    padding: var(--spacing-sm);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.task-input {
    flex: 1;
    padding: var(--spacing-md);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: var(--font-family);
    background: transparent;
    transition: all 0.2s ease;
}

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

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

.task-estimate-input {
    width: 70px;
    padding: var(--spacing-md);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-family: var(--font-family);
    text-align: center;
    background: var(--bg-tertiary);
    transition: all 0.2s ease;
}

.task-estimate-input:focus {
    outline: none;
    background: var(--border-color);
}

.btn-add {
    width: 44px;
    height: 44px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    color: white;
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-add:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* 任务列表 */
.task-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.task-item:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.task-item.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), var(--shadow-md);
}

.task-item.completed {
    opacity: 0.55;
}

.task-item.completed .task-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* 当前任务标记 */
.task-item.active::before {
    content: '▶';
    position: absolute;
    top: 50%;
    left: -8px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
    box-shadow: var(--shadow-md);
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.task-checkbox:hover {
    border-color: var(--primary-color);
}

.task-checkbox.checked {
    background: linear-gradient(135deg, var(--secondary-color), #059669);
    border-color: var(--secondary-color);
}

.task-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.task-name {
    font-size: 0.9375rem;
    color: var(--text-primary);
    word-break: break-word;
}

.task-pomodoros {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.task-pomodoros .pomodoro-icon {
    font-size: 12px;
}

.task-pomodoros .pomodoro-count {
    font-weight: 600;
}

.task-pomodoros .pomodoro-divider {
    opacity: 0.4;
}

.task-pomodoros .pomodoro-completed {
    color: var(--secondary-color);
}

.task-pomodoros .pomodoro-estimated {
    color: var(--text-muted);
}

.task-delete {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.125rem;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    opacity: 0;
}

.task-item:hover .task-delete {
    opacity: 1;
}

.task-delete:hover {
    background: var(--danger-color);
    color: white;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-muted);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-color);
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.6;
}

.empty-state p {
    font-size: 0.9375rem;
}

/* ==================== 数据统计区域 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg) var(--spacing-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all 0.25s ease;
}

.stat-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon-time {
    background: linear-gradient(135deg, var(--primary-light), #ddd6fe);
}

.stat-icon-pomodoro {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
}

.stat-icon-task {
    background: linear-gradient(135deg, var(--secondary-light), #a7f3d0);
}

.stat-info {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* 图表卡片 */
.charts-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.chart-header {
    margin-bottom: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-container {
    height: 180px;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1200px) {
    .main {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-lg);
    }

    .stats-column {
        grid-column: span 2;
    }

    .charts-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-md);
    }

    .chart-card:last-child {
        grid-column: span 2;
    }
}

@media (max-width: 992px) {
    .main {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .stats-column {
        grid-column: span 1;
    }

    .timer-card {
        padding: var(--spacing-xl);
    }

    .timer-ring {
        width: 220px;
        height: 220px;
    }

    .time {
        font-size: 3.5rem;
    }

    .timer-controls {
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }

    .chart-card:last-child {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    /* 平板竖屏优化 */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-sm);
    }

    .stat-card {
        padding: var(--spacing-md);
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

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

    .chart-large {
        height: 180px;
    }

    .chart-medium {
        height: 150px;
    }

    .chart-small {
        height: 130px;
    }

    .mode-switcher {
        padding: 6px;
    }

    .mode-btn {
        padding: var(--spacing-sm);
        font-size: 0.75rem;
    }
}

@media (max-width: 600px) {
    /* 手机端优化 */
    .nav-container {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .container {
        padding: var(--spacing-md) var(--spacing-sm);
        gap: var(--spacing-md);
    }

    .brand-title {
        font-size: 1rem;
    }

    .brand-icon {
        font-size: 1.5rem;
    }

    .nav-date {
        display: none;
    }

    .nav-btn {
        width: 36px;
        height: 36px;
    }

    /* 计时器区域 */
    .timer-card {
        padding: var(--spacing-lg);
        border-radius: var(--radius-lg);
    }

    .timer-ring {
        width: 200px;
        height: 200px;
        margin-bottom: var(--spacing-lg);
    }

    .time {
        font-size: 2.5rem;
        letter-spacing: -2px;
    }

    .mode-badge {
        font-size: 0.6875rem;
        padding: 4px 12px;
    }

    /* 控制按钮 - 增大触控区域 */
    .timer-controls {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--spacing-xs);
        margin-bottom: var(--spacing-md);
    }

    .btn {
        padding: var(--spacing-md) var(--spacing-xs);
        min-height: 56px;
    }

    .btn-icon {
        font-size: 1.125rem;
    }

    .btn-text {
        font-size: 0.625rem;
        letter-spacing: 0.3px;
    }

    /* 任务管理区域 */
    .task-input-wrapper {
        flex-wrap: nowrap;
        padding: var(--spacing-xs);
        gap: var(--spacing-xs);
    }

    .task-input {
        padding: var(--spacing-sm);
        font-size: 0.875rem;
    }

    .task-estimate-input {
        width: 56px;
        padding: var(--spacing-sm);
        font-size: 0.8125rem;
    }

    .btn-add {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .task-list {
        max-height: 280px;
    }

    .task-item {
        padding: var(--spacing-sm);
    }

    .task-content {
        gap: 0;
    }

    .task-name {
        font-size: 0.875rem;
    }

    .task-pomodoros {
        font-size: 0.6875rem;
    }

    .task-delete {
        width: 24px;
        height: 24px;
        font-size: 1rem;
        opacity: 1;
    }

    /* 统计卡片 - 紧凑横排 */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-xs);
    }

    .stat-card {
        padding: var(--spacing-sm);
        border-radius: var(--radius-md);
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        border-radius: var(--radius-sm);
    }

    .stat-value {
        font-size: 1.125rem;
        font-weight: 700;
    }

    .stat-label {
        font-size: 0.625rem;
        white-space: nowrap;
    }

    /* 图表区域 */
    .charts-container {
        gap: var(--spacing-sm);
    }

    .chart-card {
        padding: var(--spacing-md);
        border-radius: var(--radius-md);
    }

    .chart-header h3 {
        font-size: 0.8125rem;
    }

    .chart-large {
        height: 140px;
    }

    .chart-medium {
        height: 120px;
    }

    .chart-small {
        height: 100px;
    }

    .chart-tabs {
        padding: 3px;
    }

    .chart-tab {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    /* 设置面板 */
    .settings-content {
        margin: var(--spacing-sm);
        padding: var(--spacing-lg);
        border-radius: var(--radius-lg);
        max-height: calc(100vh - var(--spacing-xl));
    }

    .settings-header h2 {
        font-size: 1.125rem;
    }

    .settings-section {
        padding: var(--spacing-md);
        border-radius: var(--radius-md);
    }

    .settings-section-title {
        font-size: 0.8125rem;
    }

    .settings-item {
        padding: var(--spacing-xs) 0;
    }

    .settings-label {
        font-size: 0.8125rem;
    }

    .settings-actions {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .btn-settings {
        padding: var(--spacing-md);
    }

    /* 空状态 */
    .empty-state {
        padding: var(--spacing-xl);
    }

    .empty-icon {
        font-size: 2.5rem;
    }

    /* 导出下拉菜单 */
    .export-dropdown {
        min-width: 180px;
        right: -8px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 380px) {
    .timer-ring {
        width: 180px;
        height: 180px;
    }

    .time {
        font-size: 2.25rem;
    }

    .timer-controls {
        gap: 4px;
    }

    .btn {
        padding: var(--spacing-sm) 4px;
        min-height: 52px;
    }

    .btn-icon {
        font-size: 1rem;
    }

    .stats-grid {
        gap: 4px;
    }

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

    .section-title {
        font-size: 0.875rem;
    }
}

/* 安全区域适配 - iPhone X 及以上 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .navbar {
        padding-top: env(safe-area-inset-top);
    }

    .container {
        padding-bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom));
    }

    .nav-right {
        padding-right: env(safe-area-inset-right);
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }

    .btn:active {
        transform: scale(0.97);
    }

    .stat-card:hover {
        transform: none;
    }

    .task-item:hover {
        transform: none;
    }

    .task-delete {
        opacity: 1;
    }

    /* 增大所有可点击元素的触控区域 */
    .nav-btn,
    .btn,
    .mode-btn,
    .chart-tab,
    .task-checkbox,
    .task-delete,
    .btn-add,
    .settings-close {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ==================== 滚动条样式 ==================== */
.task-list::-webkit-scrollbar {
    width: 6px;
}

.task-list::-webkit-scrollbar-track {
    background: transparent;
}

.task-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}

.task-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==================== 动画 ==================== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.85;
        transform: scale(0.98);
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ==================== 图表容器样式 ==================== */
.chart-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.chart-tab {
    flex: 1;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.chart-tab:hover {
    color: var(--text-primary);
}

.chart-tab-active {
    background: var(--bg-card);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.chart-large {
    height: 200px;
}

.chart-medium {
    height: 160px;
}

.chart-small {
    height: 140px;
}

/* ==================== 导航栏右侧按钮 ==================== */
.nav-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    position: relative;
}

.nav-btn {
    width: 40px;
    height: 38px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 1.125rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    color: var(--text-primary);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

/* ==================== 设置面板 ==================== */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.settings-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-xl);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
}

.settings-header h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
}

.settings-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.settings-close:hover {
    background: var(--danger-color);
    color: white;
}

.settings-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.settings-section {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    background: var(--bg-tertiary);
}

.settings-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) 0;
}

.settings-item:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.settings-label {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.settings-control {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

input[type="range"] {
    width: 120px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.settings-value {
    min-width: 60px;
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
}

.settings-unit {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

input[type="number"] {
    width: 70px;
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: var(--font-family);
    text-align: center;
    background: var(--bg-card);
    color: var(--text-primary);
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 开关切换 */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    position: absolute;
    z-index: 2;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    border-radius: var(--radius-full);
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* 设置按钮 */
.settings-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.btn-settings {
    flex: 1;
    padding: var(--spacing-md);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-settings-primary {
    background: linear-gradient(135deg, var(--primary-color), #7c3aed);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-settings-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.btn-settings-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

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

/* ==================== 深色模式 ==================== */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --border-hover: #475569;
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --primary-light: #312e81;
    --secondary-color: #34d399;
    --secondary-hover: #10b981;
    --secondary-light: #064e3b;
    --danger-color: #f87171;
    --danger-hover: #ef4444;
    --warning-color: #fbbf24;
    --warning-hover: #f59e0b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .navbar {
    background: rgba(30, 41, 59, 0.8);
}

[data-theme="dark"] .timer-card::before {
    background: linear-gradient(90deg, var(--primary-color), #a78bfa, var(--secondary-color));
}

[data-theme="dark"] .mode-badge {
    background: linear-gradient(135deg, var(--primary-light), #3730a3);
    color: var(--primary-color);
}

[data-theme="dark"] .btn-primary {
    box-shadow: 0 4px 12px rgba(129, 140, 248, 0.3);
}

[data-theme="dark"] .btn-add {
    box-shadow: 0 4px 12px rgba(129, 140, 248, 0.3);
}

[data-theme="dark"] .task-item.active {
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.1), rgba(167, 139, 250, 0.1));
}

/* ==================== 导出下拉菜单 ==================== */
.export-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 1000;
    display: none;
    animation: fadeIn 0.2s ease-out;
    overflow: hidden;
}

.export-dropdown.active {
    display: block;
}

.export-dropdown-header {
    padding: var(--spacing-md);
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9375rem;
}

.export-date-filter {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.export-date-filter label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.export-date-filter select {
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
}

.export-date-custom {
    padding: 0 var(--spacing-md) var(--spacing-md);
    display: none;
    gap: var(--spacing-sm);
    align-items: center;
}

.export-date-custom.active {
    display: flex;
}

.export-date-custom input {
    flex: 1;
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.export-date-custom span {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.export-option {
    display: block;
    width: 100%;
    padding: var(--spacing-md);
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.export-option:hover {
    background: var(--bg-tertiary);
}

.export-option:first-of-type {
    border-top: 1px solid var(--border-color);
}

/* ==================== 动画优化 ==================== */
.stat-value {
    transition: all 0.3s ease;
}

/* 模式切换淡入淡出 */
.mode-fade {
    animation: modeFade 0.3s ease-out;
}

@keyframes modeFade {
    0% { opacity: 0.6; transform: scale(0.96); }
    100% { opacity: 1; transform: scale(1); }
}

/* 任务项动画 */
.task-item {
    animation: fadeIn 0.3s ease-out;
}

.task-item.adding {
    animation: slideIn 0.3s ease-out;
}

.task-item.removing {
    animation: slideOut 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* 设置面板动画 */
.settings-item {
    transition: all 0.3s ease;
}

/* 图表更新动画 */
canvas {
    transition: all 0.3s ease;
}

/* SVG 渐变定义 */
.ring-svg {
    position: absolute;
    width: 0;
    height: 0;
}
