:root {
  --primary: #6B35A3;
  --primary-2: #8A4FD0;
  --secondary: #F4B942;
  --secondary-2: #FFD27A;
  --bg: #120723;
  --bg-2: #0A0419;
  --text: #FFFFFF;
  --muted: #CFC0E8;
  --dim: #8A7BA8;
  --success: #4CAF50;
  --warn: #F4B942;
  --grey: #4A3D6A;
  --today: #5BC0FF;
  --danger: #E94B4B;

  /* Glass tokens */
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.10);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-strong: rgba(255, 255, 255, 0.18);
  --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.10);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --blur: blur(22px) saturate(140%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  min-height: 100vh;
  min-height: 100dvh;
}

body {
  background:
    radial-gradient(620px 620px at 12% 8%,  rgba(138, 79, 208, 0.55), transparent 60%),
    radial-gradient(520px 520px at 92% 20%, rgba(244, 185, 66, 0.30), transparent 60%),
    radial-gradient(720px 520px at 50% 105%, rgba(231, 76, 175, 0.35), transparent 60%),
    radial-gradient(440px 440px at 5% 85%,  rgba(91, 192, 255, 0.22), transparent 60%),
    radial-gradient(380px 380px at 95% 75%, rgba(76, 175, 80, 0.18), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 110px;
  padding-top: calc(16px + env(safe-area-inset-top));
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--secondary-2), var(--secondary) 60%, #b9892b);
  box-shadow: 0 0 14px rgba(244, 185, 66, 0.7);
}
.brand-title {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: -2px;
  letter-spacing: 0.02em;
}

.awake-badge {
  background: rgba(76, 175, 80, 0.14);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(76, 175, 80, 0.40);
  color: #BFE7C1;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  box-shadow: var(--glass-inset);
}

/* Screens */
.screen { display: none; animation: fade 260ms ease both; }
.screen.active { display: block; }
@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Glass surfaces ---------- */
.card {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--glass-shadow), var(--glass-inset);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 {
  font-size: 12px;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Type selector */
.type-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
  padding: 6px;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow), var(--glass-inset);
}
.type-btn {
  height: 44px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 120ms ease, background 240ms ease, color 240ms ease, border-color 240ms ease, box-shadow 240ms ease;
}
.type-btn:active { transform: scale(0.97); }
.type-btn.active {
  background: linear-gradient(180deg, rgba(138, 79, 208, 0.55), rgba(107, 53, 163, 0.45));
  color: #fff;
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow:
    0 8px 18px rgba(107, 53, 163, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.type-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Focus image — visible only when a session is active */
.focus-image {
  display: none;
}
body.session-active .focus-image {
  display: flex;
  justify-content: center;
  margin: 4px auto 16px;
  animation: focus-in 320ms ease both;
}
body.session-active .focus-image img {
  max-height: 60vh;
  max-width: 100%;
  width: auto;
  border-radius: 18px;
  border: 1px solid var(--glass-border-strong);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.50),
    0 0 0 1px rgba(244, 185, 66, 0.10),
    0 0 38px rgba(244, 185, 66, 0.18),
    var(--glass-inset);
  object-fit: contain;
}
@keyframes focus-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* Hide normal-mode pieces while a session is active */
body.session-active .type-selector,
body.session-active .today-summary,
body.session-active #quote {
  display: none;
}

/* Focus mode: hide the circular ring + halo entirely and render
   just a compact digital readout below the image. The image is the
   focal point; the timer just confirms elapsed time. */
body.session-active .timer-ring { display: none; }
body.session-active .timer-wrap::before { display: none; }
body.session-active .timer-wrap {
  width: auto;
  height: auto;
  margin: 6px auto 10px;
}
body.session-active .timer-center {
  position: static;
}
body.session-active .timer-digits {
  font-size: 36px;
  letter-spacing: -0.03em;
}
body.session-active .timer-target {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
}

/* Timer */
.timer-wrap {
  position: relative;
  width: 290px;
  height: 290px;
  margin: 12px auto 22px;
}
.timer-wrap::before {
  /* glow halo behind the timer */
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(244, 185, 66, 0.18), transparent 65%);
  pointer-events: none;
  z-index: 0;
}
.timer-ring { width: 100%; height: 100%; transform: rotate(-90deg); position: relative; z-index: 1; }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 10; }
.ring-fg {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 628.318;
  stroke-dashoffset: 628.318;
  transition: stroke-dashoffset 0.4s linear;
  filter: drop-shadow(0 0 10px rgba(244, 185, 66, 0.5));
}
.timer-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  z-index: 2;
}
.timer-digits {
  font-family: 'Inter', sans-serif;
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 24px rgba(244, 185, 66, 0.28);
}
.timer-target { color: var(--muted); margin-top: 6px; font-size: 12px; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.running .timer-digits { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { text-shadow: 0 0 18px rgba(244, 185, 66, 0.30); }
  50%      { text-shadow: 0 0 36px rgba(244, 185, 66, 0.70); }
}

/* Controls */
.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.btn {
  min-height: 52px;
  padding: 0 22px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms ease, filter 200ms ease, box-shadow 200ms ease;
  color: #fff;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.btn:active { transform: scale(0.97); }
.btn-start {
  background: linear-gradient(180deg, rgba(76, 175, 80, 0.85), rgba(58, 140, 61, 0.85));
  box-shadow: 0 10px 22px rgba(76, 175, 80, 0.40), var(--glass-inset);
  flex: 1; min-width: 160px;
}
.btn-pause {
  background: linear-gradient(180deg, rgba(244, 185, 66, 0.85), rgba(200, 146, 48, 0.85));
  color: #2a1d04;
  box-shadow: 0 10px 22px rgba(244, 185, 66, 0.40), var(--glass-inset);
  flex: 1; min-width: 120px;
}
.btn-resume {
  background: linear-gradient(180deg, rgba(76, 175, 80, 0.85), rgba(58, 140, 61, 0.85));
  flex: 1; min-width: 120px;
  box-shadow: 0 10px 22px rgba(76, 175, 80, 0.40), var(--glass-inset);
}
.btn-stop {
  background: linear-gradient(180deg, rgba(233, 75, 75, 0.85), rgba(181, 54, 54, 0.85));
  box-shadow: 0 10px 22px rgba(233, 75, 75, 0.40), var(--glass-inset);
  flex: 1; min-width: 140px;
}

/* Today summary */
.today-head {
  display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px;
}
.today-total {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.today-count { color: var(--muted); font-size: 13px; letter-spacing: -0.01em; }

.target-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.target-card {
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  padding: 12px 10px;
  transition: background 280ms ease, border-color 280ms ease, box-shadow 280ms ease;
  box-shadow: var(--glass-inset);
}
.target-card.complete {
  background: rgba(76, 175, 80, 0.18);
  border-color: rgba(76, 175, 80, 0.55);
  box-shadow:
    0 8px 18px rgba(76, 175, 80, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.target-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}
.target-time {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.progress { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--secondary), var(--secondary-2));
  transition: width 0.6s cubic-bezier(.2,.7,.2,1), background 0.4s ease;
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(244, 185, 66, 0.4);
}
.target-card.complete .progress-bar { background: linear-gradient(90deg, var(--success), #82d585); box-shadow: 0 0 10px rgba(76, 175, 80, 0.4); }
.target-card.partial  .progress-bar { background: linear-gradient(90deg, var(--secondary), var(--secondary-2)); }
.target-check {
  position: absolute; top: 8px; right: 8px;
  font-size: 14px; line-height: 1; opacity: 0; transition: opacity 240ms ease, transform 240ms ease;
}
.target-card.complete .target-check { opacity: 1; transform: scale(1); }
.target-card.complete .target-check::before { content: "✅"; }

/* Quote */
.quote {
  font-style: italic;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  padding: 20px 18px;
  position: relative;
}
.quote::before, .quote::after {
  position: absolute;
  font-family: 'Inter', sans-serif;
  color: rgba(244, 185, 66, 0.35);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.quote::before { content: '\201C'; top: 8px; left: 14px; }
.quote::after  { content: '\201D'; bottom: 0px;  right: 14px; }

/* Sparkle burst */
.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.sparkle {
  position: absolute;
  width: 6px; height: 6px;
  background: var(--secondary-2);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--secondary);
  animation: sparkle 900ms ease-out forwards;
}
@keyframes sparkle {
  0%   { transform: translate(0, 0) scale(0.6); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* Day controls (date picker + step buttons in stats Day card) */
.day-controls {
  display: flex; align-items: center; gap: 6px;
}
.day-picker {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  padding: 7px 10px;
  border-radius: 10px;
  color-scheme: dark;
  cursor: pointer;
  outline: none;
  transition: background 200ms ease, border-color 200ms ease;
  min-height: 34px;
}
.day-picker:hover { background: rgba(255, 255, 255, 0.10); }
.day-picker:focus { border-color: rgba(91, 192, 255, 0.6); box-shadow: 0 0 0 2px rgba(91, 192, 255, 0.15); }
.day-picker::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.7);
  cursor: pointer;
}
.day-step {
  width: 32px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 18px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  transition: background 200ms ease, transform 120ms ease, opacity 200ms ease;
  padding: 0;
}
.day-step:hover { background: rgba(255, 255, 255, 0.12); }
.day-step:active { transform: scale(0.94); }
.day-step:disabled { opacity: 0.35; cursor: not-allowed; }

/* Sessions list inside the Day card */
.day-sessions {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}
.day-session-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 9px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  align-items: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.day-session-item:first-child { border-top: 0; }
.day-session-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}
.day-session-meta { color: var(--muted); }
.day-session-meta b { color: var(--text); font-weight: 600; }
.day-session-dur { color: var(--secondary-2); font-weight: 700; }
.day-empty {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.10);
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: -0.005em;
}

.day-load-more {
  display: flex;
  justify-content: center;
  padding: 10px 0 2px;
}
.load-more-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--glass-inset);
  transition: background 200ms ease, transform 120ms ease, border-color 200ms ease;
}
.load-more-btn:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--glass-border-strong); }
.load-more-btn:active { transform: scale(0.97); }

/* Stats screen */
.today-detail { text-align: center; padding: 8px 0; }
.today-detail-total {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}
.ring-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-ring { text-align: center; }
.mini-ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.mr-bg { fill: none; stroke: rgba(255, 255, 255, 0.10); stroke-width: 6; }
.mr-fg {
  fill: none;
  stroke: var(--secondary);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 163.36;
  stroke-dashoffset: 163.36;
  transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;
  filter: drop-shadow(0 0 6px rgba(244, 185, 66, 0.5));
}
.mini-ring.complete .mr-fg { stroke: var(--success); filter: drop-shadow(0 0 6px rgba(76, 175, 80, 0.5)); }
.mini-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.02em;
  font-weight: 500;
}
.mini-time { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Weekly bars */
.week-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 6px;
  height: 150px;
  padding: 8px 4px 0;
}
.week-day { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.week-bar-wrap { width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.week-bar {
  width: 80%;
  min-height: 4px;
  border-radius: 8px 8px 4px 4px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: height 0.6s cubic-bezier(.2,.7,.2,1);
  box-shadow: var(--glass-inset);
}
.week-bar.complete { background: linear-gradient(180deg, #82d585, #4CAF50); border-color: rgba(76, 175, 80, 0.5); box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3); }
.week-bar.partial  { background: linear-gradient(180deg, var(--secondary-2), var(--secondary)); border-color: rgba(244, 185, 66, 0.5); box-shadow: 0 4px 12px rgba(244, 185, 66, 0.3); }
.week-bar.some     { background: linear-gradient(180deg, #b69bd9, var(--primary-2)); border-color: rgba(138, 79, 208, 0.5); box-shadow: 0 4px 12px rgba(138, 79, 208, 0.3); }
.week-bar.none     { background: rgba(255, 255, 255, 0.06); }
.week-label {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  letter-spacing: 0.02em;
}
.week-label b { display: block; color: var(--text); font-weight: 600; font-size: 11px; }

/* Lifetime card (All time) */
.lifetime-hero {
  text-align: center;
  padding: 10px 0 14px;
}
.lifetime-hours {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--secondary-2), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(244, 185, 66, 0.18);
}
.lifetime-label {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

.milestones {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.milestone-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 4px;
  text-align: center;
  box-shadow: var(--glass-inset);
  transition: background 240ms ease, border-color 240ms ease, transform 200ms ease;
}
.milestone-chip .m-lbl {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.milestone-chip .m-ico {
  margin-top: 4px;
  font-size: 13px;
  color: var(--dim);
  line-height: 1;
}
.milestone-chip.reached {
  background: rgba(244, 185, 66, 0.16);
  border-color: rgba(244, 185, 66, 0.45);
  box-shadow:
    0 6px 14px rgba(244, 185, 66, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.milestone-chip.reached .m-lbl { color: var(--text); }
.milestone-chip.reached .m-ico { color: var(--secondary-2); }

.milestone-progress { margin-bottom: 14px; }
.milestone-progress .progress { height: 8px; }
.milestone-next {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.lifetime-stats {
  list-style: none;
  padding: 0;
  margin: 0;
}
.lifetime-stats li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  gap: 12px;
}
.lifetime-stats li:first-child { border-top: 0; }
.lt-label {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.lt-val {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Month grid */
.month-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
  box-shadow: var(--glass-inset);
}
.stat-num {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-num.small-num { font-size: 11px; letter-spacing: 0; }
.stat-lbl {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.calendar-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.cal-cell {
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform 200ms ease, background 200ms ease, box-shadow 200ms ease;
}
.cal-cell:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.08); }
.cal-cell:active { transform: scale(0.94); }
.cal-cell.selected {
  outline: 2px solid var(--secondary);
  outline-offset: 1px;
}
.cal-cell.complete { background: rgba(76, 175, 80, 0.45);  border-color: rgba(76, 175, 80, 0.55);  color: #fff; }
.cal-cell.partial  { background: rgba(244, 185, 66, 0.45); border-color: rgba(244, 185, 66, 0.55); color: #fff; }
.cal-cell.some     { background: rgba(138, 79, 208, 0.45); border-color: rgba(138, 79, 208, 0.55); color: #fff; }
.cal-cell.none     { background: rgba(255, 255, 255, 0.03); }
.cal-cell.today    {
  border-color: var(--today);
  box-shadow: 0 0 0 1px var(--today), 0 0 12px rgba(91, 192, 255, 0.45);
  color: #fff;
  font-weight: 700;
}
.cal-blank { aspect-ratio: 1 / 1; }

.legend {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.legend .lg {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 3px; margin-right: 5px; vertical-align: middle;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.lg.complete { background: rgba(76, 175, 80, 0.7); }
.lg.partial  { background: rgba(244, 185, 66, 0.7); }
.lg.some     { background: rgba(138, 79, 208, 0.7); }
.lg.none     { background: rgba(255, 255, 255, 0.10); }

/* Tabbar — strongest glass surface in the app */
.tabbar {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: 12px;
  width: calc(100% - 24px);
  max-width: 456px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--glass-border-strong);
  border-radius: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom) * 0.4);
  gap: 6px;
  z-index: 10;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    var(--glass-inset);
}
.tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 10px 6px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer;
  transition: background 240ms ease, color 240ms ease, transform 120ms ease;
}
.tab:active { transform: scale(0.97); }
.tab span:first-child { font-size: 19px; }
.tab.active {
  background: linear-gradient(180deg, rgba(138, 79, 208, 0.55), rgba(107, 53, 163, 0.45));
  color: #fff;
  box-shadow:
    0 6px 16px rgba(107, 53, 163, 0.40),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(92px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  color: #fff;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--glass-border-strong);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55), var(--glass-inset);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  max-width: 90vw;
  text-align: center;
  z-index: 20;
  animation: toast-in 260ms ease both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (min-width: 520px) {
  .timer-wrap { width: 320px; height: 320px; }
  .timer-digits { font-size: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
