*{box-sizing:border-box}body{margin:0;background:#21130e;color:#fff1d0;font-family:Georgia,serif}.game{display:grid;grid-template-columns:minmax(250px,26%) minmax(300px,44%) minmax(320px,30%);min-height:100vh}button{font:inherit;cursor:pointer}button:focus-visible{outline:3px solid #fff;outline-offset:2px}.click-panel,.store{background:repeating-linear-gradient(0deg,#4e2718 0,#5a3020 30px,#3d2015 32px);padding:16px;border:5px ridge #9f6c35}.click-panel{text-align:center}h1,h2{color:#4c2613;background:#f5d99a;border:4px ridge #b27a36;text-align:center;text-shadow:0 1px #fff2c8}h1{font-size:clamp(21px,2vw,31px);padding:15px 5px;margin:0 0 20px}h2{font-size:21px;margin:4px 0 12px;padding:7px}.counter{background:#28160f;border:3px ridge #b27a36;padding:12px}.counter strong,.counter span{display:block}.counter strong{font-size:clamp(24px,2.4vw,38px);color:#ffdd8a}.counter span{color:#aeea72;font-weight:bold}#quest{width:min(100%,420px);padding:0;border:0;background:none;margin-top:20px;transition:transform .1s}#quest:active{transform:scale(.94)}#quest img{width:100%;border-radius:50%;display:block}.motto{font-weight:bold;line-height:1.5;color:#f5d995}.center{min-width:0;display:flex;flex-direction:column;border-right:4px ridge #a16a30}.toolbar{background:#45271c;display:flex;gap:8px;padding:8px}.toolbar button,dialog button{background:#603a24;color:#fff0ce;border:2px solid #d4aa5c;padding:8px 12px}.news{background:#f7e0aa;color:#4a2817;border:4px ridge #b27a36;padding:12px}.news strong{font-size:20px}.news p{margin:5px 0}.scene{position:relative;flex:1;min-height:500px;background:linear-gradient(transparent 60%,#29140cbb),url('visuels/decoupage/scene-guilde.png') center top/cover}.scene-caption{position:absolute;bottom:20px;left:20px;right:20px;text-shadow:0 2px 4px #000;display:flex;flex-direction:column;gap:5px}.scene-caption strong{font-size:24px}.store{overflow:auto}.upgrades{display:grid;grid-template-columns:repeat(5,1fr);gap:5px;margin-bottom:20px}.upgrade{position:relative;padding:0;background:#332016;border:2px solid #d9a34a;aspect-ratio:1}.upgrade img{width:100%;height:100%;object-fit:cover}.upgrade:disabled{filter:grayscale(.85);opacity:.5;cursor:not-allowed}.upgrade .price{position:absolute;bottom:0;left:0;right:0;background:#1f130ddd;font: bold 10px sans-serif;color:#ffe8ac}.hint{font-size:13px;color:#f0d39d}.hero{display:grid;grid-template-columns:58px 1fr auto;align-items:center;gap:8px;width:100%;text-align:left;margin:7px 0;padding:4px;background:#f3d6a1;color:#4a2514;border:3px ridge #a7763e}.hero img{width:58px;height:58px;object-fit:cover}.hero strong,.hero small{display:block}.hero small{color:#2f681e}.hero .amount{font-size:20px;font-weight:bold}.hero:disabled{filter:grayscale(.7);opacity:.65;cursor:not-allowed}.hero .cost{color:#6a380b}.empty{font-size:14px;color:#f0d39d;grid-column:1/-1}dialog{background:#f5dfa9;color:#432416;border:5px ridge #a26b31;max-width:440px}dialog::backdrop{background:#000b}#status{position:fixed;bottom:8px;left:10px;background:#26160ce8;padding:5px;color:#ffe9b6;font-size:12px;pointer-events:none}#status:empty{display:none}@media(max-width:850px){.game{display:flex;flex-direction:column}.click-panel{padding:12px}#quest{width:min(65vw,280px);margin:10px auto 0}.motto{display:none}.scene{min-height:320px}.store{overflow:visible}.upgrades{grid-template-columns:repeat(5,minmax(0,70px));justify-content:center}.center{border-right:0}.hero{min-height:70px}}

.upgrade[aria-disabled="true"]:not(.purchased){filter:grayscale(.85);opacity:.5;cursor:not-allowed}.upgrade.purchased{filter:none;opacity:1;border-color:#8dd860;cursor:default}.upgrade:hover::after,.upgrade:focus-visible::after{content:attr(data-tooltip);position:absolute;z-index:10;right:0;top:calc(100% + 6px);width:max-content;max-width:240px;white-space:normal;background:#24170f;color:#fff1d0;border:2px solid #d9a34a;padding:9px;font:14px/1.35 Georgia,serif;text-align:left;box-shadow:0 4px 10px #0009}.upgrade:hover,.upgrade:focus-visible{z-index:5}

dialog:has(.trophy-section){width:min(900px,95vw);max-width:900px;max-height:85vh}.trophy-section{margin:20px 0}.trophy-section h3{display:flex;align-items:center;gap:10px;border-bottom:2px solid #a36b32;padding-bottom:6px}.trophy-section h3 img{width:46px;height:46px;object-fit:cover;border:2px solid #a36b32}.trophy-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:8px}.trophy{background:#fff2d4;border:2px solid #c7a46d;padding:10px;display:flex;flex-direction:column;gap:5px}.trophy small{line-height:1.3}.trophy span{font-size:12px}.trophy.locked{background:#c9bba3;color:#564e43}.trophy.won{border-color:#a57118}.toolbar{flex-wrap:wrap}

/* La boutique garde ses infobulles au-dessus de la scène et dans sa largeur. */
.game > .store{position:relative;z-index:2;min-width:0;overflow-x:clip;overflow-y:visible}
.upgrades{grid-template-columns:repeat(5,minmax(0,1fr));min-width:0}
.upgrade{min-width:0}
.upgrade:hover::after,.upgrade:focus-visible::after{position:fixed;left:auto;right:12px;top:70px;bottom:auto;width:min(280px,calc(100vw - 24px));max-width:none;overflow-wrap:anywhere}
@media(max-width:850px){.game > .store{overflow:visible}.upgrades{grid-template-columns:repeat(5,minmax(0,70px))}.upgrade:hover::after,.upgrade:focus-visible::after{top:auto;bottom:12px}}

/* Infobulle hors des panneaux pour éviter leur découpage et leurs superpositions. */
.upgrade:hover::after,.upgrade:focus-visible::after{content:none}
.upgrade[aria-disabled="true"]:not(.purchased){cursor:not-allowed}
.upgrade[aria-disabled="true"]:not(.purchased) .price{color:#ffd696}
#upgrade-tooltip{position:fixed;z-index:9999;max-width:min(280px,calc(100vw - 16px));background:#24170f;color:#fff1d0;border:2px solid #d9a34a;padding:9px;font:14px/1.35 Georgia,serif;text-align:left;box-shadow:0 4px 10px #0009;pointer-events:none;overflow-wrap:anywhere}
#upgrade-tooltip[hidden]{display:none}
/* Les améliorations non achetées sont grisées ; l’infobulle reste séparée. */
.upgrade:not(.purchased),.upgrade[aria-disabled="true"]:not(.purchased){filter:grayscale(1);opacity:.6}

#trophy-notifications{position:absolute;z-index:4;inset:0;overflow:hidden;pointer-events:none}.trophy-popup{position:absolute;left:50%;bottom:12%;transform:translate(-50%,35px);display:flex;align-items:center;gap:10px;width:max-content;max-width:90%;padding:10px 15px;background:#2b190feb;border:2px solid #e1b35b;box-shadow:0 5px 18px #0009;color:#ffe8b3;animation:trophy-rise 4s ease-out forwards}.trophy-popup img{width:48px;height:48px;object-fit:cover;border:1px solid #d9a34a}.trophy-popup small,.trophy-popup strong{display:block}.trophy-popup small{color:#e8c675;margin-bottom:3px}.trophy-popup strong{font-size:16px}@keyframes trophy-rise{0%{opacity:0;transform:translate(-50%,35px)}15%{opacity:1}75%{opacity:1}100%{opacity:0;transform:translate(-50%,-100px)}}@media(prefers-reduced-motion:reduce){.trophy-popup{animation:trophy-fade 4s ease forwards}@keyframes trophy-fade{0%,85%{opacity:1}100%{opacity:0}}}
#trophy-notifications{display:flex;flex-direction:column-reverse;align-items:center;justify-content:flex-start;padding:0 10px 12%;gap:8px}.trophy-popup{position:relative;left:auto;bottom:auto;flex-shrink:0;transform:translateY(35px);animation-name:trophy-rise-stack}@keyframes trophy-rise-stack{0%{opacity:0;transform:translateY(35px)}15%{opacity:1}75%{opacity:1}100%{opacity:0;transform:translateY(-100px)}}@media(prefers-reduced-motion:reduce){.trophy-popup{animation-name:trophy-fade;transform:none}}

.trophy-icon{width:42px;height:42px;display:grid;place-items:center;background:#4b3827;color:#f2deb3;border:2px solid #aa854b;font:bold 26px Georgia,serif}.trophy-icon img{width:100%;height:100%;object-fit:cover}

.settings-label{font-weight:bold;margin:16px 0 8px;color:#56351f}.language-buttons{display:flex;gap:10px;justify-content:center;margin:12px 0 22px}.language-button{min-width:90px;display:flex;flex-direction:column;align-items:center;gap:4px;padding:9px 13px;background:#6b4024;color:#fff1cf;border:3px ridge #b88848}.language-button span{font-size:30px;line-height:1.2}.language-button small{font-size:12px}.language-button:hover{background:#85542d}.language-button.selected{background:#8a5926;border-color:#e8bc5b;box-shadow:0 0 0 2px #684015,inset 0 0 0 1px #f8d78a}.language-button:focus-visible{outline:3px solid #59340f;outline-offset:2px}
/* Les traductions restent contenues dans les panneaux et les boutons. */
.game{grid-template-columns:minmax(0,26fr) minmax(0,44fr) minmax(0,30fr);width:100%;max-width:100%;overflow-x:clip}
.click-panel,.center,.store,.toolbar,.news,.counter,.scene-caption{min-width:0}
.click-panel h1,.counter strong,.counter span,.news,.scene-caption,.hero strong,.hero small,.hero .cost,.trophy,.language-button{overflow-wrap:anywhere}
.toolbar{align-content:flex-start}.toolbar button{min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
.hero{grid-template-columns:58px minmax(0,1fr) auto}.hero>span{min-width:0}.hero .amount{white-space:nowrap}
.counter strong{font-size:clamp(20px,2.1vw,34px)}.counter span{font-size:clamp(12px,1.05vw,16px)}
@media(max-width:850px){.game{display:flex}.toolbar button{flex:1 1 auto}.hero{grid-template-columns:58px minmax(0,1fr) auto}}
/* Réserver la même place aux libellés quelle que soit la langue. */
html{scrollbar-gutter:stable}
.click-panel h1{height:100px;display:flex;align-items:center;justify-content:center;font-size:clamp(19px,1.8vw,27px);line-height:1.2}
.counter{min-height:90px;display:flex;flex-direction:column;justify-content:center}
.toolbar{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));align-items:stretch;gap:4px}
.toolbar button{min-height:54px;padding:5px 3px;font-size:clamp(11px,.95vw,15px);line-height:1.2}
.news{min-height:105px}.store h2{min-height:52px;display:flex;align-items:center;justify-content:center;line-height:1.2}
.hint{min-height:38px}.hero{min-height:88px}.hero strong,.hero small,.hero .cost{line-height:1.25}
dialog:has(.language-buttons){width:min(440px,calc(100vw - 32px))}.language-button{width:100px;min-width:0}
@media(max-width:850px){.click-panel h1{height:80px}.toolbar{grid-template-columns:repeat(2,minmax(0,1fr))}.toolbar button{font-size:14px;min-height:45px}.news{min-height:105px}}
/* Sur ordinateur, seul le contenu des panneaux défile. */
@media (min-width:851px){
 html,body{height:100%;overflow:hidden}
 .game{height:100dvh;min-height:0;overflow:hidden}
 .click-panel,.store{min-height:0;overflow-x:hidden;overflow-y:auto}
 .center{height:100%;min-height:0;overflow:hidden}
 .scene{min-height:0}
}
@media (min-width:851px){
 .store{display:flex;flex-direction:column;overflow:hidden}
 .store h2,.store .hint,.upgrades{flex-shrink:0}
 #heroes{min-height:0;flex:1;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;padding-right:4px}
}

@media (min-width:851px){.upgrades{flex:0 1 auto;min-height:80px;max-height:38%;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;align-content:start;padding-right:4px}.store h2,.store .hint{flex-shrink:0}#heroes{flex:1 1 0;min-height:100px}}
@media (max-width:850px){.upgrades{max-height:260px;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;align-content:start}}
.save-tools{border-top:2px solid #b88848;padding-top:2px}.save-actions{display:flex;gap:8px;flex-wrap:wrap}.save-actions button{flex:1 1 140px}.save-actions button:hover{background:#85542d}#settings-message{min-height:1.4em;font-size:14px;line-height:1.4;color:#56351f}

.upgrade-art{display:block;width:100%;height:100%;background-image:url("visuels/ameliorations/atlas-nouvelles-familles.png");background-size:300% 300%;background-repeat:no-repeat}

.recruit-quantity{display:flex;gap:4px;margin:4px 0 8px}.recruit-quantity button{flex:1;min-width:0;padding:4px 2px;background:#603a24;color:#fff0ce;border:2px solid #a7763e}.recruit-quantity button[aria-pressed="true"]{background:#e1b65c;color:#422413;border-color:#ffe5a0}
