:root{--cocoa:#4c2616;--dark:#24130e;--cream:#fff0c9;--gold:#e7a42b;--green:#4fad32;--red:#c64232;--blue:#2882b8}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}
html,body{margin:0;min-height:100%;background:#2b1710;color:#fff;font-family:Trebuchet MS,system-ui,sans-serif;overflow-x:hidden;overscroll-behavior:none;-webkit-user-select:none;user-select:none}
button{font:inherit;cursor:pointer}.app{width:min(100%,760px);margin:auto;min-height:100dvh;background:linear-gradient(#5e321d,#2b1710);position:relative}.screen{display:none;min-height:100dvh}.screen.active{display:flex}
.home-screen{position:relative;align-items:flex-end;justify-content:center;overflow:hidden;background:#26130d}.home-art{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center}.hotspot{position:absolute;border:0;background:transparent;border-radius:28px;z-index:3}.hotspot:focus-visible{outline:4px solid #fff;box-shadow:0 0 0 7px #41a9ff}.hotspot-play{left:25.5%;width:49%;top:75.4%;height:7.2%}.hotspot-options{left:8%;width:39%;top:85.2%;height:6.4%}.hotspot-scores{left:52%;width:40%;top:85.2%;height:6.4%}
.levels-screen,.rules-screen,.scores-screen{align-items:center;justify-content:center;padding:22px;background:linear-gradient(#3c2115cc,#24120ddd),url('assets/factory-bg.png') center/cover}.wood-panel{width:100%;background:linear-gradient(180deg,#7e4924,#4b2717);border:5px solid #d58b35;border-radius:24px;padding:20px;box-shadow:inset 0 0 0 3px #4a2514,0 18px 40px #0008}.wood-panel h1{text-align:center;margin:0;color:#ffe9ad;text-shadow:0 3px #3c1a0e;font-size:26px}.subtitle{text-align:center;color:#f0cca1;margin:8px 0 18px}.level-cards{display:grid;gap:10px}.level-card{display:grid;grid-template-columns:54px 1fr auto;align-items:center;gap:10px;border:2px solid #e2a14c;border-radius:16px;background:linear-gradient(#fff0cc,#e7bd7a);color:#4b2817;padding:10px;text-align:left;box-shadow:inset 0 2px #fff9}.level-card.locked{filter:saturate(.25);opacity:.62}.level-num{width:48px;height:48px;border-radius:50%;display:grid;place-items:center;background:#217f89;color:#fff;border:3px solid #f6c45b;font-weight:1000;font-size:22px}.level-card b{display:block;font-size:16px}.level-card small{display:block;margin-top:3px}.stars{font-size:18px;color:#c98b10}.nav-btn{width:100%;margin-top:18px;min-height:48px;border-radius:16px;background:linear-gradient(#528bb7,#2c5f86);border:3px solid #f5c15b;color:white;font-weight:1000}.rules-panel{max-width:620px}.rule{display:grid;grid-template-columns:42px 1fr;gap:11px;align-items:center;background:#f7dfae;color:#4a2818;border:2px solid #c88232;border-radius:14px;padding:10px;margin-top:10px}.rule>span{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:#e39731;color:#fff;font-weight:1000}.rule small{display:block;margin-top:3px;color:#754b31}
.game-screen{flex-direction:column;padding:0;background:#26150f}.hud{display:grid;grid-template-columns:48px repeat(3,1fr) 48px;gap:5px}.hud-item,.round-btn{border:2px solid #b8792c;background:linear-gradient(#6e3a20,#3b2117);border-radius:13px;color:#fff;box-shadow:inset 0 1px #ffffff20}.hud-item{text-align:center;padding:5px 4px;min-width:0}.hud-item span{display:block;color:#f1c989;font-size:9px;font-weight:900}.hud-item strong{font-size:15px}.round-btn{font-weight:1000;font-size:22px}.objective-strip{display:flex;justify-content:space-between;align-items:center;gap:8px;background:#f2d09b;color:#5b2d18;border:2px solid #ae6a2b;border-radius:12px;padding:7px 11px;font-weight:900;font-size:12px}.objective-strip b{color:#1e7375}.game-shell{position:relative;overflow:hidden;border-radius:18px;border:3px solid #b9792d;background:#1d120d;box-shadow:0 8px 24px #0009;flex:1;min-height:0}.game-shell:after{content:"";position:absolute;inset:0;pointer-events:none;box-shadow:inset 0 0 48px #2c110be0}canvas{display:block;width:100%;height:auto;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}.tutorial,.toast{position:absolute;z-index:3;left:12px;right:12px;border-radius:14px;text-align:center;font-weight:900;pointer-events:none}.tutorial{top:12px;background:#fff0c9ee;color:#562c18;border:3px solid #d99439;padding:10px;transition:.3s}.tutorial.hidden{opacity:0;transform:translateY(-10px)}.toast{bottom:12px;background:#3e2118e8;color:#fff0c9;border:2px solid #b8792c;padding:8px;font-size:12px;opacity:0;transition:.2s}.toast.show{opacity:1}.game-controls{display:grid;grid-template-columns:1fr 1fr;gap:7px}.small-btn{min-height:46px;border-radius:14px;background:linear-gradient(#8b4d2d,#562b1a);font-size:12px;border:3px solid #f5c15b;color:white;font-weight:1000}.small-btn.green{background:linear-gradient(#6bc84d,#338f20)}.hidden{display:none!important}
@media(max-width:460px){.app{width:100%}.levels-screen,.rules-screen,.scores-screen{padding:10px}.wood-panel{padding:14px}.wood-panel h1{font-size:21px}.hud{grid-template-columns:42px repeat(3,1fr) 42px}.hud-item strong{font-size:13px}}

.score-cards{display:grid;gap:10px}.score-card{display:grid;grid-template-columns:52px 1fr auto;gap:10px;align-items:center;background:linear-gradient(#fff0cc,#e7bd7a);color:#4b2817;border:2px solid #e2a14c;border-radius:16px;padding:10px}.score-rank{width:46px;height:46px;border-radius:50%;display:grid;place-items:center;background:#7b3f22;color:#ffe4a0;border:3px solid #f0b94f;font-weight:1000}.score-card b{display:block}.score-card small{display:block;margin-top:3px;color:#754b31}.score-value{font-weight:1000;color:#1f7777;text-align:right}.score-empty{padding:18px;border-radius:14px;background:#f7dfae;color:#5b2d18;text-align:center;border:2px dashed #c88232}.door-hint{font-weight:900}
/* V8 — briefing plein écran : aucun colis ne démarre avant fermeture. */
.tutorial{position:absolute;inset:0;z-index:20;display:grid;place-items:center;padding:22px;background:rgba(35,17,11,.88);backdrop-filter:blur(4px);pointer-events:auto;opacity:1;transform:none;border:0;border-radius:0;text-align:center;transition:.2s}
.tutorial.hidden{display:none!important;opacity:0;transform:none}
.tutorial-card{width:min(100%,560px);max-height:92%;overflow:auto;background:linear-gradient(180deg,#fff1c9,#e6b96f);color:#542a18;border:5px solid #d88b31;border-radius:26px;padding:22px 18px;box-shadow:inset 0 0 0 3px #fff4c8,0 18px 50px #0009}
.story-kicker{display:inline-block;background:#71391f;color:#ffe4a2;border:2px solid #e3a345;border-radius:999px;padding:5px 12px;font-size:12px;font-weight:1000;letter-spacing:.08em}.tutorial-card h2{margin:12px 0 8px;font-size:27px}.tutorial-card p{margin:0 auto 14px;max-width:480px;font-weight:800;line-height:1.4}.tutorial-mechanic{margin:12px 0;background:#fff8df;border:2px solid #c98231;border-radius:14px;padding:10px;font-size:13px;font-weight:900}.tutorial-close{width:100%;min-height:54px;border:3px solid #7c431e;border-radius:16px;background:linear-gradient(#67c54c,#328c28);color:white;font-weight:1000;font-size:16px;box-shadow:inset 0 2px #ffffff66}

/* V9 — décor de jeu complet : les cartouches sont peints dans l'image de fond. */
.canvas-data,.game-controls{display:none!important}
.game-shell{position:relative;overflow:hidden;border:0!important;border-radius:0!important;background:#1d120d;box-shadow:none!important;flex:1;min-height:0}
.game-shell:after{display:none!important}
#game{width:100%;height:auto;max-height:none;display:block}

.settings-block{background:#f7dfae;color:#4a2818;border:2px solid #c88232;border-radius:16px;padding:12px;margin:12px 0 16px}.settings-block label{display:block}.settings-block small{display:block;margin-top:4px;color:#754b31}.settings-block select{width:100%;margin-top:10px;min-height:46px;border:2px solid #b8792c;border-radius:12px;background:#fff7df;color:#4b2817;padding:8px 10px;font-weight:900;font-size:16px}.difficulty-hint{margin-top:8px;color:#1f7777;font-weight:900;font-size:12px}.rules-title{text-align:center;color:#ffe9ad;text-shadow:0 2px #3c1a0e;font-size:20px;margin:14px 0 8px}

/* V10.4 — écran de jeu plein format : le décor et le canvas occupent toute la hauteur disponible. */
.game-screen.active{display:flex;height:100dvh;min-height:100dvh;overflow:hidden}
.game-shell{width:100%;height:100dvh;min-height:100dvh;flex:1 1 auto}
#game{display:block;width:100%;height:100%;max-height:none;object-fit:fill}


/* V12 — refonte graphique uniquement. Gameplay inchangé. */
:root{--cocoa:#512715;--cocoa2:#2a130d;--cream:#fff0c2;--gold:#efb23d;--teal:#197d7e;--teal2:#63c1b7;--rasp:#d94e79}
.app{background:#1f0f0a}
.version-badge{position:absolute;right:14px;bottom:12px;z-index:5;padding:5px 10px;border-radius:999px;background:#3b1b12cc;border:2px solid #efb23d;color:#fff2bd;font-weight:1000;font-size:12px;box-shadow:0 4px 12px #0008}
.levels-screen,.rules-screen,.scores-screen{background:linear-gradient(#2b150dc9,#140906e8),url('assets/factory-bg.png') center/cover}
.wood-panel{background:linear-gradient(180deg,#6f321c 0%,#4b2416 45%,#2f1710 100%);border:4px solid #e9ad3e;box-shadow:inset 0 0 0 2px #2b130b,inset 0 10px 20px #ffffff12,0 18px 45px #000a;position:relative;overflow:hidden}
.wood-panel:before{content:"";position:absolute;left:-20px;right:-20px;top:-12px;height:28px;background:linear-gradient(#6a2c1d,#3d1a12);border-bottom:3px solid #c57928;box-shadow:0 5px 10px #0007}
.wood-panel h1{position:relative;font-size:28px;letter-spacing:.04em;color:#fff0bc;text-shadow:0 3px 0 #3b170d,0 0 14px #d98a2d55}
.subtitle{position:relative;color:#e7c08d}
.level-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.level-card{grid-template-columns:52px 1fr;grid-template-areas:"num title" "num stars";gap:4px 10px;min-height:86px;background:linear-gradient(145deg,#fff2cb 0%,#f0c17d 65%,#d99b49 100%);border:3px solid #7a3b1d;box-shadow:inset 0 0 0 2px #ffecc1,0 5px 0 #5a2a18,0 10px 18px #0005;transform:translateY(0);transition:transform .12s,filter .12s}
.level-card:not(.locked):active{transform:translateY(3px);box-shadow:inset 0 0 0 2px #ffecc1,0 2px 0 #5a2a18,0 5px 10px #0005}
.level-num{grid-area:num;background:radial-gradient(circle at 35% 30%,#3fb3b0,#167175 70%);border:3px solid #ffd267;box-shadow:inset 0 0 0 2px #0c4a4d,0 3px 0 #5c2a18}
.level-card>span:nth-child(2){grid-area:title;min-width:0}.level-card .stars{grid-area:stars;justify-self:start;letter-spacing:1px;text-shadow:0 1px #fff7}
.level-card b{font-size:15px}.level-card small{font-size:11px;line-height:1.2}
.nav-btn,.tutorial-close{background:linear-gradient(#75d656,#3b9d2b);border:3px solid #7c3d1e;box-shadow:inset 0 2px #ffffff66,0 4px 0 #4e2415;color:#fff8db;text-shadow:0 2px #2c651e}
.rule,.settings-block,.score-card{background:linear-gradient(#fff3ce,#e9bd79);border:3px solid #7a3b1d;box-shadow:inset 0 0 0 2px #fff4d0}
.rule>span,.score-rank{background:radial-gradient(circle at 35% 30%,#e4638e,#a92f58 70%);border-color:#ffd06a}
.tutorial{background:rgba(27,8,7,.9);backdrop-filter:blur(7px)}
.tutorial-card{background:linear-gradient(#fff4cb 0%,#efc177 72%,#d99b4f 100%);border:5px solid #6f341c;box-shadow:inset 0 0 0 3px #ffeab6,0 0 0 7px #e4a13d,0 24px 70px #000c}
.story-kicker{background:linear-gradient(#8a3a57,#5c2035);border-color:#f1b35e;color:#ffe8a7}
.tutorial-mechanic{background:#4b2417;color:#ffe8b3;border:2px solid #e3a345;box-shadow:inset 0 0 18px #0005}
.toast{left:50%;right:auto;transform:translateX(-50%);width:min(86%,520px);bottom:30px;background:#32160fe8;border:3px solid #e8a63c;color:#fff2c6;box-shadow:0 8px 24px #0009}
@media(max-width:560px){.level-cards{grid-template-columns:1fr}.level-card{min-height:78px}}
