:root {
  --bg: #0b0f0c;
  --surface: #151a17;
  --surface-2: #1c221e;
  --line: #262c28;
  --line-soft: #1e2420;
  --text: #f5f7f5;
  --muted: #a3ada6;
  --dim: #6f7a73;
  --accent: #34a853;
  --green: #1e8e3e;
  --green-bg: #10251a;
  --red: #d93025;
  --red-bg: #2a1614;
  --gray: #3a4038;
  --danger: #b3261e;
  --radius: 16px;
  --tap: 44px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { min-height: 100dvh; }

button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
}
input:focus { outline: none; border-color: var(--accent); }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 18px max(14px, env(safe-area-inset-bottom));
}

.screen { display: none; flex: 1; flex-direction: column; }
.screen.on { display: flex; }
.scroll { flex: 1; overflow-y: auto; }

/* ---------- typography ---------- */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
}
h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; margin: 6px 0 4px; }
h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: 15px; margin: 0 0 20px; }
.section-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--dim); margin: 20px 0 10px;
}
.error { color: var(--red); font-size: 14px; margin-top: 8px; }

/* ---------- fields ---------- */
.field-wrap { margin-bottom: 16px; }
.field-wrap label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

/* ---------- buttons ---------- */
.btn {
  width: 100%;
  min-height: var(--tap);
  border-radius: 12px;
  font-weight: 650;
  font-size: 16px;
  padding: 13px;
  margin-bottom: 10px;
}
.btn-primary { background: var(--accent); color: #06210f; }
.btn-danger { background: var(--red-bg); color: var(--red); }
.link-quiet {
  color: var(--dim);
  font-size: 13px;
  padding: 8px 4px;
  text-decoration: underline;
  text-decoration-color: transparent;
}
.link-quiet:active { text-decoration-color: var(--dim); }

/* ---------- foot ---------- */
.foot { padding-top: 14px; }
.foot-quiet { text-align: center; padding-top: 6px; }

/* ---------- onboarding ---------- */
.onboarding-center { display: flex; flex-direction: column; justify-content: center; flex: 1; }

/* ---------- home ---------- */
.top-bar { display: flex; align-items: flex-start; justify-content: space-between; padding: 4px 0 8px; }
.total { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }
.total.green { color: var(--green); }
.total.red { color: var(--red); }
.streak-badge {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 650;
  font-size: 15px;
}

.camera-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 0 8px;
}
.camera-btn {
  width: 62vw;
  max-width: 240px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--accent);
  color: #06210f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 8px 30px -10px rgba(52, 168, 83, 0.55);
}
.camera-btn:active { transform: scale(0.97); }
.camera-icon { font-size: 44px; line-height: 1; }
.camera-label { font-weight: 700; font-size: 16px; }

.entry-list { display: flex; flex-direction: column; gap: 8px; }
.entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  width: 100%;
}
.entry-row .label { font-weight: 600; font-size: 15px; }
.entry-row .meta { color: var(--dim); font-size: 12px; margin-top: 2px; }
.entry-row .cal { font-weight: 700; font-size: 15px; white-space: nowrap; margin-left: 10px; }
.empty { color: var(--dim); font-size: 14px; text-align: center; padding: 24px 0; }

/* ---------- history ---------- */
.streak-headline { font-size: 26px; font-weight: 700; text-align: center; margin: 18px 0 20px; }
.day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.day-box { aspect-ratio: 1; border-radius: 6px; }
.day-green { background: var(--green); }
.day-red { background: var(--red); }
.day-gray { background: var(--gray); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 20px; color: var(--muted); font-size: 13px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-gray { background: var(--gray); }

/* ---------- macros ---------- */
.macros-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--text); color: #06210f; font-weight: 700; font-size: 15px;
  padding: 12px 20px; border-radius: 999px; opacity: 0; pointer-events: none;
  max-width: 86vw; text-align: center;
  transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
