:root {
    --bg: #090d16;
    --card: #161b2c;
    --accent: #38bdf8;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --step-color: #A855F7;
    --sidebar-w: 240px;
}

* { box-sizing: border-box; transition: all 0.2s ease; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); overflow-x: hidden; }
.hidden { display: none !important; }

/* Layout */
.dashboard { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: rgba(0,0,0,0.3); border-right: 1px solid rgba(255,255,255,0.05); padding: 30px 15px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.main-content { padding: 40px; }

/* Вкладки */
.tab-content { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Sidebar */
.logo { display: flex; align-items: center; margin-bottom: 40px; }
.logo-text { font-size: 20px; font-weight: bold; margin-left: 10px; background: linear-gradient(90deg, #38bdf8, #a855f7); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-menu { flex-grow: 1; }
.nav-item { display: flex; align-items: center; background: none; border: none; padding: 12px; border-radius: 12px; color: var(--text-muted); cursor: pointer; width: 100%; margin-bottom: 5px; }
.nav-item.active { background: rgba(56, 189, 248, 0.1); color: var(--accent); }
.nav-label { margin-left: 10px; }

/* Мовний перемикач */
.language-toggle {
    position: relative; display: flex; align-items: center;
    background: rgba(255,255,255,0.1); border-radius: 20px; padding: 3px;
    margin-left: 10px; cursor: pointer; width: 70px; height: 28px; flex-shrink: 0;
}
.lang-option { flex: 1; text-align: center; font-size: 14px; z-index: 2; transition: color 0.2s ease; user-select: none; }
.lang-option.active { color: var(--accent); font-weight: bold; }
.lang-slider {
    position: absolute; top: 3px; left: 3px;
    width: calc(50% - 3px); height: calc(100% - 6px);
    background: var(--card); border-radius: 17px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.language-toggle[data-lang="en"] .lang-slider { transform: translateX(100%); }

/* Bento Grid */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--card); padding: 25px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.05); }
.content-grid { display: grid; grid-template-columns: 1fr 300px 1fr; gap: 25px; }
.mentor-box, .steps-container-large, .tasks-box { background: var(--card); padding: 25px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.05); min-height: 400px; }

/* Кроки — шапка */
.steps-container-large .steps-header {
    width: 100%; display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;
}
.steps-container-large .steps-header .label { margin: 0; }
.steps-btn {
    background: rgba(56, 189, 248, 0.1); color: var(--accent);
    border: 1px solid var(--accent); padding: 6px 12px; border-radius: 8px;
    cursor: pointer; font-weight: 600; font-size: 12px; transition: all 0.2s ease; white-space: nowrap;
}
.steps-btn:hover { background: var(--accent); color: #000; transform: translateY(-2px); }
@keyframes stepsSaved { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.steps-saved { animation: stepsSaved 0.3s ease; }

/* Крокометр */
.steps-container-large { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.step-circle-box { position: relative; width: 200px; height: 200px; margin: 20px 0; }
.step-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.step-bg { fill: none; stroke: #1e293b; stroke-width: 8; }
.step-fill { fill: none; stroke: var(--step-color); stroke-width: 8; stroke-dasharray: 283; stroke-dashoffset: 283; stroke-linecap: round; }
.step-data { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }

/* User profile */
.user-mini-profile { display: flex; align-items: center; gap: 8px; padding: 10px 0; flex-wrap: wrap; }
.user-mini-profile img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.user-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.user-info span { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.level-badge { font-size: 11px; color: var(--accent); }

/* Кнопка плюс */
.task-header { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 10; margin-bottom: 20px; }
.btn-plus {
    background: var(--accent) !important; color: #000; border: none; width: 40px; height: 40px;
    border-radius: 50%; cursor: pointer; font-size: 24px; font-weight: bold;
    display: flex; align-items: center; justify-content: center; z-index: 999; pointer-events: auto !important;
}

/* Auth & Modals */
#auth-screen { height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--card); padding: 40px; border-radius: 30px; text-align: center; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.modal-content { background: var(--card); padding: 30px; border-radius: 20px; width: 350px; text-align: center; }
input, select { background: #090d16; border: 1px solid #334155; color: white; padding: 12px; border-radius: 10px; width: 100%; margin: 10px 0; }
.save-btn { background: var(--accent); color: #000; border: none; padding: 15px; border-radius: 10px; width: 100%; font-weight: bold; cursor: pointer; }
.close-txt { background: none; border: none; color: var(--text-muted); margin-top: 15px; cursor: pointer; }

/* Спідометр */
.speedometer-container { position: relative; width: 160px; height: 160px; margin: 20px auto; }
.speedo-bg { fill: none; stroke: #1e293b; stroke-width: 10; }
.speedo-fill { fill: none; stroke: var(--accent); stroke-width: 10; stroke-dasharray: 440; stroke-dashoffset: 440; stroke-linecap: round; }
.speedo-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 24px; font-weight: bold; }
.finish-btn { background: #10b981; color: white; border: none; padding: 15px; border-radius: 10px; width: 100%; font-weight: bold; cursor: pointer; margin-top: 20px; }
.progress-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.progress-overlay .modal-content {
    background: #161b2c; padding: 30px; border-radius: 20px; width: 90%; max-width: 400px;
    text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1);
}

/* Кольори */
h1, h2, h3, .label, .stat-card h2 { color: var(--accent) !important; }
#modal-task-title {
    background: linear-gradient(90deg, #38bdf8, #a855f7);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    font-size: 26px; font-weight: 800; margin-bottom: 10px; display: inline-block;
}
header h2 span#user-name { color: var(--accent); }
#progress-percent, .speedo-text { color: var(--accent) !important; font-weight: bold; }
.task-item strong { color: var(--accent); }
#modal-ai-role { color: #a855f7; font-weight: bold; margin-top: 5px; }
#ai-fun-text { color: #cbd5e1; font-style: italic; line-height: 1.4; margin: 15px 0; }

/* Графік */
.streak-chart { background: var(--card); padding: 25px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.05); margin-top: 20px; }
.chart-bars { display: flex; align-items: flex-end; justify-content: space-between; height: 120px; margin-top: 20px; gap: 10px; padding: 0 10px; }
.chart-bar {
    flex: 1; background: linear-gradient(180deg, var(--accent), var(--step-color));
    border-radius: 6px 6px 0 0; min-width: 25px; position: relative;
    transition: height 0.4s ease, transform 0.2s ease;
}
.chart-bar:hover { transform: scaleY(1.05); filter: brightness(1.1); }
.chart-bar::after {
    content: attr(data-day); position: absolute; bottom: -25px; left: 50%;
    transform: translateX(-50%); font-size: 11px; color: var(--text-muted);
}
.chart-bar.empty { background: rgba(255,255,255,0.1); }

/* Досягнення */
.achievements-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; margin-top: 20px; }
.achievement-card {
    background: var(--card); padding: 20px 15px; border-radius: 20px; text-align: center;
    border: 2px solid transparent; transition: all 0.3s ease; position: relative; overflow: hidden;
}
.achievement-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--step-color)); opacity: 0; transition: opacity 0.3s ease;
}
.achievement-card.unlocked { border-color: var(--accent); box-shadow: 0 0 25px rgba(56,189,248,0.2); }
.achievement-card.unlocked::before { opacity: 1; }
.achievement-card.locked { opacity: 0.7; filter: grayscale(0.4); }
.achievement-card:hover { transform: translateY(-3px); }
.achievement-icon { font-size: 36px; margin-bottom: 12px; display: block; }
.achievement-card.unlocked .achievement-icon { filter: drop-shadow(0 0 10px rgba(56,189,248,0.5)); }
.achievement-name { font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--text); }
.achievement-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; min-height: 32px; }
.achievement-progress { margin-top: 12px; height: 5px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.achievement-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--step-color)); border-radius: 3px; transition: width 0.5s ease; }
.achievement-card.unlocked .achievement-progress-fill { width: 100%; }
.achievement-card.locked .achievement-progress-fill { width: 30%; opacity: 0.5; }

/* Адаптив */
@media (max-width: 1024px) {
    .content-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .achievements-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
@media (max-width: 768px) {
    .dashboard { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: -100%; top: 0; height: 100vh; z-index: 1000; transition: left 0.3s ease; width: var(--sidebar-w); }
    .sidebar.open { left: 0; }
    .menu-toggle {
        display: block !important; position: fixed; top: 20px; left: 20px; z-index: 1001;
        background: var(--accent); border: none; width: 45px; height: 45px; border-radius: 12px; font-size: 20px; cursor: pointer;
    }
    .main-content { padding: 80px 20px 20px; }
    .achievements-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-bars { height: 100px; }
    .user-mini-profile { flex-wrap: wrap; }
    .language-toggle { margin-left: 0; margin-top: 8px; }
}
@media (max-width: 480px) {
    .achievements-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 20px; }
}
.menu-toggle { display: none; }