/* movEat — identité : vert feuille + abricot, Bricolage Grotesque + Inter.
   App mobile-first, centrée sur desktop. Thème clair/sombre automatique. */
:root {
  --bg: #eef1e8;
  --surface: #fbfcf8;
  --surface-2: #f1f4ea;
  --ink: #17241b;
  --ink-soft: #4a5a4e;
  --ink-faint: #8a978c;
  --line: #dce2d2;
  --leaf: #159767;
  --leaf-deep: #0d6e4b;
  --leaf-wash: #e3f2ea;
  --apricot: #f08a4b;
  --apricot-wash: #fce9da;
  --sky: #4c86c6;
  --on-leaf: #ffffff;
  --shadow: 0 18px 40px -22px rgba(13, 42, 27, .45);
  --font-d: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-b: "Inter", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e140f;
    --surface: #161d18;
    --surface-2: #1d261f;
    --ink: #eef3ec;
    --ink-soft: #aeb9b0;
    --ink-faint: #74817a;
    --line: #2a352c;
    --leaf: #39c08a;
    --leaf-deep: #27a673;
    --leaf-wash: #163026;
    --apricot: #f59a5f;
    --apricot-wash: #3a2416;
    --sky: #74a7e0;
    --on-leaf: #07130d;
    --shadow: 0 18px 44px -20px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-b);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

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

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem max(16px, env(safe-area-inset-left,0px)) .7rem max(16px, env(safe-area-inset-right,0px));
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
}
.brand { display: flex; align-items: center; gap: .5rem; }
.brand .logo { width: 30px; height: 30px; }
.brand b { font-family: var(--font-d); font-size: 1.15rem; letter-spacing: -.01em; }
.mini {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  border-radius: 999px; padding: .4rem .7rem; font: 600 .78rem var(--font-b); cursor: pointer;
}
.mini:hover { color: var(--ink); border-color: var(--leaf); }

/* Layout stack */
.stack {
  flex: 1; display: flex; flex-direction: column;
  padding: .5rem max(18px, env(safe-area-inset-left,0px)) 2rem max(18px, env(safe-area-inset-right,0px));
}
.screen { display: flex; flex-direction: column; flex: 1; animation: rise .32s ease; }
.screen[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hello { color: var(--leaf); font-weight: 600; font-size: .82rem; letter-spacing: .02em; margin: .6rem 0 .1rem; }
.h1 { font-family: var(--font-d); font-weight: 700; font-size: 1.9rem; letter-spacing: -.02em; line-height: 1.08; margin: 0 0 .5rem; text-wrap: balance; }
.h2 { font-family: var(--font-d); font-weight: 700; font-size: 1.35rem; letter-spacing: -.02em; margin: .2rem 0 .3rem; }
.lead { color: var(--ink-soft); font-size: .95rem; margin: 0 0 1.1rem; max-width: 40ch; }

/* Buttons */
.cta {
  width: 100%; border: 0; border-radius: 16px; padding: 1rem;
  background: var(--leaf); color: var(--on-leaf);
  font: 600 1rem var(--font-b); cursor: pointer; margin-top: auto;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  box-shadow: var(--shadow); transition: filter .15s, transform .1s, opacity .15s;
}
.cta:active { transform: scale(.985); }
.cta:hover { filter: brightness(1.04); }
.cta:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.cta.ghost { background: transparent; color: var(--ink-soft); box-shadow: none; border: 1px solid var(--line); margin-top: .6rem; }
.cta.ghost:hover { color: var(--ink); border-color: var(--leaf); }
.cta-ic { font-size: 1.15rem; }
.back { align-self: flex-start; background: none; border: 0; color: var(--ink-faint); font: 600 .86rem var(--font-b); cursor: pointer; padding: .3rem 0 .6rem; }
.back:hover { color: var(--ink); }

/* Cards & fields */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.field { margin-bottom: 1rem; }
.label { display: block; font-size: .78rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .5rem; }
.label.center { text-align: center; }
.note { font-size: .8rem; color: var(--ink-faint); background: var(--leaf-wash); border-radius: 12px; padding: .7rem .85rem; margin: 0 0 1rem; }
.tiny { font-size: .78rem; color: var(--ink-faint); text-align: center; margin: .4rem 0 0; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: .5rem .8rem; font: 500 .85rem var(--font-b);
  cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; transition: all .15s;
}
.chip:hover { border-color: var(--leaf); }
.chip.sel { background: var(--leaf-wash); border-color: var(--leaf); color: var(--leaf-deep); font-weight: 600; }
.chip .x { color: var(--ink-faint); margin-left: .1rem; font-size: 1rem; line-height: 1; }
.mood .chip { font-size: .9rem; }
.add-food { display: flex; gap: .4rem; margin-top: .55rem; }
.add-food input { flex: 1; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 10px; padding: .5rem .7rem; font: 400 .88rem var(--font-b); }
.add-food input:focus { outline: 2px solid var(--leaf); outline-offset: 1px; }
.filepick { cursor: pointer; }

/* Segmented */
.seg { display: flex; gap: .3rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; padding: .25rem; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--ink-soft); border-radius: 10px; padding: .55rem .2rem; font: 600 .82rem var(--font-b); cursor: pointer; transition: all .15s; }
.seg button.sel { background: var(--leaf); color: var(--on-leaf); }

/* Viewfinder */
.viewfinder { position: relative; aspect-ratio: 4/5; border-radius: 22px; overflow: hidden; background: #0a0f0b; border: 1px solid var(--line); margin-bottom: 1rem; }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; }
.vf-overlay { position: absolute; inset: 0; pointer-events: none; }
.vf-overlay .c { position: absolute; width: 26px; height: 26px; border: 3px solid rgba(255,255,255,.85); }
.vf-overlay .tl { top: 16px; left: 16px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.vf-overlay .tr { top: 16px; right: 16px; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.vf-overlay .bl { bottom: 16px; left: 16px; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.vf-overlay .br { bottom: 16px; right: 16px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.vf-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: #cdd6cc; font-size: .9rem; text-align: center; padding: 1rem; }
.capture-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.shutter { width: 68px; height: 68px; border-radius: 50%; border: 5px solid var(--leaf); background: var(--leaf); cursor: pointer; display: grid; place-items: center; box-shadow: 0 10px 22px -8px var(--leaf); transition: transform .12s; }
.shutter:active { transform: scale(.92); }
.shutter::after { content: ""; width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--surface); }
.meal-photo { width: 100%; border-radius: 14px; margin-bottom: .8rem; max-height: 180px; object-fit: cover; }

/* Journal */
.journal { margin-top: 1.4rem; }
.journal-list { display: flex; flex-direction: column; gap: .5rem; }
.j-item { display: flex; align-items: center; gap: .7rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .65rem .8rem; }
.j-emoji { font-size: 1.3rem; }
.j-main { flex: 1; min-width: 0; }
.j-main b { font-size: .88rem; display: block; }
.j-main span { font-size: .74rem; color: var(--ink-faint); }
.j-feel { font-size: 1.1rem; }

/* Options (suggestions) */
.options { display: flex; flex-direction: column; gap: .7rem; margin-bottom: .5rem; }
.opt { border: 1px solid var(--line); border-radius: 18px; padding: .95rem; background: var(--surface); cursor: pointer; text-align: left; transition: transform .12s, border-color .15s; box-shadow: var(--shadow); }
.opt:active { transform: scale(.99); }
.opt:hover { border-color: var(--leaf); }
.opt .head { display: flex; align-items: center; gap: .6rem; }
.opt .ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.opt .tag { font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; font-weight: 700; }
.opt h3 { font-family: var(--font-d); font-size: 1.08rem; margin: .1rem 0 0; }
.opt p { font-size: .82rem; color: var(--ink-soft); margin: .55rem 0 0; }
.opt .meta { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-top: .55rem; font-size: .72rem; color: var(--ink-faint); }
.opt.now { border-color: var(--apricot); background: linear-gradient(180deg, var(--apricot-wash), var(--surface)); }
.opt.now .ic { background: var(--apricot); color: #fff; }
.opt.now .tag { color: var(--apricot); }
.opt.later .ic { background: var(--leaf-wash); color: var(--leaf-deep); }
.opt.later .tag { color: var(--leaf); }
.opt.rest .ic { background: color-mix(in srgb, var(--sky) 20%, transparent); color: var(--sky); }
.opt.rest .tag { color: var(--sky); }

/* Done */
.done-hero { text-align: center; padding: 1.4rem 0 .6rem; }
.done-ring { width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 50%; background: var(--leaf-wash); color: var(--leaf-deep); display: grid; place-items: center; font-size: 2rem; font-weight: 700; border: 3px solid var(--leaf); }
.done-hero .lead { margin-left: auto; margin-right: auto; }
.feel-row { display: flex; gap: .4rem; }
.feel { flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: .7rem .2rem; cursor: pointer; font: 500 .72rem var(--font-b); color: var(--ink-soft); display: flex; flex-direction: column; align-items: center; gap: .25rem; transition: all .15s; }
.feel span { font-size: 1.4rem; }
.feel:hover { border-color: var(--leaf); }
.feel.sel { background: var(--leaf-wash); border-color: var(--leaf); color: var(--leaf-deep); }

/* Toast + overlay */
.toast { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom,0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .7rem 1rem; border-radius: 12px; font-size: .85rem; z-index: 20; box-shadow: var(--shadow); max-width: 90vw; }
.overlay { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(4px); display: grid; place-items: center; gap: .9rem; z-index: 30; }
.overlay p { color: var(--ink-soft); font-weight: 600; font-size: .9rem; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--leaf); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
