/* ==========================================================
   Bingo des Lutins — styles (mobile-first, 360–430 px)
   ========================================================== */
:root {
  --sapin: #1E4D3B;
  --sapin-700: #153A2C;
  --sapin-600: #245C47;
  --sapin-50: #E7F0EA;
  --cranberry: #A4243B;
  --cranberry-700: #861B2F;
  --cranberry-50: #F9E8EB;
  --creme: #FBF6EC;
  --creme-2: #F3EADB;
  --or: #C9A24B;
  --or-700: #82620F;
  --or-50: #FBF2DC;
  --ink: #1C2A23;
  --muted: #56645C;
  --line: #E6DCCB;
  --card: #FFFDF8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(28, 42, 35, .06), 0 6px 18px rgba(28, 42, 35, .07);
  --shadow-lg: 0 10px 40px rgba(28, 42, 35, .22);
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--creme);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(201, 162, 75, .07) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 22%, rgba(30, 77, 59, .05) 0 2px, transparent 3px);
  background-size: 120px 120px, 160px 160px;
  min-height: 100vh;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--sapin); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .6em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; border-radius: 6px; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
.page { padding: 16px 16px calc(var(--nav-h) + 28px + var(--safe-b)); }
.page.no-nav { padding-bottom: 32px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.xs { font-size: .78rem; }
.center { text-align: center; }

/* ---------- Bandeau démo ---------- */
.demo-banner {
  background: var(--or-50); color: var(--or-700); border-bottom: 1px solid #EBD9A8;
  font-size: .8rem; padding: 6px 16px; text-align: center;
}
.demo-banner button { background: none; border: 0; text-decoration: underline; color: inherit; cursor: pointer; padding: 0 4px; font-size: inherit; }

/* ---------- En-tête ---------- */
.appbar {
  position: relative;
  background: var(--sapin);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 18px;
  border-radius: 0 0 24px 24px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(21, 58, 44, .25);
}
.appbar::before { /* neige discrète */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.55) 0 1.4px, transparent 2px),
    radial-gradient(circle, rgba(255,255,255,.35) 0 1px, transparent 1.6px);
  background-size: 46px 46px, 29px 29px;
  background-position: 0 0, 13px 17px;
}
.appbar > * { position: relative; }
.appbar .holly { position: absolute; right: 10px; top: calc(8px + env(safe-area-inset-top, 0px)); width: 64px; opacity: .95; pointer-events: none; }
.appbar-top { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.appbar h1 { font-size: 1.45rem; color: #fff; }
.appbar .sub { color: rgba(255,255,255,.82); font-size: .9rem; margin-top: 2px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; display: inline-grid; place-items: center;
  background: rgba(255,255,255,.12); color: #fff; cursor: pointer; flex: none; font-size: 1.15rem;
}
.icon-btn:hover { background: rgba(255,255,255,.2); }
.icon-btn.light { background: var(--creme-2); color: var(--ink); }

/* ---------- Cartes ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(230, 220, 203, .7);
  padding: 16px;
}
.card.flat { box-shadow: none; }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 10px; }
.section-title h2 { font-size: 1.15rem; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 2px solid transparent;
  font-weight: 600; font-size: 1rem; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }
.btn-primary { background: var(--sapin); color: #fff; box-shadow: 0 3px 0 var(--sapin-700); }
.btn-primary:hover { background: var(--sapin-600); }
.btn-red { background: var(--cranberry); color: #fff; box-shadow: 0 3px 0 var(--cranberry-700); }
.btn-gold { background: var(--or); color: #2A2008; box-shadow: 0 3px 0 #A5832F; }
.btn-ghost { background: transparent; color: var(--sapin); border-color: var(--line); }
.btn-ghost:hover { background: var(--sapin-50); }
.btn-outline-red { background: #fff; color: var(--cranberry); border-color: var(--cranberry); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .9rem; border-radius: 12px; }
.btn-link { background: none; border: 0; color: var(--sapin); text-decoration: underline; cursor: pointer; padding: 8px 4px; font-weight: 600; min-height: 44px; }
.btn .spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }

/* ---------- Formulaires ---------- */
.field { display: block; }
.field + .field { margin-top: 14px; }
.label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }
.input, .textarea, .select {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: #fff; font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--sapin); box-shadow: 0 0 0 3px rgba(30,77,59,.15); }
.input.invalid, .textarea.invalid { border-color: var(--cranberry); }
.err { color: var(--cranberry); font-size: .84rem; margin-top: 5px; min-height: 0; }
.err:empty { display: none; }
.code-input { text-transform: uppercase; letter-spacing: .25em; font-weight: 700; text-align: center; font-size: 1.25rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.counter { float: right; font-weight: 400; color: var(--muted); font-size: .78rem; }

.alert { border-radius: 12px; padding: 12px 14px; font-size: .9rem; display: flex; gap: 10px; align-items: flex-start; }
.alert-info { background: var(--sapin-50); color: var(--sapin-700); }
.alert-warn { background: var(--or-50); color: #5C4508; }
.alert-error { background: var(--cranberry-50); color: var(--cranberry-700); }
.alert .ico { flex: none; font-size: 1.1rem; line-height: 1.2; }

/* ---------- Tags ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.tag-org { background: var(--cranberry-50); color: var(--cranberry-700); }
.tag-player { background: var(--sapin-50); color: var(--sapin-700); }
.tag-gold { background: var(--or-50); color: var(--or-700); }
.tag-grey { background: #EEE9DF; color: #5A5446; }

/* ---------- Accueil ---------- */
.hero { text-align: center; padding: 34px 8px 8px; }
.hero .logo { width: 92px; height: 92px; margin: 0 auto 14px; }
.hero h1 { font-size: 2.1rem; color: var(--sapin); }
.hero p { color: var(--muted); max-width: 32ch; margin: 8px auto 0; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  padding: 16px; border-radius: var(--radius); border: 0; cursor: pointer; min-height: 120px;
  box-shadow: var(--shadow); color: #fff;
}
.action-card .emoji { font-size: 1.7rem; }
.action-card strong { font-family: var(--font-display); font-size: 1.08rem; line-height: 1.15; }
.action-card span { font-size: .8rem; opacity: .9; }
.action-card.green { background: linear-gradient(150deg, var(--sapin-600), var(--sapin-700)); }
.action-card.red { background: linear-gradient(150deg, #B4304A, var(--cranberry-700)); }
.game-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid rgba(230,220,203,.8); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.game-item + .game-item { margin-top: 10px; }
.game-item .badge-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; flex: none; }
.game-item .badge-ico.org { background: var(--cranberry-50); }
.game-item .badge-ico.player { background: var(--sapin-50); }
.game-item .title { font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); font-size: 1.3rem; }
.empty { text-align: center; padding: 26px 16px; color: var(--muted); }
.empty .big { font-size: 2.4rem; display: block; margin-bottom: 6px; }

/* ---------- Progression ---------- */
.progress-card { margin-top: -26px; position: relative; z-index: 2; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.progress-num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--sapin); }
.progress-bar { height: 12px; background: var(--creme-2); border-radius: 999px; overflow: hidden; margin: 10px 0 12px; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--sapin), var(--sapin-600) 70%, var(--or)); border-radius: inherit; transition: width .6s ease; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--creme); border-radius: 12px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 1.15rem; font-family: var(--font-display); }
.stat span { font-size: .72rem; color: var(--muted); }

/* ---------- Grille de bingo ---------- */
.view-toggle { display: inline-flex; background: var(--creme-2); border-radius: 12px; padding: 3px; }
.view-toggle button { border: 0; background: transparent; padding: 0 12px; min-height: 36px; border-radius: 9px; font-weight: 600; font-size: .85rem; cursor: pointer; color: var(--muted); }
.view-toggle button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.bingo-head { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-bottom: 5px; }
.bingo-head span { text-align: center; font-family: var(--font-display); font-weight: 700; color: var(--cranberry); font-size: 1.05rem; }
.bingo { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.cell {
  position: relative; aspect-ratio: 1 / 1.08; min-width: 0; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; padding: 4px 3px 3px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-align: center; box-shadow: 0 1px 2px rgba(28,42,35,.06); transition: transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.cell:active { transform: scale(.95); }
.cell .ci { font-size: clamp(1.05rem, 5.2vw, 1.45rem); line-height: 1; }
.cell .ct {
  font-size: clamp(.56rem, 2.45vw, .7rem); font-weight: 600; line-height: 1.12; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; hyphens: auto;
}
.cell .cb { position: absolute; top: -5px; right: -5px; width: 19px; height: 19px; border-radius: 50%; font-size: .66rem; display: grid; place-items: center; font-weight: 800; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.cell.s-pending { background: var(--or-50); border: 2px dashed var(--or); }
.cell.s-pending .cb { background: var(--or); color: #2A2008; }
.cell.s-done { background: var(--sapin); border-color: var(--sapin-700); }
.cell.s-done .ct { color: #fff; }
.cell.s-done .cb { background: var(--or); color: var(--sapin-700); }
.cell.s-redo { background: var(--cranberry-50); border: 2px solid var(--cranberry); }
.cell.s-redo .cb { background: var(--cranberry); color: #fff; }
.cell.free { background: radial-gradient(circle at 50% 35%, #F4DE9C, var(--or) 75%); border-color: #B08A33; }
.cell.free .ct { color: #3A2C06; }
.cell.in-line { box-shadow: 0 0 0 2px var(--or), 0 2px 8px rgba(201,162,75,.45); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 4px; border: 1.5px solid var(--line); background: #fff; }
.legend i.p { background: var(--or-50); border: 1.5px dashed var(--or); }
.legend i.d { background: var(--sapin); border-color: var(--sapin); }
.legend i.r { background: var(--cranberry-50); border-color: var(--cranberry); }

/* Vue liste */
.mission-list { list-style: none; margin: 0; padding: 0; }
.mission-row {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--card); border: 1px solid rgba(230,220,203,.8);
  border-radius: 14px; padding: 12px; cursor: pointer; min-height: 64px;
}
.mission-list li + li { margin-top: 8px; }
.mission-row .mi { width: 42px; height: 42px; border-radius: 12px; background: var(--creme); display: grid; place-items: center; font-size: 1.35rem; flex: none; }
.mission-row .mt { font-weight: 650; }
.mission-row .md { font-size: .82rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.chip.s-todo { background: #EFEAE0; color: #5A5446; }
.chip.s-pending { background: var(--or-50); color: var(--or-700); }
.chip.s-done { background: var(--sapin-50); color: var(--sapin-700); }
.chip.s-redo { background: var(--cranberry-50); color: var(--cranberry-700); }

/* ---------- Défi du jour ---------- */
.challenge-banner {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 0; cursor: pointer;
  background: linear-gradient(120deg, var(--cranberry), #7E1A2D); color: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.challenge-banner .ico { font-size: 1.8rem; }
.challenge-banner small { opacity: .85; display: block; font-size: .78rem; }
.challenge-banner strong { font-family: var(--font-display); font-size: 1.05rem; }
.pulse { animation: pulse 2.2s ease-in-out infinite; }

/* ---------- Classement ---------- */
.lb { list-style: none; margin: 0; padding: 0; }
.lb li { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid rgba(230,220,203,.8); }
.lb li + li { margin-top: 8px; }
.lb li.me { border: 2px solid var(--or); background: #FFFBF0; }
.lb .rank { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--creme-2); flex: none; font-size: .95rem; }
.lb .rank.r1 { background: #F1D98C; } .lb .rank.r2 { background: #E2E2E2; } .lb .rank.r3 { background: #EBC6A0; }
.lb .pts { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--sapin); text-align: right; }
.lb .pts small { display: block; font-family: var(--font); font-size: .7rem; color: var(--muted); font-weight: 500; }

/* ---------- Navigation basse ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255, 253, 248, .97); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.bottom-nav .inner { max-width: 560px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.bottom-nav button {
  border: 0; background: none; min-height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .7rem; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; padding: 4px 2px;
}
.bottom-nav button .ni { font-size: 1.3rem; line-height: 1; filter: grayscale(.6); opacity: .8; }
.bottom-nav button[aria-current="page"] { color: var(--sapin); }
.bottom-nav button[aria-current="page"] .ni { filter: none; opacity: 1; }
.bottom-nav button[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--cranberry); }
.nav-badge { position: absolute; top: 7px; left: 54%; background: var(--cranberry); color: #fff; border-radius: 999px; font-size: .64rem; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; }

/* ---------- Panneau (bottom sheet) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(16, 28, 22, .48); z-index: 50; animation: fade .2s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--creme); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg);
  padding: 8px 16px calc(20px + var(--safe-b)); max-width: 560px; margin: 0 auto; animation: slideup .26s cubic-bezier(.2,.8,.2,1);
}
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: #D6CCBA; margin: 4px auto 10px; }
.sheet-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.sheet-head .big-ico { width: 54px; height: 54px; border-radius: 16px; background: #fff; display: grid; place-items: center; font-size: 1.9rem; flex: none; box-shadow: var(--shadow); }
.sheet-close { margin-left: auto; }

.photo { position: relative; border-radius: 14px; overflow: hidden; background: var(--creme-2); min-height: 160px; display: grid; place-items: center; }
.photo img { width: 100%; max-height: 60vh; object-fit: contain; background: #10180F; }
.photo .ph { color: var(--muted); font-size: .85rem; padding: 20px; text-align: center; }
.skeleton { background: linear-gradient(90deg, var(--creme-2), #FAF4E8, var(--creme-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.sk-line { height: 14px; border-radius: 7px; margin: 8px 0; }
.sk-card { height: 84px; border-radius: var(--radius); margin-top: 10px; }

.upload-zone { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.upload-zone label.btn { cursor: pointer; }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.preview { position: relative; margin-top: 10px; }
.preview img { border-radius: 14px; max-height: 280px; width: 100%; object-fit: cover; }
.preview .remove { position: absolute; top: 8px; right: 8px; }
.privacy { font-size: .78rem; color: var(--muted); background: var(--creme-2); border-radius: 12px; padding: 10px 12px; }
.privacy strong { color: var(--ink); }

.review-note { border-left: 4px solid var(--cranberry); background: var(--cranberry-50); padding: 10px 12px; border-radius: 0 12px 12px 0; font-size: .9rem; }

/* ---------- Organisateur ---------- */
.org-card .meta { font-size: .8rem; color: var(--muted); }
.org-card .target { font-weight: 700; }
.org-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 0; padding: 0; cursor: pointer; background: var(--creme-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; color: #fff; font-size: .72rem; text-align: left; background: linear-gradient(transparent, rgba(0,0,0,.72)); line-height: 1.2; }
.thumb .st { position: absolute; top: 6px; left: 6px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters .select { min-height: 44px; font-size: .9rem; padding: 8px 10px; }
.edit-row { padding: 12px; }
.edit-row + .edit-row { margin-top: 10px; }
.edit-row .row { align-items: flex-start; }
.emoji-input { width: 58px; text-align: center; font-size: 1.4rem; padding: 6px; }
.code-box { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 1.7rem; font-weight: 800; letter-spacing: .18em; color: var(--sapin); text-align: center; background: var(--creme); border: 2px dashed var(--or); border-radius: 14px; padding: 10px; }
.danger-zone { border: 1.5px solid #EBC3CB; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.mini-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; max-width: 220px; }
.mini-grid span { aspect-ratio: 1; border-radius: 5px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); font-size: .85rem; }

/* ---------- Toasts / dialogues ---------- */
#toasts { position: fixed; left: 0; right: 0; top: calc(10px + env(safe-area-inset-top, 0px)); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; max-width: 420px; width: 100%; background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-lg); font-size: .92rem; display: flex; gap: 10px; align-items: flex-start; animation: dropin .25s ease; }
.toast.success { background: var(--sapin); }
.toast.error { background: var(--cranberry); }
.toast.gold { background: var(--or); color: #2A2008; }
.dialog-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(16, 28, 22, .5); animation: fade .2s ease; }
.dialog { background: var(--creme); border-radius: 22px; padding: 20px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); animation: pop .25s ease; }
.dialog .actions { display: flex; gap: 10px; margin-top: 18px; }
.dialog .actions .btn { flex: 1; }
.celebrate { text-align: center; }
.celebrate .big { font-size: 3.2rem; display: block; }
.celebrate h2 { font-size: 1.9rem; color: var(--cranberry); margin: 4px 0 6px; }

.lightbox { position: fixed; inset: 0; z-index: 85; background: rgba(8, 12, 10, .94); display: flex; flex-direction: column; color: #fff; animation: fade .2s ease; }
.lightbox .lb-top { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px; }
.lightbox .lb-img { flex: 1; display: grid; place-items: center; padding: 8px; min-height: 0; }
.lightbox .lb-img img { max-height: 100%; max-width: 100%; object-fit: contain; border-radius: 8px; }
.lightbox .lb-info { padding: 12px 16px calc(16px + var(--safe-b)); font-size: .9rem; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.switch input { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 999px; background: #D7CEBE; position: relative; cursor: pointer; flex: none; transition: background .2s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked { background: var(--sapin); }
.switch input:checked::after { transform: translateX(20px); }

.tabs-inline { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs-inline button { flex: none; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; min-height: 38px; padding: 0 14px; font-weight: 600; font-size: .85rem; cursor: pointer; color: var(--muted); }
.tabs-inline button[aria-pressed="true"] { background: var(--sapin); color: #fff; border-color: var(--sapin); }

.footer-note { text-align: center; font-size: .75rem; color: var(--muted); margin-top: 26px; }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(100%); } }
@keyframes dropin { from { transform: translateY(-14px); opacity: 0; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(164,36,59,.18), var(--shadow); } }
@keyframes cellIn { from { transform: scale(.85); opacity: 0; } }
.cell.just-done { animation: cellIn .45s cubic-bezier(.2,1.4,.4,1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
html.no-anim *, html.no-anim *::before, html.no-anim *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }

@media (min-width: 430px) {
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bingo { gap: 7px; }
}
@media (max-width: 370px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .bingo { gap: 4px; }
  .action-card { min-height: 108px; padding: 14px 12px; }
}

/* ---------- Compléments ---------- */
.appbar.tall { padding-bottom: 46px; }
.page.overlap > :first-child { margin-top: -34px; position: relative; z-index: 2; }
.upload-zone label { position: relative; overflow: hidden; }
.thumb-img { width: 100%; height: 100%; }
.thumb-img img { width: 100%; height: 100%; object-fit: cover; }
.thumb-img .ph { display: grid; place-items: center; height: 100%; font-size: .75rem; color: var(--muted); }
.thumb .skeleton { width: 100%; height: 100%; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸ '; color: var(--muted); }
details[open] > summary::before { content: '▾ '; }
code { background: var(--creme-2); padding: 1px 6px; border-radius: 6px; font-weight: 700; letter-spacing: .06em; }
