@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800;900&display=swap');

:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #dce4ef;
  --border-strong: #cbd5e1;

  --green: #22c55e;
  --green-dark: #15803d;
  --green-soft: #dcfce7;
  --orange: #ff7a00;
  --orange-dark: #c2410c;
  --orange-soft: #ffedd5;
  --gold: #f59e0b;
  --gold-soft: #fef3c7;
  --red: #ef4444;
  --red-dark: #b91c1c;
  --red-soft: #fee2e2;
  --purple: #8b5cf6;
  --purple-dark: #6d28d9;
  --purple-soft: #ede9fe;
  --blue: #0ea5e9;
  --blue-dark: #0369a1;
  --blue-soft: #e0f2fe;

  --dot-empty: #e2e8f0;
  --heat-1: #86efac;
  --heat-2: #16a34a;

  --radius: 16px;
  --radius-sm: 12px;
  --card-shadow: 0 4px 0 var(--border);
}

[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #131f33;
  --surface-alt: #0f172a;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #24344d;
  --border-strong: #334155;

  --green-soft: rgba(34, 197, 94, 0.16);
  --orange-soft: rgba(255, 122, 0, 0.18);
  --gold-soft: rgba(245, 158, 11, 0.18);
  --red-soft: rgba(239, 68, 68, 0.18);
  --purple-soft: rgba(139, 92, 246, 0.2);
  --blue-soft: rgba(14, 165, 233, 0.18);

  --dot-empty: #24344d;
  --heat-1: #22c55e;
  --heat-2: #4ade80;
  --card-shadow: 0 4px 0 #070c16;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* =========================================================
   Interactive Animations (Avatars, Mascots, Hero Orbs)
   ========================================================= */
@keyframes floatY {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

@keyframes bobScale {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-4px) scale(1.04); }
}

@keyframes svgBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.12); }
}

@keyframes svgPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.18); }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes modalPop {
  0% { opacity: 0; transform: scale(0.94) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes heroOrbit {
  0% { transform: rotate(0deg) translateX(62px) rotate(0deg); }
  100% { transform: rotate(360deg) translateX(62px) rotate(-360deg); }
}

@keyframes mascotCelebrate {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.16) rotate(-8deg); }
  50% { transform: scale(1.2) rotate(8deg); }
  75% { transform: scale(1.12) rotate(-4deg); }
}

.anim-float { animation: floatY 3.2s ease-in-out infinite; }
.anim-bob { animation: bobScale 2.6s ease-in-out infinite; }
.celebrate-bounce { animation: mascotCelebrate 0.65s ease-in-out !important; }

.svg-blink {
  transform-box: fill-box;
  transform-origin: center;
  animation: svgBlink 4.2s infinite;
}

.svg-pulse {
  transform-box: fill-box;
  transform-origin: center;
  animation: svgPulse 2s ease-in-out infinite;
}

.svg-spin-slow {
  transform-box: fill-box;
  transform-origin: center;
  animation: spinSlow 14s linear infinite;
}

/* Confetti Canvas & Floating XP */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.xp-float {
  position: fixed;
  pointer-events: none;
  z-index: 95;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--gold);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  animation: xpRise 1.05s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes xpRise {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.75); }
  20% { opacity: 1; transform: translate(-50%, -8px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -56px) scale(0.95); }
}

/* Connection Banner */
.status-banner {
  background: var(--orange);
  color: #ffffff;
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 800;
}

.status-banner.syncing {
  background: var(--blue);
}

/* Tactile 3D Gamified Buttons (Zero Layout Shift) */
button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 800;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease, background 0.15s ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--green);
  color: #ffffff;
  padding: 0.7rem 1.25rem;
  font-size: 0.95rem;
  box-shadow: 0 4px 0 var(--green-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--green-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
  box-shadow: 0 3px 0 var(--border-strong);
  padding: 0.55rem 0.95rem;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-alt);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--border-strong);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border: 2px solid transparent;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.btn-danger:hover:not(:disabled) {
  border-color: var(--red);
}

.btn-icon {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
  box-shadow: 0 2px 0 var(--border-strong);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.btn-icon:hover:not(:disabled) {
  background: var(--surface-alt);
}

.btn-icon:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--border-strong);
}

/* Inputs */
input, select, textarea {
  font-family: inherit;
  background: var(--surface-alt);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
  min-width: 0;
  max-width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  width: 100%;
  padding-right: 2.8rem;
}

.password-toggle {
  position: absolute;
  right: 0.5rem;
  background: transparent;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.password-toggle:hover {
  color: var(--text);
  background: var(--border);
}

/* App Shell Layout */
.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

@media (min-width: 900px) {
  .app-shell {
    grid-template-columns: 268px 1fr;
  }
}

/* Sidebar (Desktop) */
.sidebar {
  display: none;
  background: var(--surface);
  border-right: 2px solid var(--border);
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

@media (min-width: 900px) {
  .sidebar {
    display: flex;
  }
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--green);
  letter-spacing: -0.02em;
  padding: 0.25rem 0.5rem 1.25rem;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #22c55e, #0ea5e9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 3px 0 #15803d;
}

.nav-list {
  display: grid;
  gap: 0.4rem;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-weight: 800;
  font-size: 0.94rem;
  border: 2px solid transparent;
  text-align: left;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.nav-item:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border-color: var(--blue);
}

[data-theme="dark"] .nav-item.active {
  color: #38bdf8;
}

.nav-count {
  font-size: 0.78rem;
  font-weight: 900;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-muted);
}

.nav-item.active .nav-count {
  background: var(--blue);
  color: #ffffff;
}

/* XP Level Card */
.xp-card {
  background: var(--purple-soft);
  border: 2px solid var(--purple);
  border-radius: var(--radius);
  padding: 0.9rem;
  margin-top: 1.25rem;
}

.xp-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 900;
  font-size: 0.86rem;
  color: var(--purple-dark);
  margin-bottom: 0.45rem;
}

[data-theme="dark"] .xp-card-top {
  color: #c4b5fd;
}

.xp-bar-track {
  height: 10px;
  background: rgba(139, 92, 246, 0.22);
  border-radius: 999px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8b5cf6, #ec4899);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-xp-bar {
  display: block;
  margin-top: 0;
}

@media (min-width: 900px) {
  .mobile-xp-bar {
    display: none;
  }
}

.sidebar-footer {
  border-top: 2px solid var(--border);
  padding-top: 0.9rem;
  display: grid;
  gap: 0.65rem;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem;
}

/* Clickable Animated Avatar Button */
.avatar-trigger {
  position: relative;
  padding: 0;
  background: transparent;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-trigger:hover .avatar-edit-dot {
  transform: scale(1.12);
}

.avatar-animated-slot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--green);
  box-shadow: 0 3px 10px rgba(34, 197, 94, 0.25);
  flex-shrink: 0;
}

.avatar-animated-slot svg {
  width: 100%;
  height: 100%;
  display: block;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-fallback {
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: #ffffff;
  font-weight: 900;
  font-size: 1rem;
}

.avatar-edit-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue);
  color: #ffffff;
  border: 2px solid var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

/* Avatar Picker Grid inside Modal */
.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

@media (min-width: 480px) {
  .avatar-picker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.avatar-option {
  background: var(--surface-alt);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.avatar-option:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
}

.avatar-option.selected {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 3px 0 var(--green-dark);
}

.avatar-preview-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

.avatar-preview-circle svg {
  width: 100%;
  height: 100%;
}

.avatar-option-name {
  font-size: 0.8rem;
  font-weight: 900;
  text-align: center;
}

.avatar-option-tag {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-muted);
}

/* Mobile Header & 5-Tab Bottom Nav */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 25;
}

@media (min-width: 900px) {
  .mobile-header {
    display: none;
  }
}

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 2px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 0.35rem 0.2rem;
  z-index: 30;
}

@media (min-width: 900px) {
  .mobile-bottom-nav {
    display: none;
  }
}

.bottom-nav-btn {
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.15rem;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 10px;
}

.bottom-nav-btn.active {
  color: var(--blue);
  background: var(--blue-soft);
}

/* Main Content Area */
.main-content {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 1.15rem 1rem 5.5rem;
  display: grid;
  gap: 1.2rem;
  align-content: start;
}

@media (min-width: 900px) {
  .main-content {
    padding: 1.75rem 2rem 3rem;
  }
}

/* High-Contrast Cards */
.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--card-shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Top Gamified Hero Grid */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.15rem;
  align-items: start;
}

@media (min-width: 760px) {
  .hero-grid {
    grid-template-columns: 1.08fr 1fr;
  }
}

/* Glowing Flame Streak Hero Card + Interactive Companion */
.streak-hero {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--surface);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.streak-hero.lit {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 55%, #fef3c7 100%);
  border-color: var(--orange);
  box-shadow: 0 5px 0 var(--orange-dark), 0 0 28px rgba(255, 122, 0, 0.25);
}

[data-theme="dark"] .streak-hero.lit {
  background: linear-gradient(135deg, #2a180a 0%, #3b1c0a 60%, #1e1b2e 100%);
  border-color: var(--orange);
  box-shadow: 0 5px 0 #7c2d12, 0 0 32px rgba(255, 122, 0, 0.28);
}

.streak-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.streak-left-group {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.flame-orb {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: var(--surface-alt);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.flame-orb svg {
  width: 34px;
  height: 34px;
  color: var(--text-muted);
  opacity: 0.55;
  transition: all 0.3s ease;
}

.streak-hero.lit .flame-orb {
  background: linear-gradient(135deg, #ff7a00, #f59e0b);
  border-color: #fdba74;
  box-shadow: 0 0 24px rgba(255, 122, 0, 0.55);
  animation: flamePulse 2.2s ease-in-out infinite;
}

.streak-hero.lit .flame-orb svg {
  color: #ffffff;
  opacity: 1;
}

@keyframes flamePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(255, 122, 0, 0.45); }
  50% { transform: scale(1.06); box-shadow: 0 0 32px rgba(255, 122, 0, 0.78); }
}

/* Interactive Dashboard Hero Mascot Widget */
.hero-mascot-btn {
  background: transparent;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.hero-mascot-slot {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 3px solid var(--orange);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-mascot-slot svg {
  width: 100%;
  height: 100%;
}

.streak-number {
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1.08;
  color: var(--text);
}

.streak-hero.lit .streak-number {
  color: var(--orange-dark);
}

[data-theme="dark"] .streak-hero.lit .streak-number {
  color: #fdba74;
}

.streak-sub {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.streak-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--surface-alt);
  border: 2px solid var(--border);
  color: var(--text);
}

.streak-hero.lit .stat-chip {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(255, 122, 0, 0.35);
}

[data-theme="dark"] .streak-hero.lit .stat-chip {
  background: rgba(15, 23, 42, 0.65);
}

.daily-goal-wrap {
  display: grid;
  gap: 0.35rem;
}

.daily-goal-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
}

.goal-track {
  height: 12px;
  border-radius: 999px;
  background: var(--dot-empty);
  overflow: hidden;
}

.goal-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #4ade80);
  transition: width 0.35s ease;
}

/* Activity Card */
.view-toggle-pills {
  display: inline-flex;
  background: var(--surface-alt);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 2px;
}

.toggle-pill {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
}

.toggle-pill.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.strip-7day {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.45rem;
  text-align: center;
  margin-top: 0.5rem;
}

.strip-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.25rem;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 2px solid transparent;
}

.strip-day.is-today {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.strip-label {
  font-size: 0.76rem;
  font-weight: 900;
  color: var(--text-muted);
}

.activity-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--dot-empty);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--text-muted);
}

.activity-dot.level-1 {
  background: var(--heat-1);
  color: #064e3b;
}

.activity-dot.level-2 {
  background: var(--heat-2);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35);
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-weight: 800;
  font-size: 0.9rem;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.month-weekday {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 900;
  padding-bottom: 2px;
}

.month-cell {
  height: 30px;
  border-radius: 7px;
  background: var(--dot-empty);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text-muted);
}

.month-cell.empty {
  background: transparent;
}

.month-cell.level-1 {
  background: var(--heat-1);
  color: #064e3b;
}

.month-cell.level-2 {
  background: var(--heat-2);
  color: #ffffff;
}

.month-cell.is-today {
  outline: 2px solid var(--blue);
}

/* Compact Quick-Add Quest Bar */
.quick-add-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  box-shadow: var(--card-shadow);
}

.quick-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.quick-add-input {
  flex: 1 1 220px;
  font-size: 1rem;
  padding: 0.72rem 0.95rem;
}

.quick-prio-select {
  padding: 0.7rem 0.75rem;
  font-size: 0.88rem;
}

/* Filter Pill Bar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-pill {
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 2px solid var(--border);
}

.filter-pill.active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.search-input {
  padding: 0.48rem 0.8rem;
  font-size: 0.88rem;
  min-width: 155px;
}

.toolbar-select {
  padding: 0.48rem 0.7rem;
  font-size: 0.85rem;
}

/* Gamified Quest Task Cards */
.task-list {
  display: grid;
  gap: 0.75rem;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 2px solid var(--border);
  border-left-width: 6px;
  box-shadow: 0 3px 0 var(--border);
  transition: transform 0.12s ease, opacity 0.2s ease;
}

.task-item:hover {
  transform: translateY(-1px);
}

.task-item.prio-high { border-left-color: var(--red); }
.task-item.prio-medium { border-left-color: var(--gold); }
.task-item.prio-low { border-left-color: var(--green); }

.task-item.completed {
  opacity: 0.68;
  background: var(--surface-alt);
}

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

.quest-check {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2.5px solid var(--border-strong);
  background: var(--surface-alt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  color: transparent;
  transition: all 0.15s ease;
}

.quest-check:hover {
  border-color: var(--green);
}

.quest-check.checked {
  background: var(--green);
  border-color: var(--green-dark);
  color: #ffffff;
  box-shadow: 0 2px 0 var(--green-dark);
}

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

.task-title {
  font-weight: 800;
  font-size: 1rem;
  word-break: break-word;
}

.task-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.badge-high { background: var(--red-soft); color: var(--red); }
.badge-medium { background: var(--gold-soft); color: #b45309; }
[data-theme="dark"] .badge-medium { color: #fbbf24; }
.badge-low { background: var(--green-soft); color: var(--green-dark); }
[data-theme="dark"] .badge-low { color: #4ade80; }
.badge-xp { background: var(--purple-soft); color: var(--purple-dark); }
[data-theme="dark"] .badge-xp { color: #c4b5fd; }
.badge-cat { background: var(--surface-alt); border: 1.5px solid var(--border); color: var(--text-muted); }
.badge-overdue { background: var(--red); color: #ffffff; }

.task-subtasks {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1.5px dashed var(--border);
  display: grid;
  gap: 0.35rem;
}

.subtask-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.subtask-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.subtask-row.done span {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* =========================================================
   FIXED MODAL (Zero Horizontal Overflow, Clean Labels & Pop)
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 60;
}

.modal-card {
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  animation: modalPop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.9rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.task-form {
  display: grid;
  gap: 1rem;
  width: 100%;
}

.modal-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.modal-field label {
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.task-form input,
.task-form select,
.task-form textarea {
  width: 100%;
  min-width: 0;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  width: 100%;
}

@media (min-width: 560px) {
  .form-row.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .form-row.cols-2 {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.65rem;
  padding-top: 0.75rem;
  border-top: 2px solid var(--border);
}

.subtasks-draft {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.subtask-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 2px solid var(--border);
  font-size: 0.82rem;
  font-weight: 800;
}

.subtask-chip button {
  background: transparent;
  color: var(--red);
  padding: 0 2px;
  font-size: 1rem;
}

/* Toasts */
.toast {
  position: fixed;
  bottom: 4.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #ffffff;
  border: 2px solid #334155;
  padding: 0.75rem 1.15rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  z-index: 70;
  max-width: calc(100vw - 2rem);
}

.toast.toast-error {
  background: var(--red-dark);
  border-color: var(--red);
}

@media (min-width: 900px) {
  .toast {
    bottom: 1.5rem;
  }
}

.toast button {
  background: var(--green);
  color: #ffffff;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  box-shadow: 0 3px 0 var(--green-dark);
}

/* =========================================================
   Split-Screen Animated Login Page
   ========================================================= */
.auth-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 860px) {
  .auth-split {
    grid-template-columns: 1.08fr 1fr;
  }
}

.auth-hero {
  background: radial-gradient(circle at 20% 20%, #14532d 0%, #0f172a 65%, #090d16 100%);
  color: #ffffff;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
}

.auth-hero-inner {
  max-width: 460px;
  margin: 0 auto;
  display: grid;
  gap: 1.25rem;
  position: relative;
  z-index: 2;
}

/* Animated Interactive Mascot Stage on Login */
.login-animation-stage {
  position: relative;
  height: 165px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.25rem 0;
}

.stage-ring {
  position: absolute;
  width: 142px;
  height: 142px;
  border-radius: 50%;
  border: 2px dashed rgba(74, 222, 128, 0.35);
  animation: spinSlow 22s linear infinite;
}

.stage-orbit-badge {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 900;
  color: #fde047;
  animation: heroOrbit 9s linear infinite;
}

.stage-mascot-core {
  width: 106px;
  height: 106px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 36px rgba(34, 197, 94, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.stage-mascot-core:hover {
  transform: scale(1.08);
}

.stage-mascot-core svg {
  width: 100%;
  height: 100%;
}

.stage-avatar-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.stage-mini-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.25);
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.stage-mini-avatar:hover,
.stage-mini-avatar.active {
  transform: scale(1.16);
  border-color: #4ade80;
}

.stage-mini-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.auth-hero h1 {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.15;
}

.auth-hero p {
  color: #cbd5e1;
  font-size: 0.96rem;
  font-weight: 600;
}

.hero-feature-list {
  display: grid;
  gap: 0.65rem;
}

.hero-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 0.7rem 0.95rem;
  font-weight: 800;
  font-size: 0.9rem;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin: 1.15rem 0;
  background: var(--surface-alt);
  border: 2px solid var(--border);
  padding: 4px;
  border-radius: 12px;
}

.auth-tab {
  padding: 0.6rem;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 0 var(--border);
}

.auth-form {
  display: grid;
  gap: 0.9rem;
}

.field-group {
  display: grid;
  gap: 0.3rem;
}

.field-group label {
  font-size: 0.85rem;
  font-weight: 800;
}

.error-box {
  background: var(--red-soft);
  color: var(--red);
  border: 2px solid var(--red);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 0.9rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.15rem 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--border);
}

.google-btn-container {
  display: flex;
  justify-content: center;
  min-height: 44px;
}
