/* Phone landscape uses the viewport as a game surface, not a scrolling page. */
@media(orientation:landscape) and (max-height:600px){
 html,body{height:100%;height:100dvh;overflow:hidden!important;overscroll-behavior:none}
 /* Rainfall selection screen. */
 body:has(#game) #menu{height:100dvh;overflow:hidden;padding:0!important;display:grid;grid-template-rows:44px minmax(0,1fr)}
 body:has(#game) #menu[hidden]{display:none}body:has(#game) #menu>header{height:44px;padding-top:0;padding-bottom:0}
 body:has(#game) #menu .menu-layout{height:100%;box-sizing:border-box;min-height:0;grid-template-columns:.95fr 1.05fr;align-items:stretch;padding:8px max(20px,env(safe-area-inset-right)) 62px max(20px,env(safe-area-inset-left));gap:20px}
 body:has(#game) .title-block{display:flex;flex-direction:column;justify-content:center;min-height:0}body:has(#game) .roster{height:100%;min-height:0}.title-block>.overline,.title-block>.controls,.title-block>.menu-links,body:has(#game) #menu>footer{display:none}
 body:has(#game) h1{font-size:30px;margin:0 0 5px}body:has(#game) .brief{margin:5px 0}body:has(#game) .brief>p{font-size:11px;line-height:1.5;margin:3px 0}body:has(#game) .brief>b{font-size:10px}.title-block h1 em{font-size:8px!important;margin:4px 0!important}.title-block .gold-btn{padding:8px 12px!important;min-height:44px}#continueRun{margin-top:6px}#record{font-size:10px;line-height:1.4}
 #game-save-dock{bottom:6px;left:max(10px,env(safe-area-inset-left));padding:3px 8px;max-width:calc(100vw - 155px)}#game-save-dock button{min-height:44px}body:has(#game)>.language-switch{bottom:6px}#game-save-dock span{font-size:11px}
 /* Card game home: identity left, opponent choice and play buttons right. */
 body:has(#cloud-dock) #app,body:has(#cloud-dock) .home{height:100dvh;overflow:hidden}
 .home .topbar{height:48px;min-height:48px;padding:5px max(20px,env(safe-area-inset-right)) 5px max(20px,env(safe-area-inset-left));box-sizing:border-box}.topbar nav{gap:12px}.home .brand{font-size:25px}.home .brand small{font-size:8px}
 body:has(#cloud-dock) .home-content{height:calc(100dvh - 152px);box-sizing:border-box;width:100%!important;margin:0!important;max-width:none;display:grid;grid-template-columns:.75fr 1.25fr;grid-template-rows:22px minmax(50px,1fr) 24px 92px;column-gap:30px;padding:5px 7%;text-align:left;align-content:center}
 .home-content>.overline{grid-area:1/1;margin:0;align-self:end}.home-content>.title-rule{display:none}.home-content>h1{grid-area:2/1;font-size:48px!important;align-self:center;margin:0}.home-content>.home-motto{grid-area:3/1;font-size:17px;margin:0;letter-spacing:2px}.home-content>.difficulty-label{grid-area:1/2;margin:0;align-self:center;font-size:12px}.home-content>.difficulties{grid-area:2/2;margin:0;align-self:center;width:100%;max-width:none;gap:5px}.difficulties button{padding:5px;min-height:52px}.difficulties b{font-size:14px}.home-content>.difficulty-note{grid-area:3/2;margin:0;font-size:11px}.home-content>.home-actions{grid-area:4/2;display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:6px 0 0;align-content:start}.home-actions button{min-width:0!important;min-height:44px!important;padding:8px 10px;font-size:13px}.home-actions button:last-child{grid-column:1/3;min-height:32px!important;padding:3px}
 body:has(#cloud-dock) .home-footer{position:absolute!important;bottom:56px!important;left:4%;right:4%;height:44px;min-height:0;padding:0!important;gap:15px;justify-content:flex-start;flex-wrap:nowrap;font-size:11px}.home-footer button{min-height:44px;font-size:11px}
 body:has(#cloud-dock) #language-switch{top:auto!important;bottom:8px!important;right:12px;min-width:44px;min-height:44px}body:has(#cloud-dock) #cloud-dock{right:70px;bottom:8px;max-width:calc(100vw - 215px);flex-direction:row;align-items:center;gap:7px}#cloud-dock button{min-height:44px;font-size:12px;padding:6px 10px}#cloud-state{font-size:10px;max-width:260px}#app-game-return{bottom:8px;min-height:44px}
 /* Card table: opponents on the left; hand and actions on the right. */
 .battle.world,.online-world.battle{height:100dvh;min-height:0!important;padding:0 max(10px,env(safe-area-inset-right)) 6px max(10px,env(safe-area-inset-left));box-sizing:border-box;display:grid!important;grid-template-columns:46% 54%;grid-template-rows:44px 44px 36px minmax(0,1fr);overflow:hidden!important}
 .battle .topbar,.battle .online-header{grid-area:1/1/2/3;height:44px;min-height:0;padding:0 8px;margin:0;gap:10px}.battle .brand{font-size:20px}.battle .brand small{display:none}.battle .topbar nav{gap:12px}.battle .topbar nav button{font-size:11px;padding:4px;min-height:44px}.battle .profile-link img{height:28px;width:28px}.battle .online-header h1{font-size:20px}.battle .online-header small{display:none}
 .battle .battle-meta{grid-area:2/1/3/3;min-height:0;height:44px;box-sizing:border-box;margin:0;padding:0 6px;gap:14px;flex-wrap:nowrap;font-size:11px}.battle-meta .pressure small,.battle-meta .mode-tag{display:none}.battle-meta button{min-height:44px;padding:4px 10px;font-size:11px}.battle-meta .auto-button{margin-left:auto}
 .battle .turn-banner{grid-area:3/1/4/3;height:36px;box-sizing:border-box;margin:0;padding:2px 12px;min-height:0;gap:8px}.turn-banner .turn-beacon{font-size:20px;width:28px;height:28px}.turn-banner>div{display:flex;gap:12px;align-items:center}.turn-banner strong{font-size:13px}.turn-banner span{font-size:11px}.battle>.direction-guide{display:none}.battle .online-clock{margin-left:auto}.battle .online-clock b{font-size:20px}
 .battle .arena{grid-area:4/1/5/2;height:100%!important;width:100%;min-height:0;max-width:none;margin:0}.battle .seat{width:112px;min-height:54px;padding:4px;gap:6px}.battle .portrait-frame{width:28px;height:38px;border-width:1px}.battle .seat.acting .portrait-frame{border-width:2px;box-shadow:0 0 0 1px #ffe8a5}.battle .seat-name{font-size:11px;max-width:74px}.battle .seat-name small{font-size:8px}.battle .hp-copy{font-size:10px}.battle .hp-copy b{font-size:17px}.battle .hp-copy em{display:none}.battle .seat-meta{font-size:9px}.battle .seat-2{left:3px;top:12px}.battle .seat-3{right:3px;top:12px}.battle .seat-1{left:3px;top:43%}.battle .seat-4{right:3px;top:43%}.battle .seat-0{left:calc(50% - 56px);bottom:2px}.battle .seat.acting:before{top:-12px;font-size:8px;padding:0 3px}.battle .center-seal{top:28%!important;left:calc(50% - 45px);width:90px}.battle .center-seal .overline{font-size:8px}.battle .required-number{font-size:35px;line-height:1.2}.battle .center-seal h2{font-size:12px!important;margin:2px!important;letter-spacing:1px}.battle .center-seal p{display:none}.battle .last-action{right:auto;left:calc(50% - 58px);bottom:65px!important;width:116px;min-height:0;padding:0;text-align:center;display:block}.battle .last-action img,.battle .last-action small{display:none}.battle .last-action p,.battle .last-action b{font-size:9px;line-height:1.25;margin:0}
 .battle .hand-zone{grid-area:4/2/5/3;min-width:0;min-height:0;height:100%;width:100%;box-sizing:border-box;padding:5px 8px 0;margin:0;display:flex;flex-direction:column;overflow:hidden}.hand-heading{min-height:24px;height:24px;padding:0;font-size:11px}.hand-heading small{font-size:9px;margin-left:4px}.hand-heading b{font-size:13px}.decision-clock{height:24px}.decision-clock #clock-number{font-size:20px}.decision-clock small{font-size:9px}
 .battle .hand{display:grid;grid-template-columns:repeat(var(--hand-columns,5),minmax(0,1fr));grid-template-rows:repeat(var(--hand-rows,1),minmax(0,1fr));gap:5px;flex:1;min-height:50px;width:100%;margin:4px 0;padding:0;overflow:hidden;align-items:stretch;justify-items:center}.battle .hand .card{width:100%;max-width:78px;height:100%;min-width:0;min-height:0;aspect-ratio:auto;margin:0!important;transform:none!important;border-radius:5px}.hand .card img{height:100%;width:100%;object-fit:cover}.hand .card .card-number{font-size:20px;left:4px;top:2px}.hand .card .card-caption b{font-size:11px}.hand .card .card-caption small{display:none}.hand .card.selected{outline:2px solid #fff0b3;outline-offset:-3px}.hand .card-ready{font-size:10px}
 .battle .action-console{min-height:0;flex:none;display:block;margin:0;padding:3px 0 0}.action-explanation p{font-size:12px;line-height:1.25;margin:0}.action-explanation small{display:block;font-size:10px;line-height:1.25;margin:2px 0}.action-options{display:flex;gap:5px;flex-wrap:nowrap;justify-content:flex-end;margin-top:4px}.action-options button{flex:1;min-height:44px;min-width:0!important;padding:4px 6px!important;font-size:11px!important;letter-spacing:0}.action-options label{font-size:9px;min-width:50px}.action-options select{max-width:85px;min-height:34px;padding:2px;font-size:12px}.battle-bottom{display:none}
 .battle .counter-panel{position:absolute;z-index:12;top:124px;left:10px;width:calc(46% - 10px);height:calc(100dvh - 130px);box-sizing:border-box;background:#10271ff8;margin:0;padding:8px;font-size:11px}.counter-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:3px}.counter-card{padding:3px;font-size:9px}.counter-card strong,.counter-card span{font-size:9px;line-height:1.3}.counter-panel>strong{font-size:11px}
 .battle .hand-zone:has(.trophy-panel)>.hand,.battle .hand-zone:has(.trophy-panel)>.action-console{display:none}.trophy-panel{margin:0;padding:6px;font-size:10px;min-height:0}.trophy-panel h2{font-size:16px;margin:3px 0}.trophy-panel h3{font-size:11px;margin:2px}.trophy-panel p{font-size:10px;margin:2px}.trophy-card{width:45px;min-height:44px;padding:2px}.trophy-card img{height:42px}.trophy-card strong{font-size:9px}.trophy-options{gap:6px}.trophy-panel>button{min-height:36px;padding:4px 10px;font-size:11px}
 body:has(.battle) #app-game-return,body:has(.battle) #cloud-dock,body:has(.battle) #language-switch{display:none}
 .match-panel{height:calc(100dvh - 110px);margin:0 auto!important;padding:8px 20px!important;display:flex;flex-direction:column;align-items:center;justify-content:center;max-width:700px}.match-sigil{display:none!important}.match-panel h2{font-size:24px!important;margin:4px!important}.match-panel p{font-size:12px!important;line-height:1.35;margin:4px}.match-buttons button{min-height:44px;padding:8px 30px}.match-panel .overline{font-size:10px}.online-world:not(.battle) .online-header{height:52px;padding:4px 20px}.online-header h1{font-size:22px}.online-header small{display:none}.online-world:not(.battle){height:100dvh;overflow:hidden}
 .screen:has(#startBtn){padding-bottom:0!important}.modal,.cloud-shade{overflow:hidden;padding:8px 18px!important}.modal-card,.cloud-panel,.save-dialog,.panel{max-height:calc(100dvh - 16px)!important;box-sizing:border-box}
 .mobile-page-shell{display:flex;flex-direction:column;max-height:calc(100dvh - 20px)!important;overflow:hidden!important}.mobile-page-content{min-height:0;overflow:hidden;flex:1}.mobile-page-controls{display:flex;justify-content:center;align-items:center;gap:15px;flex:none;height:44px;padding-top:4px;font:12px system-ui}.mobile-page-controls button{min-width:50px;min-height:40px;padding:4px 12px;background:#20372f;border:1px solid #a6a27b66;color:#e3d7b5;border-radius:8px}
}

@media(orientation:landscape) and (max-height:600px){.modal-card .rulebook,.modal-card .lesson-content,.cloud-panel .cloud-panel{max-height:none;overflow:visible}.home-content .difficulties button b{white-space:nowrap}.home-content .home-motto{letter-spacing:1px;font-size:15px}.home-content .difficulty-label{white-space:nowrap}.battle .online-message{position:absolute;left:20px;bottom:2px;max-width:40%;font-size:10px;margin:0}}

@media(orientation:landscape) and (max-height:600px){
 .modal-backdrop>.modal.mobile-page-shell{height:calc(100dvh - 32px)}
 .modal-backdrop>.modal .mobile-page-content{padding-right:36px}
 .modal-backdrop>.modal h2{font-size:22px;margin:3px 0 12px}
 .modal-backdrop>.modal .gallery{gap:15px;grid-template-columns:repeat(3,1fr)}
 .modal-backdrop>.modal .gallery .card{width:78px;height:116px}
 .modal-backdrop>.modal .gallery article{gap:5px}.modal-backdrop>.modal .gallery p{font-size:12px;line-height:1.4;margin:0}
}

@media(orientation:landscape) and (max-height:600px){
 .results.world{height:100dvh;min-height:0;overflow:hidden}
 .results .topbar{height:44px;min-height:44px;padding:3px 20px;box-sizing:border-box}.results .brand{font-size:20px}.results .brand small{display:none}
 .results .result-content{height:calc(100dvh - 46px);max-height:none!important;box-sizing:border-box;margin:0 auto;padding:4px 20px;width:100%;max-width:950px;overflow:hidden}
 .results .result-content.mobile-page-shell{display:flex;flex-direction:column}.results .mobile-page-content{order:0}.results .mobile-page-controls{order:1}.results .result-actions{order:2;flex:none;min-height:44px;gap:20px}.results .result-actions button{min-height:44px;padding:5px 20px;font-size:13px}
 .results .victory-emblem{display:none}.results h1{font-size:25px;margin:0;line-height:1.25}.result-content>p,.result-content .mobile-page-content>p{font-size:12px;margin:4px 0}.results .overline{font-size:9px}.results .winner-hand{display:inline-block;margin:4px 12px}.winner-hand h3{font-size:12px;margin:0}.winning-cards{margin:3px 0;gap:4px}.winning-cards span{font-size:20px;padding:2px 7px}.winning-cards small{font-size:9px}
 .result-table{margin-top:8px}.result-row{padding:3px 8px;font-size:11px;gap:8px}.result-row b{font-size:15px}.result-row img{width:17px;height:22px}.result-note{font-size:10px!important;line-height:1.4}
 body:has(.results) #app-game-return,body:has(.results) #cloud-dock,body:has(.results) #language-switch{display:none}
}
