/* ==========================================
   CSS Variables
   ========================================== */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #1e1e35;
  --border: #2a2a3e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b85;
  --accent-purple: #7c3aed;
  --accent-purple-light: #9f5ef0;
  --accent-green: #10b981;
  --accent-green-light: #34d399;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  --accent-orange: #f97316;
  --coin-color: #fbbf24;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-purple: 0 0 20px rgba(124, 58, 237, 0.3);
  --radius: 12px;
  --radius-lg: 16px;
  --transition: all 0.3s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ==========================================
   Header
   ========================================== */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-icon { font-size: 1.5rem; }

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-purple-light), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: flex-end;
}

.level-badge {
  background: var(--accent-purple);
  border-radius: 8px;
  padding: 0.25rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-purple);
}

.level-label {
  font-size: 0.65rem;
  font-weight: 600;
  opacity: 0.8;
  letter-spacing: 0.05em;
}

.level-number {
  font-size: 1.1rem;
  font-weight: 800;
}

.xp-container {
  flex: 1;
  min-width: 80px;
  max-width: 200px;
}

.xp-bar-wrapper {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.xp-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-purple-light));
  border-radius: 3px;
  transition: width 0.5s ease;
  width: 0%;
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.6);
}

.xp-text {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.coin-badge {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 8px;
  padding: 0.25rem 0.6rem;
  flex-shrink: 0;
  transition: var(--transition);
}

/* Negative balance styling */
.coin-badge.coin-badge-negative {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
}

.coin-icon { font-size: 1rem; }

.coin-amount {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--coin-color);
  transition: color 0.3s ease;
}

/* Negative coin amount — red + pulse */
.coin-amount.coin-negative {
  color: var(--accent-red);
  animation: coinPulse 1.5s ease infinite;
}

@keyframes coinPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ==========================================
   Integrity Streak Badge (header)
   ========================================== */
.integrity-badge {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  padding: 0.25rem 0.6rem;
  flex-shrink: 0;
  cursor: default;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-green-light);
  white-space: nowrap;
}

.integrity-badge #integrity-icon { font-size: 0.9rem; }
.integrity-badge #integrity-count { font-size: 0.9rem; font-weight: 800; }
.integrity-label-text { font-size: 0.65rem; font-weight: 500; opacity: 0.8; }

/* Small "I Cheated" button in header */
.btn-cheat-micro {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 0.25rem 0.45rem;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  line-height: 1;
}

.btn-cheat-micro:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--accent-red);
}

.btn-header-icon {
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 8px;
  padding: 0.25rem 0.45rem;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  line-height: 1;
  color: var(--text-primary);
}
.btn-header-icon:hover {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--accent-purple);
}

/* ==========================================
   Navigation
   ========================================== */
.nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 60px;
  z-index: 99;
}

.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  padding: 0 1rem;
}

.nav-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.875rem 0.5rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.nav-tab:hover { color: var(--text-secondary); }

.nav-tab.active {
  color: var(--accent-purple-light);
  border-bottom-color: var(--accent-purple);
}

.nav-icon { font-size: 1rem; }

/* ==========================================
   Main & Sections
   ========================================== */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 5rem;
}

.section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary { background: var(--accent-purple); color: white; }
.btn-primary:hover {
  background: var(--accent-purple-light);
  box-shadow: var(--shadow-purple);
  transform: translateY(-1px);
}

.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-green { background: var(--accent-green); color: white; }
.btn-green:hover {
  background: var(--accent-green-light);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.btn-danger { background: transparent; color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

/* ==========================================
   Cards
   ========================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: var(--transition);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(124, 58, 237, 0.3);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ==========================================
   Task List & Items
   ========================================== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: var(--transition);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.task-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(124, 58, 237, 0.3);
  box-shadow: var(--shadow);
}

.task-item.completed { opacity: 0.6; }
.task-item.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Circular check button */
.task-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  background: transparent;
  margin-top: 2px;
}

.task-check:hover {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
}

.task-check.checked {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.task-check.checked::after {
  content: '✓';
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

.task-content { flex: 1; min-width: 0; }

.task-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  word-break: break-word;
}

.task-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  word-break: break-word;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-category { background: rgba(124, 58, 237, 0.15); color: var(--accent-purple-light); border: 1px solid rgba(124, 58, 237, 0.2); }
.badge-easy     { background: rgba(16, 185, 129, 0.15);  color: var(--accent-green);        border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-medium   { background: rgba(245, 158, 11, 0.15);  color: var(--accent-yellow);       border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-hard     { background: rgba(249, 115, 22, 0.15);  color: var(--accent-orange);       border: 1px solid rgba(249, 115, 22, 0.2); }
.badge-epic     { background: rgba(239, 68, 68, 0.15);   color: var(--accent-red);          border: 1px solid rgba(239, 68, 68, 0.2); }

.badge-count {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.xp-reward   { font-size: 0.72rem; color: var(--accent-purple-light); font-weight: 600; }
.coin-reward { font-size: 0.72rem; color: var(--coin-color);          font-weight: 600; }

.task-actions { display: flex; gap: 0.4rem; flex-shrink: 0; align-items: flex-start; }

/* ==========================================
   Rewards
   ========================================== */
.rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.reward-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  transition: var(--transition);
  animation: slideIn 0.3s ease;
}

.reward-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(251, 191, 36, 0.3);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.1);
  transform: translateY(-2px);
}

.reward-emoji { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }
.reward-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.5rem; }

.reward-price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--coin-color);
  margin-bottom: 1rem;
}

.reward-actions { display: flex; gap: 0.5rem; justify-content: center; }

/* Purchased history row */
.purchased-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideIn 0.3s ease;
}

.purchased-info { display: flex; align-items: center; gap: 0.75rem; }
.purchased-emoji { font-size: 1.5rem; }
.purchased-title { font-size: 0.875rem; font-weight: 600; }
.purchased-date  { font-size: 0.75rem; color: var(--text-muted); }
.purchased-price { font-size: 0.875rem; font-weight: 700; color: var(--coin-color); }

/* ==========================================
   Impact / Stats Dashboard
   ========================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: var(--transition);
}

.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(124, 58, 237, 0.3);
  transform: translateY(-2px);
}

.stat-icon  { font-size: 1.75rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.25rem; }
.stat-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }

/* ==========================================
   Activity Chart (CSS bar chart)
   ========================================== */
.chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  height: 120px;
  padding: 0 0.25rem;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  gap: 0.35rem;
}

.chart-bar-wrapper {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.chart-bar {
  width: 100%;
  max-width: 36px;
  border-radius: 4px 4px 0 0;
  background: var(--accent-purple);
  transition: height 0.5s ease;
  min-height: 4px;
  cursor: pointer;
}

.chart-bar:hover {
  background: var(--accent-purple-light);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.5);
}

.chart-bar-today { background: var(--accent-green); }
.chart-bar-today:hover {
  background: var(--accent-green-light);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.chart-value { font-size: 0.7rem; font-weight: 600; color: var(--text-secondary); min-height: 1em; }
.chart-label { font-size: 0.65rem; color: var(--text-muted); white-space: nowrap; }

/* ==========================================
   Breakdown bars (Category / Difficulty)
   ========================================== */
.breakdown-item { margin-bottom: 0.75rem; }

.breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
}

.breakdown-name  { color: var(--text-secondary); }
.breakdown-count { font-weight: 600; }

.breakdown-bar-wrapper {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.breakdown-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ==========================================
   Empty States
   ========================================== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-icon  { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-secondary); }
.empty-hint  { font-size: 0.8rem; }

/* ==========================================
   Modals
   ========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow), var(--shadow-purple);
  animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  transition: var(--transition);
  line-height: 1;
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-card); }

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ==========================================
   Form Elements
   ========================================== */
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.65rem 0.875rem;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

.form-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }

/* Option grid (difficulty / category buttons) */
.option-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.option-grid-5 { grid-template-columns: repeat(3, 1fr); }

.option-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.65rem 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  line-height: 1.6;
}

.option-btn small {
  display: block;
  font-size: 0.7rem;
  opacity: 0.7;
  line-height: 1.4;
}

.option-btn:hover { border-color: var(--accent-purple); color: var(--text-primary); }
.option-btn.active {
  border-color: var(--accent-purple);
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-purple-light);
}

/* ==========================================
   Toast Notifications
   ========================================== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  min-width: 220px;
  max-width: 320px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.warning { border-left: 3px solid var(--accent-yellow); }
.toast.error   { border-left: 3px solid var(--accent-red); }
.toast.info    { border-left: 3px solid var(--accent-purple); }
.toast-icon    { font-size: 1.1rem; flex-shrink: 0; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ==========================================
   Level Up Overlay
   ========================================== */
.levelup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.levelup-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.levelup-content { text-align: center; animation: levelUpBounce 0.5s ease; }

@keyframes levelUpBounce {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.1); }
  100% { transform: scale(1);   opacity: 1; }
}

.levelup-emoji {
  font-size: 5rem;
  margin-bottom: 1rem;
  display: block;
  animation: spin 0.5s ease;
}

@keyframes spin {
  from { transform: rotate(-20deg) scale(0.5); }
  to   { transform: rotate(0deg)   scale(1); }
}

.levelup-title {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-purple-light), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.levelup-subtitle { font-size: 1.25rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.levelup-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 1.5rem; }

/* ==========================================
   Scrollbar
   ========================================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 600px) {
  .header-title { display: none; }
  .xp-container { min-width: 60px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .rewards-grid { grid-template-columns: 1fr 1fr; }
  .task-item { padding: 0.875rem 1rem; }
}

@media (max-width: 420px) {
  .rewards-grid { grid-template-columns: 1fr; }
  .option-grid-5 { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================
   Danger / Reset Button (filled)
   ========================================== */
.btn-danger-filled { background: var(--accent-red); color: white; border: none; }
.btn-danger-filled:hover {
  background: #dc2626;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}
.btn-danger-filled:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ==========================================
   Backup & Restore (Impact Dashboard)
   ========================================== */
.backup-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.backup-actions .btn { font-size: 0.85rem; }

/* ==========================================
   Notifications & Reminders (Impact Dashboard)
   ========================================== */
.notifications-settings {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.notif-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}
.notif-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
.notif-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.notif-row label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex: 0 0 auto;
  min-width: 150px;
}
.notif-row input[type="time"],
.notif-row input[type="text"] {
  flex: 1;
  min-width: 160px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
}
.notif-row input[type="time"]:focus,
.notif-row input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
}
.notif-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}
.notif-actions .btn { font-size: 0.85rem; }
.notif-status {
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-height: 1.1em;
  font-style: italic;
}
.notif-status.ok      { color: #10b981; font-style: normal; }
.notif-status.warning { color: #f59e0b; font-style: normal; }

/* ==========================================
   Danger Zone (Impact Dashboard)
   ========================================== */
.danger-zone {
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  background: rgba(239, 68, 68, 0.05);
}
.danger-zone-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-red);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.danger-zone-desc { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1rem; }

/* Reset confirm input */
.reset-confirm-input {
  font-family: monospace;
  letter-spacing: 0.15em;
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
}

/* ==========================================
   Timer Presets (Reward Modal)
   ========================================== */
.timer-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.preset-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: var(--transition);
}
.preset-btn:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
  background: rgba(124, 58, 237, 0.1);
}
.preset-btn.active {
  border-color: var(--accent-purple);
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-purple-light);
}


/* ==========================================
   Floating Timers Widget
   ========================================== */
.timers-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 280px;
}
.timer-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow);
  pointer-events: all;
  animation: slideIn 0.3s ease;
}
.timer-widget.finished {
  border-color: var(--accent-green);
  animation: timerFinishedPulse 1s ease infinite;
}
@keyframes timerFinishedPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  50%       { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}
.timer-emoji { font-size: 1.5rem; flex-shrink: 0; }
.timer-info  { flex: 1; min-width: 0; }
.timer-title { font-size: 0.78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-time  {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-purple-light);
  font-variant-numeric: tabular-nums;
}
.timer-time.urgent   { color: var(--accent-red); }
.timer-time.finished { color: var(--accent-green); }
.timer-time.paused   { color: var(--text-muted); }
.timer-controls { display: flex; gap: 0.3rem; flex-shrink: 0; }

/* ==========================================
   Daily Quests
   ========================================== */
.daily-progress-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.daily-progress-text { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); flex-shrink: 0; }
.daily-progress-text strong { color: var(--text-primary); font-size: 1rem; }
.daily-progress-bar-wrapper {
  flex: 1;
  min-width: 80px;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.daily-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-green-light));
  border-radius: 4px;
  transition: width 0.5s ease;
}
/* Completed daily task styling */
.done-today { opacity: 0.55; }
.done-today .task-title { color: var(--text-muted); }

/* Bonus reward badge on quest cards */
.badge-bonus-reward {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(251, 191, 36, 0.12);
  color: var(--coin-color);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

/* ==========================================
   Cheat Penalty Button (rewards section)
   ========================================== */
.btn-cheat-penalty {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-yellow);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-cheat-penalty:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--accent-yellow);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
  transform: translateY(-1px);
}

/* Confirm cheat penalty button inside modal */
.btn-cheat-penalty-confirm {
  background: var(--accent-orange);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-cheat-penalty-confirm:hover {
  background: #ea6c00;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.4);
  transform: translateY(-1px);
}

/* ==========================================
   Buy on Credit button (reward cards)
   ========================================== */
.btn-credit {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-yellow);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.btn-credit:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--accent-yellow);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.btn-disabled {
  background: rgba(100, 100, 100, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(100, 100, 100, 0.3);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-disabled:hover {
  background: rgba(100, 100, 100, 0.15);
  border-color: rgba(100, 100, 100, 0.3);
  box-shadow: none;
}

.credit-limit-info {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-align: center;
}

.badge-custom-reward {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

/* ==========================================
   Inflation Banner
   ========================================== */
.inflation-banner {
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.35);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  color: var(--accent-orange);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  animation: inflationPulse 2s ease infinite;
}

@keyframes inflationPulse {
  0%, 100% { border-color: rgba(249, 115, 22, 0.35); }
  50%       { border-color: rgba(249, 115, 22, 0.7); box-shadow: 0 0 12px rgba(249, 115, 22, 0.2); }
}

/* ==========================================
   Debt Warning
   ========================================== */
.debt-warning {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.debt-warning-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-red);
  margin-bottom: 0.5rem;
}

.debt-bar-wrapper {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.debt-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-red), #ff6b6b);
  border-radius: 3px;
  transition: width 0.5s ease;
  width: 0%;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.debt-bar-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==========================================
   Inflated reward price display
   ========================================== */
.reward-price-original {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-right: 0.3rem;
}

.reward-price-inflated {
  color: var(--accent-orange);
  font-weight: 700;
  font-size: 1.1rem;
}

.reward-price-inflated small {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.85;
}

/* ==========================================
   Red Flash Overlay (streak reset animation)
   ========================================== */
.red-flash-overlay {
  position: fixed;
  inset: 0;
  background: rgba(239, 68, 68, 0.0);
  z-index: 500;
  pointer-events: none;
  transition: none;
}

.red-flash-overlay.active {
  animation: redFlash 0.6s ease forwards;
}

@keyframes redFlash {
  0%   { background: rgba(239, 68, 68, 0.0); }
  20%  { background: rgba(239, 68, 68, 0.35); }
  100% { background: rgba(239, 68, 68, 0.0); }
}

/* ==========================================
   Responsive adjustments for new header elements
   ========================================== */
@media (max-width: 600px) {
  .integrity-label-text { display: none; }
  .btn-cheat-micro { padding: 0.25rem 0.35rem; }
}

@media (max-width: 420px) {
  .integrity-badge { display: none; }
  .btn-cheat-micro { display: none; }
  .btn-header-icon { display: none; }
}

/* ==========================================
   Task Timer — Toggle Button
   ========================================== */
.timer-toggle-group { margin-bottom: 0; }

.timer-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: var(--radius);
  padding: 0.55rem 0.85rem;
  color: var(--accent-purple-light);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.timer-toggle-btn:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: var(--accent-purple);
}

.timer-toggle-arrow {
  margin-left: auto;
  font-size: 0.75rem;
  opacity: 0.7;
}

.timer-toggle-icon { font-size: 1rem; }

/* ==========================================
   Task Timer — Section Inside Modal
   ========================================== */
.timer-section {
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--radius);
  padding: 0.85rem;
  margin-top: 0.5rem;
  background: rgba(124, 58, 237, 0.04);
  animation: fadeIn 0.2s ease;
}

/* Days / Hours / Minutes inputs row */
.timer-inputs-row {
  display: flex;
  gap: 0.5rem;
}

.timer-input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.timer-num-input {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.5rem 0.4rem !important;
  -moz-appearance: textfield;
}

.timer-num-input::-webkit-inner-spin-button,
.timer-num-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.timer-input-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Bonus / Penalty sub-sections */
.timer-sub-section {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  animation: fadeIn 0.2s ease;
}

.timer-sub-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}

/* ==========================================
   Task Timer — Live Countdown on Cards
   ========================================== */
.task-timer {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  transition: background 0.3s ease, color 0.3s ease;
}

.task-timer-green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.task-timer-yellow {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-yellow);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.task-timer-orange {
  background: rgba(249, 115, 22, 0.12);
  color: var(--accent-orange);
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.task-timer-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.35);
  animation: timerPulse 1.2s ease infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1;   box-shadow: none; }
  50%       { opacity: 0.7; box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }
}

/* ==========================================
   Overdue Task Card — Pulsing Red Border
   ========================================== */
.task-item.task-overdue {
  border-color: rgba(239, 68, 68, 0.5) !important;
  animation: overdueCard 2s ease infinite, slideIn 0.3s ease;
}

@keyframes overdueCard {
  0%, 100% { border-color: rgba(239, 68, 68, 0.35); box-shadow: none; }
  50%       { border-color: rgba(239, 68, 68, 0.75); box-shadow: 0 0 12px rgba(239, 68, 68, 0.2); }
}

/* ==========================================
   Penalty Quest Card
   ========================================== */
.task-item.task-penalty-quest {
  border-color: rgba(249, 115, 22, 0.4) !important;
  background: rgba(249, 115, 22, 0.05) !important;
}

.task-item.task-penalty-quest:hover {
  border-color: rgba(249, 115, 22, 0.65) !important;
  background: rgba(249, 115, 22, 0.08) !important;
}

/* Penalty Quest badge */
.badge-penalty-quest {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(249, 115, 22, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(249, 115, 22, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Reward timer badge on reward cards */
.reward-timer-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ============================
   Feature 1: Penalty reward badge
   ============================ */
.badge-penalty-reward {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

/* ============================
   Feature 2: Edit button
   ============================ */
.btn-edit {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-size: 0.85rem;
}
.btn-edit:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.5);
}

/* ============================
   Feature 3: Dreams Tab
   ============================ */

/* Dream cards */
.dream-card {
  position: relative;
  border-radius: 16px;
  margin-bottom: 1.25rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: transform 0.2s, box-shadow 0.2s;
}
.dream-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.15), 0 4px 20px rgba(0,0,0,0.4);
}
.dream-card-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(167,139,250,0.08) 0%, rgba(236,72,153,0.06) 50%, rgba(59,130,246,0.06) 100%);
  pointer-events: none;
  border-radius: 16px;
  border: 1px solid transparent;
  background-clip: padding-box;
}
.dream-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(167,139,250,0.5), rgba(236,72,153,0.4), rgba(59,130,246,0.4));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.dream-card-inner {
  padding: 1.25rem;
  position: relative;
  z-index: 1;
}
.dream-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.dream-emoji {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}
.dream-card-title-block {
  flex: 1;
  min-width: 0;
}
.dream-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}
.dream-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Progress bar for stages */
.dream-progress {
  margin-bottom: 0.75rem;
}
.dream-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.dream-progress-bar-wrapper {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.dream-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #a78bfa, #ec4899);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Dream rewards row */
.dream-rewards {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}
.dream-custom-reward {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Dream action buttons */
.dream-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.btn-stage {
  background: rgba(16,185,129,0.15);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.3);
}
.btn-stage:hover {
  background: rgba(16,185,129,0.25);
  border-color: rgba(16,185,129,0.5);
}
.btn-dream-achieve {
  background: linear-gradient(135deg, rgba(167,139,250,0.25), rgba(236,72,153,0.2));
  color: #c4b5fd;
  border: 1px solid rgba(167,139,250,0.4);
  font-weight: 600;
}
.btn-dream-achieve:hover {
  background: linear-gradient(135deg, rgba(167,139,250,0.4), rgba(236,72,153,0.3));
  color: #e9d5ff;
  border-color: rgba(167,139,250,0.6);
}

/* Achieved dream cards */
.dream-card-achieved {
  opacity: 0.85;
}
.dream-card-achieved::before {
  background: linear-gradient(135deg, rgba(251,191,36,0.6), rgba(245,158,11,0.5));
}
.dream-card-achieved:hover {
  box-shadow: 0 0 20px rgba(251,191,36,0.2), 0 4px 20px rgba(0,0,0,0.4);
}
.dream-achieved-date {
  font-size: 0.78rem;
  color: #fbbf24;
  margin-top: 0.2rem;
}

/* Emoji picker in dream modal */
.dream-emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.4rem;
}
.dream-emoji-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0.4rem;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.dream-emoji-btn:hover {
  background: rgba(255,255,255,0.1);
  transform: scale(1.1);
}
.dream-emoji-btn.active {
  background: rgba(167,139,250,0.2);
  border-color: rgba(167,139,250,0.6);
  box-shadow: 0 0 8px rgba(167,139,250,0.3);
}

/* Dream Achieved overlay */
.dream-achieved-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.dream-achieved-overlay.show {
  opacity: 1;
  pointer-events: all;
}
.dream-achieved-content {
  text-align: center;
  padding: 2.5rem;
  max-width: 480px;
  animation: dreamAchievedIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.dream-achieved-stars {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  animation: starPulse 1.5s ease-in-out infinite;
}
.dream-achieved-title {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fbbf24, #f59e0b, #ec4899, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}
.dream-achieved-name {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.dream-achieved-rewards {
  font-size: 1rem;
  color: #fbbf24;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.dream-achieved-custom {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}
.dream-achieved-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Wide modal for dreams */
.modal-wide {
  max-width: 540px;
}

@keyframes dreamAchievedIn {
  from { transform: scale(0.5) rotate(-5deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg);   opacity: 1; }
}
@keyframes starPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}

/* ==========================================
   Chrome Extension Integration — Site Blocker
   ========================================== */

/* Extension panel in Rewards section */
.extension-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

.extension-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.ext-install-link {
  color: var(--accent-purple-light);
  font-size: 0.8rem;
  text-decoration: none;
  margin-left: auto;
}
.ext-install-link:hover { text-decoration: underline; }

/* Blocked-sites collapsible */
.blocked-sites-details summary.blocked-sites-summary {
  list-style: none;
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
}
.blocked-sites-details summary::-webkit-details-marker { display: none; }
.blocked-sites-details[open] summary { border-bottom: 1px solid var(--border); }

.blocked-sites-body {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.blocked-sites-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.blocked-site-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  background: var(--bg-secondary);
  border-radius: 6px;
  font-size: 0.83rem;
}

.blocked-site-domain { flex: 1; }

/* Status badge: 🔒 blocked / 🔓 unlocked */
.blocked-site-status {
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
}
.blocked-site-status.blocked {
  color: #f87171;
  background: rgba(239,68,68,.12);
}
.blocked-site-status.unlocked {
  color: #34d399;
  background: rgba(16,185,129,.15);
}

.blocked-site-add {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Timer site badge (inside floating timer widget) */
.timer-site-badge {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent-green-light);
  background: rgba(16,185,129,.15);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ==========================================
   Daily Discount Banner
   ========================================== */
.daily-discount-banner {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  color: var(--accent-green-light, #34d399);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  animation: discountPulse 2.5s ease infinite;
}

@keyframes discountPulse {
  0%, 100% { border-color: rgba(16, 185, 129, 0.35); }
  50%       { border-color: rgba(16, 185, 129, 0.7); box-shadow: 0 0 12px rgba(16, 185, 129, 0.2); }
}

/* Discount price display in reward cards */
.reward-price-discount {
  color: var(--accent-green-light, #34d399);
  font-weight: 700;
  font-size: 1.1rem;
}

.reward-price-discount small {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.85;
}

/* ==========================================
   Dream Stage List (inside dream cards)
   ========================================== */
.dream-stages-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dream-stage-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.2rem 0;
}

.dream-stage-item.done {
  color: var(--text-muted);
}

.dream-stage-item.done .dream-stage-label {
  text-decoration: line-through;
  opacity: 0.6;
}

.dream-stage-check {
  font-size: 0.85rem;
  flex-shrink: 0;
}

.dream-stage-label {
  line-height: 1.3;
}

/* Dream stage label inputs in modal */
.dream-stage-input {
  font-size: 0.85rem !important;
  padding: 0.4rem 0.6rem !important;
}

/* ==========================================
   Yearly Activity Heatmap
   ========================================== */
:root {
  --heatmap-cell: 11px;
  --heatmap-gap: 3px;
  --heatmap-l0: #1a1a2e;
  --heatmap-l1: #1b4332;
  --heatmap-l2: #2d6a4f;
  --heatmap-l3: #40916c;
  --heatmap-l4: #52b788;
}

.heatmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.heatmap-total {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.heatmap-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.heatmap-scroll::-webkit-scrollbar       { height: 6px; }
.heatmap-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.heatmap-months {
  display: grid;
  grid-auto-flow: column;
  gap: var(--heatmap-gap);
  padding-left: calc(var(--heatmap-cell) + 0.4rem + var(--heatmap-gap));  /* align past day labels */
  margin-bottom: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: max-content;
}
.heatmap-months span { white-space: nowrap; }

.heatmap-body {
  display: flex;
  gap: 0.4rem;
  min-width: max-content;
}

.heatmap-days {
  display: grid;
  grid-template-rows: repeat(7, var(--heatmap-cell));
  gap: var(--heatmap-gap);
  font-size: 0.65rem;
  color: var(--text-muted);
}
.heatmap-days span {
  display: flex;
  align-items: center;
  height: var(--heatmap-cell);
  line-height: 1;
}

.heatmap-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, var(--heatmap-cell));
  gap: var(--heatmap-gap);
}

.heatmap-cell {
  width: var(--heatmap-cell);
  height: var(--heatmap-cell);
  border-radius: 2px;
  background: var(--heatmap-l0);
  transition: transform 0.15s ease;
}
.heatmap-cell:hover { transform: scale(1.35); }
.heatmap-l0 { background: var(--heatmap-l0); }
.heatmap-l1 { background: var(--heatmap-l1); }
.heatmap-l2 { background: var(--heatmap-l2); }
.heatmap-l3 { background: var(--heatmap-l3); }
.heatmap-l4 { background: var(--heatmap-l4); }
.heatmap-empty { opacity: 0.25; pointer-events: none; }
.heatmap-today {
  box-shadow: 0 0 0 1.5px var(--accent-purple-light);
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.85rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.heatmap-legend .heatmap-cell { cursor: default; }
.heatmap-legend .heatmap-cell:hover { transform: none; }
.heatmap-legend-label { margin: 0 0.25rem; }

/* ==========================================
   Pomodoro / Focus Modal
   ========================================== */
.focus-phase {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.35rem 0.8rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: fit-content;
  margin: 0 auto 1rem;
}
.focus-phase-work {
  color: var(--accent-purple-light);
  border-color: rgba(124, 58, 237, 0.5);
  background: rgba(124, 58, 237, 0.1);
}
.focus-phase-short {
  color: var(--accent-green-light);
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.1);
}
.focus-phase-long {
  color: var(--accent-yellow);
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.1);
}
.focus-phase-paused {
  opacity: 0.6;
}

.focus-timer-display {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 5rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.focus-session-info {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.focus-controls {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.focus-controls .btn { font-size: 0.85rem; padding: 0.55rem 1.1rem; }

.focus-settings {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-bottom: 1rem;
}
.focus-settings-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.focus-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.focus-settings-item label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.focus-settings-item input {
  text-align: center;
  font-weight: 600;
}
.focus-presets {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.focus-block-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.4;
}
.focus-block-toggle input[type="checkbox"] {
  margin-top: 0.15rem;
  accent-color: var(--accent-purple);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.focus-reward-section,
.focus-sound-section {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.focus-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}
.focus-section-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 0.6rem 0;
}
.focus-reward-section select.form-input {
  width: 100%;
}

.focus-sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.sound-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
  text-align: center;
  font-family: inherit;
}
.sound-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.sound-btn:active { transform: scale(0.97); }
.sound-btn.active {
  background: rgba(124, 58, 237, 0.18);
  border-color: var(--accent-purple);
  color: var(--accent-purple-light);
  box-shadow: 0 0 0 1px var(--accent-purple) inset;
}

.focus-volume-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.focus-volume-row label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  flex: 0 0 auto;
}
.focus-volume-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent-purple);
  cursor: pointer;
}

.focus-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 0.85rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.focus-stat { text-align: center; }
.focus-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-purple-light);
  font-variant-numeric: tabular-nums;
}
.focus-stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}

@media (max-width: 480px) {
  .focus-timer-display { font-size: 3.75rem; }
  .focus-settings-grid { grid-template-columns: 1fr; }
}

/* ==========================================
   Achievements
   ========================================== */
.achievement-category {
  margin-top: 1rem;
}
.achievement-category:first-child { margin-top: 0; }

.achievement-category-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.achievement-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
}

.achievement {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.6rem;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.achievement.unlocked {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(16, 185, 129, 0.08));
  border-color: rgba(124, 58, 237, 0.35);
}
.achievement.unlocked:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.25);
}
.achievement.locked {
  opacity: 0.5;
  filter: grayscale(0.7);
}
.achievement.locked:hover {
  opacity: 0.75;
}

.achievement.ach-tier-bronze.unlocked { border-color: rgba(205, 127, 50, 0.5); }
.achievement.ach-tier-silver.unlocked { border-color: rgba(192, 192, 192, 0.5); }
.achievement.ach-tier-gold.unlocked   {
  border-color: rgba(251, 191, 36, 0.6);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(124, 58, 237, 0.1));
}

.achievement-emoji {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 0.4rem;
}
.achievement-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}
.achievement-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
}
.achievement-date {
  font-size: 0.6rem;
  color: var(--accent-green-light);
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}

/* ==========================================
   Keyboard Shortcuts Modal
   ========================================== */
.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.shortcut-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-purple-light);
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}
.shortcut-group-title:first-child { margin-top: 0; }

.shortcut-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.15rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(42, 42, 62, 0.5);
}
.shortcut-row:last-child { border-bottom: none; }
.shortcut-row span:last-child {
  margin-left: auto;
  color: var(--text-primary);
  text-align: right;
}

kbd {
  display: inline-block;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  min-width: 1.4rem;
  padding: 0.15rem 0.45rem;
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  text-align: center;
  line-height: 1;
}

/* Shared secondary-text block inside modals (morning, reflection). */
.modal-intro-text {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 0.3rem 0 1rem;
}

/* ==========================================
   Tab Time Tracker
   ========================================== */
.tab-time-intro {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 0.3rem 0 1rem;
}
.tab-time-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.tab-time-totals {
  display: flex;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.tab-time-totals strong {
  color: var(--accent-purple-light);
  font-variant-numeric: tabular-nums;
}
.tab-time-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tab-time-row {
  display: grid;
  grid-template-columns: minmax(0, 130px) 1fr auto;
  gap: 0.6rem;
  align-items: center;
}
.tab-time-domain {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab-time-bar-wrap {
  height: 8px;
  background: var(--bg-card-hover);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.tab-time-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-red));
  border-radius: 6px;
  transition: width 0.4s ease;
}
.tab-time-value {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: right;
}

/* ==========================================
   Evening Reflection Modal
   ========================================== */
.reflection-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
  margin-bottom: 0.4rem;
  transition: var(--transition);
}
.reflection-row:hover {
  border-color: var(--accent-purple);
}
.reflection-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-green, #4ade80);
  cursor: pointer;
  flex-shrink: 0;
}
.reflection-row span {
  flex: 1;
  line-height: 1.4;
  word-break: break-word;
}
