/* v0.5.8: 横持ちの短いビューポート専用。元の画像、描画座標、PCの通常レイアウトは維持。 */
#rotateNotice{width:min(90vw,420px);max-height:90dvh;overflow:auto;text-align:center;padding:28px 22px;border:2px solid #dfbd76;border-radius:18px;background:#26364a;color:#fff4de;box-shadow:0 12px 45px #0008}
#rotateNotice::backdrop{background:#162839f5}#rotateNotice h2{font-size:21px;line-height:1.5}#rotateNotice p{font-size:14px;line-height:1.65}#rotateNotice small{color:#e0d0ad}#rotateNotice .eyebrow{color:#eacb8e;margin-top:12px}.rotate-symbol{position:relative;width:110px;height:80px;margin:auto;color:#ffce72;font-size:60px;line-height:80px}.rotate-symbol span{display:block;position:absolute;inset:16px 25px;border:3px solid #ffce72;border-radius:7px;transform:rotate(-25deg);background:#26364a}.rotate-symbol span::after{content:'';position:absolute;inset:5px 9px;border:1px solid #e7c789;border-radius:2px}
@media (orientation:landscape) and (max-height:600px){
  :root{--safe-l:max(6px,env(safe-area-inset-left));--safe-r:max(6px,env(safe-area-inset-right));--safe-t:max(4px,env(safe-area-inset-top));--safe-b:max(4px,env(safe-area-inset-bottom))}
  html,body{height:100%;overflow:hidden;overscroll-behavior:none}
  body{padding:var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l)}
  .entry,.app{height:100%;min-height:0;max-width:none;min-width:0}
  .entry{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:8px;padding:0;align-items:stretch}
  .entry-scene,.entry.intro .entry-scene{height:100%;min-height:0;border-radius:12px}
  .entry-brand{width:86%;height:62%;min-height:0}.entry-mast{top:8px;left:10px;right:10px;font-size:9px}.entry-copy{margin:0}.entry-copy small{font-size:18px}.entry-copy p{font-size:11px}
  .entry-controls{align-content:center;min-width:0;overflow:auto;border:1px solid #b8995c;border-radius:12px;padding:8px;gap:6px;width:100%;max-height:100%}
  .entry-actions{grid-template-columns:1fr 1fr;gap:5px}.entry-btn{font-size:15px;min-height:48px;padding:6px 8px}.entry-btn small{font-size:8px}.entry-tools{gap:3px}.entry-tools button{min-height:40px;padding:5px 10px;font-size:11px}.entry-notice{font-size:10px}
  .app{display:flex;flex-direction:column;overflow:hidden}.bar{flex:none;flex-wrap:nowrap;gap:5px;padding:2px 6px;border-bottom-width:2px;min-height:42px}.bar .logo img{width:86px;height:36px}.bar small{font-size:9px;overflow:hidden;text-overflow:ellipsis;min-width:0;margin-right:auto}.bar .secondary,.bar #titleBack{font-size:11px;min-height:38px;padding:5px 10px;white-space:nowrap}.footer{display:none}
  #loading.loading{flex:none;padding:2px 8px;gap:6px;background-image:none!important}#loading .logo{display:none}#loading .load-panel{display:flex;align-items:center;gap:6px;max-width:none;font-size:10px}#loading .load-panel small{display:none}#loading progress{width:80px;flex:1;margin:0}#retryImages{min-height:30px}
  .app>main{flex:1;min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain}
  .home{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;gap:5px;padding:5px;min-height:0;overflow:hidden!important}
  .home-head{grid-column:1/-1;display:flex;flex-wrap:nowrap;align-items:center;gap:6px}.home .welcome{background:#fff8e9ef;border:1px solid #b69a6e;border-radius:9px;padding:5px 8px;max-width:none;flex:none}.home .welcome .eyebrow,.home .welcome h1,.home .welcome>p:not(#saveNotice){display:none}.home #saveNotice:empty{display:none}.home #saveNotice{max-width:160px;margin:1px 0;font-size:10px}.wallet{font-size:11px;gap:2px}.wallet .ui-icon{width:16px;height:16px;margin:0}.home-nav{width:auto;flex:1;justify-content:flex-end;gap:3px;flex-wrap:nowrap}.home-nav button{min-width:0;flex:1;min-height:40px;font-size:11px;padding:5px 7px;line-height:1.25}.home .home-nav .primary strong{font-size:12px}.home-nav .primary small{display:none}
  .home .showcase{display:contents}.home .hero-stage{grid-column:1;grid-row:2/4;height:100%;width:100%;min-height:0;overflow:hidden;align-self:stretch}.home .hero-stage img{width:100%;height:100%;max-height:100%;min-height:0;min-width:0;position:absolute;inset:0}.home .hero-stage:before{bottom:7%;width:40%;height:10%}
  .home .info{grid-column:2;grid-row:2;align-self:stretch;min-height:0;overflow:auto;border:1px solid #b69a6e;border-image:none;background:#fff8e9f5;border-radius:9px;padding:7px 10px;width:100%}.info h2{font-size:19px;margin:2px 0}.role{font-size:11px;padding:2px 5px}.info .skillbox{margin:5px 0;padding:4px 6px;font-size:12px}.info .detail-entry{margin:3px 0}.info .chip,.info button,.home-options select{min-height:38px;padding:5px 9px;font-size:11px}.home-options{margin:5px 0;gap:5px}.motions{gap:3px}
  .roster-wrap{grid-column:2;grid-row:3;min-width:0;margin:0;padding:4px;border-radius:8px}.sectionline{gap:4px;padding:0;flex-wrap:nowrap}.sectionline b{font-size:11px;padding:4px 10px;white-space:nowrap}.sectionline small{display:none}.sectionline .detail-entry{min-height:32px;font-size:10px;padding:4px 8px}.roster{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(57px,1fr);grid-template-columns:none;gap:3px;overflow-x:auto;overscroll-behavior-x:contain}.unitcard{min-height:52px;padding:0 1px 2px}.unitcard img{height:35px}.unitcard b{font-size:11px}.unitcard small{font-size:9px}.unitcard .dot{width:5px;height:5px;top:3px;left:3px}
  .stage-select{padding:7px 12px;min-height:0}.stage-head{gap:8px;flex-wrap:nowrap;margin-bottom:8px}.stage-head button{min-height:40px}.ribbon{padding:7px 16px;font-size:18px;min-width:0;flex:1}.stage-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}.stage-body{min-height:0;padding:5px 7px}.stage-body strong{font-size:12px}.stage-meta,.stage-status{font-size:10px;margin-top:2px}.stage-meta img,.stage-status img{width:14px;height:14px}.future{margin:10px 0}.corner{width:20px;height:20px}
  .battle{display:grid;grid-template-columns:minmax(0,1fr) clamp(182px,30%,270px);grid-template-rows:auto minmax(0,1fr);overflow:hidden!important}
  .battlebar{grid-column:1/-1;gap:3px;padding:2px 4px;flex-wrap:wrap;justify-content:flex-start}.battlebar .stat{font-size:10px;padding:4px 5px;gap:2px}.battlebar .secondary{min-height:36px;font-size:10px;padding:5px 8px}.battlebar .push{display:none}.battlebar .hpbar.asset-gauge{width:55px}.battlebar .boss-stat .hpbar.asset-gauge{width:64px}.battlebar .ui-icon{width:13px;height:13px;margin-right:0}
  .fieldwrap{grid-column:1;grid-row:2;min-width:0;min-height:0;display:grid;place-items:center;container-type:size}
  .battle canvas{width:min(100cqw,calc(100cqh * 1200 / 610));height:auto;max-width:100%;max-height:100%;aspect-ratio:1200/610;margin:0;touch-action:none}.toast{font-size:10px;top:3px;padding:4px 6px;max-width:96%;width:max-content}
  .bottombar{grid-column:2;grid-row:2;min-height:0;min-width:0;overflow:auto;padding:4px;border-top:0;border-left:2px solid #b6a68a;display:flex;flex-direction:column;gap:3px}
  .controls{display:grid;grid-template-columns:1fr 1fr;gap:3px;margin:0;flex:none}.controls span{grid-column:1/-1;min-width:0;font-size:10px;line-height:1.3}.controls button,.controls .primary{font-size:10px;min-height:35px;min-width:0;white-space:normal;padding:3px 7px;line-height:1.2}#start,#special{grid-column:1/-1;min-height:40px}
  .battle-roster{grid-template-columns:repeat(4,minmax(0,1fr));gap:3px;flex:none}.battle-roster button{padding:0 1px 2px;min-height:48px;border-radius:5px}.battle-roster img{height:26px}.battle-roster b{font-size:10px;line-height:1.1;white-space:nowrap}.battle-roster small{font-size:8px;line-height:1.15;white-space:nowrap}.battle-roster .mini.asset-gauge{width:100%;max-width:44px}.battle-roster .mini.sp{margin-top:-2px}
  .scout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);min-height:0;gap:5px;padding:5px 8px;overflow:hidden!important}.scout-head{grid-column:1/-1;margin:0;max-width:none;width:100%;flex-wrap:nowrap;gap:6px}.scout-head h1{font-size:19px}.scout-head button{min-height:38px}.scout-head .wallet{width:auto}.scout-layout{display:contents}.summon-stage{grid-column:1;grid-row:2;min-height:0;display:flex;flex-direction:column;align-items:center;container-type:size;border-radius:9px}.summon-caption{width:100%;min-height:26px;padding:5px;font-size:11px;flex:none}.portal{width:min(100cqw,calc(100cqh - 28px));height:auto;aspect-ratio:1;flex:none}.scout-skip{top:30px;right:3px;min-height:36px;padding:5px 10px;font-size:10px}.scout .scout-controls,.scout .scout-results{grid-column:2;grid-row:2;margin:0;min-width:0;min-height:0;overflow:auto;padding:8px;border-radius:9px}.scout-controls h2{font-size:16px;margin:3px 0}.scout-controls p{font-size:11px;margin:5px 0}.scout-actions{display:grid;grid-template-columns:1fr 1fr;gap:4px}.scout-actions button{min-width:0;min-height:44px;padding:5px;font-size:13px}.scout-actions small{font-size:10px}.scout-pool{grid-template-columns:repeat(4,minmax(0,1fr));gap:3px}.scout-pool img{height:32px}.scout-pool small{font-size:10px}.scout-results{z-index:9;position:relative;display:flex;flex-direction:column;gap:4px}.scout-results h2{font-size:17px;margin:0}.result-cards{grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin:0;flex:1;overflow:auto;min-height:0}.scout-card{padding:3px}.scout-card img{height:55px}.scout-card b{font-size:12px}.scout-card small{font-size:10px}#resultDone{flex:none;min-height:40px;padding:4px 10px}
  .modal,.entry-dialog{padding:6px}.modal .paper,.entry-dialog-panel{max-height:calc(100dvh - 20px);overflow:auto;padding:12px 18px;background:#fff8e9;border:2px solid #b69a6e;border-image:none;border-radius:12px}.modal h2{font-size:22px}.modal p{font-size:12px;margin:6px 0}.modal button,.entry-dialog button{min-height:40px}
  .hero-details,#missionDialog{max-height:calc(100dvh - 20px);max-width:calc(100% - 20px);overflow:auto}.detail-header{padding:6px 12px}.detail-body{padding:8px}.detail-tabs{grid-template-columns:repeat(8,minmax(0,1fr));gap:3px;margin-bottom:8px}.detail-tab{min-height:40px;font-size:11px;padding:5px 2px}.detail-layout{grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);gap:10px}.detail-portrait img{max-width:210px}.detail-name{padding:5px 8px}.detail-name h3{font-size:18px}.mission-header{position:sticky;top:0;background:#222936;z-index:1}.mission-header h2{font-size:19px}.mission-row{grid-template-columns:minmax(0,1fr) minmax(80px,auto) 94px;gap:5px;padding:6px}.mission-row .mission-text{grid-column:auto}.mission-row button{min-height:40px}
}
@media (orientation:landscape) and (max-height:360px){
  .bar small{display:none}.bar .logo{margin-right:auto}.home .welcome .wallet{display:grid;grid-template-columns:auto auto;gap:1px 3px}.home .welcome{padding:3px 5px}.home-nav button{font-size:10px;padding:4px 5px}.home .home-nav .primary strong{font-size:11px}.battlebar .stat{padding:2px 3px}.battlebar .secondary{min-height:32px}.bottombar{padding:3px}.controls button{min-height:32px}.controls span{font-size:9px}.battle-roster img{height:22px}.battle-roster button{min-height:44px}.scout-head h1{font-size:16px}
}
/* 短い横画面ではカード内の職業とレベルを一行で扱う。戦闘操作を常に手元に置く。 */
@media (orientation:landscape) and (max-height:600px){
  .home .unitcard small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.2;min-height:0;margin:0;padding:0}
  .home .unitcard b{line-height:1.2}.home .unitcard img{height:38px}.home .unitcard{padding:0 2px 3px;min-height:0}
  .home .info .motions{margin-top:3px}.home .info .skillbox{margin:4px 0}.home .info .detail-entry{margin:0}
  .battle-roster button{min-height:44px}.battle-roster .mini.asset-gauge{width:30px;max-width:95%}.battle-roster img{height:23px}.battle-roster b{font-size:9px;letter-spacing:-.25px}.battle-roster small{font-size:8px;letter-spacing:-.2px}
  .bottombar .controls{position:sticky;top:0;background:#fff9ec;z-index:2;padding-bottom:2px}
  .home .info{display:flex;flex-direction:column;align-items:flex-start}.home .info .motions{order:-1;flex:none}.home .info .eyebrow{display:none}
}
@media (orientation:landscape) and (max-height:600px){
  html,body{height:100dvh}
  .home .info .role{order:-3}.home .info h2{order:-2}
  /* 出撃準備の全カードはHP数値で確認。ゲージは戦闘開始と同時に復帰。 */
  .battle:has(#start:not([hidden])) .battle-roster .mini{display:none}
  .battle:has(#start:not([hidden])) .battle-roster button{min-height:44px}
}
@media (orientation:landscape) and (max-height:360px){
  .battlebar .stat{font-size:9px;padding:2px 3px;gap:1px}.battlebar .ui-icon{width:11px;height:11px}.battlebar .secondary{padding:4px 6px;font-size:9px;min-height:30px}.battlebar .hpbar.asset-gauge{width:43px}.battlebar .boss-stat .hpbar.asset-gauge{width:50px}
  .controls button{min-height:29px}#start,#special{min-height:34px}.controls span{line-height:1.15}
  .battle-roster img{height:18px}.battle-roster b{white-space:normal;overflow-wrap:anywhere;font-size:9px;line-height:1.05}.battle-roster small{font-size:7.5px;line-height:1.1}.battle-roster .mini.asset-gauge{width:26px}
}
