:root {
  --bg: #0f0f1a;
  --card: #1a1a2e;
  --card2: #16213e;
  --accent: #e94560;
  --gold: #f0c040;
  --green: #4ade80;
  --blue: #60a5fa;
  --text: #e0e0e0;
  --text2: #8892b0;
  --border: #2a2a4a;
  --tab-h: 60px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  padding: 12px 12px calc(var(--tab-h) + 12px);
  overflow-x: hidden;
}
.container { max-width: 600px; margin: 0 auto; }

/* ═══ Top Bar ═══ */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0 12px;
}
.top-bar-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
.top-bar-icon { font-size: 18px; }
.top-bar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  outline: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
  min-width: 30px;
  padding: 2px 4px;
  border-radius: 4px;
}
.top-bar-title:focus {
  border-bottom-color: var(--gold);
  background: rgba(240,192,64,0.08);
}
.top-bar-title.editable-hint {
  border-bottom: 2px dashed var(--border);
  cursor: text;
}
.title-edit-btn {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.title-edit-btn:hover { opacity: 1; }
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sync-badge {
  font-size: 11px;
  color: var(--green);
  opacity: 0.8;
  transition: opacity 0.3s;
}
.sync-badge.syncing { color: var(--gold); animation: pulse 1s ease-in-out infinite; }
.sync-badge.stale { color: var(--accent); }
@keyframes pulse { 0%,100%{opacity:0.5} 50%{opacity:1} }
.live-clock {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  color: var(--gold);
  font-size: 15px;
  letter-spacing: 1px;
}

/* ═══ Hero Cards (Level + XP) ═══ */
.hero-cards {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.level-card {
  background: linear-gradient(145deg, var(--card), var(--card2));
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.level-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #e6a800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #1a1a1a;
  box-shadow: 0 0 20px rgba(240,192,64,0.3);
}
.level-sub {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}
.xp-card {
  background: linear-gradient(145deg, var(--card), var(--card2));
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.xp-card-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.xp-card-numbers {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}
.xp-card-bar {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.xp-card-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #ff6b35);
  border-radius: 5px;
  transition: width 0.6s ease;
}
.xp-card-label {
  font-size: 11px;
  color: var(--text2);
}

/* ═══ Stat Cards Row ═══ */
.stat-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}
.stat-icon { font-size: 18px; }
.stat-number {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}
.stat-number small {
  font-size: 12px;
  color: var(--text2);
  font-weight: 400;
}
.stat-label {
  font-size: 10px;
  color: var(--text2);
  font-weight: 500;
}

/* Tab Content */
.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Titles */
.section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-sub {
  font-size: 11px;
  color: var(--text2);
  font-weight: 400;
  margin-left: 6px;
}

/* Tasks Grid */
.task-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.task-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.task-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.task-card.done { opacity: 0.45; border-color: var(--green); }
.task-card.done:hover { border-color: var(--accent); }
.task-card .check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
}
.task-card.done .check { background: var(--green); border-color: var(--green); }
.task-icon { font-size: 18px; }
.task-info { flex: 1; }
.task-name { font-size: 13px; font-weight: 600; }
.task-xp { font-size: 11px; color: var(--gold); }

/* Calendar */
.calendar-section {
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.calendar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.calendar-row label { font-size: 13px; color: var(--text2); white-space: nowrap; }
.calendar-row input[type="date"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.calendar-row input[type="date"]:focus { border-color: var(--accent); }
.calendar-row input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }
.day-summary { margin-left: auto; font-size: 12px; color: var(--text2); }
.day-summary strong { color: var(--gold); }
.day-tasks { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.day-task-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 5px;
  font-size: 12px;
}
.day-task-badge .day-xp { color: var(--gold); font-size: 10px; }
.day-empty { color: var(--text2); font-size: 12px; padding: 4px 0; }

/* Achievements */
.achieve-section {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.achieve-cat { margin-bottom: 16px; }
.achieve-cat:last-child { margin-bottom: 0; }
.achieve-cat-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.achieve-grid { display: flex; flex-direction: column; gap: 4px; }
.achieve-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: default;
}
.achieve-card.unlocked { background: rgba(74, 222, 128, 0.06); border-color: rgba(74, 222, 128, 0.2); }
.achieve-card.locked { opacity: 0.35; filter: grayscale(0.6); }
.achieve-icon-wrap {
  width: 34px; height: 34px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
}
.achieve-info { flex: 1; min-width: 0; }
.achieve-name { font-size: 12px; font-weight: 600; }
.achieve-card.locked .achieve-name { color: var(--text2); }
.achieve-desc { font-size: 10px; color: var(--text2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.achieve-xp { font-size: 10px; color: var(--gold); white-space: nowrap; flex-shrink: 0; }
.achieve-card.locked .achieve-xp { display: none; }
.achieve-lock-icon { font-size: 12px; color: var(--text2); flex-shrink: 0; }
.achieve-card.unlocked .achieve-lock-icon { color: var(--green); }
.rarity-common .achieve-name { color: #b0b0b0; }
.rarity-uncommon .achieve-name { color: #4ade80; }
.rarity-epic .achieve-name { color: #a855f7; }
.rarity-legendary .achieve-name { color: #f0c040; }
.rarity-event .achieve-name { color: #60a5fa; }
.rarity-mythic .achieve-name { color: #ff6b35; }
.rarity-mythic .achieve-icon-wrap { animation: mythic-glow 2s ease-in-out infinite; }
@keyframes mythic-glow { 0%,100%{box-shadow:0 0 5px rgba(255,107,53,0.3)} 50%{box-shadow:0 0 15px rgba(255,107,53,0.6)} }

/* Chart */
.chart-section {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.chart-container { height: 160px; }

/* History */
.history-list {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  max-height: 280px;
  overflow-y: auto;
}
.history-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.history-item:last-child { border-bottom: none; }
.history-item .xp { color: var(--gold); }

/* Bottom Tab Bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tab-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text2);
  font-family: inherit;
  transition: color 0.2s;
  position: relative;
}
.tab-btn .tab-icon { font-size: 20px; }
.tab-btn .tab-label { font-size: 10px; font-weight: 500; }
.tab-btn.active { color: var(--gold); }
.tab-btn.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--gold);
  border-radius: 0 0 2px 2px;
}
.tab-btn .tab-badge {
  position: absolute;
  top: 2px;
  right: 50%;
  transform: translateX(calc(50% + 14px));
  background: var(--accent);
  color: white;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 700;
}

/* FAB */
.fab-book {
  position: fixed;
  bottom: calc(var(--tab-h) + 8px);
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #c0392b);
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s;
}
.fab-book:hover { transform: scale(1.1); }
.fab-book:active { transform: scale(0.95); }

/* Toast */
.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  left: 16px;
  max-width: 400px;
  margin: 0 auto;
  background: var(--card2);
  border: 1px solid var(--green);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  transform: translateY(-120%);
  transition: transform 0.3s;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  text-align: center;
}
.toast.show { transform: translateY(0); }

@media (max-width: 480px) {
  body { padding: 8px 8px calc(var(--tab-h) + 8px); }
  .task-grid { grid-template-columns: 1fr; }
  .hero-cards { grid-template-columns: 80px 1fr; gap: 8px; }
  .level-circle { width: 48px; height: 48px; font-size: 13px; }
  .level-card { padding: 12px 6px; }
  .xp-card { padding: 12px 14px; }
  .stat-cards { gap: 6px; }
  .stat-card { padding: 10px 6px; }
  .stat-number { font-size: 17px; }
  .top-bar { padding: 2px 0 10px; }
  .top-bar-title { font-size: 14px; }
  .modal-card { margin: 10px; padding: 20px; }
}

/* ═══ User Badge ═══ */
.user-badge {
  font-size: 12px;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  padding: 3px 10px;
  border-radius: 8px;
  white-space: nowrap;
  font-weight: 500;
}

/* ═══ Logout Button ═══ */
.logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 8px;
  transition: all 0.2s;
}
.logout-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(233, 69, 96, 0.1);
}

/* ═══ Add Habit Button ═══ */
.add-habit-btn {
  background: linear-gradient(135deg, var(--gold), #e6a800);
  border: none;
  color: #1a1a1a;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  margin-left: auto;
  transition: transform 0.15s;
}
.add-habit-btn:hover { transform: scale(1.05); }
.add-habit-btn:active { transform: scale(0.95); }

/* ═══ Card Edit / Delete Buttons ═══ */
.card-delete-btn, .card-edit-btn {
  position: absolute;
  top: 4px;
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 5;
  line-height: 1;
  padding: 0;
}
.task-card { position: relative; }
.task-card:hover .card-delete-btn,
.task-card:hover .card-edit-btn { opacity: 1; }
.card-delete-btn {
  right: 4px;
  color: var(--accent);
}
.card-edit-btn {
  right: 28px;
  color: var(--gold);
  font-size: 11px;
}
.card-delete-btn:hover { background: var(--accent); color: white; }
.card-edit-btn:hover { background: var(--gold); color: #1a1a1a; }

/* ═══ Modal ═══ */
.modal-overlay {
  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: 300;
  animation: fadeIn 0.2s ease;
}
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px 0;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--gold); }
.modal-close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--accent); }
.modal-body {
  padding: 16px 20px;
}
.modal-body label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  margin-top: 14px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.modal-body label:first-child { margin-top: 0; }
.modal-body input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}
.modal-body input:focus { border-color: var(--gold); }

/* Type / Schedule picker */
.type-picker, .schedule-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.type-option {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.type-option.active {
  background: rgba(240,192,64,0.15);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}
.type-option:hover {
  border-color: var(--text2);
}

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 0 20px 18px;
}
.modal-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s;
}
.modal-btn:hover { transform: translateY(-1px); }
.modal-btn:active { transform: scale(0.98); }
.modal-btn.cancel {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text2);
}
.modal-btn.confirm {
  background: linear-gradient(135deg, var(--gold), #e6a800);
  color: #1a1a1a;
}

/* ═══ Section Colors for Three Groups ═══ */
:root {
  --milestone: #e94560;
  --milestone-bg: rgba(233, 69, 96, 0.08);
  --target: #60a5fa;
  --target-bg: rgba(96, 165, 250, 0.08);
  --daily: #4ade80;
  --daily-bg: rgba(74, 222, 128, 0.08);
}
.section-milestone { color: var(--milestone); }
.section-target { color: var(--target); }
.section-daily { color: var(--daily); }

/* ═══ Milestone Cards ═══ */
.card-milestone {
  border-color: rgba(233, 69, 96, 0.3);
  background: var(--milestone-bg);
}
.card-milestone:hover { border-color: var(--milestone); }
.card-milestone.done { opacity: 0.5; border-color: var(--green); }
.task-card-left { flex-shrink: 0; }
.milestone-badge {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: rgba(233, 69, 96, 0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.milestone-sub {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.milestone-sub strong { color: var(--text); }
.milestone-deadline {
  color: var(--milestone);
  font-size: 11px;
  font-weight: 500;
}
.milestone-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.milestone-bar {
  flex: 1;
  height: 8px;
  background: rgba(233, 69, 96, 0.15);
  border-radius: 4px;
  overflow: hidden;
}
.milestone-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--milestone), #ff6b6b);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.milestone-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--milestone);
  width: 36px;
  text-align: right;
}

/* ═══ Target Cards ═══ */
.card-target {
  border-color: rgba(96, 165, 250, 0.3);
  background: var(--target-bg);
}
.card-target:hover { border-color: var(--target); }
.card-target.done { opacity: 0.5; border-color: var(--green); }
.target-detail {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
}
.target-detail strong { color: var(--text); }
.target-fill { background: linear-gradient(90deg, var(--target), #93c5fd); }
.target-pct { color: var(--target); }

/* ═══ Daily Cards ═══ */
.card-daily {
  border-color: rgba(74, 222, 128, 0.2);
  background: var(--daily-bg);
}
.card-daily:hover { border-color: var(--daily); }
.card-daily.done { border-color: var(--green); opacity: 0.5; }

/* ═══ Compliance Bar on Habit Cards ═══ */
.comp-bar-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  width: 100%;
}
.comp-label {
  font-size: 10px;
  color: var(--text2);
  white-space: nowrap;
  flex-shrink: 0;
}
.comp-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.comp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
  border-radius: 2px;
  transition: width 0.5s ease;
}
.task-card.done .comp-fill { background: var(--green); }
.comp-pct {
  font-size: 10px;
  font-weight: 600;
  color: var(--green);
  white-space: nowrap;
  flex-shrink: 0;
}
.task-card .task-info { flex: 1; min-width: 0; }

/* ═══ Insight Tab ═══ */
.insight-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.insight-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.insight-row:last-child { border-bottom: none; }
.insight-rank {
  width: 18px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-align: center;
}
.insight-rank:nth-child(1) { color: var(--gold); }
.insight-rank:nth-child(2) { color: var(--text2); }
.insight-rank:nth-child(3) { color: #cd7f32; }
.insight-icon { font-size: 16px; width: 20px; text-align: center; }
.insight-name { flex: 1; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insight-stat { font-size: 11px; color: var(--text2); white-space: nowrap; }
.insight-bar-wrap { width: 60px; flex-shrink: 0; }
.insight-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.insight-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--gold), #e6a800);
}
.insight-pct {
  width: 36px;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}
.insight-pct.green { color: var(--green); }
.insight-pct.yellow { color: var(--gold); }
.insight-pct.red { color: var(--accent); }

/* Streak Cards */
.streak-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.streak-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 80px;
  flex: 1;
}
.streak-icon { font-size: 20px; }
.streak-name { font-size: 11px; color: var(--text2); white-space: nowrap; }
.streak-num { font-size: 14px; font-weight: 700; color: #ff6b35; }
.insight-empty { font-size: 13px; color: var(--text2); text-align: center; padding: 10px; }

/* ═══ Heatmap ═══ */
.heatmap-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 4px;
  align-items: flex-start;
  overflow-x: auto;
}
.heatmap-days {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 0;
  margin-right: 2px;
}
.heatmap-days span {
  font-size: 8px;
  color: var(--text2);
  height: 12px;
  line-height: 12px;
}
.heatmap-grid { display: flex; gap: 2px; }
.heatmap-col { display: flex; flex-direction: column; gap: 2px; }
.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.15s;
}
.heatmap-cell:hover { transform: scale(1.4); z-index: 2; }
.heatmap-cell.intensity-0 { background: #1a1a2e; border: 1px solid #2a2a4a; }
.heatmap-cell.intensity-1 { background: #1a3a2e; border: 1px solid #2a4a3a; }
.heatmap-cell.intensity-2 { background: #2a6a3e; border: 1px solid #3a8a4e; }
.heatmap-cell.intensity-3 { background: #4ade80; border: 1px solid #5aee90; }
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  align-self: flex-end;
}
.heatmap-legend span { font-size: 9px; color: var(--text2); }
.rarity-common { border-color: #b0b0b0; }
.rarity-uncommon { border-color: #4ade80; }
.rarity-rare { border-color: #60a5fa; }
.rarity-epic { border-color: #a855f7; }
.rarity-legendary {
  border-color: #f0c040;
  box-shadow: 0 0 12px rgba(240,192,64,0.2);
}
.rarity-legendary.done {
  animation: breathe 2s ease-in-out infinite;
  opacity: 1;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 8px rgba(240,192,64,0.2); }
  50% { box-shadow: 0 0 20px rgba(240,192,64,0.5); }
}

/* ═══ Progress Ring (replaces .check for flexible tasks) ═══ */
.progress-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card2);
  border: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  color: var(--text2);
  line-height: 1.2;
  position: relative;
  overflow: hidden;
}
.progress-ring .progress-bar-inner {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  border-radius: 0 2px 0 0;
  transition: width 0.5s ease;
}
.task-card.done .progress-ring {
  border-color: var(--green);
  background: rgba(74,222,128,0.1);
}
.task-card.done .progress-ring .progress-bar-inner {
  background: var(--green);
  height: 100%;
  opacity: 0.15;
}
.task-card.done .progress-ring {
  color: var(--green);
}