/* ── HABIT TRACKER MODAL ─────────────────────────────── */
.habit-app {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: 92%;
  max-width: 600px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  box-shadow: 0 40px 100px rgba(0,0,0,0.35);
  transform: scale(0.95) translateY(20px);
  transition: all 0.35s cubic-bezier(0.23,1,0.32,1);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.modal-bg.open .habit-app { transform: scale(1) translateY(0); }

/* HEADER */
.ha-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.ha-header-left { display: flex; align-items: center; gap: 12px; }
.ha-logo { font-size: 28px; line-height: 1; }
.ha-title { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -0.5px; }
.ha-subtitle { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
.ha-header-right { display: flex; align-items: center; gap: 8px; }
.ha-close, .ha-popout {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(128,128,128,0.1); border: none;
  cursor: pointer; color: var(--ink-muted); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--trans); flex-shrink: 0;
}
.ha-close:hover { background: rgba(128,128,128,0.2); color: var(--ink); }
.ha-popout:hover { background: var(--accent-glow); color: var(--accent); border: 1px solid var(--border-em); }

/* STATS BAR */
.ha-stats {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 8px;
  margin-bottom: 20px;
}
.ha-stat {
  background: var(--surface2, rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 10px; text-align: center;
}
[data-theme="dark"] .ha-stat { background: rgba(255,255,255,0.03); }
.ha-stat-val { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: -0.5px; }
.ha-stat-label { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

/* HABIT LIST */
.ha-section-label {
  font-family: 'DM Mono', monospace; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px; color: var(--ink-muted);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.ha-habits { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.ha-habit {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; transition: var(--trans); position: relative; overflow: hidden;
}
.ha-habit:hover { border-color: var(--border-em); }
.ha-habit.shame {
  border-color: rgba(220,38,38,0.25);
  animation: shameGlow 2s ease-in-out infinite alternate;
}
@keyframes shameGlow {
  from { box-shadow: 0 0 0 rgba(220,38,38,0); }
  to   { box-shadow: 0 0 20px rgba(220,38,38,0.15); }
}
.ha-habit.fire {
  border-color: rgba(245,158,11,0.35);
  box-shadow: 0 0 24px rgba(245,158,11,0.12);
}
.ha-habit-check {
  width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid var(--border); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--trans); flex-shrink: 0; font-size: 13px; color: transparent;
}
.ha-habit-check.checked {
  background: var(--accent); border-color: var(--accent); color: white;
}
.ha-habit-emoji { font-size: 18px; flex-shrink: 0; }
.ha-habit-info { flex: 1; min-width: 0; }
.ha-habit-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.ha-habit-shame {
  font-family: 'DM Mono', monospace; font-size: 10px; color: #dc2626;
  margin-top: 2px; font-style: italic;
}
.ha-habit-streak {
  display: flex; align-items: center; gap: 4px;
  font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 600;
  color: var(--ink-muted); flex-shrink: 0;
}
.ha-habit-streak.hot { color: #f59e0b; }
.ha-habit-history {
  display: flex; gap: 3px; flex-shrink: 0;
}
.ha-hist-day {
  width: 10px; height: 10px; border-radius: 2px;
  background: var(--border); transition: background 0.2s;
}
.ha-hist-day.l1 { background: rgba(245,158,11,0.25); }
.ha-hist-day.l2 { background: rgba(245,158,11,0.5); }
.ha-hist-day.l3 { background: rgba(245,158,11,0.75); }
.ha-hist-day.l4 { background: #f59e0b; }

/* CALENDAR */
.ha-calendar {
  margin-bottom: 20px; padding: 16px;
  background: var(--surface2, rgba(255,255,255,0.03));
  border: 1px solid var(--border); border-radius: 16px;
}
[data-theme="dark"] .ha-calendar { background: rgba(255,255,255,0.03); }
.ha-cal-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.ha-cal-month {
  font-family: 'Fraunces', serif; font-size: 15px; font-weight: 600; color: var(--ink);
}
.ha-cal-nav {
  display: flex; gap: 6px;
}
.ha-cal-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(128,128,128,0.1); border: none;
  cursor: pointer; color: var(--ink-muted); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--trans);
}
.ha-cal-btn:hover { background: rgba(128,128,128,0.2); color: var(--ink); }
.ha-cal-days {
  display: grid; grid-template-columns: repeat(7,1fr); gap: 1px; font-family: 'DM Mono', monospace;
}
.ha-cal-day-label {
  text-align: center; font-size: 9px; color: var(--ink-muted);
  padding: 4px 0; text-transform: uppercase; letter-spacing: 0.5px;
}
.ha-cal-day {
  aspect-ratio: 1; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink-muted); cursor: pointer; transition: all 0.15s;
  border: 1px solid transparent; position: relative;
}
.ha-cal-day:hover { border-color: var(--border-em); }
.ha-cal-day.empty { pointer-events: none; }
.ha-cal-day.today { border-color: var(--accent); font-weight: 700; color: var(--ink); }
.ha-cal-day.c1 { background: rgba(245,158,11,0.15); color: var(--ink-soft); }
.ha-cal-day.c2 { background: rgba(245,158,11,0.3); color: var(--ink); }
.ha-cal-day.c3 { background: rgba(245,158,11,0.5); color: var(--ink); }
.ha-cal-day.c4 { background: rgba(245,158,11,0.75); color: white; }
.ha-cal-day.c5 { background: #f59e0b; color: white; font-weight: 700; }

/* ADD HABIT */
.ha-add-row {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 16px; border: 1.5px dashed var(--border);
  border-radius: 12px; margin-bottom: 20px; transition: border-color 0.2s;
}
.ha-add-row:focus-within { border-color: var(--accent); border-style: solid; }
.ha-add-input {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 13px; color: var(--ink);
}
.ha-add-input::placeholder { color: var(--ink-muted); }
.ha-emoji-picks {
  display: flex; gap: 4px; flex-shrink: 0;
}
.ha-emoji-pick {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--trans);
}
.ha-emoji-pick:hover { border-color: var(--accent); background: var(--accent-glow); }
.ha-emoji-pick.selected { border-color: var(--accent); background: var(--accent-glow); }
.ha-add-btn {
  padding: 7px 16px; border-radius: 100px;
  background: var(--accent); border: none; color: white;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: var(--trans); white-space: nowrap; flex-shrink: 0;
}
.ha-add-btn:hover { background: var(--accent-deep); transform: translateY(-1px); }

/* STREAK BREAK OVERLAY */
.ha-streak-break {
  position: absolute; inset: 0; background: rgba(220,38,38,0.06);
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Mono', monospace; font-size: 12px; color: #dc2626;
  font-weight: 700; opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.ha-streak-break.show { opacity: 1; }

/* FIRE PARTICLES */
@keyframes fireFloat {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-40px) scale(0.3); opacity: 0; }
}
.ha-fire-particle {
  position: absolute; font-size: 12px; pointer-events: none;
  animation: fireFloat 0.8s ease-out forwards;
}
