:root {
  --bg: #fbf7f0;
  --card: #ffffff;
  --ink: #2e2a25;
  --muted: #7d766b;
  --line: #eee6d8;
  --green: #2f6b52;
  --green-soft: #e9f1eb;
  --red: #b5443b;
  --red-soft: #f9eae7;
  --gold: #b98f3e;
  --gold-soft: #f8f0dc;
  --shadow: 0 1px 2px rgba(70, 50, 20, .05), 0 10px 28px rgba(70, 50, 20, .07);
  --shadow-hover: 0 2px 4px rgba(70, 50, 20, .06), 0 16px 36px rgba(70, 50, 20, .11);
  --radius: 20px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.3rem; }
p { margin: 0 0 .8rem; }
a { color: var(--green); text-underline-offset: 3px; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 28px; padding-bottom: 48px; min-height: 70vh; }
.narrow { max-width: 580px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: .93rem; }
.plain { list-style: none; margin: 0; padding: 0; }

/* En-tête */
.top { background: var(--bg); }
.top-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding-top: 18px; padding-bottom: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 600; font-size: 1.3rem; color: var(--ink); text-decoration: none; }
.brand svg { flex: none; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 14px; border-radius: 999px; transition: background .15s; }
.nav a:hover { background: var(--green-soft); color: var(--green); }
.nav form { margin: 0 0 0 10px; }
.dot { display: inline-block; background: var(--red); color: #fff; border-radius: 999px; font-size: .72rem; font-weight: 600; line-height: 1; padding: 4px 7px; vertical-align: 2px; }

/* Guirlande : le seul décor permanent */
.lights {
  height: 8px;
  background:
    radial-gradient(circle at 12px 4px, var(--red) 2.5px, transparent 3.2px),
    radial-gradient(circle at 44px 4px, var(--gold) 2.5px, transparent 3.2px),
    radial-gradient(circle at 76px 4px, var(--green) 2.5px, transparent 3.2px),
    linear-gradient(var(--line), var(--line)) 0 4px / 100% 1px no-repeat;
  background-size: 96px 8px, 96px 8px, 96px 8px, 100% 1px;
  opacity: .75;
}

.event-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; color: var(--muted); font-size: .92rem; margin-bottom: 18px; }
.pill { display: inline-block; background: var(--gold-soft); color: #7a5a1c; border-radius: 999px; padding: 3px 14px; font-weight: 600; }
.foot { color: var(--muted); font-size: .88rem; text-align: center; padding-bottom: 32px; }
.foot span { color: var(--gold); }

/* Blocs */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; margin-bottom: 22px; }
.card.empty { color: var(--muted); text-align: center; box-shadow: none; background: transparent; border: 1.5px dashed var(--line); padding: 36px 20px; }
.notice { background: var(--gold-soft); box-shadow: none; }
.hint { background: var(--green-soft); color: #2a5441; border-radius: 14px; padding: 12px 18px; font-size: .95rem; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.head h1, .head h2 { margin: 0; }
.head-actions, .inline-forms { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inline-forms { margin-top: 10px; }
.inline-forms form { margin: 0; }
.section-title { font-family: var(--serif); font-size: 1.15rem; color: var(--muted); font-weight: 600; margin: 30px 0 14px; display: flex; align-items: center; gap: 12px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.flash { border-radius: 14px; padding: 12px 18px; margin-bottom: 20px; background: var(--green-soft); color: #2a5441; }
.flash-err { background: var(--red-soft); color: #8c2f28; }
.flash-link { background: var(--gold-soft); color: var(--ink); }
.error { background: var(--red-soft); color: #8c2f28; border-radius: 12px; padding: 10px 16px; }
.copy-row { display: flex; gap: 8px; margin-top: 10px; }
.copy-row input { flex: 1; min-width: 0; }

/* Accueil */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #fff 0%, #fdf8ec 100%);
  border-radius: 28px; box-shadow: var(--shadow); padding: 34px 32px; margin-bottom: 26px;
}
.hero h1 { font-size: 2.4rem; margin-bottom: .35rem; }
.hero-kicker { color: var(--red); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; margin-bottom: .4rem; }
.hero-text { color: var(--muted); font-size: 1.08rem; margin: 0; max-width: 34em; }
.hero-text strong { color: var(--ink); }
.hero-deco { position: absolute; right: -6px; top: -10px; width: 190px; height: 190px; opacity: .9; pointer-events: none; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { font: inherit; font-size: .92rem; cursor: pointer; background: var(--card); color: var(--ink); border: 0; box-shadow: var(--shadow); border-radius: 999px; padding: 6px 16px; transition: background .15s, color .15s; }
.chip:hover { color: var(--green); }
.chip.is-on { background: var(--green); color: #fff; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.person {
  display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s;
}
.person:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.person-main { display: grid; gap: 1px; min-width: 0; }
.person-main strong { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; }
.person-free { color: var(--green); font-weight: 600; }
.person.is-me { background: linear-gradient(135deg, #fff, var(--gold-soft)); margin-bottom: 4px; }
.avatar { flex: none; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 1.35rem; }
.avatar.big { width: 64px; height: 64px; font-size: 1.7rem; }
.av-0 { background: #e9f1eb; color: #2f6b52; }
.av-1 { background: #f9eae7; color: #b5443b; }
.av-2 { background: #f8f0dc; color: #8a6a22; }
.av-3 { background: #e8eef5; color: #3d5f86; }
.av-4 { background: #f3e9f1; color: #86507c; }
.av-5 { background: #efe9df; color: #6f5b3e; }

.settings { margin-top: 34px; box-shadow: none; background: transparent; padding: 0; }
.settings summary { cursor: pointer; color: var(--muted); font-size: .95rem; }
.settings[open] summary { margin-bottom: 14px; }

/* Boutons et formulaires */
.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--card); color: var(--ink); border: 0; border-radius: 999px; padding: 10px 22px;
  box-shadow: inset 0 0 0 1.5px var(--line); transition: background .15s, box-shadow .15s, transform .1s;
}
.btn:hover { box-shadow: inset 0 0 0 1.5px var(--green); color: var(--green); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--green); color: #fff; box-shadow: 0 4px 12px rgba(47, 107, 82, .25); }
.btn.primary:hover { background: #285c46; color: #fff; }
.btn.small { padding: 6px 15px; font-size: .9rem; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.form { display: grid; gap: 18px; }
.form label { display: grid; gap: 6px; font-weight: 600; }
.form label small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fdfbf7; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
input[type=checkbox] { width: 1.2rem; height: 1.2rem; margin-top: .2rem; flex: none; accent-color: var(--green); box-shadow: none; }
.inline-forms input { width: auto; flex: 1 1 160px; }
.form label.check, label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.with-btn { display: flex; gap: 8px; }
.with-btn input { flex: 1; min-width: 0; }
fieldset { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 18px 16px; margin: 0; display: grid; gap: 8px; }
legend { font-weight: 600; padding: 0 8px; }
.preview-img { max-height: 180px; border-radius: 14px; justify-self: start; }
.danger-zone { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Liste d'envies */
.list-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 20px; }
.list-head h1 { margin: 0; }
.list-head .head-actions { margin-left: auto; }
.items { display: grid; gap: 18px; }
.item { display: flex; gap: 20px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; scroll-margin-top: 20px; }
.item.st-taken, .item.st-group_closed { box-shadow: none; background: rgba(255, 255, 255, .55); }
.item.st-taken .item-img, .item.st-group_closed .item-img { opacity: .55; }
.item.st-taken h2, .item.st-group_closed h2 { color: var(--muted); }
.item:target { box-shadow: 0 0 0 3px var(--gold), var(--shadow); }
.item-img { flex: none; width: 120px; height: 120px; object-fit: cover; border-radius: 16px; background: var(--bg); }
.item-body { flex: 1; min-width: 0; }
.item-body h2 { font-size: 1.25rem; overflow-wrap: anywhere; margin-bottom: .45rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag { display: inline-block; font-size: .8rem; font-weight: 600; border-radius: 999px; padding: 2px 12px; background: var(--bg); color: var(--muted); }
.tag.prio-1 { background: var(--red-soft); color: var(--red); }
.tag.secret, .tag.warn { background: var(--gold-soft); color: #7a5a1c; }
.tag.free { background: var(--green-soft); color: var(--green); }
.desc { overflow-wrap: anywhere; color: #4d4841; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.meta strong { font-family: var(--serif); font-size: 1.2rem; }
.meta span { color: var(--muted); }
.res { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 6px; }
.res form { margin: 0 0 10px; }
.res-state { font-weight: 600; margin-bottom: 8px; color: var(--muted); }
.res-state.mine { color: var(--green); }
.parts { font-size: .95rem; margin-bottom: 10px; color: #4d4841; }
.group-form summary { cursor: pointer; color: var(--green); font-size: .95rem; }
.group-form[open] summary { margin-bottom: 12px; }
.item-edit { display: flex; gap: 18px; align-items: center; margin-top: 10px; font-size: .92rem; }
.item-edit form { margin: 0; }

/* Mes achats et gestion */
.totals { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.totals span { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 20px; color: var(--muted); font-size: .92rem; display: grid; }
.totals strong { font-family: var(--serif); font-size: 1.5rem; color: var(--ink); }
.buys li, .members li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.buys li:first-child, .members li:first-child { border-top: 0; }
.buy-main { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.buy-main .tag { justify-self: start; margin-top: 4px; }
.buy-main > a { font-weight: 600; color: var(--ink); text-decoration: none; }
.buy-main > a:hover { color: var(--green); }
.buys .inline-forms, .members .inline-forms { margin-top: 0; }
.is-bought .buy-main > a { text-decoration: line-through; color: var(--muted); }
.is-gone .buy-main > a { color: var(--muted); }

@media (max-width: 560px) {
  body { font-size: 16px; }
  h1 { font-size: 1.6rem; }
  .wrap { padding: 0 16px; }
  .top-in { padding-top: 14px; }
  .nav { gap: 0; margin: 0 -10px; }
  .nav a { padding: 6px 10px; }
  .hero { padding: 26px 22px; border-radius: 22px; }
  .hero h1 { font-size: 1.9rem; }
  .hero-deco { width: 120px; height: 120px; opacity: .5; }
  .row { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .item { padding: 16px; gap: 14px; }
  .item-img { width: 76px; height: 76px; border-radius: 12px; }
  .list-head .head-actions { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Jeu des lutins */
.xp { display: block; height: 8px; border-radius: 999px; background: var(--line); }
.xp-fill { display: block; position: relative; height: 100%; min-width: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--gold), #d9b25f); transition: width .6s; }
.w-0 { width: 0%; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }

.level { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; position: relative; }
.level-badge { flex: none; background: var(--green); color: #fff; font-weight: 600; font-size: .85rem; border-radius: 999px; padding: 4px 14px; }
.level-main { flex: 1 1 200px; display: grid; gap: 6px; font-size: .95rem; }
.level-link { color: var(--green); font-weight: 600; font-size: .93rem; }
.level:hover .level-link { text-decoration: underline; }
.level-hero .xp { margin: 14px 0 12px; max-width: 420px; height: 10px; }

.word { color: var(--muted); font-size: .97rem; margin: -6px 4px 24px; }
.word-label { display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--red); margin-right: 6px; }

.sleigh { margin-bottom: 20px; }
.sleigh p { margin-bottom: 14px; }
.sleigh-bar { height: 6px; margin-right: 14px; }
.sleigh-bar .xp-fill { background: linear-gradient(90deg, #7fae96, var(--green)); min-width: 14px; }
.sleigh-icon { position: absolute; right: -14px; top: -17px; font-size: 1.5rem; line-height: 1; transform: scaleX(-1); }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin: 20px 0; }
.badge { display: flex; align-items: center; gap: 14px; background: rgba(255, 255, 255, .55); border-radius: var(--radius); padding: 16px 18px; }
.badge-icon { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; background: var(--bg); filter: grayscale(1); opacity: .45; }
.badge-main { display: grid; gap: 1px; flex: 1; min-width: 0; }
.badge-main strong { font-family: var(--serif); font-size: 1.05rem; color: var(--muted); }
.badge-pts { flex: none; font-weight: 600; font-size: .85rem; color: var(--muted); }
.badge.is-on { background: var(--card); box-shadow: var(--shadow); }
.badge.is-on .badge-icon { background: var(--gold-soft); filter: none; opacity: 1; }
.badge.is-on .badge-main strong { color: var(--ink); }
.badge.is-on .badge-pts { color: var(--green); font-size: 1.1rem; }
.badge.is-secret .badge-icon { font-family: var(--serif); font-weight: 600; filter: none; }

.flash-party { background: var(--gold-soft); color: #6b4f17; font-weight: 600; }

.toasts { position: fixed; z-index: 20; right: 16px; bottom: 16px; left: 16px; display: grid; gap: 10px; justify-items: end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; max-width: 360px; background: var(--ink); color: #fff; text-decoration: none; border-radius: 18px; padding: 12px 20px 12px 14px; box-shadow: 0 14px 34px rgba(40, 30, 10, .28); animation: toast-in .5s cubic-bezier(.2, 1.3, .4, 1) both; }
.toast span { display: grid; }
.toast small { color: #e2c98c; font-size: .78rem; }
.toast strong { font-family: var(--serif); font-size: 1.1rem; }
.toast-icon { width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .12); place-items: center; font-size: 1.5rem; }
.toast.is-out { opacity: 0; transform: translateY(12px); transition: opacity .4s, transform .4s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(24px) scale(.94); } }

.foot .star { cursor: default; user-select: none; display: inline-block; transition: transform .2s; }
.foot .star:hover { transform: rotate(40deg) scale(1.3); }

.fx { position: fixed; z-index: 30; pointer-events: none; top: -30px; user-select: none; }
.fx-snow { color: #fff; text-shadow: 0 0 3px #9fb6c9, 0 0 1px #6f8ea8; animation: fx-fall linear forwards; }
.fx-confetti { width: 9px; height: 14px; border-radius: 2px; animation: fx-fall cubic-bezier(.3, .6, .6, 1) forwards; }
.fx-fox { top: auto; bottom: 12px; left: -60px; font-size: 2.4rem; animation: fx-run 4.5s linear forwards; }
@keyframes fx-fall { to { transform: translate3d(var(--dx, 0), 110vh, 0) rotate(var(--rot, 360deg)); } }
@keyframes fx-run { to { transform: translateX(calc(100vw + 120px)); } }
