@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');
:root{--forest:#183d33;--deep:#122e28;--pine:#275246;--red:#ac554e;--cream:#faf8f3;--white:#fff;--ink:#263530;--muted:#7a827d;--line:#e7e8e1;--surface:#f2f5f0;--gold:#dfc694;--shadow:0 16px 50px rgba(23,47,35,.08)}
*{box-sizing:border-box}
body{margin:0;background:var(--cream);font-family:'DM Sans',system-ui,sans-serif;color:var(--ink)}
button,input,textarea{font:inherit}
button{cursor:pointer}
button:disabled{opacity:.55;cursor:not-allowed}
.app-shell{min-height:100vh;display:flex;flex-direction:column}
.topbar{height:76px;background:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 max(24px,calc((100vw - 1040px)/2));border-bottom:1px solid var(--line)}
.brand{font-weight:800;font-size:22px;letter-spacing:-1px;display:flex;align-items:center;gap:9px;cursor:pointer}
.brand-icon{display:grid;place-items:center;background:var(--forest);color:var(--gold);height:36px;width:36px;border-radius:12px;font-size:25px}
.brand-accent{color:var(--red)}
.top-right{display:flex;align-items:center;gap:12px}
.mode-tag{color:#7b817a;background:#f4f4f0;padding:7px 10px;border-radius:20px;font-size:11px}
.icon-btn{border:1px solid var(--line);width:32px;height:32px;border-radius:50%;background:white;color:var(--forest);font-weight:bold}
.main{max-width:1010px;width:100%;padding:30px 24px 66px;margin:auto;flex:1}
.hero{background:var(--forest);border-radius:25px;padding:42px;position:relative;overflow:hidden;color:white;display:flex;align-items:center;justify-content:space-between;gap:20px}
.hero:before{content:'✦';font-size:200px;color:rgba(255,255,255,.055);position:absolute;right:100px;top:-90px}
.hero:after{content:'✳';font-size:190px;color:rgba(255,255,255,.055);position:absolute;right:-28px;bottom:-130px}
.eyebrow{font-size:11px;text-transform:uppercase;letter-spacing:2.5px;font-weight:700;color:var(--gold)}
h1,h2,h3{margin:0}
h1{font-family:'Playfair Display',Georgia,serif;line-height:1.15;font-size:clamp(31px,4.5vw,48px);margin:14px 0}
.hero p{color:#d5e3db;line-height:1.7;font-size:15px;max-width:440px;margin:0}
.hero-art{font-size:105px;transform:rotate(-11deg);z-index:1;text-shadow:0 9px 0 rgba(0,0,0,.09)}
.section-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin:33px 0 19px}
.section-head h2{font-family:'Playfair Display',Georgia,serif;font-size:29px}
.section-head small{font-size:13px;color:var(--muted);display:block;margin-top:5px}
.btn{border:0;border-radius:11px;padding:13px 18px;font-size:14px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;gap:8px;white-space:nowrap}
.btn.primary{background:var(--forest);color:white}
.btn.primary:hover{background:var(--pine)}
.btn.secondary{background:#f0f2ed;color:var(--forest)}
.btn.subtle{background:white;color:var(--forest);border:1px solid var(--line)}
.btn.danger{background:#fff0ec;color:#9c3432}
.btn.big{padding:15px 18px}
.participant-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px}
.person-card{border:1px solid var(--line);border-radius:18px;padding:20px;background:white;box-shadow:0 3px 16px rgba(0,0,0,.015);text-align:left;display:flex;align-items:center;gap:13px;width:100%;transition:transform .15s,border-color .15s,box-shadow .15s}
.person-card:hover{transform:translateY(-2px);border-color:#aec1b6;box-shadow:0 10px 24px rgba(24,61,51,.06)}
.avatar{width:50px;height:50px;display:grid;place-items:center;flex-shrink:0;border-radius:16px;color:var(--forest);background:#e8f0e7;font-family:'Playfair Display',serif;font-weight:700;font-size:23px}
.avatar.v1{background:#f8e8e1;color:#9b574b}
.avatar.v2{background:#efe9f5;color:#725c85}
.avatar.v3{background:#f8f1dc;color:#917a39}
.person-info{min-width:0;flex:1}
.person-name{font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:16px}
.person-count{color:var(--muted);font-size:12px;margin-top:6px}
.chevron{font-size:25px;color:#a2ada6}
.add-card{display:flex;align-items:center;justify-content:center;gap:9px;background:transparent;border:2px dashed #c7d2c7;color:var(--pine);font-weight:700;min-height:91px}
.info-strip{margin-top:31px;background:#f0f3ed;padding:17px 20px;display:flex;gap:12px;border-radius:14px;font-size:13px;line-height:1.7;color:#64756c}
.info-strip strong{color:var(--forest)}
.back{border:0;background:none;color:#68776d;padding:0;margin-bottom:19px;font-size:14px;font-weight:700;display:flex;gap:8px;align-items:center}
.profile-intro{display:flex;align-items:center;gap:16px;margin-bottom:20px}
.profile-intro .avatar{width:68px;height:68px;font-size:32px;border-radius:20px}
.profile-intro h1{margin:4px 0 4px;font-size:40px}
.profile-intro p{color:var(--muted);font-size:15px;margin:0}
.profile-actions{display:flex;gap:9px;flex-wrap:wrap;margin-left:auto}
.gift-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}
.gift-card{border:1px solid var(--line);border-radius:18px;background:white;overflow:hidden;display:flex;flex-direction:column;min-width:0;transition:transform .18s,box-shadow .18s,border-color .18s}
.gift-card:hover{transform:translateY(-3px);box-shadow:0 14px 32px rgba(24,61,51,.08);border-color:#d7ddd6}
.gift-photo{height:200px;background:linear-gradient(135deg,#eef2eb,#f8eae1);display:grid;place-items:center;font-size:53px;position:relative}
button.gift-photo{border:0;padding:0;width:100%;cursor:zoom-in}
.gift-photo img{width:100%;height:100%;object-fit:cover;transition:transform .22s ease}
.gift-photo.zoomable:hover img{transform:scale(1.04)}
.gift-photo-hint{position:absolute;right:10px;bottom:10px;background:rgba(24,61,51,.78);color:white;font-size:12px;font-weight:700;padding:7px 10px;border-radius:999px;opacity:0;transform:translateY(6px);transition:opacity .18s,transform .18s;pointer-events:none}
.gift-photo.zoomable:hover .gift-photo-hint,.gift-photo.zoomable:focus-visible .gift-photo-hint{opacity:1;transform:translateY(0)}
.gift-photo-fallback{background:linear-gradient(135deg,#eef2eb,#f8eae1)}
.gift-photo-emoji{font-size:56px}
.gift-content{padding:18px;display:flex;flex-direction:column;gap:10px;flex:1}
.gift-main{display:flex;flex-direction:column;gap:6px}
.gift-title{font-size:18px;font-weight:700;line-height:1.3;overflow-wrap:anywhere}
.gift-description{font-size:14px;color:#5f6e66;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}
.gift-price{font-weight:800;color:var(--red);font-size:17px}
.gift-link-wrap{display:flex;align-items:flex-start;gap:6px;flex-wrap:wrap;padding:10px 12px;background:#f5f7f3;border-radius:12px}
.gift-link-label{font-size:13px;font-weight:700;color:#66756d}
.gift-link{font-size:13px;font-weight:700;color:var(--pine);text-decoration:none;overflow-wrap:anywhere;word-break:break-word}
.gift-actions{display:flex;gap:8px;margin-top:auto;padding-top:12px}
.gift-actions button{background:#f3f4f0;border:0;border-radius:9px;padding:10px 12px;color:var(--pine);font-size:13px;font-weight:700}
.gift-actions .remove{color:#a34b45}
.empty{padding:55px 20px;border:1px dashed #cbd5ca;border-radius:20px;text-align:center;color:var(--muted);background:#fff}
.empty .emoji{font-size:57px;margin-bottom:12px}
.empty h3{font-size:18px;color:var(--forest);margin-bottom:8px}
.empty p{font-size:14px;margin-bottom:23px}
.search{border:1px solid var(--line);padding:12px 14px;border-radius:11px;background:white;min-width:210px;width:260px;outline:none;font-size:14px}
footer{text-align:center;font-size:12px;color:#97a099;padding:22px 15px;border-top:1px solid var(--line)}
dialog{border:none;border-radius:19px;width:min(470px,calc(100% - 22px));padding:0;box-shadow:0 20px 80px #142f2660;max-height:calc(100dvh - 25px)}
dialog::backdrop{background:rgba(10,35,27,.58)}
.dialog-form{padding:25px;overflow-y:auto;max-height:calc(100dvh - 25px)}
.dialog-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}
.dialog-header h2{font-family:'Playfair Display',serif;font-size:24px}
.close-btn{border:0;background:none;color:#7b817c;font-size:27px}
.field{display:flex;flex-direction:column;gap:7px;margin-bottom:16px}
.field label{font-size:13px;font-weight:700;color:#40534a}
.field input,.field textarea{width:100%;border-radius:10px;padding:13px 14px;border:1px solid #dce3db;outline-color:var(--forest);background:white;color:var(--ink);font-size:15px}
.field textarea{resize:vertical;min-height:90px}
.hint{font-size:12px;color:#89938c;line-height:1.5}
.form-error{color:#ae3434;font-size:13px;min-height:15px}
.dialog-actions{display:flex;justify-content:flex-end;gap:8px}
.toast{position:fixed;bottom:23px;left:50%;transform:translate(-50%,150px);background:var(--deep);color:white;padding:13px 20px;border-radius:12px;box-shadow:var(--shadow);font-size:13px;transition:transform .2s;z-index:5;max-width:90vw;text-align:center}
.toast.show{transform:translate(-50%,0)}
.notice{color:#775e33;background:#fff4d8;padding:11px 14px;border-radius:10px;font-size:12px;margin:0 0 20px}
.settings{line-height:1.75;font-size:13px}
.settings code{background:#f0f3ed;padding:2px 4px;border-radius:4px}
a{color:var(--pine)}
.login-panel{max-width:520px;margin:0 auto 40px;padding:28px;border:1px solid #e9ded1;border-radius:22px;background:#fffdf8;box-shadow:0 10px 35px rgba(20,40,25,.06)}
.login-panel h2{margin:0 0 8px}
.login-panel p{color:#66736c;line-height:1.6}
.login-panel .btn{width:100%;justify-content:center}
.login-panel .field{margin:20px 0 12px}
.image-viewer{width:min(980px,calc(100% - 18px));background:transparent;box-shadow:none}
.image-viewer-shell{position:relative;background:#0f1f1b;border-radius:20px;padding:16px;display:flex;flex-direction:column;gap:10px}
.image-viewer img{width:100%;max-height:78dvh;object-fit:contain;border-radius:14px;background:#182b25}
.image-viewer-close{position:absolute;right:12px;top:10px;color:white;background:rgba(255,255,255,.12);border-radius:999px;width:40px;height:40px;display:grid;place-items:center;font-size:26px;line-height:1}
.image-viewer-caption{margin:0;color:#ecf2ef;font-size:14px;text-align:center}
@media(max-width:900px){.gift-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.participant-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:760px){.hero{padding:29px 27px}.hero-art{font-size:74px}.topbar{padding:0 18px}.main{padding:21px 16px 50px}.profile-actions{margin-left:0;width:100%}.profile-intro{flex-wrap:wrap}.profile-actions .btn{flex:1}.gift-photo{height:170px}.profile-intro h1{font-size:34px}}
@media(max-width:620px){.participant-grid,.gift-grid{grid-template-columns:1fr}.gift-card{max-width:100%}.gift-photo{height:210px}}
@media(max-width:490px){.mode-tag{font-size:10px;padding:6px 8px}.brand{font-size:20px}.hero{padding:28px 23px}.hero-art{display:none}.hero h1{font-size:36px}.person-card{padding:14px 16px;min-height:83px}.gift-content{padding:14px}.gift-title{font-size:17px}.gift-price{font-size:16px}.gift-description,.gift-link,.gift-link-label{font-size:14px}.gift-actions{gap:6px;flex-wrap:wrap}.gift-actions button{padding:9px 10px;font-size:12px;flex:1}.section-head{align-items:flex-start;flex-direction:column}.section-head h2{font-size:25px}.search{min-width:0;width:100%}.profile-intro h1{font-size:29px}.profile-intro .avatar{width:56px;height:56px}.dialog-form{padding:20px}.field input,.field textarea{font-size:16px}}

/* V4 : retirer une photo pendant la saisie */
.photo-clear{align-self:flex-start;white-space:normal;padding:9px 12px;font-size:13px}
.photo-clear[hidden]{display:none}
.photo-existing{background:#f2f5f0;border-radius:12px;padding:13px 14px;margin-bottom:16px;display:flex;flex-direction:column;gap:8px;font-size:13px}
.photo-existing>span{color:#52675b;font-weight:700}
.remove-image{display:flex;gap:9px;align-items:center;cursor:pointer;font-size:14px}
.remove-image input{width:18px;height:18px;accent-color:#ac554e}

/* V5 : cartes compactes, photos non rognées, commandes accessibles */
.gift-grid{align-items:start;gap:18px}
.gift-card{height:auto;align-self:start}
.gift-content{flex:0 0 auto;gap:12px}
.gift-actions{margin-top:3px;padding-top:5px}
.gift-photo{height:205px;background:#f4f3ef;overflow:hidden}
.gift-photo img{object-fit:contain;object-position:center;transition:transform .22s ease}
.gift-photo.zoomable:hover img{transform:scale(1.045)}
.gift-shop-button{display:flex;align-items:center;justify-content:center;min-height:44px;padding:11px 13px;border-radius:11px;background:#e8f0eb;color:var(--forest);font-size:14px;font-weight:700;text-align:center;text-decoration:none;line-height:1.3;border:1px solid #d6e3db;transition:background .15s ease}
.gift-shop-button:hover,.gift-shop-button:focus-visible{background:#dceae1;text-decoration:underline}
.gift-add-card{border:2px dashed #bacdc0;border-radius:18px;background:#f6f8f3;min-height:205px;padding:22px;color:var(--forest);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:13px;text-align:center;transition:background .15s,border-color .15s}
.gift-add-card:hover{background:#edf3eb;border-color:#779e89}
.gift-add-icon{display:grid;place-items:center;border-radius:50%;background:#d9e8dc;width:50px;height:50px;font-size:27px}
.gift-add-card strong{font-size:16px}
.gift-add-card>span:last-child{font-size:13px;color:#60766b;line-height:1.4}
.gifts-header{align-items:flex-end}
.list-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.sort-label{display:flex;align-items:center;gap:9px;color:#65786d;font-size:13px;font-weight:700}
.sort-select{border:1px solid #dce3db;border-radius:11px;padding:11px 12px;background:#fff;color:var(--forest);font-size:14px;min-height:43px}
.participant-settings{margin-top:36px;border-top:1px solid var(--line);padding-top:16px;color:#748177;font-size:13px;max-width:420px}
.participant-settings summary{cursor:pointer;font-weight:700;font-size:13px;list-style:revert;color:#60776a}
.participant-settings p{line-height:1.5}
.participant-settings .btn{white-space:normal;text-align:center}
@media(max-width:760px){.gift-photo{height:190px}.list-tools{justify-content:flex-start}}
@media(max-width:620px){.gift-photo{height:220px}.gift-add-card{min-height:125px}.gifts-header{align-items:stretch}.list-tools{width:100%;justify-content:stretch;flex-direction:column;align-items:stretch}.sort-label{justify-content:space-between}.sort-select{flex:1}}
@media(max-width:490px){.gift-content{padding:15px}.gift-shop-button{font-size:14px}}
