/* ===== Variables & Themes ===== */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-glass: rgba(255,255,255,0.7);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --accent: #3b82f6;
    --accent-2: #6366f1;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: 0.3s ease;
}

[data-theme="dark"] {
    --bg-primary: #0a0f1e;
    --bg-secondary: #111827;
    --bg-tertiary: #1e293b;
    --bg-card: #151d2e;
    --bg-glass: rgba(21,29,46,0.8);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #1e293b;
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}
[data-theme="dark"] body {
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(99,102,241,0.06), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(59,130,246,0.05), transparent);
}

.hidden { display: none !important; }
.container { max-width: 800px; margin: 0 auto; padding: 0 24px; }

/* ===== Header ===== */
.header {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container { max-width: 800px; }
.header-content { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.header-left { display: flex; align-items: center; gap: 16px; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    transition: all var(--transition);
}
.back-link:hover { color: var(--accent); background: rgba(59,130,246,0.1); }

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { width: 28px; height: 28px; color: var(--accent); }
.logo h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions { display: flex; align-items: center; gap: 12px; }
.handle-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
}

.theme-toggle {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
    color: var(--text-secondary);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="light"] .moon-icon, [data-theme="dark"] .sun-icon { display: none; }

/* ===== Main ===== */
.main { padding: 32px 0 64px; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    animation: fadeIn 0.5s ease;
}
.empty-icon { color: var(--text-muted); margin-bottom: 24px; opacity: 0.5; }
.empty-state h2 { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; margin-bottom: 12px; }
.empty-state p { color: var(--text-tertiary); margin-bottom: 32px; }

/* ===== Session Progress ===== */
.session-progress { margin-bottom: 24px; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-tertiary); margin-bottom: 8px; font-weight: 500; }
.progress-pct { font-family: 'JetBrains Mono', monospace; color: var(--accent); }
.progress-track { height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent-gradient); border-radius: 3px; transition: width 0.5s ease; width: 0; }

/* ===== Problem Card ===== */
.problem-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.4s ease;
}
.problem-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--accent-gradient);
    transition: background 0.4s ease;
}
.problem-card.phase-solve::before { background: linear-gradient(90deg, #10b981, #34d399); }
.problem-card.phase-tutorial::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.problem-card.phase-final::before { background: linear-gradient(90deg, #ef4444, #f87171); }

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

.problem-phase-badge {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 20px;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.problem-phase-badge.phase-solve { background: rgba(16,185,129,0.15); color: #10b981; }
.problem-phase-badge.phase-tutorial { background: rgba(245,158,11,0.15); color: #f59e0b; }
.problem-phase-badge.phase-final { background: rgba(239,68,68,0.15); color: #ef4444; }

.problem-rating {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 4px 12px;
    border-radius: 8px;
    background: var(--bg-tertiary);
}
.problem-rating.rating-gray { color: #808080; }
.problem-rating.rating-green { color: #10b981; }
.problem-rating.rating-cyan { color: #06b6d4; }
.problem-rating.rating-blue { color: #3b82f6; }
.problem-rating.rating-violet { color: #8b5cf6; }
.problem-rating.rating-orange { color: #f59e0b; }
.problem-rating.rating-red { color: #ef4444; }

.problem-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

.problem-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(59,130,246,0.3);
    transition: all var(--transition);
    margin-bottom: 16px;
}
.problem-link:hover { background: rgba(59,130,246,0.1); border-color: var(--accent); }

.problem-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    font-weight: 500;
}

/* ===== Timer ===== */
.timer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 32px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
    animation: slideUp 0.5s ease 0.1s both;
    position: relative;
    overflow: hidden;
    transition: border-color 0.6s ease;
}
.timer-section.phase-solve { border-color: rgba(16,185,129,0.3); }
.timer-section.phase-tutorial { border-color: rgba(245,158,11,0.3); }
.timer-section.phase-final { border-color: rgba(239,68,68,0.3); }

.timer-ring-container {
    position: relative;
    width: 260px;
    height: 260px;
    margin-bottom: 28px;
}

.timer-glow {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(16,185,129,0.12) 0%, transparent 70%);
    transition: background 0.6s ease;
    pointer-events: none;
}
.timer-section.running .timer-glow { animation: glowPulse 2.5s ease-in-out infinite; }
.timer-section.phase-tutorial .timer-glow { background: radial-gradient(circle, rgba(245,158,11,0.12) 0%, transparent 70%); }
.timer-section.phase-final .timer-glow { background: radial-gradient(circle, rgba(239,68,68,0.15) 0%, transparent 70%); }

@keyframes glowPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}

.timer-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring-track { stroke: var(--text-muted); }
.timer-ring-bg { stroke: var(--bg-tertiary); transition: stroke 0.4s ease; }
.timer-ring-progress {
    stroke: var(--success);
    transition: stroke 0.6s ease, stroke-dashoffset 0.3s linear;
}

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

.timer-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 3px;
    background: linear-gradient(180deg, var(--text-primary) 40%, var(--text-tertiary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.timer-phase {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    margin-top: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Phase indicator dots */
.timer-phase-dots {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 28px;
}
.phase-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.4;
    transition: all 0.4s ease;
}
.phase-dot.active { opacity: 1; }
.phase-dot.completed { opacity: 0.7; }
.dot-pip {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    transition: all 0.4s ease;
}
.phase-dot.active .dot-pip {
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 0 8px rgba(16,185,129,0.5);
}
.phase-dot.completed .dot-pip {
    background: var(--text-muted);
    border-color: var(--text-muted);
}
.phase-dot[data-phase="1"].active .dot-pip {
    background: var(--warning);
    border-color: var(--warning);
    box-shadow: 0 0 8px rgba(245,158,11,0.5);
}
.phase-dot[data-phase="2"].active .dot-pip {
    background: var(--danger);
    border-color: var(--danger);
    box-shadow: 0 0 8px rgba(239,68,68,0.5);
}
.dot-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
.phase-dot.active .dot-label { color: var(--text-primary); }
.phase-connector {
    width: 40px;
    height: 2px;
    background: var(--border-color);
    margin: 0 4px;
    margin-bottom: 20px;
    transition: background 0.4s ease;
}

.timer-controls { display: flex; gap: 12px; margin-bottom: 16px; }

.btn-timer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}

.btn-start {
    background: var(--accent-gradient);
    color: white;
}
.btn-start:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(59,130,246,0.4); }

.btn-refresh {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-refresh:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Submission Status ===== */
.submission-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease;
}
.submission-status.checking { background: rgba(59,130,246,0.1); color: var(--accent); }
.submission-status.accepted { background: rgba(16,185,129,0.15); color: #10b981; }
.submission-status.not-solved { background: rgba(239,68,68,0.15); color: #ef4444; }
.submission-status.error { background: rgba(245,158,11,0.15); color: #f59e0b; }

.status-icon { font-size: 1.2rem; }

/* ===== Post Timer ===== */
.post-timer {
    text-align: center;
    padding: 40px 32px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
    animation: slideUp 0.4s ease;
}
.post-timer h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 8px;
}
.post-timer p { color: var(--text-tertiary); margin-bottom: 24px; }
.post-timer-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.btn-completed, .btn-upsolve {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}

.btn-completed {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}
.btn-completed:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(16,185,129,0.4); }

.btn-upsolve {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}
.btn-upsolve:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(245,158,11,0.4); }

/* ===== Queue ===== */
.queue-section {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.5s ease 0.2s both;
}

.queue-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.queue-list { display: flex; flex-direction: column; gap: 8px; }

.queue-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    transition: all var(--transition);
}
.queue-item:hover { transform: translateX(4px); }

.queue-num {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}

.queue-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-rating {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 6px;
    background: var(--bg-card);
}

.queue-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 16px;
}

/* ===== Completed / Session Progress ===== */
.completed-section {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-top: 16px;
    animation: slideUp 0.5s ease 0.3s both;
}
.completed-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--success);
}
.completed-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(16,185,129,0.15);
    color: var(--success);
}
.completed-list { display: flex; flex-direction: column; gap: 8px; }
.completed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--success);
    transition: all var(--transition);
    animation: slideUp 0.3s ease;
}
.completed-item.result-upsolve { border-left-color: var(--warning); }
.completed-item.result-skipped { border-left-color: var(--text-muted); opacity: 0.7; }
.completed-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 700; flex-shrink: 0;
    background: rgba(16,185,129,0.15); color: var(--success);
}
.completed-item.result-upsolve .completed-icon { background: rgba(245,158,11,0.15); color: var(--warning); }
.completed-item.result-skipped .completed-icon { background: var(--bg-card); color: var(--text-muted); }
.completed-info { flex: 1; min-width: 0; }
.completed-name {
    font-size: 0.9rem; font-weight: 500;
    color: var(--text-secondary); text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.completed-name:hover { color: var(--accent); }
.completed-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.completed-result-badge {
    font-size: 0.7rem; font-weight: 600;
    padding: 2px 8px; border-radius: 4px;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.completed-result-badge.result-solved { background: rgba(16,185,129,0.15); color: var(--success); }
.completed-result-badge.result-upsolve { background: rgba(245,158,11,0.15); color: var(--warning); }
.completed-result-badge.result-skipped { background: var(--bg-card); color: var(--text-muted); }
.completed-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem; color: var(--text-tertiary);
}
.completed-rating {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem; font-weight: 600;
    padding: 2px 10px; border-radius: 6px;
    background: var(--bg-card); flex-shrink: 0;
}

/* ===== Upsolve Early Button ===== */
.btn-upsolve-early {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 20px; font-size: 0.82rem; font-weight: 500;
    color: var(--text-secondary); background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md); cursor: pointer;
    font-family: inherit; transition: all var(--transition);
}
.btn-upsolve-early:hover {
    color: var(--warning);
    border-color: rgba(245,158,11,0.4);
    background: rgba(245,158,11,0.08);
}

/* ===== Session Complete ===== */
.session-complete {
    text-align: center;
    padding: 60px 24px;
    animation: fadeIn 0.5s ease;
}
.complete-icon { color: var(--success); margin-bottom: 20px; }
.session-complete h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 12px;
}
.session-complete p { color: var(--text-tertiary); margin-bottom: 32px; }
.session-complete-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.session-complete-actions .btn-lg { min-width: 160px; }

.session-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 32px;
}
.session-stats .stat-item { text-align: center; }
.session-stats .stat-val {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}
.session-stats .stat-item.completed .stat-val { color: var(--success); }
.session-stats .stat-item.upsolve .stat-val { color: var(--warning); }
.session-stats .stat-lbl { font-size: 0.85rem; color: var(--text-tertiary); font-weight: 500; }

/* ===== Modal ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}
.modal-content {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius-xl);
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--accent);
    animation: slideUp 0.3s ease;
}
.modal-icon { margin-bottom: 16px; }
.modal-content h2 { font-family: 'Space Grotesk', sans-serif; font-size: 1.3rem; margin-bottom: 8px; }
.modal-content p { color: var(--text-tertiary); margin-bottom: 24px; font-size: 0.95rem; }

/* ===== Buttons ===== */
.btn-gradient {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
    text-decoration: none;
}
.btn-gradient:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(59,130,246,0.35); }
.btn-gradient.btn-lg, .btn-outline.btn-lg { padding: 16px 32px; font-size: 1.05rem; }

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Sync Status ===== */
.sync-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    transition: all var(--transition);
}
.sync-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition);
}
.sync-status.synced { color: var(--success); }
.sync-status.synced .sync-dot { background: var(--success); }
.sync-status.syncing { color: var(--accent); }
.sync-status.syncing .sync-dot { background: var(--accent); animation: pulse 1s infinite; }
.sync-status.error { color: var(--warning); }
.sync-status.error .sync-dot { background: var(--warning); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== Toast System ===== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    font-size: 0.88rem;
    font-weight: 500;
    animation: toastIn 0.3s ease;
    pointer-events: auto;
    max-width: 360px;
}
.toast.removing { animation: toastOut 0.3s ease forwards; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--accent); }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--accent); }
.toast-text { flex: 1; color: var(--text-primary); }
.toast-close-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1.1rem;
    padding: 0 2px; line-height: 1;
}
.toast-close-btn:hover { color: var(--text-primary); }

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

/* ===== Restore Banner ===== */
.restore-banner {
    margin-bottom: 20px;
    animation: slideUp 0.4s ease;
}
.restore-banner-content {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(59,130,246,0.08));
    border: 1px solid rgba(16,185,129,0.3);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 12px rgba(16,185,129,0.1);
}
.restore-banner-icon {
    color: var(--success);
    flex-shrink: 0;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(16,185,129,0.15);
    border-radius: 50%;
}
.restore-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.restore-banner-text strong {
    font-size: 0.92rem;
    color: var(--text-primary);
}
.restore-banner-text span {
    font-size: 0.82rem;
    color: var(--text-tertiary);
}
.restore-banner-dismiss {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 6px;
    border-radius: 50%;
    transition: all var(--transition);
}
.restore-banner-dismiss:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

/* ===== Session Actions ===== */
.session-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}
.btn-skip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}
.btn-skip:hover {
    color: var(--warning);
    border-color: rgba(245,158,11,0.4);
    background: rgba(245,158,11,0.08);
}
.btn-abandon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}
.btn-abandon:hover {
    color: var(--danger);
    border-color: rgba(239,68,68,0.3);
    background: rgba(239,68,68,0.08);
}

/* ===== Keyboard Shortcuts ===== */
.shortcuts-hint {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 16px;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.shortcuts-hint span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.shortcuts-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.68rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    line-height: 1;
}

/* ===== Cross-device Session Load ===== */
.cross-device-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    max-width: 360px;
}
.cross-device-hint {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}
.handle-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.handle-input {
    flex: 1;
    padding: 10px 14px;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition);
}
.handle-input:focus {
    border-color: var(--accent);
}
.btn-sm {
    padding: 10px 18px;
    font-size: 0.82rem;
    white-space: nowrap;
}

/* ===== Practice Hub ===== */
.practice-hub {
    padding: 40px 0 !important;
    text-align: left !important;
}
.hub-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 0;
}
.hub-header {
    text-align: center;
    margin-bottom: 32px;
}
.hub-icon {
    color: var(--accent);
    margin-bottom: 16px;
    opacity: 0.8;
}
.hub-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.hub-header p {
    color: var(--text-tertiary);
    font-size: 0.92rem;
    max-width: 400px;
    margin: 0 auto;
}

.hub-stats {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px 16px;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.4s ease;
}
.hub-stat {
    text-align: center;
    flex: 1;
    min-width: 0;
}
.hub-stat-val {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}
.hub-stat-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.hub-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 28px;
    animation: slideUp 0.4s ease 0.1s both;
}
.hub-action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition);
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
}
.hub-action-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.hub-action-card svg {
    flex-shrink: 0;
    color: var(--accent);
}
.hub-action-card strong {
    display: block;
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 2px;
}
.hub-action-card span {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}
.hub-action-upsolve svg { color: var(--warning); }
.hub-action-upsolve:hover { border-color: var(--warning); }

.hub-section {
    margin-bottom: 24px;
    animation: slideUp 0.4s ease 0.2s both;
}
.hub-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.hub-sessions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.hub-session-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    transition: all var(--transition);
}
.hub-session-card:hover {
    box-shadow: var(--shadow-md);
}
.hub-session-card.status-paused {
    border-left: 3px solid var(--warning);
}
.hub-session-card.status-completed {
    border-left: 3px solid var(--success);
}
.hub-session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.hub-session-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.hub-session-badge.status-paused {
    background: rgba(245,158,11,0.15);
    color: var(--warning);
}
.hub-session-badge.status-completed {
    background: rgba(16,185,129,0.15);
    color: var(--success);
}
.hub-session-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.hub-session-stats {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    margin-bottom: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.hub-session-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}
.hub-session-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.4s ease;
}
.hub-session-resume {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}
.hub-session-resume:hover {
    background: rgba(59,130,246,0.2);
    border-color: var(--accent);
}

/* ===== Upsolve Selection Modal ===== */
.upsolve-select-modal {
    max-width: 520px !important;
    text-align: left !important;
    max-height: 80vh;
    overflow-y: auto;
}
.upsolve-select-modal h2 { text-align: center; }
.upsolve-select-modal > p { text-align: center; }
.upsolve-select-actions {
    margin: 16px 0 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.upsolve-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}
.upsolve-select-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}
.upsolve-select-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
}
.upsolve-select-item:hover { background: var(--bg-secondary); }
.upsolve-select-name {
    flex: 1;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upsolve-select-footer {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .container { padding: 0 16px; }
    .problem-card { padding: 24px 20px; }
    .problem-name { font-size: 1.15rem; }
    .timer-ring-container { width: 200px; height: 200px; }
    .timer-ring-container svg { viewBox: 0 0 260 260; }
    .timer-time { font-size: 2.2rem; }
    .timer-phase-dots { margin-bottom: 20px; }
    .phase-connector { width: 24px; }
    .dot-label { font-size: 0.6rem; }
    .timer-controls { flex-direction: column; width: 100%; }
    .btn-timer { width: 100%; justify-content: center; }
    .post-timer-actions { flex-direction: column; }
    .btn-completed, .btn-upsolve { width: 100%; justify-content: center; }
    .session-stats { gap: 20px; }
    .session-stats .stat-val { font-size: 1.5rem; }
    .toast-container { right: 10px; left: 10px; }
    .toast { max-width: 100%; }
    .restore-banner-content { flex-wrap: wrap; }
    .sync-status .sync-text { display: none; }
    .completed-item { flex-wrap: wrap; }
    .completed-rating { margin-left: auto; }
    .btn-upsolve-early { width: 100%; justify-content: center; }
    .hub-quick-actions { grid-template-columns: 1fr; }
    .hub-stats { flex-wrap: wrap; gap: 8px; padding: 16px 12px; }
    .hub-stat { min-width: 60px; }
    .hub-stat-val { font-size: 1.1rem; }
    .hub-session-card { padding: 14px 16px; }
    .upsolve-select-modal { max-width: 95vw !important; }
}
