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

::selection { background: rgba(56,189,248,0.3); color: #e0f2fe; }

/* smooth scroll */
html { scroll-behavior: smooth; }

/* page fade in */
body { animation: pageIn 0.3s ease; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

/* scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(14,165,233,0.2); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(14,165,233,0.35); }

:root {
  --bg:       #030b17;
  --surface:  #071525;
  --blue-1:   #0ea5e9;
  --blue-2:   #38bdf8;
  --blue-3:   #7dd3fc;
  --blue-dim: #0c2d48;
  --text:     #e0f2fe;
  --muted:    #4a7fa5;
  --red:      #ef4444;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow-x: hidden;
}

/* ─── NAV ─── */
.tabs {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: rgba(3,11,23,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(14,165,233,0.12);
  z-index: 100;
}

.tab-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-eye { width: 36px; height: 24px; }
.logo-text {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--blue-2);
}

/* hamburger — hidden on desktop */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--blue-2);
  border-radius: 2px;
  transition: transform 0.2s;
}

.tab-links { display: flex; gap: 0.25rem; align-items: center; }

/* Logout button */
.logout-btn {
  background: none;
  border: 1px solid rgba(239,68,68,0.2) !important;
  color: rgba(239,68,68,0.6) !important;
  cursor: pointer;
  font-family: inherit;
  margin-left: 0.5rem;
  font-size: 0.8rem !important;
}
.logout-btn:hover {
  background: rgba(239,68,68,0.08) !important;
  color: #ef4444 !important;
}

.tab {
  padding: 0.4rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
  letter-spacing: 0.04em;
}
.tab:hover { color: var(--blue-2); background: rgba(14,165,233,0.07); }
.tab.active { color: var(--blue-1); background: rgba(14,165,233,0.12); }

/* MOBILE NAV */
@media (max-width: 640px) {
  .hamburger { display: flex; }

  .tab-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0; right: 0;
    flex-direction: column;
    background: rgba(3,11,23,0.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(14,165,233,0.12);
    padding: 0.5rem;
    gap: 0;
  }
  .tab-links.open { display: flex; }

  .tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    border-radius: 8px;
  }

  .tabs { padding: 0 1rem; }
  .logo-text { font-size: 0.9rem; }
}

/* ─── MAIN ─── */
.main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 60px;
  position: relative;
  gap: 1.5rem;
}

/* ─── AMBIENT GLOW ─── */
.glow-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: pulse 6s ease-in-out infinite;
}
.ring-1 {
  width: 600px; height: 600px;
  background: radial-gradient(ellipse, rgba(14,165,233,0.07) 0%, transparent 70%);
  animation-delay: 0s;
}
.ring-2 {
  width: 400px; height: 400px;
  background: radial-gradient(ellipse, rgba(56,189,248,0.05) 0%, transparent 70%);
  animation-delay: 2s;
}
.ring-3 {
  width: 200px; height: 200px;
  background: radial-gradient(ellipse, rgba(125,211,252,0.06) 0%, transparent 70%);
  animation-delay: 4s;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* ─── PROGRESS CIRCLE ─── */
.circle-wrap {
  position: relative;
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* outer hours ring (larger, behind main ring) */
.outer-hours {
  position: absolute;
  inset: -20px;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.outer-hours.visible { opacity: 1; }

.outer-ring-svg {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.outer-track {
  fill: none;
  stroke: rgba(56,189,248,0.08);
  stroke-width: 2;
}

.outer-progress {
  fill: none;
  stroke: rgba(56,189,248,0.3);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 942.5; /* 2π×150 */
  stroke-dashoffset: 942.5;
  transition: stroke-dashoffset 1s ease;
}

/* floating label on the outer ring */
.outer-label {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: rgba(56,189,248,0.5);
  font-variant-numeric: tabular-nums;
}

/* main ring SVG */
.progress-ring {
  width: 280px;
  height: 280px;
  transform: rotate(-90deg);
  position: absolute;
}

.ring-track {
  fill: none;
  stroke: rgba(14,165,233,0.1);
  stroke-width: 6;
}

.ring-progress {
  fill: none;
  stroke: var(--blue-2);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 722.6; /* 2π×115 */
  stroke-dashoffset: 722.6;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4,0,0.2,1),
              stroke 0.5s ease;
}

/* center number */
.ring-inner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}

.ring-number {
  font-size: clamp(3.5rem, 15vw, 5.5rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--blue-2);
  line-height: 1;
  text-shadow: 0 0 40px rgba(56,189,248,0.5);
  transition: color 0.4s, text-shadow 0.4s;
}

.ring-unit {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
}

/* info below circle */
.below-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  z-index: 1;
}

.best-streak {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* ─── MILESTONE ─── */
.milestone {
  font-size: 0.78rem;
  color: var(--blue-3);
  letter-spacing: 0.07em;
  opacity: 0.8;
}

/* ─── RELAPSE BUTTON ─── */
.relapse-btn {
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 50px;
  background: rgba(239,68,68,0.06);
  color: rgba(239,68,68,0.7);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.25s;
}
.relapse-btn:hover {
  background: rgba(239,68,68,0.14);
  border-color: rgba(239,68,68,0.6);
  color: #ef4444;
  box-shadow: 0 0 20px rgba(239,68,68,0.15);
}
.relapse-icon { font-size: 1rem; }

/* ─── MILESTONE ─── */
.milestone {
  z-index: 1;
  font-size: 0.8rem;
  color: var(--blue-3);
  letter-spacing: 0.08em;
  height: 1.2em;
  transition: opacity 0.4s;
}

/* ─── MODAL ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }

.modal {
  background: #071525;
  border: 1px solid rgba(14,165,233,0.18);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 60px rgba(14,165,233,0.1);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform:translateY(20px); opacity:0 } to { transform:translateY(0); opacity:1 } }

.modal-eye { margin-bottom: 1rem; }
.modal-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.6rem; color: var(--text); }
.modal-sub { font-size: 0.85rem; color: var(--muted); line-height: 1.6; }

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-cancel {
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  border: 1px solid rgba(14,165,233,0.3);
  background: rgba(14,165,233,0.08);
  color: var(--blue-2);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.btn-cancel:hover { background: rgba(14,165,233,0.16); }

.btn-confirm {
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  border: 1px solid rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.1);
  color: #ef4444;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.btn-confirm:hover { background: rgba(239,68,68,0.2); }

/* celebrate modal */
.celebrate { border-color: rgba(125,211,252,0.3); }
.celeb-emoji { font-size: 3rem; margin-bottom: 0.75rem; }

/* ─── BLANK PAGE PLACEHOLDER ─── */
.blank-page {
  min-height: 100vh;
  padding-top: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  color: var(--muted);
}
.blank-page h2 { font-size: 1.4rem; color: var(--blue-2); }
.blank-page p { font-size: 0.85rem; letter-spacing: 0.06em; }
