/* Lock It In — Daily Grit */

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --card: #1a1a1a;
  --border: rgba(255,255,255,0.08);
  --text: #e8e6e0;
  --muted: #888;
  --dim: #555;
  --accent: #e63946;
  --accent-dim: rgba(230,57,70,0.15);
  --green: #4ade80;
  --green-dim: rgba(74,222,128,0.12);
  --yellow: #fbbf24;
  --blue: #60a5fa;
  --font: 'DM Sans', sans-serif;
  --mono: 'DM Mono', monospace;
}

/* Dark mode is default. Light mode toggle later. */

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

html {
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }

/* Layout */
.container { max-width: 480px; margin: 0 auto; padding: 0 16px 100px; }

/* Header */
.header {
  padding: 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
}
.header-logo { height: 40px; }
.header-date { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 4px; letter-spacing: 1px; }

/* Stats Bar */
.stats-bar {
  display: flex;
  justify-content: space-around;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.stat { text-align: center; }
.stat-value { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--green); }
.stat-label { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

/* Streak */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(230,57,70,0.3);
  border-radius: 20px;
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin: 12px auto;
}

/* Section */
.section-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

/* Habit Card */
.habit {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.habit:active { opacity: 0.7; }

.habit-check {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
  transition: all 0.2s;
}
.habit-check.done { background: var(--green); border-color: var(--green); color: #000; }
.habit-check.skipped { background: var(--dim); border-color: var(--dim); color: #fff; font-size: 12px; }

.habit-name { font-size: 15px; flex: 1; }
.habit-name.done { text-decoration: line-through; color: var(--muted); }

/* Water Tracker */
.water-section { padding: 16px 0; }
.water-progress {
  background: var(--card);
  border-radius: 12px;
  height: 24px;
  overflow: hidden;
  margin: 8px 0;
  border: 1px solid var(--border);
}
.water-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #3b82f6);
  border-radius: 12px;
  transition: width 0.5s ease;
}
.water-text { font-family: var(--mono); font-size: 13px; color: var(--muted); text-align: center; margin-top: 4px; }
.water-buttons { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.water-btn {
  flex: 1;
  min-width: 70px;
  padding: 10px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}
.water-btn:active { background: var(--blue); color: #000; }

/* Workout Timer */
.workout-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin: 8px 0;
}
.workout-card.active { border-color: var(--accent); }
.workout-timer { font-family: var(--mono); font-size: 48px; font-weight: 700; color: var(--accent); margin: 12px 0; }
.workout-btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}
.btn-start { background: var(--green); color: #000; }
.btn-stop { background: var(--accent); color: #fff; }
.workout-options { display: flex; gap: 8px; margin-bottom: 12px; }
.workout-opt {
  flex: 1;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}
.workout-opt.selected { border-color: var(--accent); color: var(--accent); }

/* Reading */
.reading-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}
.reading-input {
  width: 60px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  text-align: center;
}
.reading-total { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 10px 0 env(safe-area-inset-bottom, 10px);
  z-index: 100;
}
.nav-item {
  text-align: center;
  color: var(--dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 12px;
  cursor: pointer;
}
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 20px; margin-bottom: 2px; }

/* Login/Register */
.auth-wrapper {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  max-width: 100vw;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
}
.auth-logo { display: block; height: 160px; margin: 0 auto 16px; }
.auth-sub { font-size: 13px; color: var(--text); text-align: center; margin-bottom: 24px; letter-spacing: 2px; text-transform: uppercase; font-weight: 600; }
.auth-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  margin-bottom: 12px;
}
.auth-input:focus { border-color: var(--accent); outline: none; }
.auth-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}
.auth-btn:active { opacity: 0.8; }
.auth-link { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }
.auth-error { background: rgba(230,57,70,0.1); border: 1px solid rgba(230,57,70,0.3); color: var(--accent); padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; text-align: center; }

/* Add Habit */
.add-habit-row { padding: 12px 0; text-align: center; }
.add-habit-btn {
  background: none;
  border: 1px dashed var(--dim);
  color: var(--muted);
  padding: 10px 24px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
}
.add-habit-btn:active { border-color: var(--accent); color: var(--accent); }
.add-habit-form { padding: 8px 0 16px; }
.habit-select {
  flex: 1;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
}
.day-picker { display: flex; gap: 4px; justify-content: center; }
.day-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}
.day-chip input { display: none; }
.day-chip:has(input:checked) { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Habit Management */
.habit-manage-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 8px;
}
.habit-manage-header { display: flex; align-items: center; gap: 8px; }
.habit-manage-name { font-size: 15px; font-weight: 500; }
.habit-manage-meta { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-top: 2px; }
.habit-manage-actions { display: flex; gap: 4px; flex-shrink: 0; }
.habit-action-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
}
.habit-action-btn:active { opacity: 0.7; }

/* Weight */
.weight-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}
.weight-trend { font-family: var(--mono); font-size: 12px; margin-left: 4px; }
.weight-trend.down { color: var(--green); }
.weight-trend.up { color: var(--accent); }

/* Alcohol */
.alcohol-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin: 8px 0;
}
.alcohol-badge {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}
.alcohol-badge.pending {
  background: var(--surface);
  border: 2px solid var(--green);
  color: var(--green);
}
.alcohol-badge.pending:active { background: var(--green); color: #000; }
.alcohol-badge.done {
  background: var(--green);
  color: #000;
  border: 2px solid var(--green);
  cursor: default;
}
.alcohol-streak {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}

/* Nomo-style Quit Counter */
.quit-counter { margin-bottom: 8px; }
.quit-number { font-family: var(--mono); font-size: 56px; font-weight: 700; color: var(--green); line-height: 1; }
.quit-label { font-family: var(--mono); font-size: 12px; letter-spacing: 3px; color: var(--green); margin-top: 2px; }
.quit-detail { font-family: var(--mono); font-size: 14px; color: var(--text); margin-top: 12px; }
.quit-since { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-top: 4px; }

/* Progress Photos */
.photo-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 8px 0;
}
.photo-thumbs { display: flex; gap: 12px; }
.photo-thumb {
  flex: 1;
  text-align: center;
}
.photo-thumb img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.photo-label { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 4px; }
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3/4;
  border: 2px dashed var(--dim);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.photo-placeholder:active { border-color: var(--accent); color: var(--accent); }
.photo-upload-prompt {
  text-align: center;
  padding: 24px;
  border: 2px dashed var(--dim);
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
}
.photo-upload-prompt:active { border-color: var(--accent); color: var(--accent); }

/* Goals Page */
.challenge-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}
.challenge-type { font-family: var(--mono); font-size: 11px; letter-spacing: 2px; color: var(--muted); margin-bottom: 4px; }
.challenge-day { font-family: var(--mono); font-size: 48px; font-weight: 700; color: var(--accent); }
.challenge-of { font-family: var(--mono); font-size: 14px; color: var(--dim); margin-top: -4px; }
.challenge-start-btn {
  padding: 10px 16px;
  background: var(--accent-dim);
  border: 1px solid rgba(230,57,70,0.3);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 8px 0 16px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.stat-card-value { font-family: var(--mono); font-size: 24px; font-weight: 700; }
.stat-card-label { font-size: 11px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Week Page */
.week-nav { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; margin-bottom: 8px; }
.week-arrow { color: var(--accent); font-size: 20px; padding: 8px 12px; text-decoration: none; }
.week-label { font-family: var(--mono); font-size: 13px; color: var(--text); text-align: center; }

.week-grid {
  display: grid;
  grid-template-columns: 70px repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}
.week-cell {
  background: var(--bg);
  padding: 6px 2px;
  text-align: center;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
}
.week-label-cell {
  justify-content: flex-start;
  padding-left: 6px;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.week-day-header {
  flex-direction: column;
  background: var(--surface);
  padding: 4px 2px;
}
.week-day-header.today { color: var(--accent); }
.day-abbr { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 1px; }
.day-num { font-family: var(--mono); font-size: 12px; }

.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.done-dot { background: var(--green); }
.skip-dot { background: var(--dim); }
.empty-dot { border: 1px solid var(--dim); }

.week-summary-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 4px 0 12px;
}
.week-summary-cell {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  padding: 6px 2px;
  background: var(--card);
  border-radius: 4px;
}
.week-summary-cell.goal-met { color: var(--green); }

/* Confetti animation */
@keyframes confetti-fall { 0% { transform: translateY(-100%) rotate(0deg); opacity: 1; } 100% { transform: translateY(100vh) rotate(720deg); opacity: 0; } }
.confetti { position: fixed; top: -10px; width: 10px; height: 10px; z-index: 200; animation: confetti-fall 1.5s ease-out forwards; pointer-events: none; }
