:root {
  --bg: #fdfeea;
  --bg-2: #f9fbbe;
  --secondary-bg: rgba(255, 255, 255, 0.75);
  --surface-border: rgba(16, 19, 8, 0.10);
  --text: #101308;
  --hint: #5c5f52;
  --link: #4a4f33;
  --button-text: #ffffff;
  --accent-1: #90c849;
  --accent-2: #4a4f33;
  --accent: #90c849;
  --accent-gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  --success: #90c849;
  --success-2: #4a4f33;
  --danger: #ef4444;
  --gold: #f5b942;
  --shadow: 0 14px 34px -14px rgba(16, 19, 8, 0.26);
  --glow: 0 0 0 rgba(144, 200, 73, 0);
  --font-display: 'Outfit', 'Manrope', -apple-system, sans-serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101308;
    --bg-2: #1a1f10;
    --secondary-bg: rgba(255, 255, 255, 0.05);
    --surface-border: rgba(255, 255, 255, 0.09);
    --text: #fdfeea;
    --hint: #979a6e;
    --link: #90c849;
    --button-text: #ffffff;
    --accent-1: #90c849;
    --accent-2: #4a4f33;
    --accent: #90c849;
    --accent-gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    --success: #90c849;
    --success-2: #4a4f33;
    --danger: #ff5f72;
    --gold: #ffc857;
    --shadow: 0 20px 44px -14px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  overflow-x: hidden;
}

button, input { font-family: inherit; }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 100px;
  position: relative;
}

.hidden { display: none !important; }

/* Decorative background */
.bg-decor { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob {
  position: absolute; border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  animation: blob-float 16s ease-in-out infinite;
}
.blob-1 { width: 280px; height: 280px; top: -80px; left: -60px; background: #90c849; animation-delay: 0s; }
.blob-2 { width: 240px; height: 240px; top: 30%; right: -100px; background: #e4f78a; opacity: 0.4; animation-delay: -5s; }
.blob-3 { width: 220px; height: 220px; bottom: 60px; left: -80px; background: #f9fbbe; opacity: 0.3; animation-delay: -10s; }
@media (prefers-color-scheme: light) { .blob { opacity: 0.28; } .blob-2 { opacity: 0.2; } .blob-3 { opacity: 0.16; } }
@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, 30px) scale(1.08); }
  66% { transform: translate(-15px, -20px) scale(0.94); }
}
@media (prefers-reduced-motion: reduce) { .blob { animation: none; } }

#confetti-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 200; pointer-events: none;
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 18px 12px;
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--bg);
}
.greeting { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.date { color: var(--hint); font-size: 13px; margin-top: 3px; text-transform: capitalize; }

.top-bar-actions { display: flex; align-items: center; gap: 10px; }
.premium-badge-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--surface-border); background: var(--secondary-bg);
  font-size: 15px; cursor: pointer; backdrop-filter: blur(12px);
  transition: transform 0.15s ease;
}
.premium-badge-btn:active { transform: scale(0.9); }
.premium-badge-btn.active {
  background: var(--accent-gradient); border-color: transparent;
  box-shadow: 0 0 12px rgba(144, 200, 73, 0.5);
}
.lang-toggle {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--surface-border); background: var(--secondary-bg);
  color: var(--text); font-size: 11px; font-weight: 800; font-family: var(--font-display);
  cursor: pointer; backdrop-filter: blur(12px);
  transition: transform 0.15s ease;
}
.lang-toggle:active { transform: scale(0.9); }

.ring-wrap { position: relative; width: 58px; height: 58px; flex-shrink: 0; }
.ring { width: 58px; height: 58px; transform: rotate(-90deg); filter: drop-shadow(0 0 8px rgba(144, 200, 73, 0.35)); }
.ring-bg { fill: none; stroke: var(--surface-border); stroke-width: 6; }
.ring-progress {
  fill: none;
  stroke: url(#ring-gradient);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 169.6;
  stroke-dashoffset: 169.6;
  transition: stroke-dashoffset 0.6s cubic-bezier(.34,1.4,.64,1);
}
.ring-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
}

/* Character bar */
.character-bar {
  display: flex; align-items: center; gap: 12px;
  width: calc(100% - 28px); margin: 0 14px 14px;
  background: var(--secondary-bg); border: 1px solid var(--surface-border);
  border-radius: 18px; padding: 10px 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  cursor: pointer; position: relative; z-index: 1;
  transition: transform 0.15s ease;
}
.character-bar:active { transform: scale(0.98); }
.char-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  box-shadow: 0 0 14px rgba(144, 200, 73, 0.4);
  animation: float-y 3.6s ease-in-out infinite;
}
.char-info { flex: 1; min-width: 0; text-align: left; }
.char-title { font-family: var(--font-display); font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.char-xp-track { height: 6px; border-radius: 6px; background: var(--surface-border); overflow: hidden; }
.char-xp-fill { height: 100%; border-radius: 6px; background: var(--accent-gradient); width: 0%; transition: width 0.7s cubic-bezier(.2,.8,.3,1); }
.char-chevron { color: var(--hint); font-size: 20px; flex-shrink: 0; }

.character-modal-body { align-items: center; text-align: center; padding-bottom: 20px; }
.char-big-avatar {
  font-size: 64px; margin: 6px 0 10px;
  animation: float-y 3.4s ease-in-out infinite;
  filter: drop-shadow(0 10px 20px rgba(144, 200, 73, 0.4));
}
.char-big-title { font-family: var(--font-display); font-size: 22px; font-weight: 800; }
.char-big-level { color: var(--hint); font-size: 13px; font-weight: 700; margin-top: 2px; }
.char-xp-track.big { height: 10px; width: 100%; margin-top: 18px; }
.char-xp-numbers { font-size: 12px; color: var(--hint); margin-top: 6px; font-weight: 600; }

.char-roadmap-title {
  font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--hint);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin: 24px 0 10px; align-self: flex-start;
}
.char-roadmap { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.roadmap-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--secondary-bg); border: 1px solid var(--surface-border);
  border-radius: 12px; padding: 9px 12px;
  opacity: 0.4;
}
.roadmap-row.unlocked { opacity: 1; }
.roadmap-row.current { border-color: var(--accent-1); box-shadow: 0 0 0 1px var(--accent-1); }
.roadmap-emoji { font-size: 19px; flex-shrink: 0; }
.roadmap-name { flex: 1; font-size: 13px; font-weight: 700; text-align: left; }
.roadmap-req { font-size: 11px; color: var(--hint); font-weight: 700; flex-shrink: 0; }

/* Content */
#content { padding: 6px 14px 10px; position: relative; z-index: 1; }
.view { animation: fade-in 0.22s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--hint);
  margin: 24px 4px 10px;
  font-weight: 700;
}

/* Glass surface base */
.glass {
  background: var(--secondary-bg);
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* Today: habits/tasks switch */
.today-switch {
  display: flex; gap: 10px;
  margin: 4px 0 18px;
}
.today-switch-btn {
  flex: 1; padding: 15px 10px; border-radius: 16px;
  border: 1.5px solid var(--surface-border);
  background: var(--secondary-bg); color: var(--text);
  font-family: var(--font-display); font-size: 15px; font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  backdrop-filter: blur(18px);
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1), box-shadow 0.2s ease;
}
.today-switch-btn:active { transform: scale(0.97); }
.today-switch-btn.active {
  background: var(--accent-gradient); color: #fff; border-color: transparent;
  box-shadow: 0 8px 20px -6px rgba(144, 200, 73, 0.55);
}

/* Habit list (today) */
.habit-list { display: flex; flex-direction: column; gap: 10px; }
.habit-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--secondary-bg);
  border-radius: 18px;
  padding: 14px 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--surface-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1), opacity 0.25s ease, box-shadow 0.2s ease;
  user-select: none;
  animation: card-in 0.32s cubic-bezier(.2,.8,.3,1) backwards;
}
@keyframes card-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.habit-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent-gradient);
  opacity: 0.85;
}
.habit-card:active { transform: scale(0.97); }
.habit-card.done { opacity: 0.55; box-shadow: none; }
.habit-check {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--surface-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
  transition: all 0.25s cubic-bezier(.34,1.56,.64,1);
}
.habit-card.done .habit-check {
  background: linear-gradient(135deg, var(--success), var(--success-2));
  border-color: transparent;
  color: #fff;
  transform: scale(1.08);
  box-shadow: 0 0 14px rgba(144, 200, 73, 0.5);
}
.habit-emoji { font-size: 23px; flex-shrink: 0; }
.habit-info { flex: 1; min-width: 0; }
.habit-name { font-weight: 700; font-size: 15px; }
.habit-card.done .habit-name { text-decoration: line-through; }
.habit-meta { font-size: 12px; color: var(--hint); margin-top: 2px; }
.streak-badge {
  font-size: 12px; font-weight: 800; color: #b45309;
  background: linear-gradient(135deg, rgba(245, 185, 66, 0.22), rgba(74, 79, 51, 0.14));
  padding: 4px 9px; border-radius: 20px; flex-shrink: 0;
}
@media (prefers-color-scheme: dark) { .streak-badge { color: var(--gold); } }

/* Habits management list */
.habit-manage-list { display: flex; flex-direction: column; gap: 10px; }
.manage-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--secondary-bg);
  border-radius: 18px; padding: 12px 14px;
  border: 1px solid var(--surface-border);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.manage-card .habit-emoji { font-size: 24px; }
.manage-card .habit-info { flex: 1; min-width: 0; }
.category-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-gradient); margin-right: 5px;
}
.manage-card .icon-btn { color: var(--hint); }

.habits-toolbar { margin: 4px 4px 12px; }
.btn-secondary {
  width: 100%; padding: 13px; border-radius: 16px;
  border: 1.5px dashed var(--accent-1); background: transparent;
  color: var(--accent-1); font-weight: 700; font-size: 14px; cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease;
}
.btn-secondary:active { transform: scale(0.98); background: rgba(144, 200, 73, 0.08); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--hint); }
.empty-emoji { font-size: 46px; margin-bottom: 10px; display: inline-block; animation: float-y 3s ease-in-out infinite; }
@keyframes float-y { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.preset-empty-btn { margin: 16px auto 0; max-width: 220px; }

/* Preset library */
.preset-hint { font-size: 12px; color: var(--hint); margin: 0 0 4px; line-height: 1.4; }
.preset-group-title { font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--accent-1); margin: 16px 0 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.preset-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--surface-border);
  cursor: pointer; user-select: none;
  transition: background 0.15s ease;
  border-radius: 10px;
}
.preset-row:active { background: rgba(144, 200, 73, 0.08); }
.preset-row:last-child { border-bottom: none; }
.preset-check {
  width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0;
  border: 2px solid var(--surface-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: transparent;
  transition: all 0.2s cubic-bezier(.34,1.56,.64,1);
}
.preset-row.selected .preset-check { background: var(--accent-gradient); border-color: transparent; color: #fff; transform: scale(1.1); }
.preset-emoji { font-size: 19px; flex-shrink: 0; }
.preset-name { flex: 1; font-size: 14px; }

/* FAB */
.fab {
  position: fixed;
  right: max(20px, calc(50% - 260px));
  bottom: 100px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  font-size: 27px;
  font-weight: 300;
  box-shadow: 0 8px 24px -4px rgba(144, 200, 73, 0.55), 0 0 0 0 rgba(144, 200, 73, 0.5);
  cursor: pointer;
  z-index: 20;
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1);
  animation: fab-pulse 2.8s ease-in-out infinite;
}
.fab:active { transform: scale(0.9); }
@keyframes fab-pulse {
  0%, 100% { box-shadow: 0 8px 24px -4px rgba(144, 200, 73, 0.55), 0 0 0 0 rgba(144, 200, 73, 0.35); }
  50% { box-shadow: 0 8px 24px -4px rgba(144, 200, 73, 0.55), 0 0 0 10px rgba(144, 200, 73, 0); }
}
@media (prefers-reduced-motion: reduce) { .fab { animation: none; } }

/* Tab bar */
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 14px;
  max-width: 520px; margin: 0 auto;
  display: flex;
  background: var(--secondary-bg);
  border: 1px solid var(--surface-border);
  border-radius: 22px;
  padding: 6px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  z-index: 10;
}
.tab-indicator {
  position: absolute; top: 6px; bottom: 6px; left: 0;
  width: 0;
  border-radius: 16px;
  background: var(--accent-gradient);
  box-shadow: 0 4px 14px -2px rgba(144, 200, 73, 0.5);
  transition: transform 0.32s cubic-bezier(.34,1.4,.64,1), width 0.32s cubic-bezier(.34,1.4,.64,1);
  z-index: 0;
}
.tab-btn {
  flex: 1; background: none; border: none; color: var(--hint);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 700; padding: 8px 0; cursor: pointer;
  position: relative; z-index: 1;
  transition: color 0.25s ease;
}
.tab-icon { font-size: 18px; transition: transform 0.25s cubic-bezier(.34,1.56,.64,1); }
.tab-btn.active { color: #fff; }
.tab-btn.active .tab-icon { transform: scale(1.12) translateY(-1px); }

/* Stats */
.stat-cards {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 8px;
}
.stat-card {
  background: var(--secondary-bg); border: 1px solid var(--surface-border);
  border-radius: 18px; padding: 14px; box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; top: -30%; right: -20%; width: 70px; height: 70px;
  background: var(--accent-gradient); opacity: 0.12; border-radius: 50%; filter: blur(14px);
}
.stat-value { font-family: var(--font-display); font-size: 23px; font-weight: 800; position: relative; }
.stat-label { font-size: 12px; color: var(--hint); margin-top: 2px; position: relative; }

.heatmap {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  gap: 3px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.heat-cell {
  width: 12px; height: 12px; border-radius: 3px;
  background: var(--surface-border);
  transition: transform 0.15s ease;
}
.heat-cell[data-level="1"] { background: rgba(144, 200, 73, 0.35); }
.heat-cell[data-level="2"] { background: rgba(144, 200, 73, 0.6); }
.heat-cell[data-level="3"] { background: linear-gradient(135deg, var(--success), var(--success-2)); }
.heat-cell[data-level="4"] { background: linear-gradient(135deg, var(--success), var(--success-2)); box-shadow: 0 0 6px rgba(144, 200, 73, 0.7); }

/* Chart cards */
.chart-card {
  background: var(--secondary-bg); border: 1px solid var(--surface-border);
  border-radius: 18px; padding: 14px; box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  margin-top: 4px;
}
/* Trend line/area chart */
.trend-svg { width: 100%; height: 120px; display: block; overflow: visible; }
.trend-area { fill: url(#trend-gradient); opacity: 0.6; }
.trend-line {
  fill: none; stroke: url(#trend-line-gradient); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round;
  filter: drop-shadow(0 2px 6px rgba(144, 200, 73, 0.4));
}
.trend-dot { fill: var(--accent-2); stroke: var(--secondary-bg); stroke-width: 2; }
.trend-axis { fill: var(--hint); font-size: 8px; }

/* Donut chart */
.donut-wrap { display: flex; align-items: center; gap: 12px; }
.donut-svg { width: 96px; height: 96px; flex-shrink: 0; overflow: visible; }
.donut-center-label { font-family: var(--font-display); font-weight: 800; }
.donut-legend { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.donut-legend-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.donut-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.donut-legend-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend-pct { color: var(--hint); font-weight: 700; }
.donut-empty { color: var(--hint); font-size: 13px; text-align: center; padding: 20px 0; }

/* Weekday bar chart */
.weekday-chart { display: flex; align-items: flex-end; gap: 6px; height: 110px; }
.wbar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.wbar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.wbar-fill {
  width: 100%; min-height: 3px; border-radius: 6px 6px 2px 2px;
  background: var(--accent-gradient);
  transition: height 0.6s cubic-bezier(.2,.8,.3,1);
  box-shadow: 0 0 8px rgba(74, 79, 51, 0.25);
}
.wbar-label { font-size: 10px; color: var(--hint); margin-top: 6px; font-weight: 700; }

/* Leaderboard */
.lb-podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 6px 0 20px; }
.podium-col { display: flex; flex-direction: column; align-items: center; width: 92px; }
.podium-medal { font-size: 24px; margin-bottom: 4px; }
.podium-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 17px;
  border: 3px solid var(--secondary-bg);
  box-shadow: 0 0 0 2px var(--accent-1);
  margin-bottom: 6px;
}
.podium-name { font-size: 12px; font-weight: 700; max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.podium-score { font-family: var(--font-display); font-size: 13px; font-weight: 800; color: var(--accent-1); margin-top: 2px; }
.podium-bar {
  width: 100%; margin-top: 8px; border-radius: 12px 12px 0 0;
  background: var(--secondary-bg); border: 1px solid var(--surface-border); border-bottom: none;
  backdrop-filter: blur(18px);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 6px;
  font-family: var(--font-display); font-weight: 800; color: var(--hint); font-size: 13px;
}
.podium-col.rank-1 .podium-bar { height: 76px; background: linear-gradient(180deg, rgba(245, 185, 66, 0.28), var(--secondary-bg)); }
.podium-col.rank-1 .podium-avatar { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(245, 185, 66, 0.5); }
.podium-col.rank-2 .podium-bar { height: 54px; }
.podium-col.rank-3 .podium-bar { height: 40px; }
.podium-col.rank-1 { order: 2; }
.podium-col.rank-2 { order: 1; }
.podium-col.rank-3 { order: 3; }

.lb-banner {
  background: var(--accent-gradient); color: #fff; border-radius: 16px;
  padding: 13px 16px; font-size: 13px; font-weight: 700;
  margin-bottom: 12px; box-shadow: 0 8px 20px -6px rgba(144, 200, 73, 0.5);
}
.lb-list { display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--secondary-bg); border: 1px solid var(--surface-border);
  border-radius: 16px; padding: 10px 14px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.lb-row.lb-me { box-shadow: 0 0 0 2px var(--accent-1), var(--shadow); }
.lb-rank { width: 26px; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--hint); flex-shrink: 0; }
.lb-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-gradient); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-meta { font-size: 11px; color: var(--hint); margin-top: 1px; }
.lb-score { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--accent-1); flex-shrink: 0; }

.streak-list { display: flex; flex-direction: column; gap: 8px; }
.streak-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--secondary-bg); border: 1px solid var(--surface-border);
  border-radius: 14px; padding: 10px 14px;
  backdrop-filter: blur(18px);
}
.streak-row .habit-name { flex: 1; font-size: 14px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 6, 20, 0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
  animation: overlay-in 0.2s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg); width: 100%; max-width: 560px;
  border-radius: 24px 24px 0 0;
  max-height: 88vh; overflow-y: auto;
  animation: slide-up 0.28s cubic-bezier(.2,.9,.25,1);
  padding-bottom: env(safe-area-inset-bottom);
  border: 1px solid var(--surface-border);
  border-bottom: none;
  position: relative;
}
.modal::before {
  content: ''; position: sticky; top: 0; display: block; width: 36px; height: 4px;
  margin: 10px auto -4px; border-radius: 4px; background: var(--surface-border);
}
@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 4px;
}
.modal-header h2 { margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.icon-btn { background: var(--secondary-bg); border: 1px solid var(--surface-border); color: var(--text); font-size: 15px; cursor: pointer; padding: 7px 10px; border-radius: 10px; }
.modal-body { padding: 8px 18px 4px; display: flex; flex-direction: column; }
.field-label {
  font-size: 13px; color: var(--hint); font-weight: 700;
  margin: 14px 0 6px; display: flex; align-items: center; gap: 6px;
}
.text-input {
  background: var(--secondary-bg); border: 1px solid var(--surface-border);
  border-radius: 13px; padding: 12px 14px; font-size: 15px; color: var(--text);
  width: 100%;
  transition: box-shadow 0.15s ease;
}
.text-input:focus { outline: none; box-shadow: 0 0 0 2px var(--accent-1); }

.emoji-picker, .chip-picker {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.emoji-opt {
  width: 40px; height: 40px; border-radius: 13px; border: 2px solid transparent;
  background: var(--secondary-bg); font-size: 19px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1);
}
.emoji-opt.selected { border-color: var(--accent-1); background: rgba(144, 200, 73, 0.14); transform: scale(1.08); }

.chip {
  padding: 7px 13px; border-radius: 20px; border: 1px solid var(--surface-border);
  background: var(--secondary-bg); font-size: 13px; cursor: pointer; color: var(--text);
  transition: transform 0.15s ease;
}
.chip.selected { background: var(--accent-gradient); color: #fff; border-color: transparent; }

.freq-toggle { display: flex; gap: 8px; }
.freq-btn {
  flex: 1; padding: 10px; border-radius: 13px; border: 1px solid var(--surface-border);
  background: var(--secondary-bg); color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer;
}
.freq-btn.active { background: var(--accent-gradient); color: #fff; border-color: transparent; }

.weekday-picker { display: flex; gap: 6px; margin-top: 10px; }
.weekday-opt {
  flex: 1; padding: 9px 0; text-align: center; border-radius: 11px;
  border: 1px solid var(--surface-border); background: var(--secondary-bg);
  font-size: 12px; font-weight: 700; cursor: pointer; color: var(--text);
}
.weekday-opt.selected { background: var(--accent-gradient); color: #fff; border-color: transparent; }

.modal-footer {
  display: flex; gap: 10px; padding: 16px 18px 20px;
}
.btn {
  flex: 1; padding: 14px; border-radius: 16px; border: none;
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: transform 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent-gradient); color: var(--button-text); box-shadow: 0 8px 20px -6px rgba(144, 200, 73, 0.55); }
.btn-primary:disabled { opacity: 0.5; box-shadow: none; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); flex: 0 0 auto; padding: 14px 18px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 108px; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 11px 20px; border-radius: 30px; font-size: 13px; font-weight: 700;
  z-index: 60; box-shadow: var(--shadow);
  animation: toast-in 0.25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px) scale(0.9); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }

/* Welcome screen */
#welcome-screen {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#welcome-screen.hidden { display: none !important; }
#welcome-screen.leaving { opacity: 0; transform: scale(1.03); pointer-events: none; }
.welcome-inner {
  position: relative; z-index: 1;
  width: 100%; max-width: 380px;
  padding: 32px;
  text-align: center;
}
.welcome-logo {
  font-size: 56px; margin-bottom: 14px;
  animation: float-y 3.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 20px rgba(144, 200, 73, 0.35));
}
.welcome-title {
  font-family: var(--font-display); font-size: 40px; font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -0.02em;
}
.welcome-subtitle { color: var(--hint); font-size: 15px; margin-top: 8px; font-weight: 600; }
.welcome-icons { font-size: 22px; margin-top: 22px; letter-spacing: 10px; opacity: 0.9; }
.welcome-choose {
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  color: var(--hint); text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 32px; margin-bottom: 12px;
}
.welcome-langs { display: flex; flex-direction: column; gap: 10px; }
.lang-btn {
  padding: 15px; border-radius: 16px; border: 1px solid var(--surface-border);
  background: var(--secondary-bg); color: var(--text);
  font-size: 15px; font-weight: 700; cursor: pointer;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1), background 0.2s ease;
}
.lang-btn:active { transform: scale(0.96); }
.lang-btn.chosen { background: var(--accent-gradient); color: #fff; border-color: transparent; }
.welcome-hint { color: var(--hint); font-size: 11.5px; margin-top: 20px; line-height: 1.5; opacity: 0.8; }

/* Tasks */
.task-add-row { display: flex; gap: 8px; margin-top: 4px; }
.task-add-row .text-input { flex: 1; }
.task-add-btn {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 13px; border: none;
  background: var(--accent-gradient); color: #fff; font-size: 22px; font-weight: 300;
  cursor: pointer; box-shadow: 0 6px 16px -4px rgba(144, 200, 73, 0.5);
  transition: transform 0.12s ease;
}
.task-add-btn:active { transform: scale(0.92); }

.task-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.task-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--secondary-bg); border: 1px solid var(--surface-border);
  border-radius: 14px; padding: 11px 12px;
  backdrop-filter: blur(18px);
  animation: card-in 0.25s cubic-bezier(.2,.8,.3,1) backwards;
}
.task-row.done { opacity: 0.55; }
.task-check {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--surface-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer;
  transition: all 0.2s cubic-bezier(.34,1.56,.64,1);
}
.task-row.done .task-check { background: linear-gradient(135deg, var(--success), var(--success-2)); border-color: transparent; color: #fff; }
.task-title { flex: 1; font-size: 14px; font-weight: 600; cursor: pointer; }
.task-row.done .task-title { text-decoration: line-through; color: var(--hint); }
.task-delete { background: none; border: none; color: var(--hint); font-size: 16px; cursor: pointer; padding: 4px 6px; flex-shrink: 0; }
.task-empty { padding: 24px 20px; }
.task-empty p { margin: 0; }

/* Journal */
.journal-mood-card {
  background: var(--secondary-bg); border: 1px solid var(--surface-border);
  border-radius: 18px; padding: 16px; box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  text-align: center;
}
.journal-mood-question { font-family: var(--font-display); font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.mood-picker { display: flex; justify-content: center; gap: 10px; }
.mood-opt {
  width: 46px; height: 46px; border-radius: 50%; border: 2px solid transparent;
  background: var(--bg); font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1), border-color 0.2s ease;
}
.mood-opt.selected { border-color: var(--accent-1); background: rgba(144, 200, 73, 0.14); transform: scale(1.14); }

.mood-trend { display: flex; gap: 5px; align-items: flex-end; height: 40px; }
.mood-dot-col { flex: 1; display: flex; align-items: flex-end; justify-content: center; height: 100%; }
.mood-dot { width: 100%; max-width: 20px; border-radius: 6px; background: var(--surface-border); }
.mood-dot[data-value="1"] { height: 20%; background: #ef4444; }
.mood-dot[data-value="2"] { height: 40%; background: #f97316; }
.mood-dot[data-value="3"] { height: 60%; background: #f5b942; }
.mood-dot[data-value="4"] { height: 80%; background: #84cc16; }
.mood-dot[data-value="5"] { height: 100%; background: #90c849; }

.journal-compose {
  background: var(--secondary-bg); border: 1px solid var(--surface-border);
  border-radius: 18px; padding: 14px; box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  margin-top: 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.journal-textarea { resize: vertical; min-height: 70px; font-family: inherit; }

.journal-list { display: flex; flex-direction: column; gap: 10px; }
.journal-entry {
  background: var(--secondary-bg); border: 1px solid var(--surface-border);
  border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.journal-entry-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.journal-entry-cat {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--accent-1); background: rgba(144, 200, 73, 0.12);
  padding: 3px 9px; border-radius: 20px;
}
.journal-entry-date { font-size: 11px; color: var(--hint); }
.journal-entry-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.journal-entry-delete { background: none; border: none; color: var(--hint); font-size: 14px; cursor: pointer; padding: 2px 6px; }

/* Premium lock badges */
.locked { opacity: 0.72; }
.locked::after { content: '🔒'; font-size: 0.85em; margin-left: 5px; }
.tab-btn.locked { position: relative; }
.tab-btn.locked::after {
  content: '🔒';
  position: absolute; top: 2px; right: 16px;
  font-size: 9px; margin: 0;
}

/* Premium modal */
.premium-feature-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 6px; }
.premium-feature-row { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.premium-feature-check {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}
.premium-active-note {
  background: rgba(144, 200, 73, 0.14); color: var(--accent-1);
  border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 700;
  text-align: center; margin-top: 10px;
}
.premium-dev-panel { margin: 18px 0 4px; padding-top: 16px; border-top: 1px dashed var(--surface-border); }
.premium-dev-title {
  font-size: 12px; font-weight: 700; color: var(--hint);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px;
}
.premium-dev-panel .btn { width: 100%; }
.premium-comingsoon { text-align: center; color: var(--hint); font-size: 13px; margin: 18px 0 8px; }
