/* M08: touch-first presentation; desktop keeps style.css and the same controls. */
.rotation-screen{display:none}
#objectiveNotice{position:absolute;z-index:5;top:58px;left:50%;transform:translateX(-50%);max-width:min(480px,70%);padding:9px 15px;background:#142e32ed;border:1px solid #d8bb7b;border-radius:20px;color:#fff0c9;text-align:center;font-size:13px;pointer-events:none}
.mobile-game{--safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px);height:100%;overflow:hidden;overscroll-behavior:none;background:#10242f}
.mobile-game body{position:fixed;inset:0;width:100%;height:100%;overflow:hidden;background:#10242f;overscroll-behavior:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.mobile-game #app,.mobile-game main{width:100%;max-width:none;height:100%;margin:0;padding:0}
.mobile-game .masthead,.mobile-game footer,.mobile-game .lower,.mobile-game .world-status,.mobile-game .floating-info{display:none}
.mobile-game .frame{position:relative;width:100%;height:100vh;height:100dvh;aspect-ratio:auto;border:0;border-radius:0;box-shadow:none;overflow:hidden}
.mobile-game #game{width:100%;height:100%;touch-action:none;object-fit:fill}
.mobile-game .gamehud{top:calc(var(--safe-top) + 8px);left:calc(var(--safe-left) + 12px);right:calc(var(--safe-right) + 12px);gap:7px;align-items:center;z-index:4}
.mobile-game .hudpiece{min-width:0;padding:6px 10px;font-size:15px;border:1px solid #c9b27777;border-radius:18px;background:#142b32d9;box-shadow:none;display:block;max-width:58%;line-height:1.2}
.mobile-game .hudtitle{display:none}
.mobile-game #money:before{content:'✦ ';color:#f2ce77}
.mobile-game #hearts{font-size:15px;overflow-wrap:anywhere}
.mobile-game .hudbutton{width:46px;height:44px;padding:0;border-radius:14px;font-size:24px;background:#142b32dd;box-shadow:none}
.mobile-game .controls{position:absolute;inset:0;z-index:6;display:block;margin:0;padding:0;min-height:0;background:none;border:0;border-radius:0;pointer-events:none;touch-action:none}
.mobile-game .controls button{pointer-events:auto;touch-action:none;-webkit-tap-highlight-color:transparent}
.mobile-game .dpad{position:absolute;left:calc(var(--safe-left) + 16px);bottom:calc(var(--safe-bottom) + 12px);width:156px;height:156px;margin:0;transform:none;display:grid;grid-template:repeat(3,50px)/repeat(3,50px);gap:3px;filter:drop-shadow(0 2px 4px #061b2180)}
.mobile-game .dpad:before{content:'';grid-area:2/2;background:#152d33a8;border-radius:50%}
.mobile-game .dpad button{position:static;width:50px;height:50px;border-radius:16px;border:1px solid #e3d8b991;background:#1b393fba;box-shadow:none;color:#fff0ca;font-size:22px}
.mobile-game .dpad [data-dir=up]{grid-area:1/2}.mobile-game .dpad [data-dir=left]{grid-area:2/1}.mobile-game .dpad [data-dir=down]{grid-area:3/2}.mobile-game .dpad [data-dir=right]{grid-area:2/3}
.mobile-game .actionkeys{position:absolute;right:calc(var(--safe-right) + 16px);bottom:calc(var(--safe-bottom) + 16px);display:grid;grid-template-columns:64px 90px;grid-template-rows:60px 76px;gap:8px;align-items:end}
.mobile-game .action{box-shadow:none;width:64px;height:60px;border-radius:22px;border:1px solid #e8d6a5b0;font-size:12px;letter-spacing:0;text-shadow:0 1px 2px #001b26;background:#934a3cc7}
.mobile-game .action small{display:none}
.mobile-game .interact{grid-area:2/2;width:90px;height:76px;background:#31775ed9;border-radius:30px;font-size:12px}
.mobile-game .bite{grid-area:2/1}
.mobile-game .magic{grid-area:1/2;justify-self:end;background:#445c9bd6;font-size:11px}
.mobile-game .magic small{display:block;font-size:12px;margin:2px 0 0;opacity:1}
.mobile-game .magic[data-unlocked="false"]{display:none}
.mobile-game .magic[data-cooling="true"]{background:#263b5fcd;border-color:#9ea9bd;opacity:.75}
.mobile-game .dpad button:active,.mobile-game .action:active{transform:scale(.96);background-color:#55766fe8}
.mobile-game:not(.mobile-playing) .controls,.mobile-game.mobile-obscured .controls{display:none}
.mobile-game .notice{top:calc(var(--safe-top) + 59px);max-width:65%;width:max-content;padding:8px 14px;font-size:13px;border-width:1px;z-index:7}
.mobile-game #objectiveNotice{top:calc(var(--safe-top) + 58px);font-size:13px}
.mobile-game .overlay{position:absolute;inset:0;z-index:20;padding:calc(var(--safe-top) + 8px) calc(var(--safe-right) + 12px) calc(var(--safe-bottom) + 8px) calc(var(--safe-left) + 12px)}
.mobile-game .overlay .panel{max-height:100%;width:min(700px,100%);padding:16px 20px;min-height:0;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-width:thin;border-width:2px}
.mobile-game .panel-emblem,.mobile-game .panel .eyebrow,.mobile-game .panel .fine{display:none}
.mobile-game .panel h2{font-size:23px;margin:0 0 8px;line-height:1.15}
.mobile-game .panel p{font-size:14px;line-height:1.4;margin:6px 0 12px}
.mobile-game .panel-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:10px 0 0;max-width:none}
.mobile-game .panel-actions button{min-height:46px;margin:0;padding:9px 13px;font-size:14px;line-height:1.2;white-space:normal}
.mobile-game .panel.pause-screen{display:block;text-align:center;max-width:650px}
.mobile-game .pause-screen>.inventory-sections{display:none}
.mobile-game .pause-screen>.panel-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:0;margin:12px 0 0}
.mobile-game .pause-screen>p{display:none}
.mobile-game .inventory-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.mobile-game .inventory-slot{font-size:12px;min-height:44px}
.mobile-game .inventory-sections h3{font-size:14px}
.mobile-game .dialog,.mobile-game .dialog:has(.dialog-choices:not(:empty)){position:absolute;z-index:15;left:calc(var(--safe-left) + 14px);right:calc(var(--safe-right) + 14px);bottom:calc(var(--safe-bottom) + 12px);width:auto;min-height:0;max-height:calc(100% - var(--safe-top) - var(--safe-bottom) - 70px);padding:12px 14px;gap:12px;overflow:auto;border-width:2px;border-radius:14px;background:#122c36f7;touch-action:pan-y}
.mobile-game .portrait{width:64px;height:64px;border-radius:10px;font-size:31px}
.mobile-game .betty-portrait{background-size:192px 256px;background-position:-64px 0}
.mobile-game .dialogtext{min-width:0;font-size:16px;line-height:1.4;gap:5px}
.mobile-game .speaker{font-size:16px}
.mobile-game .dialogBtns button,.mobile-game .dialog-choices button{min-height:44px;font-size:14px;padding:9px 16px;border-radius:8px}
.mobile-game .dialog-choices{flex-wrap:wrap;gap:8px}
.mobile-game .church-panel canvas,.mobile-game .mirror-panel canvas{max-width:100%}
.mobile-game .panel.main-screen{width:min(720px,100%);padding:20px 28px;background-size:55% auto;text-align:left}
.mobile-game .main-screen h2{font-size:28px;max-width:70%}.mobile-game .main-screen>p{max-width:65%}.mobile-game .main-screen .panel-actions{max-width:420px}
.mobile-game.mobile-portrait .rotation-screen{position:fixed;inset:0;z-index:100;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:14px;padding:calc(var(--safe-top) + 24px) calc(var(--safe-right) + 28px) calc(var(--safe-bottom) + 24px) calc(var(--safe-left) + 28px);text-align:center;background:radial-gradient(circle at 50% 35%,#31534d,#10242f 70%)}
.rotation-screen .rotation-icon{font-size:72px;color:#eccb8b}.rotation-screen h2{font-size:25px;margin:0;max-width:300px}.rotation-screen p{color:#ccd7c7;max-width:290px;line-height:1.5;margin:0}
.mobile-portrait #app{visibility:hidden}
@media(max-height:350px) and (orientation:landscape){.mobile-game .dpad{width:138px;height:138px;grid-template:repeat(3,44px)/repeat(3,44px);bottom:calc(var(--safe-bottom) + 8px)}.mobile-game .dpad button{width:44px;height:44px}.mobile-game .actionkeys{bottom:calc(var(--safe-bottom) + 8px);grid-template-rows:52px 64px}.mobile-game .action{height:52px}.mobile-game .interact{height:64px}.mobile-game .panel-actions button{min-height:44px}.mobile-game .overlay .panel{padding:12px 16px}}

/* M09: one shared inventory, two compact columns, local scrolling only. */
.mobile-game .panel.pause-screen:has(.inventory-sections){display:grid;grid-template-columns:minmax(0,1.25fr) minmax(192px,.85fr);grid-template-rows:auto minmax(0,1fr);gap:6px 14px;width:100%;max-width:900px;height:min(350px,100%);min-height:0;padding:8px 10px;overflow:hidden;text-align:left}
.mobile-game .pause-screen:has(.inventory-sections)>.panel-emblem,.mobile-game .pause-screen:has(.inventory-sections)>p{display:none}
.mobile-game .pause-screen:has(.inventory-sections)>h2{grid-column:2;grid-row:1;font-size:21px;text-align:center;margin:0}
.mobile-game .pause-screen:has(.inventory-sections)>.panel-actions{grid-column:2;grid-row:2;display:flex;flex-direction:column;justify-content:flex-start;gap:4px;min-height:0;overflow-y:auto;margin:0;padding:2px 3px 4px;overscroll-behavior:contain;touch-action:pan-y}
.mobile-game .pause-screen .panel-actions button{min-height:44px;flex-shrink:0;padding:8px;font-size:13px;border-width:1px}
.mobile-game .pause-screen:has(.inventory-sections)>.inventory-sections{display:flex;flex-direction:column;grid-column:1;grid-row:1/-1;min-height:0;height:100%;padding-right:12px;overflow:hidden;border-right:1px solid #d7be7e66}
.mobile-game .pause-screen .inventory-sections:before{flex-shrink:0;font-size:13px;letter-spacing:1px;padding:3px 0 5px}
.mobile-game .pause-screen .inventory-content{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;padding-right:3px}
.mobile-game .pause-screen .inventory-sections h3{font-size:12px;margin:7px 0 4px}
.mobile-game .pause-screen .inventory-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
.mobile-game .pause-screen .inventory-slot{min-height:32px;padding:4px;font-size:10px;border-width:1px}
.mobile-game .pause-screen .pause-objective{display:block;flex-shrink:0;border-top:1px solid #b6a77966;margin:6px 0 0;padding:6px 0 0;font-size:11px;line-height:1.35;color:#dac994}
.mobile-game .dialog,.mobile-game .dialog:has(.dialog-choices:not(:empty)){height:min(210px,calc(100dvh - var(--safe-top) - var(--safe-bottom) - 64px));max-height:calc(100% - var(--safe-top) - var(--safe-bottom) - 64px);overflow:hidden;align-items:stretch}
.mobile-game .dialogtext{min-height:0;font-size:16px;line-height:1.4;letter-spacing:normal;-webkit-text-size-adjust:100%;text-size-adjust:100%}
.mobile-game #dialogContent{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;font-size:16px;line-height:1.4}
.mobile-game .speaker,.mobile-game .dialogBtns,.mobile-game .dialog-choices{flex-shrink:0}
.mobile-game .dialog-choices:empty{display:none}
.mobile-game .dialog-choices{margin-top:0}
.mobile-game .dialogBtns{margin-top:0}
.mobile-game .opening button{right:calc(var(--safe-right) + 14px);top:calc(var(--safe-top) + 10px)}
.mobile-portrait .eyelid{animation-play-state:paused}
.mobile-game .main-screen .install-link{font-size:12px;min-height:36px!important}
/* Keep management controls in one vertical scroll track on short screens. */
.mobile-game .pause-screen:has(.inventory-sections)>.panel-actions{flex-wrap:nowrap;overflow-x:hidden}
.mobile-game #app button{-webkit-tap-highlight-color:transparent}

/* Sancy R1: preserve aspect even during a late viewport relayout. */
.mobile-game #game{object-fit:contain}
/* Compact short lines, bounded long text, footer/choices never shrink. */
.mobile-game .dialog,.mobile-game .dialog:has(.dialog-choices:not(:empty)){--dialog-limit:min(320px,calc(100dvh - var(--safe-top) - var(--safe-bottom) - 70px));display:grid;grid-template-columns:64px minmax(0,1fr);height:auto;min-height:0;max-height:var(--dialog-limit);align-items:start}
.mobile-game .dialogtext{max-height:calc(var(--dialog-limit) - 28px);min-height:0}
.mobile-game #dialogContent{flex:0 1 auto;max-height:none}

/* R3: trois caractéristiques lisibles et exactement trois souvenirs. */
.panel .inventory-sections .inventory-grid.progression-grid{grid-template-columns:1fr}.inventory-sections .progression-grid .inventory-slot{justify-content:flex-start;text-align:left;min-height:34px;font-size:13px}.panel .inventory-sections .inventory-grid.souvenir-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.inventory-slot{overflow-wrap:anywhere}

/* R8 : deux lignes visuelles de progression ; aucun changement des bonus. */
.compact-stats{display:flex;flex-direction:column;gap:2px;padding:5px 0}.inventory-hearts{display:flex;flex-wrap:wrap;align-items:center;gap:4px;font-size:25px;line-height:1.05}.heart-full{color:#ef846e}.heart-empty{color:#c7b898}.heart-count{font-size:12px;margin-left:6px;color:#d4d7cc}.inventory-upgrades{display:flex;align-items:center;gap:28px}.upgrade-count{display:flex;align-items:center;gap:7px;font-weight:bold;font-size:16px}.upgrade-icon{width:32px;height:28px;image-rendering:pixelated}
.mobile-game .pause-screen .inventory-sections h3{margin:4px 0 3px;font-size:12px}.mobile-game .pause-screen .inventory-slot{min-height:28px;font-size:11px;padding:3px;line-height:1.15}.mobile-game .pause-screen .compact-stats{padding:3px 0}.mobile-game .pause-screen .pause-objective{margin-top:3px;padding-top:3px}
