#installAppBtn {
  display: none; /* Hidden by default, will be shown via JS */
}

/* Service Buttons in Profile Menu */
.service-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.service-btn {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  text-align: left;
  outline: none !important;
}

.service-btn.gyan { /* Re-used for Stats Button */
  background: linear-gradient(135deg, #e1f4f8, #d1eef5);
  color: #2c5f7a;
  border: 1px solid rgba(44, 95, 122, 0.15);
}

.service-btn.gyan:hover {
  background: linear-gradient(135deg, #d1eef5, #c1e8f2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(44, 95, 122, 0.2);
}

.service-btn.feedback {
  background: linear-gradient(135deg, #f0e8f8, #e6d7f2);
  color: #6a4c93;
  border: 1px solid rgba(106, 76, 147, 0.15);
}

.service-btn.feedback:hover {
  background: linear-gradient(135deg, #e6d7f2, #dcc6ec);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(106, 76, 147, 0.2);
}

/* New Notifications Service Button */
.service-btn.notifications {
  background: linear-gradient(135deg, #fff3b0, #fde488);
  color: #855b11;
  border: 1px solid rgba(133, 91, 17, 0.15);
}
.service-btn.notifications:hover {
  background: linear-gradient(135deg, #fde488, #fcd662);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(133, 91, 17, 0.2);
}

.service-btn.share {
  background: linear-gradient(135deg, #e0f2fe, #d1e7ff);
  color: #1e40af;
  border: 1px solid rgba(30, 64, 175, 0.15);
}

.service-btn.share:hover {
  background: linear-gradient(135deg, #d1e7ff, #c2d9ff);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.15);
}

.service-btn.leaderboard {
  background: linear-gradient(135deg, #d4f7e3, #c3f2d8);
  color: #2a7a4f;
  border: 1px solid rgba(42, 122, 79, 0.15);
}

.service-btn.leaderboard:hover {
  background: linear-gradient(135deg, #c3f2d8, #b2ecd3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(42, 122, 79, 0.2);
}

/* New Settings Service Button */
.service-btn.settings {
  background: linear-gradient(135deg, #eef2f3, #e0e5e7);
  color: #4a5568;
  border: 1px solid rgba(74, 85, 104, 0.15);
}

.service-btn.settings:hover {
  background: linear-gradient(135deg, #e0e5e7, #d5dadd);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 85, 104, 0.2);
}

/* New Logout Service Button (replaces old style) */
.service-btn.logout {
  background: linear-gradient(135deg, #fed7d7, #fbb6b6);
  color: #c53030;
  border: 1px solid rgba(197, 48, 48, 0.15);
}

.service-btn.logout:hover {
  background: linear-gradient(135deg, #fbb6b6, #f99f9f);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(197, 48, 48, 0.2);
}


/* Dark theme for service buttons */
[data-theme="dark"] .service-btn.gyan {
  background: linear-gradient(135deg, #1a2f3a, #22374a);
  color: #74a5c1;
  border-color: rgba(116, 165, 193, 0.3);
}

[data-theme="dark"] .service-btn.feedback {
  background: linear-gradient(135deg, #2f1a3a, #37224a);
  color: #a574d4;
  border-color: rgba(165, 116, 212, 0.3);
}

[data-theme="dark"] .service-btn.notifications {
  background: linear-gradient(135deg, #4d3c0e, #695115);
  color: #fde488;
  border-color: rgba(253, 228, 136, 0.3);
}

[data-theme="dark"] .service-btn.share {
  background: linear-gradient(135deg, #1e3a8a, #1c44b3);
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.3);
}

[data-theme="dark"] .service-btn.leaderboard {
  background: linear-gradient(135deg, #1a3a2f, #224a3b);
  color: #74d4a5;
  border-color: rgba(116, 212, 165, 0.3);
}

[data-theme="dark"] .service-btn.settings {
  background: linear-gradient(135deg, #2d3748, #1a202c);
  color: #a0aec0;
  border-color: rgba(160, 174, 192, 0.3);
}

[data-theme="dark"] .service-btn.logout {
  background: linear-gradient(135deg, #4a2222, #3a1a1a);
  color: #e57373;
  border-color: rgba(229, 115, 115, 0.3);
}

:root{--bg:#fbf7f3;--accent:#7d5032;} /* Color contrast fix */
.wrap{contain:layout style paint;}
.circle{transform:translateZ(0);}
.count{font-feature-settings:"tnum";}

/* ---------- UPGRADED LOADING ANIMATION ---------- */
@keyframes pulseGlow {
    0%, 100% { text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent), 0 0 30px var(--accent); opacity: 0.7; transform: scale(1); }
    50% { text-shadow: 0 0 20px var(--accent), 0 0 30px var(--accent), 0 0 40px var(--accent); opacity: 1; transform: scale(1.05); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes background-pan {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

#loading-overlay {
  position: fixed; top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: linear-gradient(135deg, var(--bg) 0%, var(--card) 100%);
  background-size: 200% 200%;
  display: flex; justify-content: center; align-items: center; flex-direction: column;
  z-index: 99999;
  opacity: 1;
  transition: opacity 0.5s ease;
  animation: fadeIn 0.5s ease, background-pan 10s ease infinite;
}
.loading-om {
  font-size: 80px;
  color: var(--accent);
  margin-bottom: 25px;
  animation: pulseGlow 3s infinite ease-in-out;
}
 .loading-text {
  margin-top: 20px;
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
  letter-spacing: 1px;
  transition: opacity 0.3s ease-in-out;
  min-height: 20px;
  text-align: center;
}
[data-theme="dark"] #loading-overlay { background: linear-gradient(135deg, #1a1512 0%, #2a231d 100%); animation-name: fadeIn, background-pan; }


/* ---------- SMOOTH SCROLLING IMPROVEMENTS ---------- */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  height: 100%;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background-color: var(--accent);
  opacity: 0.4;
  border-radius: 8px;
  transition: opacity 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  opacity: 0.7;
}

::-webkit-scrollbar-track {
  background-color: transparent;
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

/* ---------- Theme & Base ---------- */
:root{
  --bg:#fbf7f3;
  --bg-rgb: 251, 247, 243;
  --card:#f3eae2;
  --accent: #7d5032; /* ACCESSIBILITY: Darker brown for better contrast */
  --muted: #755b48; /* ACCESSIBILITY: Darker muted text */
  --shadow: 0 12px 30px rgba(40,26,20,0.06); /* POLISH: Softer shadow */
  --soft-shadow: 0 16px 45px rgba(40,26,20,0.05); /* POLISH: Softer shadow */
  --radius:18px;
  --warning:#d64545;
  --toggle-bg: #e4dcd3;
  --toggle-handle: #fff;
  --circle-gradient-start: #f3eadf;
  --circle-gradient-end: #fbf3eb;
  --circle-border: rgba(138,90,58,0.08);
  --circle-inset: rgba(255,255,255,0.6);
  --btn-gradient-start: #eee6de;
  --btn-gradient-end: #f7f1ec;
  --btn-border: rgba(0,0,0,0.02);
  --mala-item-bg: #f7efe9;
  --mala-badge-bg: rgba(138,90,58,0.06);
  --ripple-bg: rgba(125,80,50,0.10);
  --popup-bg: #fff;
  --daily-summary-bg: #e8ddd1;
  --success: #28a745;
}

[data-theme="dark"] {
  --bg: #1a1512;
  --bg-rgb: 26, 21, 18;
  --card: #2a231d;
  --accent: #d4a574;
  --muted: #8a7b6a;
  --shadow: 0 10px 26px rgba(0,0,0,0.3);
  --soft-shadow: 0 14px 40px rgba(0,0,0,0.25);
  --warning: #e55757;
  --toggle-bg: #3a332a;
  --toggle-handle: #d4a574; /* This variable is now overridden by more specific rules below */
  --circle-gradient-start: #2a231d;
  --circle-gradient-end: #342b24;
  --circle-border: rgba(212,165,116,0.15);
  --circle-inset: rgba(255,255,255,0.05);
  --btn-gradient-start: #2a231d;
  --btn-gradient-end: #342b24;
  --btn-border: rgba(255,255,255,0.03);
  --mala-item-bg: #342b24;
  --mala-badge-bg: rgba(212,165,116,0.15);
  --ripple-bg: rgba(212,165,116,0.20);
  --popup-bg: #2a231d;
  --daily-summary-bg: #3a2f27;
  --success: #34c759;
}

*{box-sizing:border-box; -webkit-tap-highlight-color:transparent; margin:0; padding:0;}

html,body{
  height:100%;
  overflow-x:hidden;
  overflow-y:auto;
}

body{
  font-family: 'Inter', sans-serif;
  background:var(--bg);
  color:var(--accent);
  min-height:100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.noscroll {
  overflow: hidden;
}
/* BUG FIX: Prevent main content scrollbar when menu is open */
body.noscroll main {
  overflow: hidden;
}

/* ---------- CENTERED AUTH CONTAINER - MOVED UPWARDS ---------- */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  transition: background-color 0.3s ease;
  background: var(--bg);
  transform: translateY(-8vh);
}

.auth-box {
  width: 100%; 
  max-width: 400px; 
  background: var(--card); 
  border-radius: 20px; 
  padding: 32px; 
  box-shadow: var(--shadow);
  text-align: center;
  transition: all 0.3s ease;
}

/* ---------- POPUP NOTIFICATION (REMOVED SWIPE) ---------- */
#popup {
  position: fixed;
  top: 3%;
  left: 50%;
  transform: translate(-50%, -150%); /* Start off-screen */
  background-color: var(--card);
  color: var(--accent);
  border-radius: 14px;
  box-shadow: var(--soft-shadow);
  z-index: 2000;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
  user-select: none;
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.4s ease;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px;
  overflow: hidden;
  opacity: 0;
}
#popup.show {
  transform: translate(-50%, 0); /* Animate in */
  opacity: 1;
}
#popup.hide {
  transform: translate(-50%, -150%);
  opacity: 0;
}

.popup-icon { font-size: 24px; flex-shrink: 0; }
.popup-content { text-align: left; flex-grow: 1; }
#popup b { font-size: 16px; font-weight: 700; margin-bottom: 4px; color: var(--accent); }
#popup span { font-size: 14px; color: var(--muted); line-height: 1.4; }
.popup-progress {
  position: absolute; bottom: 0; left: 0; height: 4px;
  width: 100%; background-color: var(--accent); opacity: 0.5;
  transform-origin: left;
}
.popup-progress.animate { animation: shrink 4s linear forwards; }
@keyframes shrink {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}


/* ---------- FORGOT PASSWORD MODAL STYLED LIKE GUEST NOTICE ---------- */
#forgotPasswordOverlay {
  position: fixed; 
  inset: 0; 
  background: rgba(0,0,0,0.46);
  display: none; 
  align-items: center; 
  justify-content: center; 
  z-index: 1600;
}

#forgotPasswordModal {
  width: calc(100% - 48px); 
  max-width: 420px; 
  background: var(--bg);
  border-radius: 14px; 
  padding: 22px; 
  box-shadow: 0 18px 50px rgba(0,0,0,0.28);
  transform: translateY(12px); 
  animation: modalIn .28s cubic-bezier(.2,.9,.3,1);
  transition: background-color 0.3s ease;
}

#forgotPasswordModal h2{ 
  text-align: center; 
  margin: 0 0 10px; 
  font-size: 20px; 
  color: var(--accent); 
  transition: color 0.3s ease; 
}

#forgotPasswordModal p{ 
  text-align: center; 
  color: var(--muted); 
  margin-bottom: 18px; 
  line-height: 1.45; 
  transition: color 0.3s ease; 
}

/* UX BUG FIX: Make forgot password input consistent with auth form */
#forgotPasswordModal input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid rgba(138,90,58,0.1);
  border-radius: 12px;
  font-size: 16px;
  background: var(--bg); /* Changed from --card to match main auth form */
  color: var(--accent);
  margin-bottom: 12px;
  transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

#forgotPasswordModal input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
}

#forgotPasswordModal .message {
  font-size: 14px;
  margin-bottom: 18px;
  text-align: center;
  min-height: 20px;
  color: var(--warning);
  transition: color 0.3s ease;
}

#forgotPasswordModal .message.success {
  color: var(--success);
}

#forgotPasswordModal .row{ 
  display: flex; 
  gap: 12px; 
}

#forgotPasswordModal .btn{ 
  flex: 1; 
  padding: 12px; 
  border-radius: 12px; 
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-size: 16px;
  transition: all 0.3s ease;
}

#forgotPasswordModal .btn.cancel{ 
  background: var(--card); 
  color: var(--accent); 
  transition: background-color 0.3s ease, color 0.3s ease; 
}

#forgotPasswordModal .btn.cancel:hover {
  background: var(--muted);
  color: var(--bg);
}

#forgotPasswordModal .btn.send{ 
  background: var(--accent); 
  color: #fff; 
  font-weight: 700;
}

#forgotPasswordModal .btn.send:hover {
  background: #6b442a; /* Adjusted hover color */
  transform: translateY(-2px);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Authentication Styles ---------- */
.auth-title {
  font-family: 'Teko', sans-serif;
  font-size: 42px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px; 
  color:var(--accent);
  transition: color 0.3s ease;
}
.auth-subtitle {
  color:var(--muted); 
  margin-bottom:24px; 
  font-size:14px;
  transition: color 0.3s ease;
}
.form-group {
  margin-bottom:16px; 
  text-align:left;
}
.form-label {
  display:block; 
  margin-bottom:6px; 
  font-size:14px; 
  font-weight:600; 
  color:var(--accent);
  transition: color 0.3s ease;
}
.form-input {
  width:100%; 
  padding:12px 16px; 
  border:2px solid rgba(138,90,58,0.1); 
  border-radius:12px; 
  font-size:16px; 
  background:var(--bg); 
  color:var(--accent);
  transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}
.form-input:focus {
  outline:none; 
  border-color:var(--accent);
}

/* PASSWORD STRENGTH INDICATOR */
.password-strength {
  font-size: 12px;
  margin-top: 4px;
  margin-bottom: 8px;
  text-align: left;
  color: var(--muted);
  display: none;
}

.password-strength.weak {
  color: var(--warning);
}

.password-strength.strong {
  color: var(--success);
}

.auth-btn {
  width:100%; 
  padding:14px; 
  border:none; 
  border-radius:12px; 
  font-size:16px; 
  font-weight:600; 
  cursor:pointer; 
  margin-bottom:12px;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.btn-primary {
  background:var(--accent); 
  color:white;
  box-shadow: 0 4px 12px rgba(125, 80, 50, 0.2);
}
.btn-primary:hover:not(:disabled) {
  background: #6b442a; /* Adjusted hover color */
  transform:translateY(-2px);
  box-shadow: 0 6px 16px rgba(125, 80, 50, 0.3);
}
.btn-guest {
  background: linear-gradient(135deg, var(--btn-gradient-start), var(--btn-gradient-end));
  color: var(--accent);
  border: 1px solid rgba(138, 90, 58, 0.15);
  font-size:14px;
  padding:12px;
  box-shadow: 0 2px 8px rgba(138, 90, 58, 0.1);
}
.btn-guest:hover:not(:disabled) {
  background: linear-gradient(135deg, #e8ddd3, #f2eae0);
  transform:translateY(-2px);
  box-shadow: 0 4px 12px rgba(138, 90, 58, 0.15);
}

.auth-link {
  color:var(--accent); 
  cursor:pointer; 
  text-decoration:underline; 
  font-size:14px;
  transition: color 0.3s ease;
}
.auth-link:hover {
  color: #6b442a; /* Adjusted hover color */
}
.forgot-password {
  text-align: right;
  margin-top: 8px;
  margin-bottom: 16px;
}
.forgot-link {
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.3s ease;
}
.forgot-link:hover {
  color: var(--warning);
}
.error-message, .success-message {
  font-size:14px; 
  margin-top:8px; 
  text-align:center;
  padding: 8px;
  border-radius: 8px;
}
.error-message {
  color:var(--warning); 
  background: rgba(213, 69, 69, 0.1);
}
.success-message {
  color:var(--success); 
  background: rgba(40, 167, 69, 0.1);
}

/* ---------- HEADER CONTROLS ---------- */
.profile-toggle {
  position: absolute; top: 15px; left: 25px;
  width: 50px; height: 26px; background: var(--toggle-bg); border-radius: 13px;
  cursor: pointer; transition: all 0.3s ease; border: none; outline: none;
  display: flex; align-items: center; justify-content: center; z-index: 20;
  font-size: 14px; font-weight: 700; color: var(--accent);
}
.theme-toggle {
  position: absolute; top: 15px; right: 25px;
  width: 50px; height: 26px; background: var(--toggle-bg); border-radius: 13px;
  cursor: pointer; transition: all 0.3s ease; border: none; outline: none;
  display: flex; align-items: center; justify-content: center; z-index: 20;
  color: var(--accent);
}

.profile-toggle:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-toggle:hover {
  background: var(--accent);
  color: white;
  transform: scale(1.05);
}

.theme-toggle:hover {
  background: var(--accent);
  color: var(--bg);
}

.theme-toggle svg {
  position: absolute;
  transition: transform 0.4s ease-out, opacity 0.3s ease-out;
  fill: currentColor;
}

.sun-icon {
  opacity: 1; transform: rotate(0deg) scale(1);
}
.moon-icon {
  opacity: 0; transform: rotate(-90deg) scale(0);
}

[data-theme="dark"] .sun-icon {
  opacity: 0; transform: rotate(90deg) scale(0);
}
[data-theme="dark"] .moon-icon {
  opacity: 1; transform: rotate(0deg) scale(1);
}

.sr-only, .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- PROFILE MENU ---------- */
.profile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.profile-menu-overlay.open {
  opacity: 1;
  visibility: visible;
}

.profile-menu {
  position: fixed;
  top: 0;
  left: -350px;
  width: 320px;
  height: 100vh;
  background: var(--card);
  box-shadow: var(--shadow);
  z-index: 100;
  transition: left 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.profile-menu.open {
  left: 0;
}

.profile-menu-header {
  background: linear-gradient(135deg, var(--accent), #946b4f); /* Adjusted gradient */
  color: white;
  padding: 30px 20px 20px;
  text-align: center;
  position: relative;
  flex-shrink: 0;
}

.profile-menu-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 35px;
  height: 35px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  transition: background 0.3s ease;
}

.profile-menu-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.profile-menu-avatar-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    cursor: pointer;
}

.profile-menu-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: white;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 32px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.profile-menu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.edit-avatar-icon {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.profile-menu-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.profile-menu-email {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 0;
}

.profile-menu-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  padding-bottom: 20px;
}

.profile-menu-section {
  padding: 20px;
  border-bottom: 1px solid rgba(138, 90, 58, 0.1);
}

.profile-menu-section:last-of-type {
  border-bottom: none;
  padding-bottom: 30px;
}

[data-theme="dark"] .profile-menu-section {
  border-bottom-color: rgba(212, 165, 116, 0.15);
}

[data-theme="dark"] .profile-menu-section:last-of-type {
  border-bottom: none;
}

.profile-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 15px;
}

.profile-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--daily-summary-bg);
  border-radius: 12px;
  margin-bottom: 8px;
  transition: all 0.3s ease;
}

.profile-stat-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.profile-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.profile-stat-value .streak-icon {
  font-size: 16px;
  vertical-align: middle;
}

.profile-menu-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none !important;
}

/* --- START: GOAL SETTING STYLES --- */
.goal-progress-container {
  margin-top: 15px;
}
.goal-text {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.goal-progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--daily-summary-bg);
  border-radius: 4px;
  overflow: hidden;
}
.goal-progress-bar-inner {
  width: 0%;
  height: 100%;
  background-color: var(--accent);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.set-goal-btn {
  width: 100%;
  margin-top: 15px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  background: var(--daily-summary-bg);
  color: var(--accent);
  border: 1px dashed var(--muted);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.set-goal-btn:hover {
  background: var(--accent);
  color: white;
  border-style: solid;
}
/* --- END: GOAL SETTING STYLES --- */

/* ---------- FULL SCREEN LAYOUT ---------- */
.wrap{ 
  width: 100vw; 
  height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

header{ 
  text-align: center; 
  position: relative; 
  z-index: 5;
  padding: 20px 0 10px;
  flex-shrink: 0;
  background: var(--bg);
}

.om{ font-size: 20px; margin-bottom: 4px; }
h1{ 
  font-family: 'Teko', sans-serif;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: -4px;
}
.subtitle{ 
  font-size: 12px; 
  color: var(--muted); 
  letter-spacing: 1px; 
  text-transform: uppercase;
  margin-bottom: 0;
}
/* NEW: Mantra Display */
.mantra-display {
  font-size: 16px;
  color: var(--accent);
  margin-top: 4px;
  font-style: italic;
  min-height: 20px; /* Reserve space */
  cursor: pointer;
  transition: transform 0.2s ease;
  display: inline-block; /* Allows for transform */
  padding: 2px 8px;
}
.mantra-display:hover {
    transform: scale(1.05);
    color: #6b442a;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0 20px 20px;
  gap: 15px;
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
  /* NEW: Hide Scrollbar */
-ms-overflow-style: none;  /* IE and Edge */
scrollbar-width: none;  /* Firefox */
}

main::-webkit-scrollbar {
  display: none;
}

.counter-wrap{ 
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

.circle{
  width: min(60vw, 240px);
  height: min(60vw, 240px);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--circle-gradient-start), var(--circle-gradient-end));
  border: 6px solid var(--circle-border);
  box-shadow: var(--soft-shadow), inset 0 8px 18px var(--circle-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: transform .18s cubic-bezier(.2,.9,.3,1), background .3s ease, border-color .3s ease, box-shadow .3s ease;
  transform-origin: center;
}

.circle:focus{outline:none;}
.circle:active{ transform:scale(.95); }

.count{ 
  font-size: min(16vw, 100px);
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  transition: transform .25s ease, color .3s ease;
  text-align: center;
}

.ripple {
  position:absolute; border-radius:50%; background: var(--ripple-bg); transform: scale(0);
  pointer-events:none; animation: rippleAnim .7s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes rippleAnim{
  0% { transform: scale(0); opacity: .9; }
  60%{ transform: scale(1.2); opacity:.55; }
  100%{ transform: scale(1.6); opacity:0; }
}

.grid {
  display: grid; 
  grid-template-columns: repeat(2, 1fr); 
  gap: 15px; 
  width: 100%;
  flex-shrink: 0;
}

.card {
  background: var(--card); 
  border-radius: 14px; 
  padding: 20px; 
  box-shadow: var(--shadow);
  text-align: center; 
  min-height: 90px; 
  display: flex; 
  flex-direction: column; 
  justify-content: center;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.card .label{ 
  font-size: 13px; 
  color: var(--muted); 
  transition: color 0.3s ease; 
  margin-bottom: 8px;
}

.card .value{ 
  font-size: 24px; 
  font-weight: 700; 
  color: var(--accent); 
  transition: color 0.3s ease; 
}

.controls{ 
  width: 100%;
  display: flex; 
  gap: 15px; 
  flex-shrink: 0;
}

.btn {
  flex: 1; 
  padding: 16px; 
  border-radius: 14px;
  background: linear-gradient(180deg, var(--btn-gradient-start), var(--btn-gradient-end));
  border: 1px solid var(--btn-border); 
  box-shadow: var(--shadow); 
  font-weight: 600;
  color: var(--accent); 
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 16px;
  outline: none !important;
  user-select: none;
}

.btn:hover {
  background: linear-gradient(180deg, #e8ddd3, #f2eae0);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(138, 90, 58, 0.15);
}

.btn:focus, .btn:active, .btn:focus-visible {
  background: linear-gradient(180deg, var(--btn-gradient-start), var(--btn-gradient-end)) !important;
  color: var(--accent) !important;
  outline: none !important;
  box-shadow: var(--shadow) !important;
}

#historyScrollBtn:focus, #historyScrollBtn:active, #historyScrollBtn:focus-visible {
  background: linear-gradient(180deg, var(--btn-gradient-start), var(--btn-gradient-end)) !important;
  color: var(--accent) !important;
  outline: none !important;
  box-shadow: var(--shadow) !important;
}

.ad-banner-slot {
  width: 100%;
  min-height: 60px;
  margin: 15px 0;
  padding: 15px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  text-align: center;
  border: 2px dashed rgba(138, 90, 58, 0.2);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden; /* UPDATED: Prevents ad content from overflowing */
  position: relative; /* UPDATED: Establishes positioning context */
}

.ad-banner-slot:hover {
  border-color: rgba(138, 90, 58, 0.3);
  transform: translateY(-1px);
}

.ad-banner-placeholder {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.ad-banner-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

/* ---------- MALA HISTORY SECTION - DARK MODE COMPATIBLE ---------- */
.history-section {
  width: 100%;
  border-radius: 20px;
  padding: 20px;
  margin: 15px 0;
  flex-shrink: 0;
  min-height: 200px; /* For lazy loading trigger */
  transition: all 0.3s ease;
  background: #f8f4f0;
  box-shadow: 0 8px 20px rgba(138, 90, 58, 0.15);
  border: 1px solid rgba(138, 90, 58, 0.1);
  max-height: 400px; /* Scrollable History */
  overflow-y: auto; /* Scrollable History */
}

.history-section-title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
  transition: color 0.3s ease;
  color: #6b4226;
}

.history-group {
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 15px;
  transition: all 0.3s ease;
  background: #f2e8db;
  box-shadow: inset 0 2px 8px rgba(138, 90, 58, 0.1);
  border: 1px solid rgba(138, 90, 58, 0.08);
}

.history-group:hover {
  background: #ede0d1;
  box-shadow: inset 0 4px 12px rgba(138, 90, 58, 0.15);
  border-color: rgba(138, 90, 58, 0.15);
  transform: translateY(-1px);
}

.history-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-group-title {
  font-size: 20px;
  font-weight: 700;
  transition: color 0.3s ease;
  color: #8a5a3a;
}

.history-group-count {
  font-size: 18px;
  font-weight: 600;
  transition: color 0.3s ease;
  color: #a07860;
}

.history-group-summary {
  font-size: 14px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  transition: color 0.3s ease;
  color: #a07860;
}

.history-group-malas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mala-number {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #8a5a3a;
  color: #fff;
  box-shadow: 0 2px 6px rgba(138, 90, 58, 0.3);
  position: relative;
}

.mala-number:hover {
  transform: scale(1.15);
  background: #a26549;
  box-shadow: 0 4px 8px rgba(138, 90, 58, 0.4);
}

/* DARK THEME STYLES */
[data-theme="dark"] .history-section {
  background: #2a221a;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  border: none;
}

[data-theme="dark"] .history-section-title {
  color: #c79d6e;
}

[data-theme="dark"] .history-group {
  background: #342519;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
  border: none;
}

[data-theme="dark"] .history-group:hover {
  background: #3f2b1c;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.5);
}

[data-theme="dark"] .history-group-title {
  color: #c79d6e;
}

[data-theme="dark"] .history-group-count {
  color: #bc9b5f;
}

[data-theme="dark"] .history-group-summary {
  color: #b9a179;
}

[data-theme="dark"] .mala-number {
  background: #c79d6e;
  color: #2a221a;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

[data-theme="dark"] .mala-number:hover {
  background: #d4a574;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.overlay {
  position: fixed; 
  inset: 0; 
  background: rgba(0,0,0,0.46);
  display: none; 
  align-items: center; 
  justify-content: center; 
  z-index: 1600;
}

.modal {
  width: calc(100% - 48px); 
  max-width: 420px; 
  background: var(--bg);
  border-radius: 14px; 
  padding: 22px; 
  box-shadow: 0 18px 50px rgba(0,0,0,0.28);
  transform: translateY(12px); 
  animation: modalIn .28s cubic-bezier(.2,.9,.3,1);
  transition: background-color 0.3s ease;
}

@keyframes modalIn{ 
  from{opacity:0; transform:translateY(18px)} 
  to{opacity:1; transform:translateY(0)} 
}

.modal h2{ 
  text-align: center; 
  margin: 0 0 10px; 
  font-size: 20px; 
  color: var(--accent); 
  transition: color 0.3s ease; 
}

.modal p, .modal .info-note { 
  text-align: center; 
  color: var(--muted); 
  margin-bottom: 18px; 
  line-height: 1.45; 
  transition: color 0.3s ease; 
}
.modal .info-note {
  font-size: 13px;
  margin-top: 10px;
}

.modal .row{ 
  display: flex; 
  gap: 12px; 
}

.modal .btn{ 
  flex: 1; 
  padding: 12px; 
  border-radius: 12px; 
}

.modal .btn.cancel{ 
  background: var(--card); 
  color: var(--accent); 
  transition: background-color 0.3s ease, color 0.3s ease; 
}

.modal .btn.confirm, .modal .btn.save { 
  background: var(--accent); 
  color: #fff; 
  font-weight: 700;
}

.modal .btn.continue{ 
  background: var(--warning); 
  color: #fff; 
  font-weight: 700;
}

.modal .btn.login{ 
  background: var(--success); 
  color: #fff; 
  font-weight: 700;
}

.modal input[type="number"], .modal input[type="url"], .modal input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid rgba(138,90,58,0.1);
  border-radius: 12px;
  font-size: 16px;
  background: var(--card);
  color: var(--accent);
  margin-bottom: 12px;
}

/* UX BUG FIX: Hide spinners on number inputs in modals */
.modal input[type=number]::-webkit-inner-spin-button, 
.modal input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
.modal input[type=number] {
  -moz-appearance: textfield;
}

.custom-file-upload {
  border: 2px dashed var(--muted);
  display: inline-block;
  padding: 12px 24px;
  cursor: pointer;
  border-radius: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 600;
}
#avatarFileInput {
  display: none;
}
#file-chosen {
  font-style: italic;
  color: var(--accent);
}

/* --- NEW: SETTINGS MODAL --- */
.settings-group {
  text-align: left;
  margin-bottom: 20px;
}
.settings-group-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--circle-border);
}
.setting-item:last-child {
  border-bottom: none;
}
.setting-item label {
  font-size: 15px;
  color: var(--muted);
  font-weight: 500;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--toggle-bg);
  transition: .4s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--toggle-handle);
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent);
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* BUG FIX: Explicit Toggle Styles for Dark Mode */
[data-theme="dark"] .slider {
    background-color: var(--toggle-bg);
}
[data-theme="dark"] .slider:before {
    background-color: var(--muted); /* Muted color for OFF handle */
}
[data-theme="dark"] input:checked + .slider {
    background-color: var(--accent); /* Accent color for ON track */
}
[data-theme="dark"] input:checked + .slider:before {
    background-color: var(--bg); /* Dark background color for ON handle for contrast */
}


/* --- START: NEW LEADERBOARD DESIGN (THEMED) --- */
#leaderboardOverlay {
position: fixed; inset: 0;
z-index: 1500;
background: var(--bg);
display: none; /* Set to none initially */
align-items: flex-start;
justify-content: flex-start;
transform: translateX(100%); /* Start off-screen to the right */
transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
}
#leaderboardOverlay.show {
transform: translateX(0); /* Slide in */
}

.leaderboard-container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
color: var(--accent);
overflow: hidden;
}

.leaderboard-header-new {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px;
flex-shrink: 0;
}

.leaderboard-header-new .back-btn, .leaderboard-header-new .prize-icon-btn, .leaderboard-header-new .info-icon-btn {
background: none;
border: none;
font-size: 28px;
color: var(--muted);
cursor: pointer;
width: 40px;
height: 40px;
transition: transform 0.3s ease;
}

.leaderboard-header-new .prize-icon-btn {
  animation: prizePulse 2.5s infinite ease-in-out;
}

.leaderboard-header-new .prize-icon-btn:hover {
animation: none;
transform: scale(1.15);
}

@keyframes prizePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.leaderboard-header-new .title {
text-align: center;
}
.leaderboard-title-main {
font-size: 20px;
font-weight: 700;
}
.leaderboard-title-sub {
font-size: 12px;
color: var(--muted);
font-weight: 400;
}

.leaderboard-your-rank {
background: var(--accent);
color: white;
border-radius: 16px;
margin: 0 16px 16px;
padding: 16px;
text-align: center;
box-shadow: var(--soft-shadow);
}
.leaderboard-your-rank .rank-title {
font-size: 14px;
opacity: 0.8;
margin-bottom: 4px;
}
.leaderboard-your-rank .rank-value {
font-size: 28px;
font-weight: 700;
}
.leaderboard-your-rank .rank-value span {
font-size: 16px;
font-weight: 400;
}
.leaderboard-your-rank .rank-score {
font-size: 14px;
opacity: 0.9;
margin-top: 4px;
}


.leaderboard-podium {
display: flex;
justify-content: center;
align-items: flex-end;
gap: 8px;
padding: 16px 16px 24px;
}

.podium-user {
width: 30%;
max-width: 120px;
background: var(--card);
border-radius: 16px;
padding: 12px 8px;
text-align: center;
box-shadow: var(--shadow);
position: relative;
opacity: 0;
transform: translateY(20px);
animation: slideUpFadeIn 0.5s ease forwards;
}

.podium-user.rank-1 {
width: 33%;
max-width: 140px;
transform: translateY(-20px);
padding-top: 24px;
order: 2;
}
.podium-user.rank-2 {
order: 1;
}
.podium-user.rank-3 {
order: 3;
}

.podium-user .podium-avatar {
width: 60px;
height: 60px;
font-size: 24px;
border-width: 3px;
}
.podium-user.rank-1 .podium-avatar {
width: 80px;
height: 80px;
font-size: 32px;
border-width: 4px;
border-color: #f0c34a;
}
.podium-user::before {
content: '';
position: absolute;
top: 0px;
left: 50%;
transform: translateX(-50%);
font-size: 28px;
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.podium-user.rank-1::before { content: '👑'; }
.podium-user.rank-2::before { content: '🥈'; }
.podium-user.rank-3::before { content: '🥉'; }

.podium-user.rank-1 .podium-score {
color: #c7882c;
font-weight: 800;
}

[data-theme="dark"] .podium-user.rank-1 .podium-score {
color: #f0c34a;
}

.podium-avatar {
border-radius: 50%;
margin: 0 auto 8px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
color: white;
border: 3px solid;
background-size: cover;
background-position: center;
}

.podium-user.rank-2 .podium-avatar { border-color: #C0C0C0; }
.podium-user.rank-3 .podium-avatar { border-color: #CD7F32; }

.podium-name {
font-weight: 600;
font-size: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: var(--accent);
}
.podium-score {
font-weight: 700;
font-size: 18px;
margin: 2px 0;
color: var(--accent);
}
.podium-username {
font-size: 12px;
color: var(--muted);
}

.leaderboard-list-container {
flex: 1;
background: var(--card);
border-top-left-radius: 24px;
border-top-right-radius: 24px;
padding: 16px;
overflow-y: auto;
}
.leaderboard-inactive-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  padding: 30px;
  text-align: center;
}
.leaderboard-inactive-state .icon {
  font-size: 60px;
  margin-bottom: 20px;
}


.list-item {
display: flex;
align-items: center;
gap: 12px;
padding: 12px;
border-bottom: 1px solid var(--circle-border);
opacity: 0;
transform: translateY(20px);
animation: slideUpFadeIn 0.4s ease forwards;
border-radius: 12px;
}
.list-item:last-child {
border-bottom: none;
}
.podium-user.current-user, .list-item.current-user {
box-shadow: 0 0 15px 3px var(--accent);
}


.list-rank {
font-weight: 600;
color: var(--muted);
width: 20px;
text-align: center;
}

.list-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: 16px;
color: white;
background-size: cover;
background-position: center;
}

.list-user-info {
flex: 1;
}
.list-name {
font-weight: 600;
color: var(--accent);
}
.list-username {
font-size: 12px;
color: var(--muted);
}

.list-score-info {
text-align: right;
}
.list-score {
font-weight: 700;
color: var(--accent);
}

@keyframes slideUpFadeIn {
to { opacity: 1; transform: translateY(0); }
}

/* --- END: NEW LEADERBOARD DESIGN --- */

/* --- START: UPGRADED STATISTICS PAGE STYLES --- */
#statisticsOverlay {
transform: translateX(100%);
transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
background: var(--bg);
align-items: flex-start;
justify-content: flex-start;
z-index: 1700;
}
#statisticsOverlay.show {
transform: translateX(0);
}

.statistics-container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
color: var(--accent);
}

.statistics-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px;
flex-shrink: 0;
border-bottom: 1px solid var(--circle-border);
}

.statistics-close-btn {
background: none;
border: none;
font-size: 24px;
font-weight: 600;
color: var(--accent);
cursor: pointer;
padding: 8px;
width: 40px;
height: 40px;
border-radius: 50%;
transition: background-color 0.3s ease;
line-height: 1;
}
.statistics-close-btn:hover {
background-color: var(--card);
}

.statistics-title {
font-size: 20px;
font-weight: 700;
text-align: center;
margin: 0;
}

.statistics-content {
flex: 1;
padding: 20px;
overflow-y: auto;
}

.stats-section-title {
font-size: 14px;
font-weight: 600;
color: var(--muted);
text-transform: uppercase;
letter-spacing: 1px;
margin-bottom: 15px;
display: flex;
align-items: center;
gap: 8px;
}

.stat-cards-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 15px;
margin-bottom: 25px;
}

.stat-card {
background: var(--card);
border-radius: 14px;
padding: 16px;
text-align: center;
box-shadow: var(--shadow);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--soft-shadow);
}
.stat-card-label {
font-size: 13px;
color: var(--muted);
margin-bottom: 8px;
}
.stat-card-value {
font-size: 20px;
font-weight: 700;
color: var(--accent);
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
}

.chart-container {
background: var(--card);
border-radius: 14px;
padding: 20px;
box-shadow: var(--shadow);
min-height: 250px;
}

.activity-grid-container {
background: var(--card);
border-radius: 14px;
padding: 20px;
box-shadow: var(--shadow);
margin-bottom: 25px;
}
.activity-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 4px;
}
.activity-day {
width: 100%;
aspect-ratio: 1 / 1;
background-color: var(--daily-summary-bg);
border-radius: 4px;
}
.activity-day[data-level="1"] { background-color: #a6cba6; }
.activity-day[data-level="2"] { background-color: #72b372; }
.activity-day[data-level="3"] { background-color: #469b46; }
.activity-day[data-level="4"] { background-color: #267c26; }
[data-theme="dark"] .activity-day { background-color: #3a2f27; }
[data-theme="dark"] .activity-day[data-level="1"] { background-color: #2a4c3a; }
[data-theme="dark"] .activity-day[data-level="2"] { background-color: #3a6b4a; }
[data-theme="dark"] .activity-day[data-level="3"] { background-color: #4a8a5a; }
[data-theme="dark"] .activity-day[data-level="4"] { background-color: #6aaa7a; }

/* NEW: Statistics Empty State */
.statistics-empty-state {
  text-align: center;
  padding: 40px 20px;
}
.statistics-empty-state-icon {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}
.statistics-empty-state h3 {
font-size: 18px;
margin-bottom: 10px;
}
.statistics-empty-state p {
  color: var(--muted);
}
/* --- END: UPGRADED STATISTICS PAGE STYLES --- */

/* --- START: UPGRADED ONBOARDING TOUR STYLES --- */
#tourOverlay {
  position: fixed; inset: 0; z-index: 9000;
  background: transparent; transition: background 0.3s ease;
  pointer-events: none;
}
#tourOverlay.active {
  background: rgba(0,0,0,0.6);
  pointer-events: all;
}
@keyframes tourPulseGlow {
0%, 100% { box-shadow: 0 0 15px 5px var(--accent), 0 0 0 0 rgba(212, 165, 116, 0.7); }
50% { box-shadow: 0 0 25px 10px var(--accent), 0 0 0 10px rgba(212, 165, 116, 0); }
}
.tour-spotlight {
  position: absolute; pointer-events: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: tourPulseGlow 2.5s infinite ease-in-out;
}
.tour-modal {
  background: var(--card); color: var(--accent);
  padding: 24px; border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.2);
  width: calc(100% - 40px); max-width: 340px;
  position: absolute; z-index: 9001;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: all;
}
.tour-modal.active {
  opacity: 1;
  transform: translateY(0);
}
.tour-modal h3 { margin: 0 0 8px; font-size: 22px; font-weight: 700; }
.tour-modal p { margin: 0 0 24px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.tour-footer { display: flex; justify-content: space-between; align-items: center; }
.tour-steps { display: flex; gap: 6px; }
.tour-step-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background-color: var(--daily-summary-bg);
  transition: background-color 0.3s ease;
}
.tour-step-dot.active { background-color: var(--accent); }
.tour-nav { display: flex; gap: 8px; }
.tour-btn {
  border: none; padding: 12px 22px; border-radius: 12px;
  cursor: pointer; font-weight: 700; font-size: 15px;
  transition: all 0.3s ease;
}
.tour-btn.primary { background: var(--accent); color: white; }
.tour-btn.primary:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.tour-btn.secondary { background: transparent; color: var(--muted); }
.tour-btn.secondary:hover { background: var(--daily-summary-bg); color: var(--accent); }
.tour-btn.skip {
  position: absolute; top: 10px; right: 10px;
  padding: 8px 12px; background: transparent; color: var(--muted);
  font-size: 14px; border-radius: 8px;
}
.tour-btn.skip:hover { background: var(--daily-summary-bg); }
/* --- END: UPGRADED ONBOARDING TOUR STYLES --- */

/* Tooltip for Mala History */
#malaTooltip {
  position: absolute;
  background: var(--card);
  color: var(--accent);
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
  font-size: 13px;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
#malaTooltip.show {
  opacity: 1;
  transform: translateY(0);
}
/* Enhanced Empty History State */
.history-empty-state {
  text-align: center;
  padding: 40px 20px;
}
.history-empty-state-icon {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}
.history-empty-state p {
  color: var(--muted);
  margin-bottom: 20px;
}
.history-empty-state .btn {
  padding: 12px 24px;
  flex: none;
  width: auto;
}

footer {
  display: none !important;
}

/* Network Status Banner Styles */
#network-status {
  position: fixed;
  bottom: -50px; /* Start off-screen */
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  z-index: 10000;
  transition: bottom 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
#network-status.offline {
  background-color: #777;
}
#network-status.online {
  background-color: #28a745;
}
#network-status.show {
  bottom: 20px; /* Animate in */
}

/* NEW: Back to Top Button */
#backToTopBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}
#backToTopBtn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#backToTopBtn:hover {
    background-color: #6b442a;
}

/* --- START: NEW FULL PAGE NOTIFICATION STYLES --- */
.notification-overlay {
  position: fixed;
  inset: 0;
  background: rgba(var(--bg-rgb), 0.8);
  backdrop-filter: blur(8px);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.notification-overlay.show {
  opacity: 1;
  visibility: visible;
}
.notification-modal {
  background: var(--card);
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--soft-shadow);
  text-align: center;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.notification-overlay.show .notification-modal {
  transform: scale(1);
}
.notification-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: var(--bg);
  border: none;
  border-radius: 50%;
  color: var(--accent);
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: transform 0.3s ease, background-color 0.3s ease;
}
.notification-close-btn:hover {
  transform: scale(1.1) rotate(90deg);
  background-color: var(--daily-summary-bg);
}
.notification-image {
  width: 100%;
  height: auto; /* UPDATED: Let height be automatic */
  max-height: 50vh; /* UPDATED: Responsive max height */
  object-fit: contain; /* UPDATED: Ensure whole image is visible */
  border-radius: 16px;
  margin-bottom: 20px;
}
.notification-image.clickable {
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.notification-image.clickable:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow);
}
.notification-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}
.notification-message {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.notification-cta-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.3s ease;
  background: var(--accent);
  color: white;
}
.notification-cta-btn:hover {
  background: #6b442a;
  transform: translateY(-2px);
}
.notification-dismiss-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.notification-dismiss-group label {
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
#notificationDismissCheck {
  cursor: pointer;
}
/* --- END: NEW FULL PAGE NOTIFICATION STYLES --- */


@media (max-width: 480px) {
  .auth-container {
    transform: translateY(-5vh);
    padding: 15px;
  }
  
  .auth-box {
    padding: 24px;
  }
      
  main {
    padding: 0 15px 15px;
    gap: 12px;
  }

  .controls {
    display: flex;
    gap: 12px;
  }

  .btn { font-size: 14px; padding: 14px; }
  
  .circle {
    width: min(65vw, 200px);
    height: min(65vw, 200px);
  }
  
  .count {
    font-size: min(18vw, 80px);
  }
  
  .card {
    padding: 16px;
    min-height: 80px;
  }
  
  .card .value { 
    font-size: 20px; 
  }
  
  .profile-toggle { left: 20px; }
  .theme-toggle { right: 20px; }
  .profile-menu { width: 280px; }
  header { padding: 15px 0 8px; }
  
  .grid {
    gap: 12px;
  }
  
  .ad-banner-slot {
    min-height: 50px;
    margin: 12px 0;
    padding: 12px;
  }
  
  .history-section {
    padding: 16px;
    margin: 12px 0;
    max-height: 350px;
  }
  
  .history-section-title {
    font-size: 20px;
  }
  
  .history-group-title {
    font-size: 18px;
  }
  
  .history-group-count {
    font-size: 16px;
  }
  
  .mala-number {
    width: 35px;
    height: 35px;
    font-size: 12px;
  }

  .stat-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  #backToTopBtn {
    bottom: 15px;
    right: 15px;
  }
}


@media (max-width: 360px) {
  .circle {
    width: min(70vw, 180px);
    height: min(70vw, 180px);
  }
  
  .count {
    font-size: min(20vw, 70px);
  }
  
  .card .value { 
    font-size: 18px; 
  }
  
  .profile-toggle { left: 15px; }
  .theme-toggle { right: 15px; }
  .profile-menu { width: 260px; }
  
  .ad-banner-slot {
    min-height: 45px;
    margin: 10px 0;
    padding: 10px;
  }
  
  .mala-number {
    width: 32px;
    height: 32px;
    font-size: 11px;
  }
}

@media (min-width: 768px) {
  .circle {
    width: 280px;
    height: 280px;
  }
  
  .count {
    font-size: 120px;
  }
  
  .ad-banner-slot {
    min-height: 80px;
  }
  
  .history-section {
    max-height: 450px;
  }
}

.hide { display: none !important; }

/* Add this at the end of your CSS styles */
.customize-panel {
background: var(--card);
border-radius: 14px;
padding: 20px;
margin: 15px 0;
text-align: center;
box-shadow: var(--shadow);
}

.customize-title {
font-size: 18px;
font-weight: 700;
color: var(--accent);
margin-bottom: 15px;
}

.size-controls {
display: flex;
gap: 8px;
margin-bottom: 15px;
}

.size-option {
flex: 1;
padding: 8px 12px;
border: 2px solid var(--accent);
border-radius: 8px;
background: var(--bg);
color: var(--accent);
cursor: pointer;
font-size: 14px;
font-weight: 600;
transition: all 0.3s ease;
}

.size-option.selected {
background: var(--accent);
color: white;
}



/* Circle Size Classes */
.circle.size-small { 
width: min(50vw, 180px) !important; 
height: min(50vw, 180px) !important; 
}
.circle.size-small .count { 
font-size: min(14vw, 70px) !important; 
}

.circle.size-large { 
width: min(70vw, 300px) !important; 
height: min(70vw, 300px) !important; 
}
.circle.size-large .count { 
font-size: min(18vw, 130px) !important; 
}
/* ... [Keep your existing CSS] ... */

/* --- CUSTOM NOTIFICATION PERMISSION MODAL --- */
.notif-custom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10000; /* High z-index to sit above everything */
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.notif-custom-overlay.show {
  display: flex;
  opacity: 1;
}

.notif-custom-modal {
  background: var(--card);
  border-radius: 24px;
  padding: 30px;
  width: 90%;
  max-width: 340px;
  text-align: center;
  box-shadow: var(--shadow);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
  border: 1px solid var(--circle-border);
}

.notif-custom-overlay.show .notif-custom-modal {
  transform: scale(1);
}

.notif-icon {
  font-size: 48px;
  margin-bottom: 15px;
  display: block;
  animation: pulseGlow 3s infinite ease-in-out;
}

.notif-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  font-family: 'Teko', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.notif-desc {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 25px;
}

.notif-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notif-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.notif-btn.allow {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(125, 80, 50, 0.2);
}

.notif-btn.allow:hover {
  background: #6b442a;
  transform: translateY(-2px);
}

.notif-btn.later {
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.notif-btn.later:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Utility to hide elements */
.hide-important {
  display: none !important;
}
/* --- PWA INSTALL MODAL (Bottom Sheet Style) --- */
.pwa-install-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: none;
  align-items: flex-end; /* Aligns to bottom on mobile */
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pwa-install-overlay.show {
  display: flex;
  opacity: 1;
}

.pwa-install-card {
  background: var(--card);
  width: 100%;
  max-width: 500px;
  border-radius: 24px 24px 0 0; /* Rounded top corners */
  padding: 30px 24px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  transform: translateY(100%); /* Start hidden below screen */
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
  position: relative;
  text-align: center;
  border-top: 1px solid var(--circle-border);
}

.pwa-install-overlay.show .pwa-install-card {
  transform: translateY(0);
}

/* Desktop Tweak: Center it instead of bottom sheet */
@media (min-width: 768px) {
  .pwa-install-overlay { align-items: center; }
  .pwa-install-card { border-radius: 24px; width: 90%; max-width: 400px; }
}

.pwa-close-btn {
  position: absolute; top: 15px; right: 15px;
  background: transparent; border: none; font-size: 24px;
  color: var(--muted); cursor: pointer; padding: 5px;
}

.pwa-icon-wrapper {
  width: 72px; height: 72px; margin: 0 auto 15px;
  background: var(--bg); border-radius: 18px;
  box-shadow: var(--shadow); padding: 2px;
}
.pwa-icon { width: 100%; height: 100%; border-radius: 16px; }

.pwa-content h3 { margin: 0 0 8px; font-size: 20px; color: var(--accent); }
.pwa-content p { margin: 0 0 20px; font-size: 14px; color: var(--muted); line-height: 1.5; }

.pwa-install-btn {
  width: 100%; padding: 14px; border: none; border-radius: 14px;
  background: var(--accent); color: white; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: transform 0.2s, background 0.2s;
  box-shadow: 0 4px 15px rgba(125, 80, 50, 0.3);
}
.pwa-install-btn:hover { transform: translateY(-2px); background: #6b442a; }

