/* ===================== BASE ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f13;
  --bg2: #17171f;
  --bg3: #1e1e2a;
  --bg4: #26263a;
  --border: #2a2a3e;
  --text: #e8e8f0;
  --text2: #9090b0;
  --primary: #6366f1;
  --primary-d: #4f52d9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --pink: #ec4899;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
  --glow: 0 0 20px rgba(99,102,241,0.3);
}

html, body { height: 100%; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); }

.emoji, .auth-logo, .streak-fire, .nav-icon, .goal-icon-wrap,
.icon-option, .mood-btn, .quote-icon, .badge-icon, .stat-icon,
.bn-icon, .day-completion-icon, .logo-icon {
  font-family: 'Noto Color Emoji', 'Segoe UI Emoji', 'Apple Color Emoji', 'Twemoji Mozilla', sans-serif;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===================== SCREEN ===================== */
.screen { min-height: 100vh; }

/* ===================== AUTH ===================== */
.auth-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; background: radial-gradient(ellipse at top, #1a1a2e 0%, var(--bg) 70%);
}
.auth-hero { text-align: center; margin-bottom: 32px; }
.auth-logo { font-size: 64px; margin-bottom: 12px; filter: drop-shadow(0 0 20px rgba(99,102,241,0.6)); }
.auth-title { font-size: 2.4rem; font-weight: 800; background: linear-gradient(135deg, #6366f1, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.auth-sub { color: var(--text2); margin-top: 8px; font-size: 1rem; }

.auth-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 20px;
  padding: 32px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.auth-tabs { display: flex; gap: 8px; margin-bottom: 24px; background: var(--bg3); border-radius: var(--radius-sm); padding: 4px; }
.auth-tab { flex: 1; padding: 10px; border: none; background: transparent; color: var(--text2); border-radius: var(--radius-sm); cursor: pointer; font-size: 0.95rem; font-weight: 600; transition: all 0.2s; }
.auth-tab.active { background: var(--primary); color: #fff; }

/* ===================== FORMS ===================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text2); margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 11px 14px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.95rem; transition: border 0.2s;
  outline: none;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-group select { cursor: pointer; }
.form-group textarea { resize: vertical; min-height: 60px; }
.form-row { display: flex; gap: 12px; }
.flex-1 { flex: 1; }
.form-error { color: var(--danger); font-size: 0.85rem; margin-bottom: 12px; min-height: 18px; }

/* ===================== BUTTONS ===================== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border: none; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); box-shadow: var(--glow); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); }
.btn-ghost { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg4); }
.btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 1rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* ===================== APP LAYOUT ===================== */
#app-screen { display: flex; height: 100vh; overflow: hidden; }

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: 240px; min-width: 240px; background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 12px; overflow-y: auto;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 20px; }
.logo-icon { font-size: 1.6rem; }
.logo-text { font-size: 1.2rem; font-weight: 800; background: linear-gradient(135deg, #6366f1, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.user-panel { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg3); border-radius: var(--radius); margin-bottom: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1rem; color: #fff; flex-shrink: 0; }
.user-info { overflow: hidden; }
.user-name { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.level-badge { font-size: 0.75rem; color: var(--warning); font-weight: 600; }

.xp-container { padding: 8px 12px; margin-bottom: 12px; }
.xp-label { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text2); margin-bottom: 6px; }
.xp-bar { height: 8px; background: var(--bg4); border-radius: 4px; overflow: hidden; }
.xp-fill { height: 100%; background: linear-gradient(90deg, #6366f1, #ec4899); border-radius: 4px; transition: width 0.6s ease; }

.streak-badge { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(239,68,68,0.1)); border: 1px solid rgba(245,158,11,0.3); border-radius: var(--radius); margin-bottom: 16px; }
.streak-fire { font-size: 1.2rem; }
#streak-count { font-size: 1.3rem; font-weight: 800; color: var(--warning); }
.streak-label { font-size: 0.75rem; color: var(--text2); }

.nav-links { list-style: none; flex: 1; }
.nav-links li { margin-bottom: 4px; }
.nav-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; background: transparent; color: var(--text2); border-radius: var(--radius-sm); cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: all 0.2s; text-align: left; }
.nav-btn:hover { background: var(--bg3); color: var(--text); }
.nav-btn.active { background: rgba(99,102,241,0.15); color: var(--primary); font-weight: 700; }
.nav-icon { font-size: 1rem; }

.btn-logout { margin-top: 12px; width: 100%; padding: 9px; background: transparent; border: 1px solid var(--border); color: var(--text2); border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.btn-logout:hover { background: rgba(239,68,68,0.1); border-color: var(--danger); color: var(--danger); }

/* ===================== MAIN CONTENT ===================== */
.main-content { flex: 1; overflow-y: auto; padding: 28px 32px; background: var(--bg); }
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 1.6rem; font-weight: 800; }
.page-subtitle { color: var(--text2); margin-top: 4px; }
.header-points { display: flex; align-items: center; gap: 6px; background: var(--bg2); border: 1px solid var(--border); border-radius: 20px; padding: 8px 16px; font-weight: 700; color: var(--warning); font-size: 1rem; }
.points-icon { font-size: 1.1rem; }

/* ===================== SECTION ===================== */
.section { margin-bottom: 28px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-header h3, .section > h3 { font-size: 1rem; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 14px; }
.progress-badge { background: rgba(99,102,241,0.15); color: var(--primary); padding: 4px 12px; border-radius: 20px; font-size: 0.82rem; font-weight: 700; }

/* ===================== GOAL CARDS ===================== */
.goals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.goals-grid-full { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.goal-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px; position: relative; overflow: hidden; transition: all 0.25s;
  display: flex; flex-direction: column; gap: 8px;
}
.goal-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--card-color, var(--primary));
}
.goal-card:hover { border-color: var(--card-color, var(--primary)); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.goal-card.completed-today { opacity: 0.75; }

.goal-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.goal-icon-wrap { font-size: 1.8rem; line-height: 1; }
.goal-card-actions { display: flex; gap: 6px; }
.goal-action-btn { background: var(--bg3); border: none; color: var(--text2); width: 30px; height: 30px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.goal-action-btn:hover { background: var(--bg4); color: var(--text); }
.goal-action-btn.btn-archive:hover { background: rgba(239,68,68,0.15); color: var(--danger); }

.goal-title { font-size: 1rem; font-weight: 700; }
.goal-category-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; width: fit-content;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.goal-meta { display: flex; gap: 10px; font-size: 0.78rem; color: var(--text2); flex-wrap: wrap; }
.goal-meta span { display: flex; align-items: center; gap: 3px; }

.goal-progress { margin-top: 2px; }
.goal-progress-bar { height: 6px; background: var(--bg4); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.goal-progress-fill { height: 100%; border-radius: 3px; background: var(--card-color, var(--primary)); transition: width 0.4s ease; }
.goal-progress-text { font-size: 0.74rem; color: var(--text2); }

/* Complete / Done buttons on cards */
.btn-complete-full {
  width: 100%; padding: 9px; border: none; border-radius: 8px;
  background: rgba(16,185,129,0.12); color: var(--success);
  font-size: 0.88rem; font-weight: 700; cursor: pointer;
  transition: all 0.2s; margin-top: 4px;
  border: 1px solid rgba(16,185,129,0.25);
}
.btn-complete-full:hover { background: var(--success); color: #fff; border-color: var(--success); }
.btn-complete-full:active { transform: scale(0.97); }

.done-badge {
  width: 100%; padding: 8px; border-radius: 8px;
  background: rgba(16,185,129,0.1); color: var(--success);
  font-size: 0.85rem; font-weight: 700; text-align: center;
  border: 1px solid rgba(16,185,129,0.2); margin-top: 4px;
}

/* ===================== QUOTE CARD ===================== */
.quote-card {
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(236,72,153,0.08));
  border: 1px solid rgba(99,102,241,0.2); border-radius: 16px; padding: 20px;
  display: flex; align-items: flex-start; gap: 14px; margin-bottom: 28px;
}
.quote-icon { font-size: 1.5rem; flex-shrink: 0; }
#quote-text { font-size: 0.95rem; line-height: 1.6; color: var(--text2); font-style: italic; }

/* ===================== WEEK CHART ===================== */
.week-chart { display: flex; gap: 8px; align-items: flex-end; height: 100px; }
.week-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week-bar-outer { width: 100%; flex: 1; background: var(--bg3); border-radius: 6px 6px 0 0; display: flex; align-items: flex-end; overflow: hidden; min-height: 60px; }
.week-bar-inner { width: 100%; background: linear-gradient(180deg, #6366f1, #ec4899); border-radius: 6px 6px 0 0; transition: height 0.5s ease; min-height: 4px; }
.week-bar-label { font-size: 0.7rem; color: var(--text2); }

/* ===================== GOALS FILTER ===================== */
.goals-filter { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-btn { padding: 7px 16px; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); border-radius: 20px; cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: all 0.2s; }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filter-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

/* ===================== CALENDAR ===================== */
.cal-nav { display: flex; align-items: center; gap: 16px; }
.cal-nav-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-size: 1.5rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; line-height: 1; font-weight: 300;
}
.cal-nav-btn:hover { background: var(--primary); border-color: var(--primary); }
.cal-month-title { font-size: 1.1rem; font-weight: 700; min-width: 160px; text-align: center; }
.cal-legend { display: flex; gap: 16px; margin-bottom: 14px; font-size: 0.8rem; color: var(--text2); flex-wrap: wrap; }
.cal-legend-item { display: flex; align-items: center; gap: 6px; }
.cal-dot-sample { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); display: inline-block; }
.cal-today-marker { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--primary); display: inline-block; }
.cal-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 3px; min-width: 280px;
}
.calendar-day-header {
  text-align: center; font-size: 0.7rem; font-weight: 700;
  color: var(--text2); padding: 10px 2px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.calendar-day {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 4px; cursor: pointer;
  transition: all 0.18s; min-height: 64px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.calendar-day:hover { border-color: var(--primary); background: var(--bg3); }
.calendar-day:active { transform: scale(0.94); }
.calendar-day.today { border-color: var(--primary); background: rgba(99,102,241,0.08); box-shadow: 0 0 0 2px rgba(99,102,241,0.2); }
.calendar-day.has-completions { background: var(--bg3); }
.calendar-day.selected { border-color: #ec4899 !important; box-shadow: 0 0 0 2px rgba(236,72,153,0.25) !important; }
.calendar-day.empty { background: transparent; border-color: transparent; cursor: default; pointer-events: none; }
.calendar-day-num {
  font-size: 0.8rem; font-weight: 700; color: var(--text2);
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.calendar-day.today .calendar-day-num { background: var(--primary); color: #fff; }
.calendar-dots { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; width: 100%; }
.calendar-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.calendar-day-points { font-size: 0.6rem; color: var(--warning); font-weight: 700; margin-top: auto; }
.day-detail {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; margin-top: 16px;
  animation: fadeIn 0.25s ease;
}
.day-detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.day-detail-header h4 { font-size: 1rem; font-weight: 700; }
.day-detail-close {
  background: var(--bg3); border: none; color: var(--text2);
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
  font-size: 0.9rem; display: flex; align-items: center; justify-content: center;
}
.day-detail-close:hover { background: var(--bg4); color: var(--text); }
.day-completion-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--bg3);
  border-radius: var(--radius-sm); margin-bottom: 8px;
  border-left: 3px solid var(--item-color, var(--primary));
}
.day-completion-icon { font-size: 1.5rem; flex-shrink: 0; }
.day-completion-info h5 { font-size: 0.88rem; font-weight: 600; }
.day-completion-info p { font-size: 0.77rem; color: var(--text2); margin-top: 2px; }
.day-empty-msg { text-align: center; color: var(--text2); font-size: 0.9rem; padding: 20px 0; }

/* ===================== STATS ===================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px; text-align: center;
}
.stat-icon { font-size: 2rem; margin-bottom: 8px; }
.stat-value { font-size: 2rem; font-weight: 800; background: linear-gradient(135deg, #6366f1, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-label { font-size: 0.82rem; color: var(--text2); margin-top: 4px; font-weight: 500; }
.stat-card-wide { grid-column: span 2; }

/* ===================== BADGES ===================== */
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.badge-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px 16px; text-align: center; transition: all 0.2s;
}
.badge-card.earned { border-color: var(--warning); background: rgba(245,158,11,0.08); }
.badge-card:hover { transform: translateY(-2px); }
.badge-icon { font-size: 2.5rem; margin-bottom: 10px; }
.badge-name { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; }
.badge-desc { font-size: 0.75rem; color: var(--text2); }
.badge-card.locked { opacity: 0.4; filter: grayscale(1); }
.badge-earned-date { font-size: 0.7rem; color: var(--warning); margin-top: 6px; }

/* ===================== MODAL ===================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-sm { max-width: 380px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: var(--bg3); border: none; color: var(--text2); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--bg4); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 20px; }

/* ===================== DIFFICULTY PICKER ===================== */
.diff-picker { display: flex; gap: 6px; }
.diff-btn {
  flex: 1; padding: 8px 4px; border: 2px solid var(--border);
  background: var(--bg3); color: var(--text2); border-radius: 8px;
  cursor: pointer; font-size: 0.78rem; font-weight: 700; text-align: center;
  transition: all 0.18s; line-height: 1.4;
}
.diff-btn span { font-size: 0.68rem; font-weight: 500; opacity: 0.75; }
.diff-btn:hover { border-color: var(--primary); color: var(--text); }
.diff-btn.selected { border-color: var(--primary); background: rgba(99,102,241,0.15); color: var(--text); }
.diff-btn[data-diff="easy"].selected    { border-color: var(--success); background: rgba(16,185,129,0.12); }
.diff-btn[data-diff="medium"].selected  { border-color: var(--primary); background: rgba(99,102,241,0.12); }
.diff-btn[data-diff="hard"].selected    { border-color: var(--warning); background: rgba(245,158,11,0.12); }
.diff-btn[data-diff="epic"].selected    { border-color: var(--danger);  background: rgba(239,68,68,0.12); }

/* ===================== ICON & COLOR PICKER ===================== */
.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-option { width: 40px; height: 40px; border: 2px solid var(--border); background: var(--bg3); border-radius: 8px; cursor: pointer; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.icon-option:hover { border-color: var(--primary); transform: scale(1.1); }
.icon-option.selected { border-color: var(--primary); background: rgba(99,102,241,0.15); }

.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: all 0.15s; }
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px currentColor; }

/* ===================== MOOD PICKER ===================== */
.mood-picker { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }
.mood-btn { width: 44px; height: 44px; border: 2px solid var(--border); background: var(--bg3); border-radius: 10px; cursor: pointer; font-size: 1.4rem; transition: all 0.15s; display: flex; align-items: center; justify-content: center; }
.mood-btn:hover { transform: scale(1.15); border-color: var(--primary); }
.mood-btn.selected { border-color: var(--primary); background: rgba(99,102,241,0.15); transform: scale(1.15); }
.complete-goal-name { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: var(--primary); }

/* ===================== TOAST ===================== */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 20px; font-size: 0.9rem; font-weight: 600; box-shadow: var(--shadow);
  animation: slideUp 0.3s ease, fadeOut 0.4s ease 3s forwards;
  pointer-events: auto; max-width: 320px; display: flex; align-items: center; gap: 10px;
}
.toast.success { border-color: var(--success); background: rgba(16,185,129,0.1); }
.toast.error { border-color: var(--danger); background: rgba(239,68,68,0.1); }
.toast.warning { border-color: var(--warning); background: rgba(245,158,11,0.1); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }

/* ===================== LEVEL UP ANIMATION ===================== */
.level-up-banner {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, #6366f1, #ec4899); color: #fff;
  padding: 16px 32px; border-radius: 50px; font-size: 1.2rem; font-weight: 800;
  z-index: 300; box-shadow: var(--shadow-lg);
  animation: levelUpPop 0.4s ease, fadeOut2 0.5s ease 2.5s forwards;
}
@keyframes levelUpPop { 0% { transform: translateX(-50%) scale(0.5); opacity: 0; } 70% { transform: translateX(-50%) scale(1.05); } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }
@keyframes fadeOut2 { to { opacity: 0; transform: translateX(-50%) scale(0.9); } }

/* ===================== EMPTY STATE ===================== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text2); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { margin-bottom: 16px; font-size: 0.95rem; }

/* ===================== RESPONSIVE / MOBILE ===================== */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 50; justify-content: space-around;
}
.bottom-nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; color: var(--text2);
  font-size: 0.63rem; font-weight: 600; cursor: pointer;
  padding: 6px 10px; border-radius: 8px; min-width: 52px;
  transition: all 0.18s; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.bottom-nav-btn .bn-icon { font-size: 1.25rem; }
.bottom-nav-btn.active { color: var(--primary); }
.bottom-nav-btn.active .bn-icon { transform: scale(1.12); }
.mobile-topbar {
  display: none;
  align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40; flex-shrink: 0;
}
.mobile-topbar-brand { font-size: 1.05rem; font-weight: 900; letter-spacing: 0.03em;
  background: linear-gradient(135deg, #6366f1, #ec4899); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
}
.mobile-topbar-right { display: flex; align-items: center; gap: 10px; }
.mobile-pts { font-size: 0.8rem; font-weight: 700; color: var(--warning); background: rgba(245,158,11,0.12); padding: 4px 10px; border-radius: 20px; }
.mobile-avatar-btn { width: 32px; height: 32px; border-radius: 50%; border: none; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem; color: #fff; cursor: pointer; background: var(--primary); }

@media (max-width: 768px) {
  .sidebar { display: none !important; }
  .bottom-nav { display: flex; }
  .mobile-topbar { display: flex; }
  #app-screen { flex-direction: column; height: 100vh; overflow: hidden; }
  .main-content {
    padding: 16px 14px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
    overflow-y: auto; flex: 1;
    -webkit-overflow-scrolling: touch;
  }
  .auth-card { padding: 20px 16px; border-radius: 16px; }
  .auth-title { font-size: 1.85rem; }
  .auth-logo { font-size: 52px; }
  .auth-screen { padding: 16px; }
  .page-header { margin-bottom: 14px; }
  .page-header h2 { font-size: 1.25rem; }
  .goals-grid, .goals-grid-full { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card-wide { grid-column: span 2; }
  .stat-value { font-size: 1.6rem; }
  .badges-grid { grid-template-columns: repeat(2, 1fr); }
  .calendar-day { min-height: 50px; padding: 4px 2px; }
  .calendar-day-num { font-size: 0.75rem; width: 22px; height: 22px; }
  .calendar-dot { width: 5px; height: 5px; }
  .cal-month-title { font-size: 0.95rem; min-width: 120px; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92vh; width: 100%; max-width: 100%; }
  .form-row { flex-direction: column; gap: 0; }
  .btn { min-height: 44px; }
  .goal-action-btn { width: 36px; height: 36px; }
  .mood-btn { width: 50px; height: 50px; font-size: 1.5rem; }
  .icon-option { width: 44px; height: 44px; }
  .filter-btn { padding: 8px 14px; white-space: nowrap; }
  .goals-filter { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .goals-filter::-webkit-scrollbar { display: none; }
  #toast-container { left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); }
  .toast { max-width: 100%; }
  .week-chart { height: 80px; }
  .quote-card { padding: 14px; }
  .header-points { font-size: 0.9rem; padding: 6px 12px; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .calendar-day { min-height: 42px; }
  .cal-nav-btn { width: 32px; height: 32px; font-size: 1.2rem; }
}

/* ===================== SOCIAL SHARE ===================== */
.btn-share {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--text); border-radius: var(--radius-sm); font-size: 0.85rem;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn-share:hover { background: var(--bg4); border-color: var(--primary); color: var(--primary); }
.btn-share .share-icon { font-size: 1.1em; font-family: "Noto Color Emoji", "Segoe UI Emoji", "Apple Color Emoji", sans-serif; margin-right: 4px; }

.share-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.share-modal-content {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 20px;
  padding: 32px; width: 90%; max-width: 500px; box-shadow: var(--shadow-lg);
  animation: modalFadeIn 0.2s;
}
@keyframes modalFadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.share-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.share-modal-title { font-size: 1.4rem; font-weight: 700; }
.share-modal-close { background: transparent; border: none; color: var(--text2); font-size: 1.5rem; cursor: pointer; }
.share-modal-body { margin-bottom: 24px; }
.share-preview {
  background: var(--bg3); border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.share-preview-title { font-size: 0.85rem; color: var(--text2); margin-bottom: 8px; }
.share-preview-text { font-size: 1rem; line-height: 1.5; }

.share-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.share-btn-twitter { background: #1da1f2; color: #fff; border: none; padding: 8px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: all 0.2s; }
.share-btn-twitter:hover { background: #1a91da; }
.share-btn-facebook { background: #1877f2; color: #fff; border: none; padding: 8px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: all 0.2s; }
.share-btn-facebook:hover { background: #166fe5; }
.share-btn-linkedin { background: #0077b5; color: #fff; border: none; padding: 8px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: all 0.2s; }
.share-btn-linkedin:hover { background: #006a9e; }
.share-btn-whatsapp { background: #25d366; color: #fff; border: none; padding: 8px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: all 0.2s; }
.share-btn-whatsapp:hover { background: #20bd5a; }
.share-btn-copy { background: var(--primary); color: #fff; }

.share-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.share-tag {
  background: var(--bg4); color: var(--primary); padding: 4px 10px; border-radius: 12px;
  font-size: 0.8rem; font-weight: 600;
}
