/* Palette de l'appli Android (ui/Theme.kt) : poterie et robe kabyles, tons adoucis. */
/* Nunito en trois graisses fixes (la police variable s'affichait en 200 dans WebKit). */
@font-face { font-family: 'Nunito'; src: url('nunito-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('nunito-700.woff2') format('woff2'); font-weight: 500 700; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('nunito-800.woff2') format('woff2'); font-weight: 800 900; font-display: swap; }
:root {
  color-scheme: light;
  --cream: #FFF6EA; --cream-deep: #F7E6CF; --card: #FFFCF7;
  --terracotta: #C8553D; --terracotta-soft: #F2C4B5;
  --saffron: #F2A541; --saffron-soft: #FBE0B3;
  --green: #6E9A5B; --green-soft: #D5E6C8;
  --blue: #3D6FA8; --blue-soft: #CBDCEF;
  --ink: #3B2A20; --ink-soft: #7A6455; --disabled: #E3D9CC; --disabled-ink: #A8998A;
  --gap: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--cream); color: var(--ink); }
body {
  font: 17px/1.4 'Nunito', system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
#root { max-width: 560px; margin: 0 auto; min-height: 100dvh; position: relative; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
button:disabled { cursor: default; }
input, textarea { font: inherit; color: var(--ink); }
[hidden] { display: none !important; }

.screen { min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: calc(24px + var(--safe-bottom)); }
.top { padding-top: var(--safe-top); background: var(--cream); }
.band {
  height: 22px; background-color: var(--cream-deep);
  background-repeat: repeat-x; background-size: auto 100%;
}
.band.thin { height: 12px; }

/* ---------- En-tête de l'accueil ---------- */
.header { display: flex; align-items: center; padding: 8px 8px 0 20px; gap: 2px; }
.header h1 { flex: 1; margin: 0; color: var(--terracotta); font-size: 30px; font-weight: 800; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; font-size: 26px; line-height: 48px; text-align: center;
  position: relative; color: var(--ink-soft);
}
.icon-btn:active { background: var(--cream-deep); }
.dot { position: absolute; top: 8px; right: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--terracotta); }
.search { margin: 4px 16px; position: relative; }
.search input {
  width: 100%; height: 50px; border-radius: 20px; border: 1.5px solid var(--ink-soft); background: var(--card);
  padding: 0 16px 0 44px; font-size: 18px; outline: none;
}
.search input:focus { border-color: var(--terracotta); border-width: 2px; }
.search::before { content: '🔍'; position: absolute; left: 14px; top: 13px; font-size: 18px; opacity: .7; }

/* ---------- Boutons de catégorie ---------- */
.cats { display: flex; flex-direction: column; gap: 8px; padding: 8px 16px; }
.cats-row { display: flex; gap: 8px; }
.cat {
  flex: 1 1 0; min-width: 0; height: 64px; border-radius: 20px; background: var(--card);
  border: 1px solid var(--cream-deep); box-shadow: 0 1px 2px rgba(59, 42, 32, .12);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 4px;
}
.cat.on { background: var(--saffron); border: 3px solid var(--terracotta); box-shadow: 0 3px 8px rgba(59, 42, 32, .22); }
.cat .line { display: flex; align-items: center; gap: 6px; }
.cat .em { font-size: 28px; line-height: 1.1; }
.cats.many .cat .em { font-size: 22px; }
.cat .count {
  font-size: 13px; font-weight: 800; color: var(--terracotta); background: rgba(242, 196, 181, .5);
  border-radius: 10px; padding: 1px 7px;
}
.cat.on .count { color: #fff; background: var(--terracotta); }
.cat .name { font-size: 13px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat.tall { height: 76px; }
.cat.short { height: 56px; }

/* ---------- Le mur ---------- */
.grid { display: flex; gap: var(--gap); padding: 8px 16px 170px; align-items: flex-start; }
.col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.tile {
  display: block; width: 100%; border-radius: 24px; overflow: hidden; position: relative;
  box-shadow: 0 2px 6px rgba(59, 42, 32, .18); text-align: left;
}
.tile.square { aspect-ratio: 1 / 1; }
.tile.square img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; text-align: center;
  background: rgba(0, 0, 0, .42); color: #fff; font-weight: 700; font-size: 16px; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile .gift { position: absolute; top: 8px; left: 8px; }
.tile.half { height: calc((var(--colw, 160px) - var(--gap)) / 2); display: flex; align-items: center; gap: 6px; padding: 0 8px 0 10px; }
.tile.half .em { font-size: 26px; }
.tile.half .txt {
  flex: 1; min-width: 0; font-weight: 700; font-size: 15px; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}
.tile.half .side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.badge {
  width: 36px; height: 36px; border-radius: 50%; background: #fff; border: 2px solid var(--saffron);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2); font-size: 18px; line-height: 32px; text-align: center; display: inline-block;
}
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 32px 180px; }
.empty .bowl {
  width: 160px; height: 160px; border-radius: 50%; background: var(--saffron-soft); font-size: 84px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 10px rgba(59, 42, 32, .2);
}
.empty h2 { color: var(--terracotta); font-size: 40px; margin: 20px 0 16px; font-weight: 800; }
.empty .arrow { font-size: 48px; }
.nothing { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 64px; padding-bottom: 170px; }

/* ---------- Gros boutons ---------- */
.dock {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + var(--safe-bottom));
  display: flex; align-items: center; gap: 22px; z-index: 5;
}
.round {
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; background: var(--terracotta); box-shadow: 0 4px 12px rgba(59, 42, 32, .3);
  width: 72px; height: 72px; font-size: 34px; flex: none;
}
.round:active { transform: scale(.95); }
.round:disabled { background: var(--disabled); box-shadow: none; filter: grayscale(1); opacity: .7; }
.round.xl { width: 92px; height: 92px; font-size: 44px; }
.round.xxl { width: 104px; height: 104px; font-size: 50px; }
.round.s { width: 60px; height: 60px; font-size: 28px; }
.round.saffron { background: var(--saffron); }
.round.blue { background: var(--blue); }
.round.green { background: var(--green); }
.round.cream { background: var(--card); border: 2px solid var(--cream-deep); }
.btn-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.btn-col small { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.actions { display: flex; justify-content: space-evenly; padding: 0 12px; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(61, 111, 168, .25); } }

/* ---------- Fiche, modification, réception ---------- */
.bar { display: flex; align-items: center; padding: 8px; min-height: 64px; }
.bar h2 { margin: 0 0 0 4px; font-size: 24px; font-weight: 700; }
.back { width: 52px; height: 52px; border-radius: 50%; font-size: 30px; }
.back:active { background: var(--cream-deep); }
.hero { margin: 0 16px; aspect-ratio: 1 / 1; border-radius: 28px; overflow: hidden; position: relative; flex: none; min-height: 0; }
.hero > * { position: absolute; inset: 0; }
.hero.narrow { margin: 0 32px; }
.hero.narrower { margin: 0 40px; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ph .em { font-size: 72px; }
.ph .ini { font-size: 40px; font-weight: 800; color: rgba(59, 42, 32, .7); }
.title { text-align: center; font-size: 28px; font-weight: 800; margin: 16px 24px 0; word-break: break-word; }
.sub { text-align: center; color: var(--ink-soft); font-weight: 700; font-size: 17px; margin: 4px 24px 0; }
.from { text-align: center; color: var(--green); font-weight: 700; font-size: 18px; margin-top: 4px; }
.note {
  margin: 16px 20px 0; background: var(--saffron-soft); border-radius: 20px; padding: 16px; display: flex; gap: 10px;
  white-space: pre-wrap; word-break: break-word; font-size: 18px;
}
.note > span:first-child { font-size: 22px; }
.field {
  width: 100%; border-radius: 20px; border: 1.5px solid var(--ink-soft); background: var(--card);
  padding: 12px 16px; outline: none; font-size: 18px;
}
.field:focus { border: 2px solid var(--terracotta); }
.field.name { font-size: 22px; font-weight: 700; height: 64px; }
.field.attract { border: 2.5px solid var(--blue); animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(61, 111, 168, .2); } }
.row { display: flex; align-items: center; gap: 12px; padding: 0 20px; }
.row.top { align-items: flex-start; }
.lead { font-size: 30px; width: 44px; text-align: center; flex: none; }
.spacer { height: 20px; flex: none; }
.grow { flex: 1; }
.center { display: flex; justify-content: center; }

/* ---------- Réglages ---------- */
.section { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.section h3 { margin: 0; color: var(--terracotta); font-size: 22px; font-weight: 700; }
.muted { color: var(--ink-soft); margin: 0; }
.warn { color: var(--terracotta); margin: 0; font-weight: 700; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  height: 48px; padding: 0 22px; border-radius: 24px; background: var(--terracotta); color: #fff; font-weight: 700;
}
.pill.green { background: var(--green); }
.pill.outline { background: transparent; color: var(--terracotta); border: 1.5px solid var(--ink-soft); }
.pill:disabled { background: var(--disabled); color: var(--disabled-ink); border-color: var(--disabled); }
.cat-line {
  display: flex; align-items: center; background: var(--card); border-radius: 16px; padding: 6px 6px 6px 12px; width: 100%;
}
.cat-line .em { font-size: 28px; }
.cat-line .nm { flex: 1; font-weight: 700; font-size: 18px; padding-left: 12px; text-align: left; word-break: break-word; }
.del { width: 48px; height: 48px; border-radius: 50%; font-size: 22px; }
.del:active { background: var(--cream-deep); }
textarea.field { min-height: 140px; resize: vertical; }

/* ---------- Fenêtres ---------- */
.modal { position: fixed; inset: 0; background: rgba(40, 28, 20, .45); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px; }
.dialog {
  background: var(--card); border-radius: 28px; width: 100%; max-width: 420px; max-height: 86dvh; overflow: auto;
  padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.dialog .big { font-size: 44px; text-align: center; }
.dialog h3 { margin: 0; text-align: center; font-size: 22px; }
.dialog .end { display: flex; justify-content: flex-end; gap: 8px; }
.dialog .end button { font-size: 26px; width: 64px; height: 52px; border-radius: 16px; }
.dialog .end button:disabled { opacity: .35; }
.dialog .end button:active { background: var(--cream-deep); }
.icons { display: flex; flex-wrap: wrap; gap: 6px; }
.icons button { font-size: 26px; width: 50px; height: 50px; border-radius: 12px; background: var(--cream-deep); }
.icons button.on { background: var(--saffron); }

/* ---------- Bandeau du bas (messages et ↩️) ---------- */
.snack {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(130px + var(--safe-bottom));
  width: calc(100% - 32px); max-width: 528px; background: var(--ink); color: #fff; border-radius: 16px;
  padding: 10px 10px 10px 18px; display: flex; align-items: center; gap: 10px; z-index: 30;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3); font-weight: 700; min-height: 56px;
}
.snack span { flex: 1; }
.snack button { background: var(--saffron); color: var(--ink); border-radius: 14px; height: 44px; padding: 0 16px; font-size: 22px; }

/* ---------- Guide d'installation (iPhone, dans Safari) ---------- */
.guide { padding: 0 20px; display: flex; flex-direction: column; gap: 14px; }
.guide .logo { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.guide .logo img { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.guide .logo h1 { margin: 0; color: var(--terracotta); font-size: 34px; }
.step { background: var(--card); border-radius: 20px; padding: 14px 16px; display: flex; gap: 14px; align-items: center; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.step .n {
  flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--terracotta); color: #fff;
  font-weight: 800; font-size: 20px; display: flex; align-items: center; justify-content: center;
}
.step .t { font-size: 18px; }
.step .t b { white-space: nowrap; }
.key {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px;
  border-radius: 10px; background: var(--cream-deep); font-weight: 800; vertical-align: middle; margin: 0 2px;
}
.key svg { width: 20px; height: 20px; }
.guide .why { color: var(--ink-soft); font-size: 15px; margin: 4px 4px 0; }
.spinner { width: 64px; height: 64px; border-radius: 50%; border: 6px solid var(--cream-deep); border-top-color: var(--terracotta); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
