/* ==================== LOCAL FONTS ==================== */
@font-face {
    font-family: 'Outfit';
    src: url('assets/fonts/Outfit-Variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('assets/fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('assets/fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('assets/fonts/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('assets/fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Yekan Bakh';
    src: url('assets/fonts/YekanBakh-Regular.woff2') format('woff2'),
         url('assets/fonts/YekanBakh-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Yekan Bakh';
    src: url('assets/fonts/YekanBakh-Bold.woff2') format('woff2'),
         url('assets/fonts/YekanBakh-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Yekan Bakh';
    src: url('assets/fonts/YekanBakh-ExtraBlack.woff2') format('woff2'),
         url('assets/fonts/YekanBakh-ExtraBlack.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* ==================== DESIGN TOKENS ==================== */
:root {
    --font: 'Outfit', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-heading: 'Outfit', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    /* spacing scale */
    --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
    --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

    /* radius scale */
    --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-xl: 28px; --r-full: 999px;

    /* elevation */
    --shadow-1: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-2: 0 10px 34px rgba(0, 0, 0, 0.18);
    --shadow-3: 0 16px 50px rgba(0, 0, 0, 0.30);

    /* transitions */
    --tr-fast: 160ms ease;
    --tr: 240ms ease;
    --tr-slow: 420ms cubic-bezier(0.22, 1, 0.36, 1);

    /* surfaces & text (glass identity preserved, noise reduced) */
    --surface: rgba(255, 255, 255, 0.10);
    --surface-strong: rgba(255, 255, 255, 0.16);
    --surface-soft: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.18);
    --border-strong: rgba(255, 255, 255, 0.32);
    --text: #ffffff;
    --text-soft: rgba(255, 255, 255, 0.78);
    --text-faint: rgba(255, 255, 255, 0.55);

    /* status (do not rely on color alone — always paired with icon/text) */
    --ok: #00ff88;
    --ok-deep: #00cc88;
    --warn: #f59e0b;
    --bad: #ff6b6b;
    --info: #38bdf8;
    --gold: #ffd700;

    /* per-mode ring colors */
    --ring-focus: #00ff88;
    --ring-short: #38bdf8;
    --ring-long: #f59e0b;

    /* theme accents (overridden per theme) */
    --accent: #3b82f6;
    --accent-2: #60a5fa;
}

/* ==================== THEMES ==================== */
body[data-theme="ocean"]     { background: linear-gradient(135deg, #1e3a8a, #3b82f6); --accent: #3b82f6; --accent-2: #60a5fa; }
body[data-theme="forest"]    { background: linear-gradient(135deg, #064e3b, #10b981); --accent: #10b981; --accent-2: #34d399; }
body[data-theme="sunset"]    { background: linear-gradient(135deg, #7c2d12, #f59e0b); --accent: #f59e0b; --accent-2: #fbbf24; }
body[data-theme="space"]     { background: linear-gradient(135deg, #1e1b4b, #4338ca); --accent: #6366f1; --accent-2: #818cf8; }
body[data-theme="cyberpunk"] { background: linear-gradient(135deg, #2d005d, #ff00ff); --accent: #e879f9; --accent-2: #ff40ff; }
body[data-theme="midnight"]  { background: linear-gradient(135deg, #232526, #414345); --accent: #94a3b8; --accent-2: #cbd5e1; }
body[data-theme="lavender"]  { background: linear-gradient(135deg, #667db6 0%, #0082c8 100%); --accent: #0082c8; --accent-2: #38bdf8; }
body[data-theme="aurora"]    { background: linear-gradient(135deg, #0f2027, #203a43 50%, #2c5364); --accent: #34d399; --accent-2: #a7f3d0; }

body {
    background-attachment: fixed;
    transition: background var(--tr-slow);
}

/* ==================== RESET & BASE ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(var(--sp-4) + env(safe-area-inset-top)) var(--sp-4) calc(96px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; color: inherit; }

/* ==================== RTL & PERSIAN TYPOGRAPHY ==================== */
html[dir="rtl"],
body[data-lang="fa"] {
    --font: 'Vazirmatn', Tahoma, sans-serif;
    --font-heading: 'Yekan Bakh', 'Vazirmatn', Tahoma, sans-serif;
    font-family: var(--font);
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6,
html[dir="rtl"] .brand-name,
html[dir="rtl"] .brand-tag,
html[dir="rtl"] .tab-label,
html[dir="rtl"] .timer-display,
html[dir="rtl"] .mode-btn,
html[dir="rtl"] .preset-chip,
html[dir="rtl"] .modal-btn,
html[dir="rtl"] .claim-btn,
html[dir="rtl"] .profile-name,
html[dir="rtl"] .level-badge,
html[dir="rtl"] .stat-val,
html[dir="rtl"] .stat-value,
html[dir="rtl"] .quest-title,
html[dir="rtl"] .achievement-title,
html[dir="rtl"] .shop-item-name,
html[dir="rtl"] .record-val,
html[dir="rtl"] .record-value,
html[dir="rtl"] .section-title,
html[dir="rtl"] .card-title,
html[dir="rtl"] .level-message,
html[dir="rtl"] .report-hero-value,
html[dir="rtl"] .task-save-btn,
html[dir="rtl"] .shop-buy-btn {
    font-family: var(--font-heading) !important;
}

html[dir="rtl"] p,
html[dir="rtl"] span,
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select,
html[dir="rtl"] label,
html[dir="rtl"] button,
html[dir="rtl"] .toast-msg,
html[dir="rtl"] .setting-hint,
html[dir="rtl"] .task-title,
html[dir="rtl"] .task-item-text,
html[dir="rtl"] .chip,
html[dir="rtl"] .active-task-name,
html[dir="rtl"] .active-task-hint,
html[dir="rtl"] .quote-text,
html[dir="rtl"] .quote-author {
    font-family: var(--font) !important;
}

/* RTL layout adjustments */
html[dir="rtl"] .session-dots-label {
    margin-left: 0;
    margin-right: 8px;
}
html[dir="rtl"] .insight-item {
    border-left: none;
    border-right: 3px solid var(--accent-2);
}
html[dir="rtl"] .zen-toggle {
    right: auto;
    left: 14px;
}
html[dir="rtl"] .toast-stack {
    right: auto;
    left: 18px;
}
html[dir="rtl"] .theme-lock {
    right: auto;
    left: 8px;
}
html[dir="rtl"] .lang-text {
    font-family: 'Outfit', sans-serif !important;
    font-weight: 700;
    font-size: 0.76rem;
}
html[dir="rtl"] .card-header-action {
    right: auto;
    left: 10px;
}
html[dir="rtl"] .hbar-track {
    transform: scaleX(-1);
}
html[dir="rtl"] .goal-head-right {
    flex-direction: row-reverse;
}
html[dir="rtl"] .task-head {
    flex-direction: row-reverse;
}
html[dir="rtl"] .topbar {
    direction: rtl;
}
html[dir="rtl"] .brand {
    direction: rtl;
}
html[dir="rtl"] .topbar-right {
    direction: ltr;
}

img, svg { display: block; }

kbd {
    background: rgba(255,255,255,0.15);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 6px;
    padding: 1px 7px;
    font-family: inherit;
    font-size: 0.8em;
}

/* ==================== A11Y HELPERS ==================== */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: #fff; color: #111; padding: 10px 18px;
    border-radius: 0 0 var(--r-sm) 0; z-index: 2000; font-weight: 700;
}
.skip-link:focus { left: 0; }

:focus-visible {
    outline: 3px solid var(--accent-2);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ==================== TOP BAR ==================== */
.topbar {
    max-width: 780px;
    margin: 0 auto var(--sp-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-3) var(--sp-4);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-1);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.brand-icon { font-size: 1.7rem; }
.brand-logo { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-logo-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    filter: drop-shadow(0 2px 10px rgba(255, 46, 86, 0.45));
    transition: transform var(--tr-fast), filter var(--tr-fast);
    display: block;
}
.brand:hover .brand-logo-img {
    transform: scale(1.08) rotate(-4deg);
    filter: drop-shadow(0 4px 14px rgba(255, 46, 86, 0.65));
}
.brand-name { font-size: 1.35rem; font-weight: 800; letter-spacing: 0.2px; }
.brand-tag {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 1.2px;
    text-transform: uppercase;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    padding: 3px 9px; border-radius: var(--r-full);
    color: var(--text-soft);
    white-space: nowrap;
}

.settings-about {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: var(--sp-4);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--border);
    gap: var(--sp-2);
}
.settings-logo-img {
    max-width: 170px;
    height: auto;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.25));
}
.settings-version {
    font-size: 0.76rem;
    color: var(--text-faint);
    font-weight: 500;
    letter-spacing: 0.4px;
}

.topbar-right { display: flex; align-items: center; gap: var(--sp-2); }

.icon-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    width: 42px; height: 42px;
    display: grid; place-items: center;
    font-size: 1.15rem; cursor: pointer;
    transition: background var(--tr-fast), transform var(--tr-fast);
}
.icon-btn:hover { background: var(--surface-strong); transform: translateY(-1px); }
.lang-text {
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1;
    font-family: var(--font-heading);
}

.profile-chip {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    padding: 5px 14px 5px 6px;
    cursor: pointer;
    transition: background var(--tr-fast), transform var(--tr-fast);
    min-width: 0;
}
.profile-chip:hover { background: var(--surface-strong); transform: translateY(-1px); }

.profile-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--surface-strong);
    border: 1px solid var(--border-strong);
    font-size: 1.15rem;
}
.profile-avatar.framed { box-shadow: 0 0 0 2.5px var(--gold), 0 0 14px rgba(255, 215, 0, 0.55); }

.profile-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; min-width: 0; }
.profile-name { font-weight: 700; font-size: 0.92rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-sub { font-size: 0.72rem; color: var(--text-faint); font-weight: 600; }

/* ==================== TAB BAR ==================== */
.tabbar {
    max-width: 780px;
    margin: 0 auto var(--sp-5);
    display: flex;
    gap: var(--sp-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 6px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-1);
}

.tab-btn {
    flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    background: transparent; border: none; border-radius: var(--r-md);
    padding: 11px 8px;
    font-size: 0.95rem; font-weight: 600; color: var(--text-soft);
    cursor: pointer;
    transition: background var(--tr-fast), color var(--tr-fast), box-shadow var(--tr-fast);
    position: relative;
    min-height: 46px;
}
.tab-btn:hover { color: var(--text); background: var(--surface-soft); }
.tab-btn.active {
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow-1);
}
.tab-badge {
    position: absolute; top: 4px; right: 10px;
    background: var(--accent); color: #fff;
    font-size: 0.62rem; font-weight: 800;
    border-radius: var(--r-full); padding: 1px 6px;
    min-width: 17px; text-align: center;
}

/* ==================== SHELL & VIEWS ==================== */
.app-shell { max-width: 780px; margin: 0 auto; }

.view { display: none; flex-direction: column; gap: var(--sp-4); animation: viewIn var(--tr-slow); }
.view.active { display: flex; }
.view[hidden] { display: none !important; }

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

/* ==================== CARDS ==================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-1);
    transition: box-shadow var(--tr), border-color var(--tr);
}

.card-title {
    font-size: 1.08rem; font-weight: 700;
    display: flex; align-items: center; gap: 8px;
    margin-bottom: var(--sp-4);
}
.card-title span[aria-hidden] { font-size: 1.1rem; }

.task-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: var(--sp-3); margin-bottom: var(--sp-4);
    flex-wrap: wrap;
}
.task-head .card-title { margin-bottom: 0; }

.ghost-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-soft);
    border-radius: var(--r-full);
    padding: 7px 14px;
    font-size: 0.85rem; font-weight: 600;
    cursor: pointer;
    transition: background var(--tr-fast), color var(--tr-fast);
}
.ghost-btn:hover { background: var(--surface-strong); color: var(--text); }
.ghost-btn.sm { padding: 5px 12px; font-size: 0.78rem; }

.hint-line { margin-top: var(--sp-3); font-size: 0.85rem; color: var(--text-faint); }

.empty-state {
    text-align: center;
    padding: var(--sp-6) var(--sp-4);
    color: var(--text-faint);
}
.empty-state .empty-icon { font-size: 2.2rem; display: block; margin-bottom: 10px; opacity: 0.85; }
.empty-state .empty-title { font-weight: 700; color: var(--text-soft); font-size: 1rem; margin-bottom: 4px; }
.empty-state p { font-size: 0.88rem; }

/* ==================== GOAL CARD ==================== */
.goal-card { border-color: rgba(0, 255, 136, 0.25); }
.goal-card.goal-celebrating {
    border-color: var(--ok);
    box-shadow: 0 0 24px rgba(0, 255, 136, 0.28), var(--shadow-1);
    animation: goalGlow 2.4s ease-in-out infinite;
}
@keyframes goalGlow {
    0%, 100% { box-shadow: 0 0 18px rgba(0, 255, 136, 0.18), var(--shadow-1); }
    50%      { box-shadow: 0 0 34px rgba(0, 255, 136, 0.38), var(--shadow-1); }
}

.goal-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.goal-head .card-title { margin-bottom: 0; }
.goal-head-right { display: flex; align-items: center; gap: var(--sp-2); }

.goal-pct {
    font-weight: 800; font-size: 1rem; color: var(--ok);
    min-width: 44px; text-align: right;
    font-variant-numeric: tabular-nums;
}

.goal-track {
    height: 14px; border-radius: var(--r-full);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    overflow: hidden;
}
.goal-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--ok-deep), var(--ok));
    border-radius: var(--r-full);
    transition: width var(--tr-slow);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.5);
}

.goal-meta {
    display: flex; justify-content: space-between; gap: var(--sp-3);
    margin-top: var(--sp-3);
    font-size: 0.9rem; color: var(--text-soft); font-weight: 600;
    flex-wrap: wrap;
}
#goalLabel { font-variant-numeric: tabular-nums; }

/* ==================== CURRENT TASK CARD ==================== */
.active-task-name {
    font-size: 1.25rem; font-weight: 700; line-height: 1.3;
    overflow-wrap: anywhere;
}
.active-task-hint { color: var(--text-faint); font-size: 0.88rem; margin-top: 4px; }

.active-task-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); }
.active-task-row .active-task-name { font-size: 1.1rem; }
.active-task-pct { font-weight: 800; color: var(--ok); font-variant-numeric: tabular-nums; }

.task-progress-track {
    height: 10px; border-radius: var(--r-full);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    overflow: hidden;
    margin: var(--sp-2) 0 var(--sp-3);
}
.task-progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--ok-deep), var(--ok));
    border-radius: var(--r-full);
    transition: width var(--tr-slow);
}

.active-task-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
    font-size: 0.72rem; font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--r-full);
    background: var(--surface-strong);
    border: 1px solid var(--border);
    color: var(--text-soft);
    white-space: nowrap;
}
.chip.priority-high   { border-color: rgba(255, 107, 107, 0.55); color: #ffb3b3; }
.chip.priority-medium { border-color: rgba(245, 158, 11, 0.55); color: #ffd9a0; }
.chip.priority-low    { border-color: rgba(0, 255, 136, 0.45); color: #a9ffd0; }
.chip.chip-cat        { border-color: var(--accent-2); color: #cfe6ff; }
.chip.chip-due        { border-color: rgba(245, 158, 11, 0.7); color: #ffd9a0; }
.chip.chip-due.overdue { border-color: rgba(255, 107, 107, 0.7); color: #ffb3b3; }
.chip.chip-tag        { border-style: dashed; }

/* ==================== TIMER CARD ==================== */
.timer-card { position: relative; text-align: center; padding-bottom: var(--sp-5); }

/* --- zen (distraction-free) toggle: top-right corner of the timer --- */
.zen-toggle {
    position: absolute; top: 14px; right: 14px; z-index: 30;
    width: 40px; height: 40px;
    border-radius: var(--r-full);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-soft);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background var(--tr-fast), color var(--tr-fast), transform var(--tr-fast);
}
.zen-toggle:hover { background: var(--surface-strong); color: var(--text); transform: scale(1.06); }
.zen-toggle:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.zen-toggle svg { width: 18px; height: 18px; }
.zen-toggle .icon-compress { display: none; }

/* --- zen mode: only the timer, bigger, covering the viewport --- */
body.zen-mode .topbar,
body.zen-mode .tabbar,
body.zen-mode .goal-card,
body.zen-mode .current-task-card,
body.zen-mode .quests-preview,
body.zen-mode .quote-card,
body.zen-mode .footer,
body.zen-mode .keyboard-hint,
body.zen-mode .timer-card .preset-row { display: none !important; }

body.zen-mode .timer-card {
    position: fixed; inset: 0; z-index: 940;
    max-width: none; margin: 0;
    border: none; border-radius: 0; box-shadow: none;
    background: transparent; /* the themed body gradient becomes the backdrop */
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: var(--sp-4);
    padding: calc(64px + env(safe-area-inset-top)) var(--sp-4) calc(28px + env(safe-area-inset-bottom));
    overflow-y: auto;
}
body.zen-mode .timer-modes { margin: 0; }
body.zen-mode .timer-container { width: min(72vmin, 430px); margin: 0; }
body.zen-mode .timer-display { font-size: clamp(3.4rem, 12vmin, 6rem); }
body.zen-mode .active-task-ring-badge { max-width: 240px; }
body.zen-mode .session-dots { margin: 0; }
body.zen-mode .timer-controls { margin-bottom: 0; }
body.zen-mode .zen-toggle {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    right: calc(14px + env(safe-area-inset-right));
    background: rgba(0, 0, 0, 0.28);
}
body.zen-mode .zen-toggle .icon-expand { display: none; }
body.zen-mode .zen-toggle .icon-compress { display: block; }

.preset-row {
    display: flex; justify-content: center; flex-wrap: wrap;
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
}
.preset-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-soft);
    border-radius: var(--r-full);
    padding: 7px 14px;
    font-size: 0.82rem; font-weight: 700;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background var(--tr-fast), color var(--tr-fast), border-color var(--tr-fast);
}
.preset-chip span { font-weight: 500; opacity: 0.75; font-size: 0.74rem; }
.preset-chip:hover { background: var(--surface-strong); }
.preset-chip.active {
    background: var(--surface-strong);
    color: var(--text);
    border-color: var(--accent-2);
    box-shadow: inset 0 0 0 1px var(--accent-2);
}

.timer-modes {
    display: flex; justify-content: center;
    gap: var(--sp-2);
    margin: 2px 0 var(--sp-2);
    flex-wrap: wrap;
}
.mode-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-soft);
    padding: 9px 18px;
    border-radius: var(--r-full);
    font-size: 0.9rem; font-weight: 600;
    cursor: pointer;
    transition: all var(--tr-fast);
    min-height: 44px;
}
.mode-btn:hover { background: var(--surface-strong); color: var(--text); }
.mode-btn.active { background: var(--surface-strong); color: var(--text); border-color: var(--border-strong); box-shadow: inset 0 0 0 1px var(--accent-2); }

.timer-container {
    position: relative;
    width: 280px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
    margin: 0 auto var(--sp-2);
}
.progress-ring {
    display: block;
    width: 100%; height: 100%;
    transform: rotate(-90deg);
}
.progress-ring-bg {
    fill: none;
    stroke: var(--surface-soft);
    stroke-width: 12;
}
.progress-ring-circle {
    fill: none;
    stroke: var(--ring-focus);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s linear, stroke var(--tr);
    filter: drop-shadow(0 0 8px rgba(0, 255, 136, 0.45));
}

.timer-display-content {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px;
    padding: 0 30px;
}
.timer-display {
    font-size: 4.1rem; font-weight: 800;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
.timer-mode-label {
    font-size: 0.85rem; font-weight: 700;
    letter-spacing: 2.5px; text-transform: uppercase;
    color: var(--text-soft);
}
.active-task-ring-badge {
    margin-top: 9px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    padding: 4px 13px;
    font-size: 0.78rem; font-weight: 500;
    max-width: 200px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    box-shadow: var(--shadow-1);
}

.timer-card.warning .timer-display { animation: warningPulse 1s ease-in-out infinite; }
@keyframes warningPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.045); opacity: 0.82; }
}

.session-dots {
    display: flex; justify-content: center; align-items: center;
    gap: 9px;
    margin: var(--sp-3) 0 var(--sp-4);
    min-height: 14px;
}
.session-dot {
    width: 11px; height: 11px;
    border-radius: 50%;
    background: var(--surface-soft);
    border: 1.5px solid var(--border-strong);
    transition: background var(--tr), transform var(--tr), box-shadow var(--tr);
}
.session-dot.filled {
    background: var(--ok);
    border-color: var(--ok);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
}
.session-dot.next { transform: scale(1.25); }
.session-dots-label { font-size: 0.75rem; color: var(--text-faint); margin-left: 8px; font-weight: 600; }

.timer-controls {
    display: flex; justify-content: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-2);
}
.control-btn {
    min-width: 150px;
    padding: 14px 30px;
    border-radius: var(--r-full);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1.05rem; font-weight: 700;
    cursor: pointer;
    transition: all var(--tr-fast);
    min-height: 52px;
}
.control-btn:hover { background: var(--surface-strong); transform: translateY(-1px); box-shadow: var(--shadow-1); }
.control-btn.primary {
    background: linear-gradient(135deg, var(--ok-deep), #00e07a);
    border-color: transparent;
    color: #052e1c;
    box-shadow: 0 8px 22px rgba(0, 255, 136, 0.32);
}
.control-btn.primary:hover { box-shadow: 0 10px 28px rgba(0, 255, 136, 0.45); }

.keyboard-hint { font-size: 0.78rem; color: var(--text-faint); margin-bottom: var(--sp-3); }

.setting-select,
.filter-select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    cursor: pointer;
}
.setting-select option, .filter-select option { background: #1e293b; color: #fff; }

/* ==================== QUESTS ==================== */
.quests-list { display: flex; flex-direction: column; gap: var(--sp-3); }

.quest-item {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-3) var(--sp-4);
    transition: border-color var(--tr), box-shadow var(--tr);
}
.quest-item.completed {
    border-color: rgba(0, 255, 136, 0.5);
    background: rgba(0, 255, 136, 0.07);
}
.quest-item.bonus { border-style: dashed; }

.quest-top {
    display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3);
    margin-bottom: 7px;
}
.quest-title { font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; gap: 7px; }
.quest-reward { font-size: 0.78rem; font-weight: 800; color: var(--gold); white-space: nowrap; }
.quest-desc { font-size: 0.8rem; color: var(--text-faint); margin-bottom: 9px; }

.quest-track {
    height: 8px; border-radius: var(--r-full);
    background: rgba(255,255,255,0.09);
    overflow: hidden;
}
.quest-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--accent-2), var(--ok));
    border-radius: var(--r-full);
    transition: width var(--tr-slow);
}
.quest-item.completed .quest-fill { background: linear-gradient(90deg, var(--ok-deep), var(--ok)); }

.quest-bottom {
    display: flex; justify-content: space-between;
    margin-top: 6px;
    font-size: 0.78rem; color: var(--text-faint); font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.quest-done-label { color: var(--ok); font-weight: 800; }

/* ==================== QUOTE ==================== */
.quote-card { text-align: center; padding: var(--sp-5) var(--sp-6); }
.quote-text { font-style: italic; font-size: 1.02rem; line-height: 1.6; margin-bottom: 8px; color: var(--text-soft); }
.quote-author { font-size: 0.85rem; color: var(--text-faint); font-weight: 500; }

/* ==================== STATS GRID ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-3);
}
.stat-item {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4) var(--sp-2);
    text-align: center;
    transition: transform var(--tr-fast);
}
.stat-item:hover { transform: translateY(-2px); }
.stat-value { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.72rem; color: var(--text-faint); font-weight: 600; margin-top: 3px; letter-spacing: 0.4px; }

.score-breakdown {
    margin-top: var(--sp-4);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4);
}
.score-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 0; font-size: 0.88rem; gap: var(--sp-3);
}
.score-row-name { display: flex; align-items: center; gap: 8px; color: var(--text-soft); }
.score-row-pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.score-row-pts.full { color: var(--ok); }
.score-row-pts.zero { color: var(--text-faint); }
.score-row-hint { font-size: 0.74rem; color: var(--text-faint); }

/* ==================== WEEKLY BAR CHART ==================== */
.weekly-bar-chart {
    display: flex; justify-content: space-between; align-items: flex-end;
    height: 150px;
    padding: 6px 4px 0;
    gap: 8px;
}
.chart-bar-container {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; gap: 6px;
    height: 100%; justify-content: flex-end;
    min-width: 0;
}
.bar-val { font-size: 0.68rem; color: var(--text-faint); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-bar-track {
    width: 100%; max-width: 30px; height: 100%;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    display: flex; flex-direction: column; justify-content: flex-end;
    overflow: hidden;
}
.bar-fill {
    width: 100%;
    background: linear-gradient(180deg, var(--ok), var(--ok-deep));
    border-radius: 8px;
    transition: height var(--tr-slow);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.35);
}
.bar-day { font-size: 0.78rem; font-weight: 700; color: var(--text-faint); }
.bar-day.is-today { color: var(--ok); }
.chart-summary { margin-top: var(--sp-3); font-size: 0.86rem; text-align: center; color: var(--text-faint); font-style: italic; }

/* ==================== WEEKLY REPORT ==================== */
.report-hero {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}
.report-hero-item {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4);
    text-align: center;
}
.report-hero-value { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.report-hero-label { font-size: 0.74rem; color: var(--text-faint); font-weight: 600; margin-top: 2px; }

.report-rows { display: flex; flex-direction: column; gap: 8px; }
.report-row {
    display: flex; justify-content: space-between; gap: var(--sp-3);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 9px 14px;
    font-size: 0.88rem;
}
.report-row-name { color: var(--text-soft); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.report-row-value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.report-row-value.up { color: var(--ok); }
.report-row-value.down { color: var(--bad); }

/* ==================== CATEGORY & TIME BARS ==================== */
.cat-breakdown, .tod-chart { display: flex; flex-direction: column; gap: var(--sp-3); }
.hbar-row { display: grid; grid-template-columns: 110px 1fr 74px; align-items: center; gap: var(--sp-3); }
.hbar-label { font-size: 0.85rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.hbar-track { height: 12px; background: rgba(255,255,255,0.08); border-radius: var(--r-full); overflow: hidden; border: 1px solid var(--border); }
.hbar-fill { height: 100%; border-radius: var(--r-full); background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width var(--tr-slow); }
.hbar-row.dim .hbar-fill { opacity: 0.28; }
.hbar-value { font-size: 0.8rem; font-weight: 700; color: var(--text-soft); text-align: right; font-variant-numeric: tabular-nums; }
.cat-detail-line { margin-top: var(--sp-2); font-size: 0.84rem; color: var(--text-faint); }

/* ==================== INSIGHTS ==================== */
.insights-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.insight-item {
    display: flex; gap: var(--sp-3);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-2);
    border-radius: var(--r-sm);
    padding: var(--sp-3) var(--sp-4);
    font-size: 0.92rem;
}
.insight-item .insight-icon { font-size: 1.2rem; flex-shrink: 0; }
.insight-item p { color: var(--text-soft); }

/* ==================== STREAKS / POWERUPS ==================== */
.streak-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }

/* ==================== TASKS VIEW ==================== */
.task-input-group { display: flex; gap: var(--sp-2); }
.task-input-group input {
    flex: 1;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 13px 16px;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color var(--tr-fast);
    min-width: 0;
}
.task-input-group input:focus { border-color: var(--accent-2); }
.task-input-group input::placeholder { color: var(--text-faint); }

.task-save-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    border: none;
    border-radius: var(--r-md);
    padding: 13px 20px;
    font-size: 0.95rem; font-weight: 700;
    cursor: pointer;
    transition: transform var(--tr-fast), box-shadow var(--tr-fast);
    white-space: nowrap;
    min-height: 48px;
}
.task-save-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }

.advanced-toggle { margin-top: var(--sp-2); }

.task-advanced { margin-top: var(--sp-3); }
.adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.adv-item { display: flex; flex-direction: column; gap: 5px; }
.adv-wide { grid-column: 1 / -1; }
.adv-item label { font-size: 0.78rem; font-weight: 700; color: var(--text-faint); letter-spacing: 0.3px; }
.adv-item input, .adv-item select {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 9px 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    color-scheme: dark;
}
.adv-item input:focus, .adv-item select:focus { border-color: var(--accent-2); }

.task-filters {
    display: flex; justify-content: space-between; align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
    flex-wrap: wrap;
}
.filter-pills { display: flex; gap: 6px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--r-full); padding: 4px; }
.filter-pill {
    background: transparent; border: none;
    color: var(--text-faint);
    padding: 6px 14px;
    border-radius: var(--r-full);
    font-size: 0.82rem; font-weight: 700;
    cursor: pointer;
    transition: all var(--tr-fast);
}
.filter-pill.active { background: var(--surface-strong); color: var(--text); }
.task-stats-line { font-size: 0.78rem; color: var(--text-faint); margin-bottom: var(--sp-3); font-weight: 600; }

.task-queue-list { display: flex; flex-direction: column; gap: var(--sp-3); max-height: none; }

.task-item {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-3) var(--sp-4);
    transition: border-color var(--tr-fast), background var(--tr-fast);
}
.task-item:hover { background: var(--surface); }
.task-item.active-task {
    border-color: var(--ok);
    background: rgba(0, 255, 136, 0.08);
    box-shadow: 0 0 14px rgba(0, 255, 136, 0.15);
}
.task-item.completed { opacity: 0.62; }
.task-item.completed .task-item-text { text-decoration: line-through; }

.task-main-row { display: flex; align-items: flex-start; gap: var(--sp-3); }

.task-radio-btn {
    background: none; border: none;
    font-size: 1.15rem; cursor: pointer;
    padding: 2px; line-height: 1;
    opacity: 0.65;
    transition: opacity var(--tr-fast), transform var(--tr-fast);
    flex-shrink: 0;
}
.task-radio-btn:hover { opacity: 1; transform: scale(1.12); }
.task-item.active-task .task-radio-btn { opacity: 1; }

.task-content { flex: 1; min-width: 0; }
.task-item-text { font-size: 0.98rem; font-weight: 600; overflow-wrap: anywhere; }
.task-meta-line {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 7px;
}
.task-progress-mini { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.task-progress-mini .task-progress-track { flex: 1; margin: 0; }
.task-progress-mini-label { font-size: 0.74rem; color: var(--text-faint); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

.task-item-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.task-action-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-soft);
    width: 34px; height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: grid; place-items: center;
    font-size: 0.9rem;
    transition: all var(--tr-fast);
}
.task-action-btn:hover { background: var(--surface-strong); color: var(--text); transform: translateY(-1px); }
.task-action-btn.done { background: rgba(0, 255, 136, 0.18); border-color: rgba(0,255,136,0.5); color: var(--ok); }
.task-action-btn.del:hover { background: rgba(255, 77, 77, 0.25); border-color: var(--bad); color: #ffb3b3; }

/* inline task editor */
.task-editor {
    margin-top: var(--sp-3);
    border-top: 1px dashed var(--border);
    padding-top: var(--sp-3);
    display: flex; flex-direction: column; gap: var(--sp-3);
    animation: viewIn var(--tr);
}
.task-editor .adv-grid { grid-template-columns: 1fr 1fr; }
.task-editor-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; flex-wrap: wrap; }

.task-sessions-log { display: flex; flex-direction: column; gap: 6px; }
.task-session-row {
    display: flex; justify-content: space-between; gap: var(--sp-3);
    font-size: 0.8rem; color: var(--text-soft);
    background: var(--surface-soft);
    padding: 6px 12px; border-radius: var(--r-sm);
    border: 1px solid var(--border);
}
.task-session-when { color: var(--text-faint); }

/* ==================== HISTORY ==================== */
.history-list { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; padding-right: 5px; }
.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 4px; }

.history-item {
    display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 10px 14px;
    font-size: 0.88rem;
    transition: background var(--tr-fast);
}
.history-item:hover { background: var(--surface); }
.history-item-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.history-item-type { font-weight: 700; font-size: 0.92rem; }
.history-item-task { font-size: 0.8rem; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.history-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.history-item-xp { color: var(--ok); font-weight: 800; font-size: 0.88rem; }
.history-item-time { font-size: 0.72rem; color: var(--text-faint); }
.history-empty { text-align: center; color: var(--text-faint); font-size: 0.9rem; padding: 18px 0; font-style: italic; }

.clear-log-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-soft);
    padding: 5px 13px;
    border-radius: var(--r-full);
    font-size: 0.78rem; font-family: inherit; font-weight: 600;
    cursor: pointer;
    transition: all var(--tr-fast);
}
.clear-log-btn:hover { background: rgba(255, 77, 77, 0.25); border-color: var(--bad); color: #ffb3b3; }

/* ==================== PROFILE / RPG ==================== */
.profile-top { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-4); flex-wrap: wrap; }

.profile-avatar-big-wrap {
    width: 76px; height: 76px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--surface-strong);
    border: 2px solid var(--border-strong);
    flex-shrink: 0;
    font-size: 2.3rem;
}
.profile-avatar-big-wrap.framed { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.35), 0 0 22px rgba(255, 215, 0, 0.4); }

.profile-info { flex: 1; min-width: 180px; }
.profile-name-big { font-size: 1.25rem; font-weight: 800; }
.profile-title-line { font-size: 0.85rem; color: var(--text-soft); font-weight: 600; margin: 2px 0 10px; }
.profile-title-line #profileTitle { color: var(--gold); }

.xp-track {
    height: 12px; border-radius: var(--r-full);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    overflow: hidden;
}
.xp-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
    border-radius: var(--r-full);
    transition: width var(--tr-slow);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
}
.xp-label { font-size: 0.78rem; color: var(--text-faint); font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }

.attr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.attr-item { background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); }
.attr-head { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 700; margin-bottom: 7px; }
.attr-head span:last-child { font-variant-numeric: tabular-nums; color: var(--text-soft); }
.attr-track { height: 8px; background: rgba(255,255,255,0.09); border-radius: var(--r-full); overflow: hidden; }
.attr-fill { height: 100%; width: 0%; border-radius: var(--r-full); background: linear-gradient(90deg, var(--accent-2), var(--ok)); transition: width var(--tr-slow); }

.profile-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--sp-4); }
.badge-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    padding: 5px 12px;
    font-size: 0.76rem; font-weight: 700; color: var(--text-soft);
}
.badge-chip.gold { border-color: rgba(255, 215, 0, 0.6); color: var(--gold); }

/* ==================== ACHIEVEMENTS ==================== */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--sp-3);
}
.achievement {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4) var(--sp-3);
    text-align: center;
    transition: transform var(--tr-fast), border-color var(--tr);
    position: relative;
}
.achievement:hover { transform: translateY(-2px); }
.achievement.unlocked {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.16), rgba(255, 215, 0, 0.06));
    border-color: rgba(255, 215, 0, 0.55);
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.15);
}
.achievement.locked { filter: saturate(0.35); opacity: 0.75; }
.achievement .lock-icon {
    position: absolute; top: 8px; right: 10px;
    font-size: 0.8rem; opacity: 0.7;
}
.achievement-icon { font-size: 2.1rem; margin-bottom: 8px; display: block; }
.achievement-title { font-size: 0.88rem; font-weight: 700; margin-bottom: 4px; }
.achievement-desc { font-size: 0.72rem; color: var(--text-faint); line-height: 1.35; }

.achievement-progress { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.achievement-progress-track { height: 6px; background: rgba(255,255,255,0.15); border-radius: 3px; overflow: hidden; }
.achievement.unlocked .achievement-progress-track { background: rgba(0, 0, 0, 0.25); }
.achievement-progress-fill { height: 100%; background: linear-gradient(90deg, var(--ok), var(--ok-deep)); border-radius: 3px; transition: width var(--tr-slow); }
.achievement.unlocked .achievement-progress-fill { background: linear-gradient(90deg, #ffe27a, #d4af37); }
.achievement-progress-label { font-size: 0.68rem; font-weight: 800; color: var(--text-faint); }
.achievement.unlocked .achievement-progress-label { color: #6b5900; }

.ach-count-line { font-size: 0.8rem; color: var(--text-faint); font-weight: 700; margin-bottom: var(--sp-3); }

/* ==================== SHOP ==================== */
.shop-balance { font-weight: 800; color: var(--gold); font-size: 0.95rem; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--sp-3); }
.shop-item {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4);
    display: flex; flex-direction: column; gap: 8px;
    transition: transform var(--tr-fast), border-color var(--tr-fast);
}
.shop-item:hover { transform: translateY(-2px); }
.shop-item.owned { border-color: rgba(0, 255, 136, 0.4); }
.shop-item-head { display: flex; align-items: center; gap: 10px; }
.shop-item-icon { font-size: 1.7rem; }
.shop-item-name { font-weight: 700; font-size: 0.95rem; }
.shop-item-desc { font-size: 0.76rem; color: var(--text-faint); flex: 1; }
.shop-item-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); margin-top: auto; }
.shop-item-price { font-weight: 800; color: var(--gold); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.shop-item-count { font-size: 0.74rem; color: var(--text-faint); font-weight: 700; }
.shop-buy-btn {
    background: linear-gradient(135deg, var(--gold), #ffed4e);
    color: #111; border: none;
    border-radius: var(--r-full);
    padding: 7px 16px;
    font-size: 0.8rem; font-weight: 800;
    cursor: pointer;
    transition: transform var(--tr-fast), box-shadow var(--tr-fast), opacity var(--tr-fast);
}
.shop-buy-btn:hover { transform: scale(1.04); box-shadow: 0 4px 14px rgba(255, 215, 0, 0.4); }
.shop-buy-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.shop-buy-btn.owned-btn { background: var(--surface-strong); color: var(--ok); }

/* ==================== RECORDS / SOCIAL ==================== */
.rank-chip {
    background: linear-gradient(135deg, var(--gold), #ffed4e);
    color: #4a3800;
    font-weight: 800; font-size: 0.8rem;
    border-radius: var(--r-full);
    padding: 5px 14px;
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.3);
}
.records-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--sp-3);
}
.record-item {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-3) var(--sp-4);
    text-align: center;
}
.record-value { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.record-label { font-size: 0.7rem; color: var(--text-faint); font-weight: 600; margin-top: 2px; }
.social-note {
    margin-top: var(--sp-4);
    font-size: 0.8rem; color: var(--text-faint);
    background: var(--surface-soft);
    border: 1px dashed var(--border);
    border-radius: var(--r-sm);
    padding: 10px 14px;
    line-height: 1.5;
}

/* ==================== GUIDE ==================== */
.guide-section {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4) var(--sp-5);
}
.guide-section h4 { color: var(--gold); margin: var(--sp-3) 0 var(--sp-2); font-size: 0.95rem; }
.guide-section h4:first-child { margin-top: 0; }
.guide-section p { margin-bottom: 5px; font-size: 0.85rem; color: var(--text-soft); line-height: 1.55; }

/* ==================== MODALS ==================== */
.modal {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: var(--sp-4);
    overflow-y: auto;
}
.modal.open { display: block; }

.modal-content {
    position: relative;
    margin: min(8vh, 80px) auto;
    width: min(480px, 100%);
    padding: var(--sp-6);
    border-radius: var(--r-lg);
    text-align: center;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-3);
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #fff;
    animation: modalIn var(--tr-slow);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h3 { font-size: 1.45rem; margin-bottom: var(--sp-4); }
.modal p { line-height: 1.5; }

.session-modal-content { background: linear-gradient(135deg, var(--accent, #1e40af), var(--accent-2, #60a5fa)); }
.session-next-up {
    font-size: 0.92rem !important;
    background: rgba(0, 0, 0, 0.18);
    border-radius: var(--r-sm);
    padding: 9px 14px;
    margin-bottom: var(--sp-4);
    font-weight: 600;
}
.session-next-up:empty { display: none; }

.confirm-modal-content { max-width: 420px; text-align: left; }
.confirm-modal-content h3 { font-size: 1.25rem; }
.confirm-modal-content p { font-size: 0.95rem; opacity: 0.92; margin-bottom: var(--sp-5); }

.settings-modal-content { text-align: left; max-width: 500px; }
.settings-modal-content h3 { text-align: center; border-bottom: 1px solid rgba(255,255,255,0.18); padding-bottom: 12px; }

.setting-block { margin-bottom: var(--sp-5); }
.setting-block h4 {
    font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1.4px;
    color: var(--text-faint);
    margin-bottom: var(--sp-3);
}

.settings-form { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-5); }

.setting-item { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-3); }
.setting-item label { font-size: 0.9rem; font-weight: 600; opacity: 0.92; }

.setting-item input[type="number"],
.setting-item input[type="text"],
.setting-item input[type="date"] {
    background: rgba(255,255,255,0.09);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: var(--r-sm);
    padding: 10px 14px;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    color-scheme: dark;
}
.setting-item input:focus { border-color: var(--accent-2, #60a5fa); }

.setting-toggle-row {
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
}
.setting-toggle-row label { flex: 1; }

.switch-input {
    appearance: none; -webkit-appearance: none;
    width: 46px; height: 26px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--r-full);
    position: relative;
    cursor: pointer;
    transition: background var(--tr-fast);
    flex-shrink: 0;
}
.switch-input::after {
    content: '';
    position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform var(--tr-fast);
}
.switch-input:checked { background: var(--ok-deep, #00cc88); }
.switch-input:checked::after { transform: translateX(20px); }

.setting-hint { font-size: 0.78rem; opacity: 0.65; line-height: 1.5; }

.data-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.modal-btn.small { padding: 9px 16px; font-size: 0.85rem; border-radius: var(--r-md); }
.modal-btn.danger { background: rgba(255, 77, 77, 0.2) !important; border-color: rgba(255, 107, 107, 0.5) !important; }
.modal-btn.danger:hover { background: rgba(255, 77, 77, 0.35) !important; }

.settings-error {
    color: #ff8f8f;
    background: rgba(255, 77, 77, 0.14);
    border: 1px solid rgba(255, 77, 77, 0.4);
    border-radius: var(--r-sm);
    padding: 10px 14px;
    font-size: 0.88rem;
    text-align: center;
}
.settings-error:empty { display: none; }

.settings-actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }

.modal-btn {
    padding: 12px 30px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    cursor: pointer;
    font-size: 1rem; font-weight: 700; font-family: inherit;
    transition: all var(--tr-fast);
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.modal-btn:hover { background: rgba(255, 255, 255, 0.32); transform: translateY(-1px); }
.modal-btn.secondary-btn { background: rgba(255, 255, 255, 0.1); }
.confirm-yes-btn { background: linear-gradient(135deg, #ff4d4d, #e33333) !important; border: none !important; min-width: 120px; }

.notification-toggle-btn {
    padding: 9px 18px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem; font-weight: 700;
    transition: all var(--tr-fast);
}
.notification-toggle-btn.enabled {
    background: linear-gradient(135deg, #00ff88, #00cc88);
    color: #052e1c;
    border-color: #00ff88;
}

/* theme modal */
.theme-modal-content { max-width: 440px; }
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-3); }
.theme-option {
    border: 2px solid var(--border);
    background: var(--surface-soft);
    border-radius: var(--r-md);
    padding: var(--sp-3);
    cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    color: #fff; font-family: inherit;
    font-size: 0.9rem; font-weight: 700;
    transition: border-color var(--tr-fast), transform var(--tr-fast);
    position: relative;
}
.theme-option:hover { transform: translateY(-2px); }
.theme-option.active { border-color: #fff; box-shadow: 0 0 14px rgba(255,255,255,0.25); }
.theme-option.locked { opacity: 0.6; cursor: not-allowed; }
.theme-swatch { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; border: 1px solid rgba(255,255,255,0.35); }
.theme-lock { position: absolute; top: 6px; right: 8px; font-size: 0.75rem; }

/* goal modal */
.radio-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.radio-pill {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.09);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: var(--r-full);
    padding: 9px 16px;
    cursor: pointer;
    font-size: 0.9rem; font-weight: 600;
    transition: border-color var(--tr-fast), background var(--tr-fast);
}
.radio-pill:has(input:checked) { border-color: var(--ok, #00ff88); background: rgba(0, 255, 136, 0.12); }
.radio-pill input { accent-color: #00cc88; }

/* profile modal */
.profile-modal-content { max-width: 440px; }
.avatar-grid { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.avatar-option {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.09);
    border: 2px solid rgba(255,255,255,0.22);
    font-size: 1.4rem;
    cursor: pointer;
    display: grid; place-items: center;
    transition: border-color var(--tr-fast), transform var(--tr-fast);
}
.avatar-option:hover { transform: scale(1.08); }
.avatar-option.active { border-color: #00ff88; background: rgba(0, 255, 136, 0.15); }

/* level up modal */
.levelup-content {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    border: 4px solid rgba(255, 255, 255, 0.45);
    overflow: hidden;
    animation: scaleIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
@keyframes scaleIn {
    from { transform: scale(0) rotate(-160deg); opacity: 0; }
    to   { transform: scale(1) rotate(0); opacity: 1; }
}
.level-badge-large {
    font-size: 5.5rem; font-weight: 800;
    text-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    margin: var(--sp-3) 0;
    animation: badgePulse 1.2s ease infinite;
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.07); }
}
.level-message { font-size: 1.05rem; margin-bottom: var(--sp-4); text-shadow: 0 1px 6px rgba(0,0,0,0.25); }
.claim-btn {
    padding: 12px 36px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, 0.9);
    color: #b45309;
    border: none;
    font-size: 1rem; font-weight: 800; font-family: inherit;
    cursor: pointer;
    transition: transform var(--tr-fast);
    position: relative;
    z-index: 2;
}
.claim-btn:hover { transform: scale(1.05); }

.confetti-container { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti {
    position: absolute; top: -10px;
    width: 10px; height: 10px;
    background: rgba(255, 255, 255, 0.85);
    animation: confettiFall 2.6s linear infinite;
}
.confetti:nth-child(1) { left: 10%; animation-delay: 0s;    background: #ff5e5e; }
.confetti:nth-child(2) { left: 30%; animation-delay: 0.5s;  background: #fff; }
.confetti:nth-child(3) { left: 55%; animation-delay: 1.1s;  background: #4ade80; }
.confetti:nth-child(4) { left: 75%; animation-delay: 0.3s;  background: #60a5fa; }
.confetti:nth-child(5) { left: 90%; animation-delay: 0.8s;  background: #fbbf24; }
.confetti.rain { animation-duration: 1.9s; }
.confetti.rain::after { content: '🎉'; font-size: 10px; }
@keyframes confettiFall {
    0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(420px) rotate(680deg); opacity: 0.4; }
}

/* ==================== TOASTS ==================== */
.toast-stack {
    position: fixed;
    right: 18px; bottom: 18px;
    z-index: 1200;
    display: flex; flex-direction: column; gap: 10px;
    max-width: 340px;
    pointer-events: none;
}
.notification-toast {
    display: flex; align-items: center; gap: 12px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: 13px 16px;
    box-shadow: var(--shadow-2);
    color: #fff;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity var(--tr), transform var(--tr);
    backdrop-filter: blur(10px);
}
.notification-toast.show-toast { opacity: 1; transform: translateX(0); }
.notification-toast.hidden { display: none; }
.notification-icon { font-size: 1.6rem; flex-shrink: 0; }
.notification-text h4 { font-size: 0.92rem; font-weight: 800; }
.notification-text p { font-size: 0.8rem; color: rgba(255,255,255,0.8); margin-top: 2px; }
.notification-reward { color: var(--gold); font-weight: 800; }

/* ==================== FOOTER ==================== */
.footer {
    max-width: 780px;
    margin: var(--sp-8) auto 0;
    text-align: center;
    padding-top: var(--sp-4);
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 0.82rem;
}

/* ==================== RESPONSIVE ==================== */
@media (min-width: 769px) {
    .tabbar { position: sticky; top: 12px; z-index: 500; }
}

@media (max-width: 768px) {
    body { padding: 12px 12px calc(96px + env(safe-area-inset-bottom)); }
    .topbar { position: sticky; top: 8px; z-index: 500; padding: 10px 12px; }
    .brand-tag { display: none; }
    .brand-logo-img { width: 28px; height: 28px; }
    .profile-name { max-width: 90px; }

    .tabbar {
        position: fixed;
        left: 12px; right: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        margin: 0;
        z-index: 900;
        background: rgba(15, 23, 42, 0.88);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-radius: var(--r-lg);
        box-shadow: var(--shadow-2);
    }
    .tab-btn { flex-direction: column; gap: 3px; font-size: 0.72rem; padding: 8px 4px; }
    .tab-icon { font-size: 1.25rem; }
    .tab-badge { top: 2px; right: calc(50% - 22px); }

    .card { padding: var(--sp-4); border-radius: var(--r-md); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .attr-grid { grid-template-columns: 1fr; }
    .report-hero { grid-template-columns: repeat(2, 1fr); }
    .timer-container { width: 236px; height: auto; }
    .timer-display { font-size: 3.3rem; }
    .control-btn { min-width: 0; flex: 1; padding: 14px 18px; }
    .timer-controls { flex-direction: row; }
    .hbar-row { grid-template-columns: 86px 1fr 64px; gap: 10px; }
    .achievements-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
    .task-input-group { flex-direction: column; }
    .task-save-btn { width: 100%; }
    .adv-grid { grid-template-columns: 1fr 1fr; }
    .toast-stack { left: 12px; right: 12px; bottom: calc(88px + env(safe-area-inset-bottom)); max-width: none; }
    .modal-content { padding: var(--sp-5) var(--sp-4); }
    .theme-grid { grid-template-columns: 1fr 1fr; }
    .profile-top { gap: var(--sp-3); }
    .history-item-task { max-width: 150px; }
}

@media (max-width: 520px) {
    .zen-toggle { top: 8px; right: 8px; width: 36px; height: 36px; }
    .zen-toggle svg { width: 16px; height: 16px; }
}

@media (max-width: 400px) {
    body { padding-left: 8px; padding-right: 8px; }
    .tabbar { left: 8px; right: 8px; }
    .timer-container { width: 210px; height: auto; }
    .timer-display { font-size: 2.9rem; }
    .active-task-ring-badge { max-width: 150px; font-size: 0.7rem; }
    .preset-chip { padding: 6px 10px; font-size: 0.74rem; }
    .mode-btn { padding: 8px 12px; font-size: 0.82rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .profile-chip .profile-meta { display: none; }
    .profile-chip { padding: 5px; }
    .brand-name { font-size: 1.15rem; }
    .hbar-row { grid-template-columns: 70px 1fr 58px; }
    .records-grid { grid-template-columns: 1fr 1fr; }
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .confetti-container { display: none; }
}
