/* Snaga v2 — design tokens ported from Claude Design handoff (Nocturne re-themed light/beige). */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --color-bg: #f7f1e6;
  --color-surface: #fffdf8;
  --color-text: #2a2420;
  --color-accent: #3a3733;
  --color-accent-2: #4a4742;
  --color-divider: color-mix(in srgb, #2a2420 12%, transparent);

  --color-neutral-100: #29282e;
  --color-neutral-200: #3f3e46;
  --color-neutral-300: #5b5964;
  --color-neutral-400: #78767f;
  --color-neutral-500: #96939c;
  --color-neutral-600: #b3b0b8;
  --color-neutral-700: #d2cfd3;
  --color-neutral-800: #e8e3da;
  --color-neutral-900: #faf6ee;

  --color-accent-100: #17161a;
  --color-accent-200: #221f24;
  --color-accent-300: #302d33;
  --color-accent-400: #3a3733;
  --color-accent-500: #55524e;
  --color-accent-600: #78746e;
  --color-accent-700: #a6a29a;
  --color-accent-800: #d8d4ca;
  --color-accent-900: #f2efe6;

  --color-accent-2-100: #1c1b1e;
  --color-accent-2-200: #2a2830;
  --color-accent-2-300: #3a3844;
  --color-accent-2-400: #4a4742;
  --color-accent-2-500: #656258;
  --color-accent-2-600: #8b8880;
  --color-accent-2-700: #b7b4ac;
  --color-accent-2-800: #e0ddd4;
  --color-accent-2-900: #f5f3ec;

  --color-pastel-cal: #f4b8a0;
  --color-pastel-protein: #f4b8a0;
  --color-pastel-carbs: #a8d5ba;
  --color-pastel-fat: #f0d68a;
  --color-pastel-gym: #a9c3e6;
  --color-pastel-box: #edb0c4;
  --color-pastel-run: #9edac6;

  --font-heading: "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  --shadow-sm: 0 0 0 1px color-mix(in srgb, #2a2420 8%, transparent);
  --shadow-md: 0 0 0 1px color-mix(in srgb, #2a2420 8%, transparent), 0 6px 18px rgba(42,36,32,0.10);
  --shadow-lg: 0 0 0 1px color-mix(in srgb, #2a2420 10%, transparent), 0 16px 40px rgba(42,36,32,0.16);
}

* , *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--color-bg); color: var(--color-text);
  font-family: var(--font-body); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h6 { font-family: var(--font-heading); font-weight: 500; margin: 0 0 4px; letter-spacing: -0.01em; }
h1 { font-size: 26px; } h2 { font-size: 21px; } h3 { font-size: 17px; }
h6 { font-size: 11px; letter-spacing: 0.06em; text-transform: none; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--color-accent) 25%, transparent); }

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

/* ---------- app shell ---------- */
#app {
  max-width: 402px; margin: 0 auto; min-height: 100vh;
  display: flex; flex-direction: column; position: relative; z-index: 0;
  background: var(--color-bg); overflow: hidden;
}
#app::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: url('/images/landing-hero.jpg');
  background-size: contain; background-position: center; background-repeat: no-repeat;
  opacity: 0.12;
}
@media (min-width: 720px) {
  body { background: #e4d9c4; display: flex; align-items: flex-start; justify-content: center; padding: 48px 20px; }
  #app { min-height: 844px; height: 844px; border-radius: 32px; box-shadow: var(--shadow-lg); margin-top: 0; }
}
.snaga-scroll { flex: 1; overflow-y: auto; position: relative; display: flex; flex-direction: column; min-height: 0; }
.snaga-scroll::-webkit-scrollbar { width: 0; }

.nav { display: flex; align-items: center; gap: 10px; padding: 20px 20px 8px; }
.nav-brand { font-family: var(--font-heading); font-size: 16px; flex: 1; }

.tabbar { display: flex; border-top: 1px solid var(--color-divider); background: var(--color-surface); padding: 10px 12px 16px; }
.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer; font-size: 11px;
}
.tab-btn i { font-size: 22px; }

.toast {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--color-surface); box-shadow: var(--shadow-md); padding: 10px 18px;
  border-radius: var(--radius-md); font-size: 13px; white-space: nowrap; z-index: 30;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: 500; font-size: 13px; line-height: 1.2;
  color: var(--color-text); background: transparent; border: 1px solid transparent;
  padding: 9px 14px; border-radius: var(--radius-md);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { color: #fff; background: var(--color-accent); border-color: var(--color-accent); }
.btn-primary:hover { background: var(--color-accent-500); }
.btn-secondary { border-color: var(--color-divider); background: var(--color-surface); }
.btn-secondary:hover { background: var(--color-neutral-800); }
.btn-ghost { color: var(--color-accent); border: none; background: transparent; padding-inline: 4px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; flex: none; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; color: var(--color-neutral-400); }
.input {
  width: 100%; min-height: 40px; padding: 8px 11px; font-size: 14px;
  color: var(--color-text); caret-color: var(--color-accent); background: #ecdfc4;
  border: 1px solid var(--color-neutral-700); border-radius: var(--radius-md);
}
.input:focus-visible { border-color: var(--color-accent); outline: none; }
textarea.input { min-height: 70px; resize: vertical; }
select.input { cursor: pointer; }
.seg { display: inline-flex; overflow: hidden; border: 1px solid var(--color-divider); border-radius: var(--radius-md); background: var(--color-surface); }
.seg-opt { display: flex; align-items: center; gap: 6px; padding: 8px 10px; font-size: 12.5px; cursor: pointer; position: relative; }
.seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.seg-opt:has(input:checked) { background: var(--color-accent-800); font-weight: 500; }

/* ---------- cards / tags ---------- */
.card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: var(--radius-md); background: var(--color-surface); }
.card-title { font-family: var(--font-heading); font-weight: 500; font-size: 15px; }
.card-kicker { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-neutral-400); }
.card-body { font-size: 13px; opacity: 0.85; }
.card-meta { font-size: 12px; color: var(--color-neutral-400); }
.elev-sm { box-shadow: var(--shadow-sm); }
.hr { height: 1px; background: var(--color-divider); border: none; margin: 4px 0; }

.tag { display: inline-flex; align-items: center; font-size: 11px; letter-spacing: 0.02em; padding: 3px 10px; border-radius: 6px; border: none; cursor: default; gap: 5px; }
.tag-accent { background: var(--color-accent-800); color: var(--color-accent-100); }
.tag-outline { border: 1px solid var(--color-divider); color: var(--color-text); background: transparent; }
button.tag { cursor: pointer; font: inherit; }

/* ---------- dialogs ---------- */
.dialog-backdrop { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 30; background: color-mix(in srgb, #2a2420 45%, transparent); }
.dialog { width: min(360px, 100%); max-height: 82%; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-lg); }
.dialog-title { font-family: var(--font-heading); font-weight: 500; font-size: 17px; }
.dialog-body { font-size: 14px; opacity: 0.85; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ---------- onboarding ---------- */
.goal-card { color: var(--color-text); font-family: var(--font-heading); font-size: 15px; cursor: pointer; padding: 16px; border-radius: var(--radius-lg); border: 1.5px solid var(--color-divider); }
.goal-card.active { border-color: var(--color-accent); background: var(--color-accent-900); }
.onb-dots { display: flex; gap: 6px; margin-bottom: 32px; }
.onb-dot { height: 3px; flex: 1; border-radius: 2px; background: var(--color-divider); }
.onb-dot.active { background: var(--color-accent); }

/* ---------- drag-reorder sections ---------- */
.drag-handle { color: var(--color-neutral-600); cursor: grab; touch-action: none; padding: 4px; }
.section-header-btn { display: flex; align-items: center; gap: 6px; flex: 1; background: none; border: none; cursor: pointer; padding: 0 0 10px; font: inherit; text-align: left; width: 100%; }

/* ---------- day nav / calendars ---------- */
.day-nav { display: flex; align-items: center; gap: 8px; padding: 12px 20px 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-weekday { text-align: center; font-size: 10px; color: var(--color-neutral-500); }
.cal-cell-dots { cursor: pointer; aspect-ratio: 1; border-radius: var(--radius-md); border: 1px solid var(--color-divider); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.cal-cell-ring { cursor: pointer; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--color-divider); padding: 2px; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; }

/* ---------- exercise picker / search ---------- */
.search-wrap { position: relative; }
.search-icon { position: absolute; left: 12px; top: 11px; color: var(--color-neutral-500); }
.search-input { padding-left: 34px; }
.combo-wrap { flex: 1; position: relative; }
.combo-caret { position: absolute; right: 10px; top: 32px; color: var(--color-neutral-500); pointer-events: none; }
.combo-list { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; max-height: 180px; overflow-y: auto; background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: var(--radius-md); z-index: 5; box-shadow: var(--shadow-md); }
.combo-opt { padding: 9px 12px; cursor: pointer; font-size: 13px; }
.combo-opt:hover { background: var(--color-neutral-800); }
.thumb { border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; background: var(--color-neutral-800); display: flex; align-items: center; justify-content: center; color: var(--color-neutral-500); font-size: 9px; text-align: center; }

/* ---------- active workout / timers ---------- */
.set-grid { display: grid; grid-template-columns: 24px 1fr 1fr 40px 32px; gap: 8px; align-items: center; }
.rest-overlay {
  position: absolute; inset: 0; background: color-mix(in srgb, var(--color-bg) 92%, transparent); backdrop-filter: blur(2px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; z-index: 20;
}
.rest-ring { width: 220px; height: 220px; border-radius: 50%; border: 6px solid var(--color-accent-800); display: flex; align-items: center; justify-content: center; position: relative; }
.rest-ring-fill { position: absolute; inset: -6px; border-radius: 50%; border: 6px solid var(--color-accent); }
.timer-run { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; transition: background 0.4s; padding: 20px; text-align: center; }
.timer-close { position: absolute; top: 20px; left: 20px; background: rgba(0,0,0,0.2) !important; border-color: rgba(0,0,0,0.3) !important; }
.timer-btn-dark { background: rgba(0,0,0,0.15) !important; border-color: rgba(0,0,0,0.3) !important; color: rgba(0,0,0,0.85) !important; }

/* ---------- nutrition rings ---------- */
.cal-ring-outer { width: 132px; height: 132px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cal-ring-inner { width: 104px; height: 104px; border-radius: 50%; background: var(--color-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.macro-bar-track { height: 5px; border-radius: 3px; background: var(--color-neutral-800); }
.macro-bar-fill { height: 100%; border-radius: 3px; }
.water-ring { position: relative; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--color-neutral-800); }
.water-ring-fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, var(--color-accent-400), var(--color-accent-700)); transition: height 0.3s; }

.spinner-icon { animation: spin 1s linear infinite; }

.tap-row:hover { background: var(--color-neutral-800); }
.text-muted { color: var(--color-neutral-400); font-size: 13px; }
.flex-row { display: flex; align-items: center; gap: 8px; }

/* ---------- AI assistant ---------- */
.fab-ai {
  position: absolute; right: 16px; bottom: 78px; z-index: 15;
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(155deg, var(--color-accent-500), var(--color-accent-800));
  border: none; box-shadow: var(--shadow-lg); display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; font-size: 22px;
}
.ai-chat-overlay {
  position: absolute; inset: 0; z-index: 40; background: var(--color-bg);
  display: flex; flex-direction: column;
}
.ai-chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; }
.ai-bubble { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; }
.ai-bubble.assistant { align-self: flex-start; background: var(--color-surface); }
.ai-bubble.user { align-self: flex-end; background: var(--color-accent-800); }
.ai-chat-input-row { display: flex; gap: 8px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--color-divider); }
