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

/* ── Smooth theme transition ── */
body, .app-window, .title-bar, .timer-box,
.section-card, .mode-tabs, .mode-tab,
.popup-card, .popup-overlay, .btn-reset,
.badge-item, .progress-bar {
  transition: background 0.35s ease, border-color 0.35s ease, color 0.35s ease, box-shadow 0.35s ease;
}

/* ════════════════════════════════════════
   LIGHT MODE (default)
════════════════════════════════════════ */

body {
  font-family: 'Quicksand', sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, #ffc8dc 0%, #ffd6e7 35%, #ffe8f0 65%, #fff0f5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
  position: relative;
}

/* ── Floating background emojis ── */
.floating-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.float-emoji {
  position: absolute;
  animation: floatUp linear infinite;
  opacity: 0.35;
}

@keyframes floatUp {
  0%   { transform: translateY(110vh) rotate(0deg);   opacity: 0;    }
  10%  { opacity: 0.35; }
  90%  { opacity: 0.25; }
  100% { transform: translateY(-10vh) rotate(360deg); opacity: 0;    }
}

/* ── App Window ── */
.app-window {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  border: 1.5px solid rgba(255, 160, 195, 0.45);
  box-shadow: 0 8px 32px rgba(255, 140, 185, 0.18), 0 2px 8px rgba(255, 120, 170, 0.10);
  overflow: hidden;
  animation: fadeInWindow 0.6s ease;
}

@keyframes fadeInWindow {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* ── Title Bar ── */
.title-bar {
  background: linear-gradient(90deg, #ff9ec4 0%, #ffb6d9 50%, #ffd0e8 100%);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.title-bar-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(180, 60, 110, 0.35);
  letter-spacing: 1px;
}

.title-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Dark Mode Toggle Button ── */
.dark-toggle {
  background: rgba(255, 255, 255, 0.28);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  border-radius: 50px;
  padding: 3px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  line-height: 1.4;
}
.dark-toggle:hover { background: rgba(255, 255, 255, 0.45); transform: scale(1.08); }

/* ── Window Control Dots ── */
.window-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.win-btn {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(140, 50, 80, 0.7);
  font-weight: 700;
  transition: transform 0.15s;
  line-height: 1;
}
.win-btn:hover   { transform: scale(1.15); }
.win-btn.red     { background: #ff8fa8; }
.win-btn.yellow  { background: #ffe08a; }
.win-btn.green   { background: #90e0a0; }

/* ── Main Content ── */
.main-content {
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Mode Tabs ── */
.mode-tabs {
  display: flex;
  gap: 8px;
  background: rgba(255, 190, 215, 0.25);
  border-radius: 50px;
  padding: 4px;
}

.mode-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: 50px;
  border: none;
  background: transparent;
  font-family: 'Quicksand', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #d4708a;
  cursor: pointer;
  transition: all 0.25s;
}

.mode-tab.active {
  background: linear-gradient(135deg, #ff9ec4, #ffb6d9);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255, 130, 170, 0.32);
}

/* ── Timer Box ── */
.timer-box {
  background: linear-gradient(135deg, rgba(255, 220, 235, 0.72), rgba(255, 240, 248, 0.72));
  border-radius: 18px;
  border: 1.5px solid rgba(255, 180, 210, 0.40);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.timer-box::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 130px; height: 130px;
  background: radial-gradient(circle, rgba(255, 182, 213, 0.35), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.timer-box::after {
  content: '';
  position: absolute;
  bottom: -20px; left: -20px;
  width: 90px; height: 90px;
  background: radial-gradient(circle, rgba(255, 200, 220, 0.25), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* ── Timer Display ── */
.timer-display {
  font-family: 'Press Start 2P', monospace;
  font-size: 42px;
  color: #e05585;
  text-shadow: 2px 2px 0 rgba(220, 80, 130, 0.15);
  letter-spacing: 4px;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.blink-cursor {
  display: inline-block;
  animation: blink 1s step-end infinite;
  color: #ffaac8;
  font-size: 36px;
  vertical-align: middle;
  margin-left: 4px;
}

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

/* ── Session Label ── */
.session-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #e889aa;
  letter-spacing: 2px;
  text-transform: uppercase;
  z-index: 1;
}

/* ── Progress Bar ── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 180, 210, 0.2);
  border-radius: 50px;
  overflow: hidden;
  z-index: 1;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff9ec4, #ffb6d9, #ffd0e8);
  border-radius: 50px;
  transition: width 1s linear;
}

/* ── Motivation Text ── */
.motivation-text {
  font-size: 14px;
  color: #d4708a;
  font-weight: 600;
  text-align: center;
  min-height: 22px;
  z-index: 1;
  animation: fadeIn 0.5s ease;
}

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

/* ── Button Row ── */
.btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  z-index: 1;
}

.ctrl-btn {
  font-family: 'Quicksand', sans-serif;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  padding: 12px 24px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ctrl-btn:hover  { transform: scale(1.06); }
.ctrl-btn:active { transform: scale(0.96); }

.btn-start {
  background: linear-gradient(135deg, #ff9ec4, #ffb6d9);
  color: #fff;
  box-shadow: 0 3px 12px rgba(255, 130, 170, 0.38);
}

.btn-pause {
  background: linear-gradient(135deg, #ffecd2, #ffe0a0);
  color: #c0903a;
  box-shadow: 0 3px 12px rgba(200, 160, 80, 0.25);
}

.btn-reset {
  background: rgba(255, 210, 228, 0.35);
  color: #d4708a;
  border: 1.5px solid rgba(255, 160, 195, 0.40);
}

/* ── Section Cards ── */
.section-card {
  background: rgba(255, 240, 248, 0.58);
  border-radius: 16px;
  border: 1.5px solid rgba(255, 185, 215, 0.28);
  padding: 16px 20px;
}

.section-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #e889aa;
  letter-spacing: 2px;
  margin-bottom: 14px;
  text-transform: uppercase;
}

/* ── Streak Row ── */
.streak-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.streak-count {
  font-size: 28px;
  font-weight: 700;
  color: #e05585;
  display: flex;
  align-items: center;
  gap: 8px;
}

.streak-fire { font-size: 30px; }

.sessions-info {
  font-size: 13px;
  color: #d4708a;
  font-weight: 500;
  text-align: right;
}

.total-label {
  font-size: 11px;
  color: #e8aabf;
  margin-top: 2px;
}

/* ── Badges Grid ── */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 185, 215, 0.28);
  background: rgba(255, 230, 242, 0.38);
  transition: all 0.3s;
  position: relative;
}

.badge-item.unlocked {
  background: linear-gradient(135deg, rgba(255, 182, 213, 0.45), rgba(255, 205, 228, 0.45));
  border-color: rgba(255, 140, 185, 0.55);
  box-shadow: 0 2px 10px rgba(255, 130, 170, 0.22);
}

.badge-item.locked { filter: grayscale(0.75) opacity(0.5); }

.badge-icon  { font-size: 26px; }
.badge-label { font-size: 11px; color: #d4708a; font-weight: 600; text-align: center; }
.badge-req   { font-size: 10px; color: #e8aabf; font-weight: 500; }
.badge-item.unlocked .badge-label { color: #c0446a; }

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0   0   rgba(255, 160, 195, 0);    }
  50%       { box-shadow: 0 0 16px 4px rgba(255, 160, 195, 0.55); }
}

/* ── Popup Overlay ── */
.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 182, 213, 0.22);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}
.popup-overlay.show { display: flex; }

.popup-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  border-radius: 22px;
  border: 2px solid rgba(255, 160, 195, 0.42);
  padding: 36px 32px;
  text-align: center;
  max-width: 300px;
  box-shadow: 0 8px 32px rgba(255, 130, 170, 0.22);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1);   }
}

.popup-emoji { font-size: 48px; margin-bottom: 12px; }

.popup-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #e05585;
  margin-bottom: 10px;
  line-height: 1.6;
}

.popup-msg {
  font-size: 15px;
  color: #d4708a;
  font-weight: 600;
  margin-bottom: 20px;
}

.popup-close {
  font-family: 'Quicksand', sans-serif;
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(135deg, #ff9ec4, #ffb6d9);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 10px 28px;
  cursor: pointer;
  transition: transform 0.15s;
}
.popup-close:hover { transform: scale(1.05); }

/* ── Confetti ── */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -30px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0%   { transform: translateY(0)     rotate(0deg);   opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ── Responsive ── */
@media (max-width: 500px) {
  .timer-display { font-size: 32px; }
  .badges-grid   { gap: 6px; }
  .badge-icon    { font-size: 20px; }
}


/* ════════════════════════════════════════
   DARK MODE  ✦  black & hot pink theme
   Applied by adding  .dark  to <body>
════════════════════════════════════════ */

body.dark {
  background: linear-gradient(135deg, #0a0a0a 0%, #160008 50%, #0a0008 100%);
}

body.dark .float-emoji { opacity: 0.20; }

/* window */
body.dark .app-window {
  background: rgba(14, 4, 10, 0.94);
  border-color: rgba(255, 60, 120, 0.30);
  box-shadow: 0 8px 40px rgba(255, 40, 110, 0.20), 0 0 0 1px rgba(255, 40, 110, 0.06);
}

/* title bar */
body.dark .title-bar {
  background: linear-gradient(90deg, #1c0010 0%, #280014 50%, #1c0010 100%);
  border-bottom: 1px solid rgba(255, 60, 120, 0.22);
}

body.dark .dark-toggle {
  background: rgba(255, 60, 120, 0.12);
  border-color: rgba(255, 60, 120, 0.38);
  color: #ff6eb4;
}
body.dark .dark-toggle:hover { background: rgba(255, 60, 120, 0.25); }

/* tabs */
body.dark .mode-tabs {
  background: rgba(255, 40, 100, 0.07);
  border: 1px solid rgba(255, 40, 100, 0.14);
}
body.dark .mode-tab { color: #ff6eb4; }
body.dark .mode-tab.active {
  background: linear-gradient(135deg, #b8003c, #e00060);
  color: #fff;
  box-shadow: 0 2px 12px rgba(200, 0, 70, 0.55);
}

/* timer box */
body.dark .timer-box {
  background: linear-gradient(135deg, rgba(24, 4, 14, 0.90), rgba(16, 0, 10, 0.90));
  border-color: rgba(255, 40, 100, 0.22);
}
body.dark .timer-box::before {
  background: radial-gradient(circle, rgba(255, 40, 100, 0.14), transparent 70%);
}
body.dark .timer-box::after {
  background: radial-gradient(circle, rgba(180, 0, 70, 0.10), transparent 70%);
}

/* timer digits – neon pink glow */
body.dark .timer-display {
  color: #ff3d85;
  text-shadow:
    0 0 8px  rgba(255, 60, 130, 0.80),
    0 0 20px rgba(255, 40, 110, 0.45),
    2px 2px 0 rgba(140, 0, 60, 0.50);
}
body.dark .blink-cursor  { color: #ff6eb4; }
body.dark .session-label { color: #aa2255; }

/* progress */
body.dark .progress-bar  { background: rgba(255, 40, 100, 0.10); }
body.dark .progress-fill { background: linear-gradient(90deg, #b8003c, #ff3d85, #ff6eb4); }

/* motivation */
body.dark .motivation-text { color: #ff6eb4; }

/* buttons */
body.dark .btn-start {
  background: linear-gradient(135deg, #b8003c, #e00060);
  box-shadow: 0 3px 16px rgba(200, 0, 70, 0.55);
}
body.dark .btn-pause {
  background: linear-gradient(135deg, #2a1c00, #3e2a00);
  color: #e8b84b;
  box-shadow: 0 3px 10px rgba(120, 80, 0, 0.30);
}
body.dark .btn-reset {
  background: rgba(255, 40, 100, 0.08);
  color: #ff6eb4;
  border-color: rgba(255, 40, 100, 0.28);
}

/* section cards */
body.dark .section-card {
  background: rgba(18, 4, 12, 0.80);
  border-color: rgba(255, 40, 100, 0.14);
}
body.dark .section-title  { color: #aa2255; }
body.dark .streak-count   { color: #ff3d85; }
body.dark .sessions-info  { color: #ff6eb4; }
body.dark .total-label    { color: #6e1a35; }

/* badges */
body.dark .badge-item {
  background: rgba(20, 4, 12, 0.75);
  border-color: rgba(255, 40, 100, 0.14);
}
body.dark .badge-item.unlocked {
  background: linear-gradient(135deg, rgba(160, 0, 60, 0.28), rgba(200, 0, 80, 0.16));
  border-color: rgba(255, 40, 100, 0.45);
  box-shadow: 0 2px 14px rgba(200, 0, 70, 0.28);
}
body.dark .badge-label                      { color: #ff6eb4; }
body.dark .badge-req                        { color: #6e1a35; }
body.dark .badge-item.unlocked .badge-label { color: #ff3d85; }

/* popup */
body.dark .popup-overlay { background: rgba(0, 0, 0, 0.72); }
body.dark .popup-card {
  background: rgba(12, 2, 8, 0.97);
  border-color: rgba(255, 60, 120, 0.40);
  box-shadow: 0 8px 40px rgba(200, 0, 70, 0.32);
}
body.dark .popup-title { color: #ff3d85; }
body.dark .popup-msg   { color: #ff6eb4; }
body.dark .popup-close {
  background: linear-gradient(135deg, #b8003c, #e00060);
  box-shadow: 0 3px 14px rgba(200, 0, 70, 0.50);
}