:root {
  --color-bg: #f8f6f2;
  --color-card: #ffffff;
  --color-primary: #4a7c59;
  --color-primary-dark: #375e43;
  --color-text: #1e1e1e;
  --color-muted: #6b6b6b;
  --color-border: #e4e0da;
  --color-done: #4a7c59;
  --color-skip: #6b6b6b;
  --color-too-hard: #c47a2b;
  --color-stop: #b04040;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Auth page ────────────────────────────── */

.auth-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2rem;
  max-width: 420px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  min-height: 100dvh;
}

.logo-icon {
  width: 56px;
  height: 56px;
  display: block;
  margin-bottom: 0.5rem;
}

.logo h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.5px;
}

.tagline {
  font-size: 1rem;
  color: var(--color-muted);
  margin-top: 0.25rem;
}

.intro {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-muted);
  margin-bottom: 1.25rem;
}

form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

form input[type="email"] {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s;
}

form input[type="email"]:focus {
  border-color: var(--color-primary);
}

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--color-primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
  background: none;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--color-muted);
  transition: border-color 0.15s, color 0.15s;
}

.btn-ghost:hover { border-color: var(--color-primary); color: var(--color-primary); }

.privacy-note {
  font-size: 0.8rem;
  color: var(--color-muted);
  text-align: center;
  margin-top: 0.75rem;
}

.sent-card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.sent-icon {
  font-size: 2.5rem;
}

.sent-card h2 {
  font-size: 1.25rem;
}

.muted { color: var(--color-muted); font-size: 0.875rem; }

/* ── App page ─────────────────────────────── */

.app-container {
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  min-height: 100dvh;
  padding: 1.5rem 1rem env(safe-area-inset-bottom, 1rem);
  gap: 1rem;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
}

.brand-logo {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.app-header .user-email {
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* Camera / start screen */

.start-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  text-align: center;
}

.start-screen h2 {
  font-size: 1.4rem;
  font-weight: 600;
}

.start-screen p {
  color: var(--color-muted);
  font-size: 0.95rem;
  max-width: 280px;
  line-height: 1.5;
}

.camera-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 4px 20px rgba(74,124,89,0.35);
}

.camera-btn:hover { background: var(--color-primary-dark); transform: scale(1.02); }
.camera-btn:active { transform: scale(0.98); }

.camera-icon {
  font-size: 2.5rem;
  line-height: 1;
}

/* Loading state */

.loading-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen p { color: var(--color-muted); font-size: 0.95rem; }

/* Step card */

.step-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.photo-preview {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--color-border);
}

.step-card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.step-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
}

.step-item {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text);
}

.step-suggestion {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #eaf3ec;
  color: var(--color-primary);
}

.step-rationale {
  font-size: 0.9rem;
  color: var(--color-muted);
  line-height: 1.5;
}

.steps-remaining {
  font-size: 0.8rem;
  color: var(--color-muted);
  text-align: right;
}

.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.action-btn {
  padding: 0.875rem 0.5rem;
  border-radius: var(--radius);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.action-btn:active { transform: scale(0.97); }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-done  { background: var(--color-done);  color: #fff; }
.btn-skip  { background: var(--color-border); color: var(--color-text); }
.btn-hard  { background: #fdf0e0; color: var(--color-too-hard); }
.btn-stop  { background: #fdeaea; color: var(--color-stop); }

/* Complete screen */

.complete-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  text-align: center;
}

.complete-screen h2 {
  font-size: 1.4rem;
  font-weight: 600;
}

.complete-screen p {
  color: var(--color-muted);
  max-width: 260px;
  line-height: 1.5;
}

.complete-icon {
  font-size: 3rem;
}

[hidden] { display: none !important; }

/* Gate overlay */

#gate-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg, #f9f7f4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
}

.gate-card {
  background: #fff;
  border-radius: 16px;
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
}

.gate-card h2 { font-size: 1.25rem; font-weight: 600; margin: 0; }
.gate-card p  { color: var(--color-muted, #666); margin: 0; line-height: 1.5; }

.gate-card input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1.25rem;
  letter-spacing: 0.15em;
  text-align: center;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  outline: none;
  box-sizing: border-box;
}

.gate-card input:focus { border-color: var(--color-primary, #4a7c59); }

.gate-error { color: #c0392b; font-size: 0.875rem; margin: 0; }
