/* =====================================================================
   Secret Santa — thème de Noël (rouge, vert, doré)
   Pensé d'abord pour smartphone, puis élargi pour PC.
   ===================================================================== */
:root {
  --red: #c8102e;
  --red-d: #7a0f1c;
  --green: #1f6b3d;
  --green-d: #0c2a1b;
  --gold: #e8b84a;
  --gold-l: #f6d98a;
  --gold-d: #a8771f;
  --cream: #fbf4e4;
  --ink: #2a1a12;
  --night: #0a1a24;
  --nav-h: 64px;
  --radius: 14px;
  --serif: Georgia, "Times New Roman", serif;
  --hand: "Segoe Print", "Bradley Hand", "Comic Sans MS", "Chalkboard SE", cursive;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #0e2b22; }
body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(ellipse at 50% -10%, #1d4a3a 0%, transparent 60%),
    linear-gradient(180deg, var(--night) 0, #0e2b22 700px, #123a2a 100%);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
}
a { color: var(--gold-l); }
h1, h2 { font-family: var(--serif); line-height: 1.2; }
h2 small { font-weight: normal; opacity: .7; font-size: .7em; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------- neige */
.snow {
  pointer-events: none; position: fixed; inset: 0; z-index: 0; opacity: .7;
  background-image:
    radial-gradient(2px 2px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 90px 120px, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 160px 60px, #fff 50%, transparent 51%),
    radial-gradient(2.5px 2.5px at 210px 170px, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 60px 200px, #fff 50%, transparent 51%);
  background-size: 240px 240px;
  animation: snow 18s linear infinite;
}
@keyframes snow { to { background-position: 60px 240px, -40px 240px, 30px 240px, -20px 240px, 50px 240px; } }

/* ---------------------------------------------------------- en-tête */
.top {
  position: relative; z-index: 3;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #d81f3a, var(--red-d));
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 4px 18px rgba(0,0,0,.4);
}
.brand {
  display: flex; align-items: center; gap: 8px; text-decoration: none;
  font-family: var(--serif); font-size: 1.15rem; font-weight: bold; color: var(--gold-l);
  text-shadow: 0 2px 0 rgba(0,0,0,.35); min-width: 0;
}
.brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-star { color: var(--gold); font-size: 1.4em; animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .55; transform: scale(.85); } }
.logout { margin-left: auto; flex: none; }
.logout button {
  background: rgba(0,0,0,.2); color: var(--gold-l); border: 1px solid rgba(246,217,138,.4);
  border-radius: 999px; padding: 4px 12px; font-size: .8rem; cursor: pointer; white-space: nowrap;
}

/* onglets : barre en bas sur mobile */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: linear-gradient(180deg, #14462d, var(--green-d));
  border-top: 2px solid var(--gold);
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none; color: #cfe3d6; font-size: .68rem; gap: 2px;
}
.tabs a span { font-size: 1.35rem; line-height: 1; filter: grayscale(.4); }
.tabs a b { font-weight: 600; }
.tabs a.on { color: var(--gold-l); background: rgba(232,184,74,.12); }
.tabs a.on span { filter: none; transform: scale(1.1); }

@media (min-width: 820px) {
  body { padding-bottom: 24px; }
  .tabs { position: static; height: auto; background: none; border: 0; padding: 0; gap: 4px; flex: 0 1 auto; }
  .tabs a { flex-direction: row; gap: 6px; font-size: .92rem; padding: 6px 12px; border-radius: 999px; color: #ffe9e9; white-space: nowrap; }
  .tabs a span { font-size: 1.05rem; }
  .tabs a.on { background: rgba(0,0,0,.22); }
}

/* guirlande lumineuse */
.garland {
  position: relative; z-index: 2; height: 16px; margin-top: -2px;
  background:
    radial-gradient(circle at 15px 9px, #ff5a5a 0 4px, transparent 5px),
    radial-gradient(circle at 45px 11px, var(--gold) 0 4px, transparent 5px),
    radial-gradient(circle at 75px 9px, #4fd17f 0 4px, transparent 5px),
    radial-gradient(circle at 105px 11px, #5ab6ff 0 4px, transparent 5px),
    radial-gradient(ellipse 60px 10px at 60px 0, transparent 9px, #2b3a2f 9px 10px, transparent 11px);
  background-size: 120px 16px;
  animation: lights 1.6s steps(2) infinite;
}
@keyframes lights { 50% { filter: hue-rotate(160deg) brightness(1.2); } }

/* ---------------------------------------------------------- mise en page */
main { position: relative; z-index: 1; }
.page { max-width: 760px; margin: 0 auto; padding: 16px 14px 24px; }
.page.wide { max-width: 1180px; }
.page-title { text-align: center; color: var(--gold-l); margin: 8px 0 16px; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.page-title.left { text-align: left; margin: 0; }
.intro { text-align: center; opacity: .9; }
.center { text-align: center; }
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; }
.big-emoji { font-size: 3rem; }
.hint { font-size: .85rem; opacity: .75; }
.error { color: #ffb3b3; font-weight: 600; }
.paper .error { color: var(--red); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card { border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.paper {
  color: var(--ink);
  background: linear-gradient(180deg, #fffaf0, var(--cream));
  border: 2px solid var(--gold);
  box-shadow: 0 6px 24px rgba(0,0,0,.35), inset 0 0 0 4px rgba(232,184,74,.18);
}
.paper h1, .paper h2 { color: var(--red-d); margin-top: 0; }
.paper a { color: var(--red-d); }

/* ---------------------------------------------------------- boutons & formulaires */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 999px; border: 0; cursor: pointer;
  font: 600 1rem system-ui, sans-serif; text-decoration: none;
  background: #e9dfc8; color: var(--ink);
  box-shadow: 0 3px 0 rgba(0,0,0,.25); transition: transform .08s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.red { background: linear-gradient(180deg, #e3263f, var(--red)); color: #fff; }
.btn.gold { background: linear-gradient(180deg, var(--gold-l), var(--gold)); color: var(--ink); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px currentColor; color: inherit; }
.btn.danger { background: #8b1020; color: #fff; }
.btn.big { padding: 14px 26px; font-size: 1.1rem; width: 100%; }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn.tiny { padding: 0 8px; font-size: .9rem; line-height: 1.6; }

.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92rem; }
input[type=text], input[type=password], input[type=url], input:not([type]), select, textarea {
  font: 1rem system-ui, sans-serif; padding: 10px 12px; border-radius: 10px;
  border: 2px solid #d8c7a0; background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,184,74,.35); }

.flash {
  margin: 0 0 14px; padding: 10px 14px; border-radius: 10px;
  background: rgba(31,107,61,.9); border: 1px solid #4fd17f; color: #fff;
}
.flash.error { background: rgba(122,15,28,.95); border-color: #ff8a8a; }

/* bannière « Le Père Noël attend ta lettre ! » */
.nudge-banner {
  display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px 14px;
  border-radius: var(--radius); color: var(--ink);
  background: linear-gradient(135deg, var(--gold-l), var(--gold));
  border: 2px solid #fff3c4; box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
.nudge-banner small { display: block; opacity: .8; }
.nudge-banner > div:nth-child(2) { flex: 1; }
.nudge-horn { font-size: 2rem; animation: horn 1.2s ease-in-out infinite; }
@keyframes horn { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(12deg) scale(1.1); } }
.nudge-banner .close { background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--ink); opacity: .6; }

/* ---------------------------------------------------------- connexion */
.auth-card { max-width: 420px; margin: 32px auto; text-align: center; }
.auth-card .stack { text-align: left; }
.auth-hat { font-size: 3.4rem; margin-top: -48px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.3)); }

/* ---------------------------------------------------------- village */
.status-board {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center;
  margin: 0 auto 10px; max-width: 640px;
}
.stat {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px;
  background: rgba(0,0,0,.25); border: 1px solid rgba(232,184,74,.35);
}
.stat b { display: block; font-size: 1.15rem; color: var(--gold-l); }
.stat small { opacity: .8; }
.stat-icon { font-size: 1.6rem; }
.progress { flex-basis: 100%; height: 10px; border-radius: 99px; background: rgba(0,0,0,.35); overflow: hidden; border: 1px solid rgba(232,184,74,.35); }
.progress span { display: block; height: 100%; background: repeating-linear-gradient(45deg, var(--red) 0 10px, #fff 10px 20px); transition: width .6s; }

.village {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 22px 10px; padding: 18px 0 0;
}
@media (min-width: 820px) { .village { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 28px 18px; } }
.villager { display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; }
.villager .perso { width: 100%; max-width: 210px; height: auto; display: block; overflow: visible; }
.villager.asleep { opacity: .55; filter: grayscale(.6); }
.villager.me .nameplate { background: linear-gradient(180deg, var(--gold-l), var(--gold)); color: var(--red-d); }
.perso-link { display: block; width: 100%; max-width: 210px; }

.bubble {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 6px;
  max-width: 100%; min-height: 40px; padding: 6px 10px; margin-bottom: -6px;
  background: #fff; color: var(--ink); border-radius: 14px; font-size: .82rem; line-height: 1.25;
  box-shadow: 0 3px 0 rgba(0,0,0,.2); word-break: break-word;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -6px;
  border: 8px solid transparent; border-top-color: #fff; border-bottom: 0;
}
.bubble-emoji { font-size: 1.25rem; }
.nameplate {
  margin-top: -2px; padding: 3px 14px; border-radius: 6px;
  font-family: var(--serif); font-weight: bold; color: var(--gold-l);
  background: linear-gradient(180deg, #d81f3a, var(--red-d)); border: 2px solid var(--gold);
  box-shadow: 0 3px 0 rgba(0,0,0,.3);
}
.nameplate small { font-weight: normal; opacity: .8; }
.badges { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.badge { font-size: .72rem; padding: 2px 8px; border-radius: 99px; background: rgba(0,0,0,.3); }
.badge.ok { background: rgba(31,107,61,.85); }
.badge.wait { opacity: .75; }

.ground {
  height: 70px; margin: 10px -14px 0;
  background:
    radial-gradient(ellipse 60% 40px at 20% 100%, #f4f7fb 98%, transparent 100%),
    radial-gradient(ellipse 70% 50px at 80% 100%, #e6edf5 98%, transparent 100%);
}

/* ---------------------------------------------------------- personnages : animations */
.perso .who, .perso .fx, .perso .frame { transform-box: view-box; }
.anim-bob .who { animation: bob 1.6s steps(1) infinite; }
@keyframes bob { 50% { transform: translateY(-1px); } }
.anim-bounce .who { animation: bounce .9s cubic-bezier(.3,.1,.5,1) infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-4px); } 55% { transform: translateY(-4px); } }
.anim-shake .who { animation: shake .35s steps(2) infinite; }
@keyframes shake { 50% { transform: translateX(.6px); } }
.anim-sway .who { transform-origin: 21px 43px; animation: sway 3.2s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
.anim-puff .fx-a { transform-origin: 2px -7px; animation: puff 1.8s ease-in-out infinite; }
@keyframes puff { 50% { transform: scale(1.12); } }

.perso .frame-1 { animation: frame1 .9s steps(1) infinite; }
.perso .frame-2 { animation: frame2 .9s steps(1) infinite; }
@keyframes frame1 { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes frame2 { 0% { opacity: 0; } 50% { opacity: 1; } }

.perso .fx-a, .perso .fx-b, .perso .fx-c { animation: float 2.4s ease-in infinite; }
.perso .fx-b { animation-delay: 1.2s; }
.perso .fx-c { animation-delay: .6s; }
.anim-puff .fx-b { animation: flash 1.8s steps(1) infinite; }
@keyframes float { 0% { opacity: 0; transform: translateY(2px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-5px); } }
@keyframes flash { 0%, 60% { opacity: 0; } 65%, 80% { opacity: 1; } }
.perso .pull-img { image-rendering: pixelated; }

@media (prefers-reduced-motion: reduce) {
  *, .perso * { animation: none !important; transition: none !important; }
  .perso .frame-2 { opacity: 0; }
}

/* ---------------------------------------------------------- humeur */
.mood-preview { display: flex; flex-direction: column; align-items: center; }
.preview-stage { width: 200px; background: radial-gradient(circle at 50% 40%, #1d4a3a, var(--night)); border-radius: 12px; padding: 8px 0; }
.preview-item .perso { width: 100%; display: block; overflow: visible; }
.mood-text { width: 100%; margin-top: 12px; }
.emotion-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.emotion-choice input, .pull-choice input { position: absolute; opacity: 0; pointer-events: none; }
.emotion-choice span {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; cursor: pointer;
  border-radius: 12px; border: 2px solid #e2d3ae; background: #fff; font-weight: 600; font-size: .85rem;
}
.emotion-choice i { font-style: normal; font-size: 1.8rem; }
.emotion-choice input:checked + span { border-color: var(--red); background: #ffeef0; box-shadow: 0 0 0 3px rgba(200,16,46,.2); }
.emotion-choice input:focus-visible + span, .pull-choice input:focus-visible + span { outline: 3px solid var(--gold); }

.pull-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.pull-choice { position: relative; }
.pull-choice span {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; cursor: pointer;
  border-radius: 12px; border: 2px solid #e2d3ae; background: #fff; font-size: .75rem; text-align: center;
}
.pull-choice img, .plain-pull { width: 60px; height: 55px; image-rendering: pixelated; border-radius: 4px; display: block; }
.plain-pull { background: var(--red); }
.pull-choice em { font-style: normal; }
.pull-choice input:checked + span { border-color: var(--red); background: #ffeef0; box-shadow: 0 0 0 3px rgba(200,16,46,.2); }
.pull-choice.static span { cursor: default; }
.pull-choice.static form { position: absolute; top: -6px; right: -6px; }

.sticky-actions {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); z-index: 5;
  padding: 8px 0 0;
}
@media (min-width: 820px) { .sticky-actions { bottom: 12px; } }

/* ---------------------------------------------------------- lettre */
.paper-letter {
  position: relative; color: #3b2a1a; padding: 22px 18px 18px; margin-bottom: 16px;
  border-radius: 6px; font-family: var(--hand);
  background:
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(120,80,40,.14) 31px 32px),
    linear-gradient(180deg, #fff9ea, #f7ead0);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  border-top: 6px solid var(--red);
}
.paper-letter::before {
  content: "🎄"; position: absolute; right: 12px; top: 10px; font-size: 1.6rem;
}
.letter-head { font-size: 1.15rem; margin: 0 0 12px; }
.letter-head small { font-size: .85em; opacity: .75; }
.letter-sign { text-align: right; margin-top: 14px; }
.letter-sign span { font-size: 1.3rem; color: var(--red-d); }
.wish-list { padding-left: 1.6em; margin: 0 0 10px; }
.wish-row { margin-bottom: 10px; }
.wish-row input {
  font-family: var(--hand); background: transparent; border: 0; border-bottom: 2px dashed rgba(120,80,40,.35);
  border-radius: 0; padding: 6px 2px; color: #3b2a1a;
}
.wish-row input[type=text] { font-size: 1.05rem; }
.wish-row input.link-input { font-size: .8rem; opacity: .8; font-family: system-ui, sans-serif; }
.wish-row input:focus { box-shadow: none; border-bottom-color: var(--red); }
.paper-letter .btn.ghost { color: var(--red-d); font-family: system-ui, sans-serif; }
.paper-letter .hint, .paper-letter .btn { font-family: system-ui, sans-serif; }
.wish-read { padding-left: 1.6em; font-size: 1.1rem; line-height: 2; }
.wish-read a { font-size: .8rem; font-family: system-ui, sans-serif; }
.empty-letter { text-align: center; font-size: 1.15rem; padding: 18px 0 8px; }

/* ---------------------------------------------------------- missions */
.envelopes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.envelope { perspective: 1200px; min-height: 380px; }
.env-inner { position: relative; height: 100%; min-height: 380px; transition: transform .7s cubic-bezier(.3,1.3,.5,1); transform-style: preserve-3d; }
.envelope.open .env-inner { transform: rotateY(180deg); }
.envelope.opening .env-inner { transform: rotateY(90deg) scale(1.05); }
.env-front, .env-back {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.env-front {
  cursor: pointer; border: 3px solid var(--gold); overflow: hidden; font: inherit; color: var(--ink);
  background: linear-gradient(180deg, #fbf1dc, #ecdcb8);
}
.env-flap {
  position: absolute; top: 0; left: 0; right: 0; height: 55%;
  background: linear-gradient(180deg, #e3263f, var(--red-d));
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.env-seal {
  position: relative; z-index: 1; width: 64px; height: 64px; margin-top: -10px; border-radius: 50%;
  display: grid; place-items: center; font: bold 1.6rem var(--serif); color: var(--gold-l);
  background: radial-gradient(circle at 35% 35%, #c9283e, #6d0a17); border: 3px solid var(--gold);
  box-shadow: 0 4px 10px rgba(0,0,0,.35); animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.08); } }
.env-label { position: relative; z-index: 1; margin-top: 18px; font: bold 1.2rem var(--serif); display: flex; flex-direction: column; }
.env-label small { font: .85rem system-ui, sans-serif; opacity: .7; }
.env-back {
  transform: rotateY(180deg); padding: 14px; gap: 6px; color: var(--ink); text-align: center;
  background: linear-gradient(180deg, #fffaf0, var(--cream)); border: 3px solid var(--gold);
}
.env-back .perso { width: 150px; height: auto; overflow: visible; background: radial-gradient(circle at 50% 40%, #1d4a3a, var(--night)); border-radius: 12px; }
.env-status { font-size: .85rem; margin: 4px 0; }

.mission-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.mission-perso { width: 120px; flex: none; }
.mission-perso .perso { width: 100%; height: auto; overflow: visible; }
.mood-line { margin: 4px 0 0; opacity: .9; }

.gift-toggle {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--radius);
  background: rgba(0,0,0,.28); border: 2px dashed rgba(232,184,74,.6);
}
.gift-toggle small { display: block; opacity: .75; }
.gift-toggle.done { border-style: solid; background: rgba(31,107,61,.55); }
.gift-toggle .btn.ghost { color: var(--cream); }

/* ---------------------------------------------------------- admin */
.people-admin { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.person-row { display: flex; gap: 12px; padding: 10px; border-radius: 12px; background: #fff; border: 1px solid #ecdcb8; }
.thumb {
  flex: none; width: 58px; height: 58px; border-radius: 50%; overflow: hidden; padding: 0; cursor: pointer;
  border: 3px solid var(--gold); background: #f3ead8; display: grid; place-items: center; font-size: 1.4rem;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.person-main summary { cursor: pointer; list-style: none; }
.person-main summary::-webkit-details-marker { display: none; }
.person-stats, .person-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.person-actions select { width: auto; padding: 5px 8px; font-size: .85rem; }
form.inline { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.person-actions form.inline { margin: 0; }
.tag { font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: #f1e6cc; white-space: nowrap; }
.tag.ok { background: #d8f0df; color: #14532d; }
.tag.warn { background: #ffe9c2; color: #7a4b00; }
.tag.gold { background: var(--gold); }
details.more { position: relative; }
details.more summary { list-style: none; }
.more-menu {
  position: absolute; right: 0; top: 110%; z-index: 4; display: flex; flex-direction: column; gap: 6px;
  padding: 8px; background: #fff; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); min-width: 150px;
}
.danger-zone { margin-top: 10px; padding: 12px; border-radius: 10px; background: #fff0f0; border: 1px solid #f3b6b6; }
.add-people textarea { resize: vertical; }
.pull-upload { margin-top: 14px; }
.pull-upload-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
#pull-canvas { width: 72px; height: 66px; image-rendering: pixelated; border: 2px solid #e2d3ae; border-radius: 4px; }
input[type=color] { width: 56px; height: 40px; padding: 2px; border-radius: 8px; border: 2px solid #d8c7a0; }

.link-box { padding: 12px; border-radius: 10px; background: #fff; border: 2px dashed var(--gold); word-break: break-all; margin-bottom: 10px; }
#link-msg { margin-bottom: 10px; }

.crop-dialog {
  border: 2px solid var(--gold); border-radius: var(--radius); padding: 16px; width: min(380px, 94vw);
  background: var(--cream); color: var(--ink);
}
.crop-dialog::backdrop { background: rgba(5,15,10,.75); }
.crop-dialog h2 { margin-top: 0; color: var(--red-d); }
.crop-area { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; margin: 10px auto; touch-action: none; }
#crop-canvas { width: 100%; height: 100%; display: block; border-radius: 8px; cursor: grab; }
.crop-ring { pointer-events: none; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.45); border: 3px solid var(--gold); }
.crop-area { overflow: hidden; border-radius: 8px; }

@media (max-width: 420px) {
  .brand { font-size: 1rem; }
  .logout button { padding: 4px 10px; }
}

/* ---------------------------------------------------------- atelier de tricot */
.pull-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pull-head h2 { margin: 0; }
.pull-thumb { width: 60px; height: 55px; display: block; border-radius: 4px; }
.pull-choice.perso span { border-color: var(--gold); }

.knit-main { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }
.knit-preview {
  width: 130px; flex: none; padding: 6px 0; border-radius: 12px;
  background: radial-gradient(circle at 50% 40%, #1d4a3a, var(--night));
}
.knit-preview .perso { width: 100%; height: auto; display: block; overflow: visible; }
.knit-board { flex: 1 1 260px; max-width: 380px; }
.knit-grid {
  display: grid; grid-template-columns: repeat(12, 1fr); aspect-ratio: 12 / 11;
  border: 3px solid var(--ink); border-radius: 4px; background: var(--ink); gap: 1px;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair;
}
.kc { position: relative; }
.kc.clear { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.35) 0 2px, transparent 2px 6px) !important; }
.kc.head::after { content: ""; position: absolute; inset: 0; background: rgba(40,40,40,.35); }
.knit-legend { margin: 6px 0 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.legend-head, .legend-clear { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid #0003; }
.legend-head { background: #8a8a8a; }
.legend-clear { background: repeating-linear-gradient(45deg, #ccc 0 2px, #fff 2px 5px); }

.knit-tools { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.knit-tools button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; cursor: pointer;
  font-size: 1.3rem; border-radius: 10px; border: 2px solid #e2d3ae; background: #fff;
}
.knit-tools b { font-size: .65rem; font-weight: 600; color: var(--ink); }
.knit-tools button.on { border-color: var(--red); background: #ffeef0; }
.knit-tools button:disabled { opacity: .4; }
.knit-h { font-size: 1rem; margin: 14px 0 6px; }
.knit-palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.knit-palette .sw {
  aspect-ratio: 1; border-radius: 8px; border: 2px solid rgba(0,0,0,.25); cursor: pointer; padding: 0;
}
.knit-palette .sw.on { outline: 3px solid var(--ink); outline-offset: 2px; transform: scale(1.06); }
.knit-palette.small .sw { border-radius: 50%; }
@media (min-width: 600px) { .knit-palette { grid-template-columns: repeat(16, 1fr); } }
.knit-models { display: flex; gap: 8px; flex-wrap: wrap; }
.knit-model { padding: 4px; border-radius: 8px; border: 2px solid #e2d3ae; background: #fff; cursor: pointer; }
.knit-model img, .knit-blank { width: 48px; height: 44px; display: block; image-rendering: pixelated; }
.knit-blank { background: repeating-linear-gradient(45deg, #eee 0 4px, #fff 4px 8px); position: relative; }
.knit-blank::after { content: "Tout\A remplir"; white-space: pre; position: absolute; inset: 0; display: grid; place-items: center; font-size: .6rem; text-align: center; color: #555; }
