/* ===== Design tokens ===== */
:root {
  --bg: #0d0d0d;
  --bg-elevated: #1a1a1a;
  --bg-card: #161616;
  --ink: #0a0a05;
  --yellow: #f4e409;
  --yellow-soft: #fff6b0;
  --white: #f6f6f1;
  --muted: #9c9c92;
  --border: #000000;
  --danger: #ff6b5d;
  --success: #8ee06b;
  --radius: 18px;
  --font-display: "Permanent Marker", "Segoe UI", cursive;
  --font-body: "Poppins", "Segoe UI", sans-serif;
  --shadow-pop: 6px 6px 0 rgba(0,0,0,0.55);
  --shadow-pop-lg: 10px 10px 0 rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

/* speckled background texture, subtle */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image:
    radial-gradient(circle, rgba(244,228,9,0.14) 1px, transparent 1.4px);
  background-size: 22px 22px;
}

/* ===== Splash ===== */
.splash {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg); z-index: 999;
}
.splash-logo {
  font-family: var(--font-display);
  font-size: 15vw;
  color: var(--yellow);
  transform: rotate(-4deg);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{ transform: rotate(-4deg) scale(1);} 50%{ transform: rotate(-2deg) scale(1.04);} }

/* ===== App shell ===== */
.app {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px 96px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.topbar .logo {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--yellow);
  transform: rotate(-3deg);
  display: inline-block;
}
.topbar .today {
  color: var(--muted);
  font-size: 13px;
  text-transform: capitalize;
}

h1.page-title {
  font-family: var(--font-display);
  color: var(--yellow);
  font-size: 26px;
  transform: rotate(-1deg);
  margin: 6px 0 18px;
}

/* ===== Bottom nav ===== */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around;
  background: #000;
  border-top: 3px solid var(--yellow);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: #6f6f68; font-size: 10.5px; font-weight: 600; padding: 4px 8px; border-radius: 10px;
  transition: color .15s ease;
}
.nav-item.active { color: var(--yellow); }
.nav-item svg { opacity: .85; }

/* ===== Sticker / torn-paper banner ===== */
.sticker {
  position: relative;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
  padding: 10px 16px;
  clip-path: polygon(1% 12%, 14% 2%, 32% 8%, 50% 1%, 68% 7%, 88% 1%, 100% 10%,
                      97% 45%, 100% 78%, 90% 100%, 70% 92%, 48% 100%, 28% 93%, 8% 100%, 0% 70%, 4% 40%);
  display: inline-block;
  line-height: 1.25;
}
.sticker.small { font-size: 13px; padding: 7px 12px; }
.sticker.rot-l { transform: rotate(-3deg); }
.sticker.rot-r { transform: rotate(2deg); }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  margin-bottom: 18px;
  position: relative;
}
.card.tilt-l { transform: rotate(-1.2deg); }
.card.tilt-r { transform: rotate(1deg); }

.card-photo {
  width: 100%; height: 150px; object-fit: cover;
  background: linear-gradient(135deg, #2a2a2a, #141414);
  border-bottom: 3px solid var(--border);
}
.card-photo.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 42px;
}
.card-body { padding: 14px 14px 16px; }
.card-title {
  font-family: var(--font-display);
  color: var(--yellow);
  font-size: 19px;
  margin: 0 0 6px;
}
.card-meta {
  color: var(--muted); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px;
}
.tag {
  display: inline-block; background: #262600; color: var(--yellow-soft);
  border: 1px solid #4a4600; border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 600;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--yellow); color: var(--ink); font-weight: 700;
  border: 3px solid var(--border); border-radius: 12px;
  padding: 11px 18px; font-size: 14.5px; cursor: pointer;
  box-shadow: 4px 4px 0 rgba(0,0,0,.55);
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:active { transform: translate(2px,2px); box-shadow: 2px 2px 0 rgba(0,0,0,.55); }
.btn.secondary { background: transparent; color: var(--white); }
.btn.ghost { background: transparent; color: var(--yellow); border-color: var(--yellow); box-shadow: none; }
.btn.danger { background: var(--danger); color: #2a0000; }
.btn.block { width: 100%; }
.btn.small { padding: 7px 12px; font-size: 12.5px; border-width: 2px; box-shadow: 3px 3px 0 rgba(0,0,0,.55); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.fab {
  position: fixed; right: 18px; bottom: 88px; z-index: 40;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--yellow); border: 3px solid var(--border);
  box-shadow: 4px 4px 0 rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; font-size: 26px; color: var(--ink);
  font-weight: 800;
}

/* ===== Forms ===== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; background: var(--bg-elevated); color: var(--white);
  border: 2px solid #333; border-radius: 10px; padding: 11px 12px; font-size: 15px; font-family: inherit;
}
.input:focus { outline: none; border-color: var(--yellow); }
textarea.input { resize: vertical; min-height: 80px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ===== Star rating ===== */
.stars { display: flex; gap: 4px; }
.star-btn {
  background: none; border: none; cursor: pointer; padding: 2px; line-height: 1;
  color: #444; font-size: 26px;
}
.star-btn.filled { color: var(--yellow); }

/* ===== Day chips (week overview) ===== */
.day-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; }
.day-chip {
  flex: 0 0 auto; width: 52px; text-align: center; padding: 8px 4px;
  border: 2px solid #2a2a2a; border-radius: 12px; font-size: 11px; color: var(--muted);
}
.day-chip .d { font-weight: 700; color: var(--white); font-size: 12px; text-transform: uppercase; }
.day-chip.today { border-color: var(--yellow); }
.day-chip.decided { background: #1c1c00; border-color: #4a4600; }
.day-chip.voting { background: #241a00; border-color: var(--yellow); }
.day-chip.skipped { opacity: .4; }

/* ===== Empty / loading states ===== */
.empty {
  text-align: center; color: var(--muted); padding: 40px 16px;
}
.empty .emoji { font-size: 44px; display: block; margin-bottom: 10px; }
.loading { text-align: center; color: var(--muted); padding: 40px; }
.spinner {
  width: 28px; height: 28px; border: 3px solid #333; border-top-color: var(--yellow);
  border-radius: 50%; margin: 0 auto 10px; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: var(--yellow); color: var(--ink); font-weight: 700; font-size: 13.5px;
  padding: 10px 16px; border-radius: 10px; border: 2px solid var(--border);
  box-shadow: 4px 4px 0 rgba(0,0,0,.55); z-index: 200; max-width: 88%; text-align: center;
}
.toast.error { background: var(--danger); }

/* ===== Modal / sheet ===== */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 150; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg-elevated); width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  border-radius: 22px 22px 0 0; border: 3px solid var(--border); border-bottom: none;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
}
.sheet-handle { width: 40px; height: 4px; background: #444; border-radius: 3px; margin: 0 auto 14px; }
.sheet-close { position: absolute; top: 14px; right: 16px; color: var(--muted); font-size: 22px; background:none; border:none; cursor:pointer; }

/* ===== Checklist (shopping list) ===== */
.aisle-group { margin-bottom: 20px; }
.aisle-title {
  font-family: var(--font-display); color: var(--yellow-soft); font-size: 15px;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px;
}
.item-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #262626;
}
.item-row.checked { opacity: .4; text-decoration: line-through; }
.checkbox {
  width: 24px; height: 24px; border: 2px solid var(--yellow); border-radius: 7px; flex: none;
  display: flex; align-items: center; justify-content: center; cursor: pointer; background: transparent;
}
.checkbox.on { background: var(--yellow); color: var(--ink); font-weight: 900; }
.item-name { flex: 1; font-size: 14.5px; }
.item-qty { color: var(--muted); font-size: 12.5px; }

/* ===== Auth screen ===== */
.auth-wrap { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-logo { font-family: var(--font-display); color: var(--yellow); font-size: 44px; text-align: center; margin-bottom: 6px; transform: rotate(-3deg); }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 28px; font-size: 13.5px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--muted); }
.auth-switch a { color: var(--yellow); font-weight: 700; }

.link-btn { background: none; border: none; color: var(--yellow); font-weight: 700; cursor: pointer; padding: 0; font-size: inherit; }

.hidden { display: none !important; }

.section-title {
  font-family: var(--font-display); color: var(--yellow-soft); font-size: 16px; margin: 22px 0 10px;
}

.badge-pending {
  background: var(--yellow); color: var(--ink); font-size: 10.5px; font-weight: 800;
  border-radius: 999px; padding: 2px 8px; margin-left: 6px;
}

/* ===== Préférences alimentaires (onboarding) ===== */
.prefs-tabs {
  display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto;
}
.prefs-tab {
  flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg-elevated); color: var(--muted); font-weight: 700; font-size: 12.5px;
  border: 2px solid #333; border-radius: 999px; padding: 9px 12px; cursor: pointer; white-space: nowrap;
}
.prefs-tab .e { font-size: 15px; }
.prefs-tab.active { background: var(--yellow); color: var(--ink); border-color: var(--border); }

.food-grid {
  display: flex; flex-wrap: wrap; gap: 9px;
}
.food-chip {
  position: relative;
  background: var(--bg-elevated); color: var(--white); font-weight: 600; font-size: 13.5px;
  border: 2px solid #333; border-radius: 999px; padding: 9px 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.food-chip .emoji { font-size: 16px; }
.food-chip.selected { background: var(--yellow); color: var(--ink); border-color: var(--border); font-weight: 800; }
.food-chip.add { background: transparent; border-style: dashed; color: var(--yellow); }
.food-chip-marker { font-size: 11px; margin-left: 2px; opacity: .8; }
