/* Desktop play is a landscape table. Mobile keeps its existing app layout. */
.desktop-lives,.undo-desktop,.desktop-rule-cat{display:none}.undo-mobile{font:inherit;font-weight:inherit}
@media(min-width:651px),(min-width:500px) and (max-height:500px) and (orientation:landscape){
 body[data-screen=game]{padding:0;background:radial-gradient(ellipse at 26% 48%,color-mix(in srgb,var(--mint) 7%,transparent),transparent 65%),var(--club-bg)}
 .game-main{--play-board:min(calc(100dvh - 104px),calc(100vw - 396px),900px);display:grid;grid-template-columns:var(--play-board) 300px;grid-template-rows:66px auto auto auto auto auto 1fr;column-gap:28px;row-gap:10px;width:max-content;max-width:calc(100% - 32px);margin:0 auto;padding:8px 0 16px!important;align-content:start;align-items:start}
 .game-main[hidden]{display:none}
 .game-main>.mobile-play-header{grid-column:1/-1;grid-row:1;min-height:0;height:60px;margin:0;padding:0;grid-template-columns:44px 1fr 44px}
 .game-main .mobile-play-header>div{text-align:left;position:relative;padding-left:66px}
 .game-main .mobile-play-header>div:before{content:'';position:absolute;left:4px;top:0;width:45px;height:45px;background:url('mascot.svg') center/contain no-repeat;transform:rotate(-8deg)}
 .game-main .mobile-play-header h1{font-size:25px;margin:4px 0 0;letter-spacing:-.7px}.game-main .mobile-play-header span{font-size:9px;letter-spacing:1.7px}
 .game-main .mobile-play-header>button{width:44px;min-width:44px;height:44px;min-height:44px;font-size:25px}
 .game-main .workspace,.game-main[data-play-mode=expedition] .workspace,.game-main .game-card,.game-main[data-play-mode=expedition] .game-card{display:contents}
 .game-main .board-wrap{grid-column:1;grid-row:2/10;width:var(--play-board);height:var(--play-board);align-self:start;overflow:visible}
 .game-main .board{width:100%;height:100%;max-width:none;min-width:0!important;padding:8px;gap:4px;border-radius:22px;aspect-ratio:1;box-shadow:0 14px 40px #0001}
 .game-main .cell,.game-main .cell.region-right,.game-main .cell.region-bottom{min-width:0;min-height:0;border-radius:8px}
 .game-main[data-large-grid=true] .cell{border-radius:6px}
 .game-main .large-grid-tools{display:none!important}
 .game-main>.mobile-play-rules{grid-column:2;grid-row:2;width:100%;max-width:none;min-height:76px;margin:0;padding:9px 6px;border-radius:19px;gap:0;box-shadow:0 6px 20px #00000004}
 .game-main .mobile-play-rules>span{flex-direction:column;gap:3px;min-height:53px;padding:0 4px}
 .game-main .mobile-play-rules svg:not(.desktop-rule-cat){display:none}.game-main .mobile-play-rules .desktop-rule-cat{display:block;width:40px;height:36px;opacity:1;color:#c4a0d9}.game-main .mobile-play-rules>span:nth-child(2) .desktop-rule-cat{color:#e7b389}.game-main .mobile-play-rules>span:nth-child(3) .desktop-rule-cat{color:#8cbeb5}
 .game-main .mobile-play-rules b{text-align:center;font-size:10px;line-height:1.3}.game-main .mobile-play-rules br{display:none}
 .game-main .game-top{grid-column:2;grid-row:3;display:grid;grid-template-columns:1fr;gap:8px;margin:0;min-height:0;padding:13px 15px;background:var(--surface);border:1px solid var(--club-line);border-radius:18px}
 .game-main .game-top>div,.game-main .mobile-play-status,.game-main .game-errors{display:none}
 .game-main .desktop-lives{display:flex;align-items:center;gap:11px;text-align:left;min-width:0}.desktop-lives>span{min-width:0}.desktop-lives b{display:block;font-size:14px;font-weight:650;color:var(--text);line-height:1.4}.desktop-lives small{display:block;font-size:11px;color:var(--sub);line-height:1.4;margin-top:3px}
 .game-main .desktop-lives .life-fish{display:flex;flex-wrap:wrap;align-content:center;gap:1px;width:48px;flex:none}.life-fish i{display:block;width:48px;height:29px}.life-fish:has(i:nth-child(2)) i{width:23px;height:17px}.life-fish svg{width:100%;height:100%;filter:drop-shadow(0 2px 1px #d8983b20)}.life-fish .spent{opacity:.2;filter:grayscale(1)}
 .game-main .game-top .timer{display:flex;justify-content:flex-start;width:100%;min-height:36px;padding:6px 0 0;border:0;border-top:1px solid var(--club-line);border-radius:0;background:none;gap:8px;font-size:12px;color:var(--sub);box-shadow:none;font-variant-numeric:tabular-nums}
 .game-main .timer:before{content:'À votre rythme';font-size:11px;color:var(--sub);margin-right:auto}.game-main .timer #timer-symbol{display:none}.game-main #time{font-size:12px;color:var(--sub)}.game-main #pause-icon{font-size:0;border-radius:7px;background:var(--club-bg);padding:6px 8px}.game-main #pause-icon:after{content:'Pause';font-size:11px}.game-main .timer[aria-label='Reprendre la partie'] #pause-icon:after{content:'Reprendre'}
 .game-main .board-footer{grid-column:2;grid-row:4;margin:0;padding:2px 6px;gap:5px}.game-main .progress{font-size:12px}.game-main .dots,.game-main[data-large-grid=true] .dots{gap:5px;min-height:20px;flex-wrap:wrap}.game-main .dots i,.game-main[data-large-grid=true] .dots i{width:18px;height:19px}
 .game-main .tools{grid-column:2;grid-row:5;display:grid;grid-template-columns:1fr 1fr;gap:6px;align-self:start;margin:0;padding:10px;background:var(--surface);border:1px solid var(--club-line);border-radius:20px;box-shadow:0 8px 24px #00000005}
 .game-main .tools button,.game-main .tools #undo,.game-main .tools #reset{grid-column:auto;grid-row:auto;order:0;display:flex;flex-direction:row;min-height:45px;padding:7px 8px;gap:7px;border-radius:12px;justify-content:flex-start;font-size:11px;line-height:1.3;text-align:left}
 .game-main .tools #mark{grid-column:1/-1;grid-row:1;font-size:13px;background:var(--club-bg)}.game-main .tools #hypothesis{grid-column:1;grid-row:2}.game-main .tools #hint{grid-column:2;grid-row:2}.game-main .tools #undo{grid-column:1;grid-row:3}.game-main .tools #reset{grid-column:2;grid-row:3}
 .game-main .tools button>span,.game-main .tools #undo>span,.game-main .tools #reset>span{width:30px;min-width:30px;height:30px;font-size:23px;display:grid;place-items:center;border:0;border-radius:10px;background:none;box-shadow:none}.game-main .tools button>span>svg{width:28px;height:28px}.game-main .tools button.active{background:color-mix(in srgb,var(--mint) 12%,var(--surface))}.game-main .tools #mark.active{background:color-mix(in srgb,var(--mint) 18%,var(--surface))}.game-main .tools .undo-mobile{display:none}.game-main .tools .undo-desktop{display:block;font:inherit;font-size:10px}
 .game-main .board-tip{grid-column:2;grid-row:6;display:block;margin:0;padding:0 9px;text-align:center;font-size:10px;line-height:1.6;max-width:300px}.game-main #message{grid-column:2;grid-row:7;margin:0 6px;font-size:11px;line-height:1.5;min-height:0}.game-main #message:empty{display:none}
 .game-main .hypothesis-panel{grid-column:2;grid-row:8;margin:0;padding:10px;border-radius:14px;min-width:0}.game-main .hypothesis-panel>span{font-size:10px}.game-main .hypothesis-panel>div{display:flex;flex-wrap:wrap;gap:4px}.game-main .hypothesis-panel button{font-size:10px;min-height:36px;padding:6px 8px}
 .game-main .hint-lesson{grid-column:2;grid-row:8;margin:0;max-height:200px;overflow:auto}.game-main .result-open{grid-column:2;grid-row:7;margin:0;min-height:44px;font-size:12px}
 .game-main .challenge-status{display:none}.game-main .lock-badge{width:14px;height:14px;font-size:9px}
}
@media(min-width:1500px) and (min-height:850px) and (orientation:landscape){.game-main{grid-template-columns:var(--play-board) 340px;column-gap:40px;grid-template-rows:76px auto auto auto auto auto 1fr;row-gap:16px;--play-board:min(calc(100dvh - 120px),calc(100vw - 460px),900px)}.game-main .mobile-play-header h1{font-size:30px}.game-main .mobile-play-rules{min-height:100px}.game-main .mobile-play-rules .desktop-rule-cat{width:50px;height:48px}.game-main .mobile-play-rules b{font-size:12px}.game-main .game-top{padding:18px;gap:14px}.desktop-lives b{font-size:16px}.desktop-lives small{font-size:12px}.game-main .tools{padding:14px;gap:10px}.game-main .tools button,.game-main .tools #undo,.game-main .tools #reset{min-height:58px;font-size:13px}.game-main .tools #mark{font-size:15px}.game-main .tools .undo-desktop{font-size:12px}.game-main .board-tip{font-size:12px;max-width:none}.game-main .board-footer{padding:10px}.game-main .progress{font-size:14px}.game-main .dots i,.game-main[data-large-grid=true] .dots i{width:23px;height:24px}.game-main .board{padding:11px;gap:6px}}
@media(min-width:651px),(min-width:500px) and (max-height:500px) and (orientation:landscape){.game-main .timer:has(#time[hidden]):before{content:'À votre rythme'}.life-fish>svg{height:32px}}
@media(min-width:651px),(min-width:500px) and (max-height:500px) and (orientation:landscape){.game-main{grid-template-rows:66px auto auto auto auto auto}.game-main .board-wrap{grid-row:2/7}.game-main .cat-mood:empty{display:none}.game-main #mobile-play-context:after{content:' · ' attr(data-grid)}}
@media(min-width:1500px) and (min-height:850px) and (orientation:landscape){.game-main{grid-template-rows:76px auto auto auto auto auto}}
/* Keep the landscape table within its board height; the final track absorbs spare space. */
@media(min-width:651px),(min-width:500px) and (max-height:500px) and (orientation:landscape){.game-main{height:calc(var(--play-board) + 100px);grid-template-rows:66px max-content max-content max-content max-content minmax(0,1fr)}}
@media(min-width:1500px) and (min-height:850px) and (orientation:landscape){.game-main{height:calc(var(--play-board) + 116px);grid-template-rows:76px max-content max-content max-content max-content minmax(0,1fr)}}
/* Landscape phones and narrow tablets use the same table, without shrinking its
   board to the height of the controls. The controls may scroll with the page. */
@media(min-width:651px) and (max-width:899px),(min-width:500px) and (max-width:650px) and (max-height:500px) and (orientation:landscape){
 #game-screen.game-main{--play-side:clamp(168px,calc(100vw - 340px),248px);--play-board:max(300px,min(calc(100dvh - 80px),calc(100vw - 288px),560px));grid-template-columns:var(--play-board) var(--play-side);grid-template-rows:52px repeat(9,max-content);column-gap:12px;row-gap:8px;height:auto;max-width:calc(100% - 16px);padding:6px 0 12px!important}
 #game-screen.game-main>.mobile-play-header{height:52px;min-height:52px;grid-template-columns:44px minmax(0,1fr) 44px}
 #game-screen.game-main .mobile-play-header>div{padding-left:48px}
 #game-screen.game-main .mobile-play-header>div:before{width:36px;height:40px;top:2px}
 #game-screen.game-main .mobile-play-header h1{font-size:21px;line-height:1.15;margin:3px 0 0}
 #game-screen.game-main .mobile-play-header span{font-size:8px;letter-spacing:1px}
 #game-screen.game-main .board-wrap{grid-column:1;grid-row:2/11;width:var(--play-board);height:var(--play-board);align-self:start;max-width:100%}
 #game-screen.game-main .board{width:var(--play-board);height:var(--play-board);aspect-ratio:1}
 #game-screen.game-main .game-top{padding:10px;min-width:0}
 #game-screen.game-main .game-top .timer{flex-wrap:wrap;min-height:44px;row-gap:4px}
 #game-screen.game-main .mentor-panel{grid-template-columns:56px minmax(0,1fr);gap:6px;padding:0;margin:0}
 #game-screen.game-main .mentor-portrait>.companion-buddy{width:56px;height:78px}
 #game-screen.game-main .mentor-name{padding-right:0}
 #game-screen.game-main .mentor-action{position:static;max-width:none;width:100%;justify-content:space-between;text-align:left}
 #game-screen.game-main .mentor-bubble{padding:10px;gap:5px}
 #game-screen.game-main .mentor-bubble>b{font-size:16px}
 #game-screen.game-main .tools{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:9px}
 #game-screen.game-main .tools button,#game-screen.game-main .tools #undo,#game-screen.game-main .tools #reset{min-height:44px;font-size:11px;padding:7px;min-width:0}
 /* companion.css is loaded later: keep its six-column mobile spans out of this table. */
 #game-screen.game-main .tools #mark{grid-column:1/-1;grid-row:1;font-size:12px}
 #game-screen.game-main .tools #hypothesis{grid-column:1/-1;grid-row:2}
 #game-screen.game-main .tools #undo{grid-column:1;grid-row:3}
 #game-screen.game-main .tools #reset{grid-column:2;grid-row:3}
 #game-screen.game-main .board-tip{display:none}
 #game-screen.game-main .large-grid-tools:not([hidden]){display:flex!important;grid-area:auto;grid-column:2;grid-row:6;gap:6px;justify-content:flex-start;margin:0;padding:0;flex-wrap:wrap}
 #game-screen.game-main .large-grid-tools>span{display:none}
 #game-screen.game-main .large-grid-tools>button{min-height:44px;min-width:44px;padding:8px 10px;font-size:12px}
 #game-screen.game-main .board-wrap.is-zoomed{overflow:auto;overscroll-behavior:contain;touch-action:pan-x pan-y}
 #game-screen.game-main .board-wrap.is-zoomed .board{min-width:576px!important;width:576px;height:576px}
 #game-screen.game-main .hypothesis-panel{grid-row:8}
 #game-screen.game-main .hint-lesson{grid-row:9}
 #game-screen.game-main .result-open{grid-area:auto;grid-column:2;grid-row:10}
 #game-screen.game-main .hypothesis-panel button,#game-screen.game-main .pause-overlay button{min-height:44px}
}
@media(min-width:500px) and (max-width:600px) and (max-height:500px) and (orientation:landscape){
 #game-screen.game-main .tools{grid-template-columns:minmax(0,1fr)}
 #game-screen.game-main .tools #undo{grid-column:1/-1;grid-row:3}
 #game-screen.game-main .tools #reset{grid-column:1/-1;grid-row:4}
 #game-screen.game-main .mobile-play-header>div{padding-left:42px}
 #game-screen.game-main .mobile-play-header h1{font-size:19px}
}
/* The sidebar can exceed a short phone's height. Keep the full board beside
   whichever controls the player scrolls to, instead of swapping it off-screen. */
@media(min-width:500px) and (max-width:899px) and (max-height:500px) and (orientation:landscape){
 #game-screen.game-main .board-wrap{position:sticky;top:8px}
}
