* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-dark: #5b21b6;
    --dark-blue: #1e1b4b;
    --dark-blue-soft: #312e81;
    --accent: #818cf8;
    --success: #34d399;
    --success-dark: #059669;
    --danger: #f87171;
    --danger-dark: #dc2626;
    --bg-body: linear-gradient(160deg, #0f0f23 0%, #1a1a3e 40%, #16213e 100%);
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f5f9;
    --text-muted: #94a3b8;
    --border-subtle: rgba(148, 163, 184, 0.15);
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.15);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--dark-blue) 0%, var(--dark-blue-soft) 50%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-soft);
    flex-wrap: wrap;
    gap: 0.5rem;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.lang-btn.active-lang {
    background: var(--primary);
    color: white;
    border-color: var(--primary-light);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
}

.lang-sep {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.85rem;
    user-select: none;
}

.header-info-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-info-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.08);
}

.header-info-icon {
    line-height: 1;
}

.balance {
    background: rgba(255, 255, 255, 0.12);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Navigation */
.nav {
    display: flex;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 0.5rem;
    gap: 0.25rem;
}

.nav-btn {
    flex: 1;
    padding: 1rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: var(--radius-sm);
}

.nav-btn.active {
    color: var(--primary-light);
    background: rgba(124, 58, 237, 0.2);
    font-weight: 600;
}

.nav-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Timer */
.timer-container {
    text-align: center;
    padding: 2rem 0;
}

.timer-display {
    margin-bottom: 2rem;
}

.timer-circle {
    position: relative;
    width: 260px;
    height: 260px;
    margin: 0 auto;
    filter: drop-shadow(0 0 30px rgba(124, 58, 237, 0.2));
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(148, 163, 184, 0.15);
    stroke-width: 10;
}

.timer-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 10;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 1s linear;
    stroke-linecap: round;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

#timer-time {
    display: block;
    font-size: 3.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.timer-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-weight: 500;
}

.timer-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 320px;
    margin: 0 auto 2rem;
}

.duration-select {
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.duration-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.task-input {
    max-width: 400px;
    margin: 0 auto;
}

/* Buttons */
.btn {
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.02em;
}

.btn-sm {
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn.active {
    border-color: var(--primary);
    color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.5);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    color: var(--primary-light);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(52, 211, 153, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(248, 113, 113, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Inputs */
.input, .textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.2s;
}

.input::placeholder, .textarea::placeholder {
    color: var(--text-muted);
}

.textarea {
    min-height: 100px;
    resize: vertical;
}

.input:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

/* Tasks */
.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.stats-actions {
    display: flex;
    gap: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    backdrop-filter: blur(12px);
}

.chart-card {
    margin-top: 1rem;
}

.card-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.card-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-sub {
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.chart {
    height: 160px;
    display: flex;
    gap: 6px;
    align-items: flex-end;
    padding: 0.75rem 0.25rem 0.25rem;
}

.bar {
    flex: 1;
    min-width: 6px;
    max-width: 16px;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(167, 139, 250, 0.95) 0%, rgba(124, 58, 237, 0.65) 100%);
    box-shadow: 0 0 18px rgba(124, 58, 237, 0.15);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.bar:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

.empty-state {
    padding: 1.25rem 0.5rem 0.25rem;
    text-align: center;
}

.empty-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.empty-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Skeletons */
.skeleton-card {
    position: relative;
    overflow: hidden;
}

.skeleton-line,
.skeleton-pill {
    position: relative;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.22);
    border-radius: 999px;
}

.skeleton-line {
    height: 10px;
    margin-bottom: 0.5rem;
}

.skeleton-pill {
    width: 72px;
    height: 20px;
}

.w-100 { width: 100%; }
.w-90 { width: 90%; }
.w-80 { width: 80%; }
.w-70 { width: 70%; }
.w-60 { width: 60%; }
.w-40 { width: 40%; }

.skeleton-card::after,
.skeleton-line::after,
.skeleton-pill::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0) 100%);
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.row {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.row-label {
    color: var(--text-muted);
    font-weight: 600;
}

.tasks-header h2 {
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

/* Streak & motivation card */
.streak-card {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12) 0%, rgba(139, 92, 246, 0.08) 100%);
    border: 1px solid rgba(124, 58, 237, 0.35);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1rem;
    margin-bottom: 1.5rem;
}

.streak-card-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin: 0 0 1rem 0;
    font-weight: 500;
}

.streak-bar {
    margin-bottom: 0.5rem;
}

.streak-days {
    display: flex;
    gap: 0.35rem;
    justify-content: space-between;
    align-items: flex-end;
}

.streak-day {
    flex: 1;
    min-width: 0;
    height: 32px;
    border-radius: 6px;
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.25);
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: bottom;
}

.streak-day.filled {
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.55) 0%, rgba(124, 58, 237, 0.35) 100%);
    border-color: rgba(124, 58, 237, 0.65);
    box-shadow: 0 0 14px rgba(124, 58, 237, 0.35);
    animation: streak-fill 0.5s ease;
}

.streak-day.filled::after {
    content: '✓';
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 4px rgba(0,0,0,0.2);
}

@keyframes streak-fill {
    0% { transform: scaleY(0.3); opacity: 0.5; }
    70% { transform: scaleY(1.05); }
    100% { transform: scaleY(1); opacity: 1; }
}

.streak-labels {
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
    margin-top: 0.35rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.streak-labels span {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.streak-bonus-hint {
    font-size: 0.85rem;
    color: var(--success);
    font-weight: 600;
    margin: 0.5rem 0 0 0;
}

.tasks-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
}

.tasks-section-my {
    margin-top: 1.5rem;
}

.tasks-app-list {
    margin-bottom: 0.5rem;
}

.tasks-app-list .task-card {
    padding: 1.25rem;
    border-left: 3px solid rgba(124, 58, 237, 0.5);
}

.tasks-app-list .task-card .task-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.tasks-app-list .task-do-btn {
    margin-top: 0.75rem;
    width: 100%;
}

@media (min-width: 480px) {
    .tasks-app-list .task-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .tasks-app-list .task-do-btn {
        width: auto;
        margin-top: 0;
    }
}

.task-difficulty {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
}

.task-diff-easy {
    background: rgba(52, 211, 153, 0.2);
    color: var(--success);
}

.task-diff-medium {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.task-diff-hard {
    background: rgba(248, 113, 113, 0.2);
    color: var(--danger);
}

.task-done-badge {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--success);
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}

.task-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(124, 58, 237, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.task-card.completed {
    border-color: rgba(52, 211, 153, 0.4);
    opacity: 0.85;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.task-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.task-status {
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.task-status.pending {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.task-status.in_progress {
    background: rgba(124, 58, 237, 0.25);
    color: var(--primary-light);
}

.task-status.completed {
    background: rgba(52, 211, 153, 0.2);
    color: var(--success);
}

.task-description {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.task-reward {
    color: var(--primary-light);
    font-weight: 600;
}

/* Profile */
.profile-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
}

.profile-header {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-header h2 {
    font-weight: 700;
    font-size: 1.4rem;
}

.profile-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--dark-blue-soft) 100%);
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.2rem;
    font-weight: 700;
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.3);
    overflow: hidden;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    text-align: center;
    padding: 1.25rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subscription-section, .referral-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-subtle);
}

.subscription-section h3, .referral-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.subscription-free-note {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.subscription-status {
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid var(--border-subtle);
}

/* Subscription plans modal */
.modal-content.subscription-plans {
    max-width: 420px;
}

.plan-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.subscription-plans-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

.plans-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.plan-card {
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    transition: all 0.25s ease;
}

.plan-card:hover {
    border-color: rgba(124, 58, 237, 0.4);
    background: rgba(124, 58, 237, 0.08);
}

.plan-card.plan-featured {
    border-color: rgba(124, 58, 237, 0.5);
    background: rgba(124, 58, 237, 0.12);
}

.plan-card.plan-best {
    border-color: rgba(52, 211, 153, 0.4);
    background: rgba(52, 211, 153, 0.06);
}

.plan-card.plan-best:hover {
    border-color: rgba(52, 211, 153, 0.6);
}

.plan-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    background: rgba(124, 58, 237, 0.3);
    color: var(--primary-light);
    margin-bottom: 0.75rem;
}

.plan-badge-save {
    background: rgba(52, 211, 153, 0.25);
    color: var(--success);
}

.plan-badge-best {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    margin-right: 0.35rem;
}

.plan-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.plan-price {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.plan-period {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.plan-btn {
    width: 100%;
}

.plan-btn-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.plan-btn .ton-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.modal-close-btn {
    width: 100%;
}

.task-reward-no-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.task-reward-reduced {
    color: var(--danger);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* How it works modal */
.how-it-works-modal .modal-content.how-it-works-content {
    max-width: 420px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.how-it-works-heading {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    text-align: center;
    background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.how-it-works-body {
    overflow-y: auto;
    flex: 1;
    padding-right: 0.25rem;
    margin-bottom: 1.25rem;
}

.how-it-works-body::-webkit-scrollbar {
    width: 4px;
}

.how-it-works-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.how-it-works-section {
    margin-bottom: 1.25rem;
}

.how-it-works-section:last-child {
    margin-bottom: 0;
}

.how-it-works-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.how-it-works-section-title::before {
    content: '';
    width: 4px;
    height: 1em;
    background: var(--primary);
    border-radius: 2px;
}

.how-it-works-text {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-muted);
    margin: 0;
}

/* Focus check-in modal (during session) */
.focus-check-modal .modal-content.focus-check-content {
    max-width: 320px;
    text-align: center;
}

.focus-check-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.focus-check-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

.focus-check-sub #focus-check-countdown {
    font-weight: 700;
    color: var(--primary-light);
}

.referral-code {
    margin-bottom: 1rem;
}

.referral-code label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.referral-explanation {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.referral-link-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.referral-link-row .input {
    flex: 1;
    margin-bottom: 0;
}

.referrals-list-wrap {
    margin-top: 1rem;
}

.referrals-list-wrap h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.referrals-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.referrals-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

.ref-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.ref-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.ref-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

.ref-avatar-fallback {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-light);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ref-name {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.referral-stats {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.referral-stats span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.referral-stats strong {
    color: var(--primary-light);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(180deg, var(--dark-blue-soft) 0%, var(--dark-blue) 100%);
    padding: 2rem;
    border-radius: var(--radius-lg);
    max-width: 90%;
    width: 400px;
    text-align: center;
    box-shadow: var(--shadow-soft), 0 0 60px rgba(124, 58, 237, 0.2);
    border: 1px solid var(--border-subtle);
}

.modal-content.onboarding {
    text-align: left;
}

.onboarding-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    background: rgba(124, 58, 237, 0.25);
    color: var(--primary-light);
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.onboarding-sub {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.onboarding-points {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0 1.25rem;
}

.point {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 0 18px rgba(124, 58, 237, 0.5);
    margin-top: 0.35rem;
    flex: 0 0 auto;
}

.point-text {
    color: var(--text-primary);
}

.toast-root {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
    width: min(520px, calc(100% - 28px));
    pointer-events: none;
}

.toast {
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    background: rgba(15, 15, 35, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-soft);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Themes */
body[data-theme="purple"] {
    /* default (current) */
}

body[data-theme="dark"] {
    --bg-body: linear-gradient(160deg, #070716 0%, #0b1024 55%, #07081a 100%);
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --primary: #6366f1;
    --primary-light: #a5b4fc;
    --primary-dark: #4f46e5;
    --dark-blue: #0b1024;
    --dark-blue-soft: #11183a;
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.16);
}

body[data-theme="light"] {
    --bg-body: linear-gradient(180deg, #f8fafc 0%, #eef2ff 40%, #ffffff 100%);
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --text-primary: #0f172a;
    --text-muted: #475569;
    --border-subtle: rgba(15, 23, 42, 0.12);
    --shadow-soft: 0 10px 26px rgba(2, 6, 23, 0.12);
    --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.10);
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--primary-light);
}

.modal-content p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-content .textarea {
    margin-bottom: 1.25rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 480px) {
    .timer-circle {
        width: 220px;
        height: 220px;
    }

    #timer-time {
        font-size: 2.75rem;
    }

    .profile-stats {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 1.3rem;
    }

    .main-content {
        padding: 1rem;
    }
}
