/* Phone play surfaces. The full collector card and desktop fan remain available. */
.hand-pager,.selection-bar .phone-instruction{display:none}
@media (max-width:760px), (orientation:landscape) and (max-height:540px) and (max-width:1100px){
  body{--safe-l:env(safe-area-inset-left,0px);--safe-r:env(safe-area-inset-right,0px);--safe-t:env(safe-area-inset-top,0px);--safe-b:env(safe-area-inset-bottom,0px);-webkit-text-size-adjust:100%;text-size-adjust:100%}
  body #app{box-sizing:border-box;padding:var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l)}
  .modal-backdrop{padding:max(6px,var(--safe-t)) max(8px,var(--safe-r)) max(8px,var(--safe-b)) max(8px,var(--safe-l))}
  body .modal{max-width:100%;max-height:calc(100dvh - var(--safe-t) - var(--safe-b) - 18px);overscroll-behavior:contain}
  .modal>header button{min-width:44px;min-height:44px}
  /* Native ruby reserves space on the same line as its own word.
     The old absolute labels overlapped whenever a longer name wrapped. */
  body ruby.place-ruby{display:ruby;position:static;vertical-align:baseline;margin:0;min-inline-size:0;line-height:inherit;ruby-position:over;ruby-align:center;white-space:nowrap}
  body :is(#app,#modal-root) ruby.place-ruby>rt{display:ruby-text;position:static;inset:auto;transform:none;width:auto;margin:0;padding:0;font:700 max(11px,.55em)/1.05 var(--reading-font),sans-serif!important;letter-spacing:0;text-shadow:none}
  .reader-origin,.reader-story p,.reader-copy .reader-lead,.explore-place h1,.modal h2,.modal h3,.note-page p{line-height:1.85}
  .explore-place h1,.reader-copy h3{overflow:visible}
  body.is-map .map-node span:has(ruby){padding:3px 6px;line-height:1.55}
  body .atlas-town .atlas-reading{font-size:19px;paint-order:stroke;stroke:#fff1d3;stroke-width:3px;stroke-linejoin:round}
  .topbar.exploration-topbar{padding-inline:6px;gap:5px}
  body:is(.is-battle,.is-map) .exploration-topbar{height:48px;padding-block:2px}
  body .exploration-topbar .explore-menu{min-width:42px;min-height:42px;justify-content:center;padding:2px 5px}
  .exploration-topbar nav{gap:3px}
  .exploration-topbar .explore-menu span{font-size:10px}
  .is-battle .battle-controls{border-radius:18px;background:#fffaf4;border:1px solid #c8dfe3;box-shadow:0 2px 0 #bfd5da;margin:0}
  .is-battle .battle-controls .selection-bar{display:flex!important;justify-content:space-between;align-items:center;min-width:0;gap:5px;margin:0;padding:0 5px;background:transparent;border:0;box-shadow:none}
  .is-battle .selection-bar .desk-instruction{display:none}
  .is-battle .selection-bar .phone-instruction{display:inline-block;color:#24465d;font-size:15px;font-weight:800;line-height:1.2}
  .is-battle .selection-bar.has-selection .phone-instruction{color:#803353}
  .is-battle .selection-bar.has-selection .quiet{order:1;min-height:34px;padding:3px 7px}
  .hand-pager{display:flex;order:2;gap:4px;margin-left:auto}
  .hand-pager button{font:800 26px/1 system-ui;padding:0;width:44px;height:36px;border-radius:12px;color:#244d69;background:#eaf7fb;border:1px solid #80afc4;box-shadow:0 2px #b2cfdb;cursor:pointer}
  .hand-pager button:disabled{color:#697c85;background:#f2f4f4;border-color:#c5d1d5;box-shadow:none;cursor:default}
  .hand-pager button span{display:inline-block}
  .hand-pager[data-axis=y] button span{transform:rotate(90deg)}
  .is-battle .battle-controls .fan-hand{width:100%;height:auto;max-width:none;box-sizing:border-box;min-height:0;min-width:0;justify-content:start;align-content:start;align-items:start;margin:0;gap:12px;overscroll-behavior:contain;scrollbar-color:#84b1be #edf4f5;scrollbar-width:thin}
  .is-battle .fan-hand .hand-slot,.is-battle .fan-hand .hand-slot:is(:hover,:focus-within):not(:has(.selected)),.is-battle .fan-hand .hand-slot:has(.selected){transform:none;justify-self:center}
  .is-battle .hand-slot .card-wrap.selected>.game-card{outline:3px solid #087d83;outline-offset:2px}
  .is-battle .fan-hand .card-under{height:24px;min-height:24px;margin:0}
  .is-battle .fan-hand .info-button{height:26px;min-height:26px;width:48px;border-radius:0 0 9px 9px;box-shadow:none}
  .is-battle .fan-hand .info-button svg{height:16px;width:16px}
  .is-battle .battle-controls .turn-bar .pile-button{justify-self:stretch;min-height:42px;min-width:0;display:grid;place-content:center;justify-items:center;gap:0;font-size:12px;padding:0;margin:0!important}
  .is-battle .battle-controls .pile-button b{font:800 17px/1 system-ui}
  .is-battle .battle-controls .pile-button span{font-size:11px}
  .is-battle .battle-controls .turn-bottom{align-self:center;margin:0}
  .is-battle .battle-controls .turn-bottom .btn{min-height:44px;padding:6px;font-size:14px}
  .is-battle .battle-log{display:none}
  .is-battle .battle-controls .turn-bar .energy-meter{min-width:0;padding:2px 6px;margin:0;align-self:center;justify-self:stretch}
  .is-battle .energy-meter .meter-label{font-size:11px}
  .is-battle .energy-meter .meter-value strong{font-size:26px}
  .is-battle .energy-meter .meter-value small{font-size:14px}
  .is-battle .energy-meter .meter-value svg{width:14px;height:19px}
  .is-battle .arena .combatant,.is-battle .arena .combatant-target{min-width:0}
  .is-battle .arena .combatant-label b{font-size:12px;line-height:1.2}
  .is-battle .enemy-party{gap:4px}
  .is-battle .arena .combatant-label{max-width:100%;padding:2px 3px}
  .is-battle .arena .overhead span,.is-battle .arena .overhead em{font-size:11px;line-height:1.1}
  .is-battle .arena.party-size-3 .overhead{min-width:0;grid-template-columns:1fr}
  .is-battle .arena.party-size-3 .enemy-party .overhead>span,.is-battle .arena.party-size-3 .enemy-party .overhead>em{font-size:10px}
  .is-battle .battle-controls:not(:has(.fan-hand)){display:flex;justify-content:space-between;gap:6px;padding:5px 8px}
  .is-battle .battle-controls:not(:has(.fan-hand)) .pile-button{min-width:44px}
  /* Small printed cards: present just the region, name, illustration, a
     short line and the combat values. The complete card opens on demand. */
  @container (max-width:234px){
    .card-wrap>.game-card,.card-wrap>.game-card:not(:has(.card-effect)),.hand .card-wrap>.game-card,.hand .card-wrap>.game-card:not(:has(.card-effect)){
      grid-template-rows:26px 0 minmax(36px,auto) minmax(0,1fr) 0 minmax(28px,auto) 0 36px;padding:3px!important}
    .game-card .card-region{font-size:13px!important;padding:0 1px 0 14px!important;overflow:visible}
    .game-card .region-seal{display:none}
    .game-card .card-place,.game-card .card-edition{display:none!important}
    .game-card .card-title,.game-card p.card-fact{border:0}
    .game-card .card-title strong,.hand .game-card .card-title strong{font-size:15px!important;line-height:1.25!important;text-wrap:balance}
    .game-card .card-title,.game-card .card-art{align-self:stretch;grid-column:1}
    .game-card p.card-fact,.hand .game-card p.card-fact{font-size:12px!important;line-height:1.25!important;padding:1px 2px!important;display:grid!important;place-content:center}
    .game-card:has(.card-effect) p.card-fact{display:none!important}
    .hand .game-card:has(.card-effect) p.card-fact{display:none!important}
    .card-wrap .game-card .card-effect{grid-row:6;font-size:12px!important;line-height:1.2!important;padding:1px 2px!important;text-wrap:balance}
    .game-card .card-stats span,.hand .game-card .card-stats span{font-size:11px!important}
    .game-card .card-stats b,.hand .game-card .card-stats b,.game-card .card-heal b{font-size:20px!important}
    .game-card .card-heal>span{font-size:13px!important}.game-card .card-heal small{font-size:10px!important}
    .game-card .cost-badge{--badge-size:30px;top:-5px;left:-6px}.game-card .cost-badge>b{font-size:18px!important}
  }
  .card-reader .reader-copy h3{line-height:1.6}
  .upgrade-select-grid,.catalog-grid{align-items:start}
  .modal .reader-story p,.note-page>p{font-size:17px}
  .is-battle dialog.battle-quiz{width:min(620px,calc(100% - var(--safe-l) - var(--safe-r) - 18px));max-height:calc(100dvh - var(--safe-t) - var(--safe-b) - 18px)}
}
@media (max-width:760px) and (orientation:portrait){
  .is-battle main.battle-screen{grid-template-rows:auto minmax(0,1fr) auto;grid-template-areas:'heading tools' 'arena arena' 'controls controls';gap:5px;padding:4px 6px 5px}
  .is-battle .battle-controls{--fan-card:clamp(130px,min(39vw,23dvh),168px);grid-template-columns:minmax(67px,1fr) 44px 44px minmax(120px,1.6fr);grid-template-rows:auto auto 48px;gap:1px 6px;padding:3px 6px 5px}
  .is-battle .battle-controls .selection-bar{grid-column:1/-1;grid-row:1}
  .is-battle .battle-controls .fan-hand{--tray-axis:x;grid-column:1/-1;grid-row:2;display:flex;overflow-x:auto;overflow-y:hidden;padding:8px 9px 3px;scroll-padding-inline:9px;touch-action:pan-x pinch-zoom}
  .is-battle .fan-hand .game-card{touch-action:pan-x pinch-zoom}
  .is-battle .fan-hand .hand-slot{flex:0 0 var(--fan-card)}
  .is-battle .battle-controls .turn-bar .energy-meter{grid-column:1;grid-row:3;flex-direction:column;height:44px}
  .is-battle .battle-controls .turn-bar .pile-button{grid-column:2;grid-row:3}
  .is-battle .battle-controls .turn-bar .discard-pile{grid-column:3}
  .is-battle .battle-controls .turn-bottom{grid-column:4;grid-row:3}
  .is-battle .battle-controls:not(:has(.fan-hand)){flex:none}
  .is-battle .arena.party-size-3{grid-template-columns:minmax(0,.92fr) minmax(0,2.65fr);gap:6px}
  .is-battle .arena .combatant{grid-template-rows:clamp(45px,9dvh,68px) minmax(0,1fr)}
  .is-battle .arena .combatant-target{grid-template-rows:minmax(0,1fr) auto 37px}
  .is-battle .arena .combatant-label b{font-size:11px}
  .is-battle .arena .hp-numbers strong{font-size:21px}
  .is-battle .arena .hp-numbers span{font-size:11px}
}
@media (orientation:landscape) and (max-height:540px) and (max-width:1100px){
  body:is(.is-battle,.is-map,.is-exploring) .exploration-topbar{height:42px;min-height:0;padding-block:0}
  body .exploration-topbar .explore-menu{flex-direction:row;align-items:center;gap:4px;min-width:44px;min-height:38px;height:38px;padding:2px 6px}
  body.is-exploring #app{min-height:0}
  .is-battle main.battle-screen{grid-template-columns:minmax(0,.94fr) minmax(0,1.12fr);grid-template-rows:auto minmax(0,1fr);grid-template-areas:'heading tools' 'arena controls';padding:2px 6px 5px;gap:3px 7px}
  .is-battle .battle-heading .eyebrow{display:none}.is-battle .battle-heading h1{font-size:15px}.is-battle .battle-heading .enemy-count{max-width:none;font-size:11px}
  .is-battle .battle-strategy-bar{justify-content:flex-end}.is-battle .battle-strategy-bar .charm-art{width:22px;height:22px}
  .is-battle .battle-controls{grid-template-columns:minmax(54px,.8fr) 42px 42px minmax(102px,1.4fr);grid-template-rows:36px minmax(0,1fr) 44px;height:100%;min-height:0;align-items:stretch;gap:2px 4px;padding:2px 5px 4px;box-sizing:border-box}
  .is-battle .battle-controls .selection-bar{grid-column:1/-1;grid-row:1}
  .is-battle .battle-controls .fan-hand{--tray-axis:y;grid-column:1/-1;grid-row:2;align-self:stretch;display:grid;grid-template-columns:repeat(auto-fit,minmax(121px,1fr));grid-auto-rows:max-content;overflow:auto;overflow-x:hidden;padding:8px 8px 10px;touch-action:pan-y pinch-zoom;scroll-padding-block:8px}
  .is-battle .fan-hand .game-card{touch-action:pan-y pinch-zoom}
  .is-battle .fan-hand .hand-slot{width:100%;max-width:154px}
  .is-battle .battle-controls .turn-bar .energy-meter{grid-column:1;grid-row:3;flex-direction:column;gap:0}
  .is-battle .battle-controls .turn-bar .pile-button{grid-column:2;grid-row:3}
  .is-battle .battle-controls .turn-bar .discard-pile{grid-column:3}
  .is-battle .battle-controls .turn-bottom{grid-column:4;grid-row:3}
  .is-battle .arena{grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);padding-inline:5px}
  .is-battle .arena.party-size-3{grid-template-columns:minmax(0,.9fr) minmax(0,2.7fr)}
  .is-battle .arena.party-size-2{grid-template-columns:minmax(0,.95fr) minmax(0,2fr)}
  .is-battle .arena .combatant{grid-template-rows:47px minmax(0,1fr)}
  .is-battle .arena .combatant-target{grid-template-rows:minmax(0,1fr) auto 36px}
  .is-battle .arena .combatant-label b{font-size:11px}.is-battle .arena .hp-numbers strong{font-size:20px}
  .is-battle main.battle-screen:has(dialog.battle-quiz){grid-template-areas:'heading tools' 'arena arena'}
  .is-battle .battle-controls:not(:has(.fan-hand)){height:auto;align-self:end;flex-wrap:wrap}
  .quick-charms{grid-template-columns:repeat(3,minmax(0,1fr))}.quick-charms .charm-choice .charm-pick{display:flex;flex-direction:column;align-items:center;gap:2px}.quick-charms .charm-pick .charm-art{height:62px;width:62px}
  .modal-body:has(.card-reader),.modal-body:has(.hand-zoom){padding:12px}
  .card-reader{grid-template-columns:minmax(0,.85fr) minmax(0,1.3fr);align-items:start}
  .hand-zoom{grid-template-columns:minmax(0,1fr) auto;align-items:center}.modal-hand-zoom .hand-zoom>.card-wrap{width:min(52dvh,230px);max-width:none}
  .modal-hand-zoom .hand-zoom>.btn{min-height:44px}
  .reward-pick{padding-block:7px;gap:8px}.reward-offer{max-width:min(94%,147dvh);gap:18px}
}


@media (max-width:760px), (orientation:landscape) and (max-height:540px) and (max-width:1100px){
  .is-battle .battle-controls .selection-bar .phone-instruction{visibility:visible;flex:0 1 auto;text-align:left}
  .is-battle .hand-pager button{color:#244d69}
  .is-battle .hand-pager button:disabled{opacity:.6}
  @container (max-width:234px){
    .game-card .card-heal{grid-template-rows:minmax(0,1fr) 11px;align-items:center;align-content:center}
    .game-card .card-heal>span{line-height:1.1}.game-card .card-heal b{line-height:1}
    .game-card .card-stats>div{grid-template-rows:12px minmax(0,1fr)!important}
    .game-card .card-stats :is(b,span){align-self:center}
    .card-wrap>.game-card:not([data-action="select-card"]){grid-template-rows:27px 26px minmax(36px,auto) minmax(0,1fr) 0 minmax(30px,auto) 0 37px}
    .game-card:not([data-action="select-card"]) .card-place{display:flex!important;flex-wrap:nowrap;align-items:center;padding:1px 0!important}
    .game-card .card-place>span,.game-card .card-place{font-size:12px!important;line-height:1.25!important}
    .card-wrap>.game-card .card-edition{display:flex!important;grid-area:4/1;align-self:end;justify-self:start;width:max-content;height:auto;z-index:1;pointer-events:none;border:0;background:#fff8ebf5;color:#433738;border-radius:0 5px 0 0;padding:1px 3px!important;font:800 10px/1.2 var(--reading-font)!important}
    .card-edition small{display:none}
  }
  @container (min-width:235px){
    .card-wrap>.game-card,.card-wrap>.game-card:not(:has(.card-effect)){grid-template-rows:9fr 9fr 12fr 38fr 5fr 10fr 6fr 11fr}
    .card-wrap>.game-card:not(:has(.card-effect)){grid-template-rows:9fr 9fr 12fr 40fr 5fr 14fr 0 11fr}
    .game-card .card-place>span{font-size:max(13px,3.5cqw)!important}
  }
}
@media (orientation:landscape) and (max-height:540px) and (max-width:1100px){
  .is-battle main.battle-screen{grid-template-areas:'heading controls' 'arena controls';grid-template-rows:31px minmax(0,1fr)}
  .is-battle .battle-heading{padding-right:40px}.is-battle .battle-heading h1{line-height:1.2}
  .is-battle .battle-heading .enemy-count{font-size:10px;line-height:1.2}
  .is-battle .battle-strategy-bar{grid-area:heading;justify-self:end;align-self:center}
  .is-battle .battle-strategy-bar .charm-status{min-width:32px;min-height:29px;padding:1px 4px}
  .is-battle .battle-strategy-bar .charm-status>b,.is-battle .battle-strategy-bar .charm-status>span{display:none}
  .is-battle .battle-controls .fan-hand{container-type:size;grid-template-columns:repeat(auto-fit,minmax(124px,1fr));column-gap:9px}
  .is-battle .fan-hand .hand-slot{max-width:clamp(104px,calc((100cqh - 2px) / 1.5),157px)}
  .is-battle .fan-hand .card-under{position:absolute;top:-4px;right:-3px;width:auto;height:auto;min-height:0;padding:0;z-index:3}
  .is-battle .fan-hand .info-button{height:27px;min-height:27px;width:27px;border-radius:50%;background:#fffdf3}
  .is-battle .fan-hand .game-card .card-region{padding:0!important;font-size:12px!important}
  .is-battle .fan-hand .card-title strong{font-size:14px!important}
  .is-battle .battle-controls .turn-bar .energy-meter{height:42px}
  .modal-hand-zoom .hand-zoom>.card-wrap{width:clamp(240px,60dvh,310px)}
}


@media (orientation:portrait) and (max-width:760px) and (max-height:680px){
  .is-battle .battle-controls{--fan-card:clamp(120px,34vw,138px);padding-block:2px 3px;grid-template-rows:auto auto 45px}
  .is-battle .fan-hand .card-under{position:absolute;top:-4px;right:-3px;width:auto;height:auto;min-height:0;padding:0;z-index:3}
  .is-battle .fan-hand .info-button{width:28px;height:28px;min-height:28px;border-radius:50%;background:#fffdf3}
  .is-battle .fan-hand .game-card .card-region{padding:0!important}
  .is-battle .battle-strategy-bar .charm-status{padding:1px 4px;min-height:30px}
  .is-battle .arena .combatant{grid-template-rows:37px minmax(0,1fr)}
  .is-battle .arena .overhead{min-height:0;padding:2px 4px}.is-battle .arena .overhead b{font-size:17px}
  .is-battle .arena .combatant-target{grid-template-rows:minmax(0,1fr) auto 30px}
  .is-battle .arena .combatant-label{padding-block:0}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:540px){
  .modal-hand-zoom .hand-zoom>.card-wrap{width:min(295px,calc((100dvh - var(--safe-t) - var(--safe-b) - 66px)/1.5))}
  .is-battle .battle-heading{display:grid;justify-content:start;gap:0}
  .is-battle .battle-heading h1{white-space:nowrap;font-size:14px}
  .is-battle .battle-heading .enemy-count{text-align:left;line-height:1.1}
}
@media (orientation:landscape) and (max-width:1100px) and (max-height:380px){
  .is-battle .fan-hand .hand-slot{max-width:clamp(109px,calc((100cqh - 2px) / 1.5),146px)}
  .is-battle .hand .card-wrap>.game-card,.is-battle .hand .card-wrap>.game-card:not(:has(.card-effect)){grid-template-rows:24px 0 minmax(33px,auto) minmax(0,1fr) 0 0 0 32px}
  .is-battle .hand .game-card p.card-fact,.is-battle .hand .card-wrap .game-card .card-effect{display:none!important}
  .is-battle .hand .game-card .card-title strong{font-size:14px!important}
}


.phone-card-kind{display:none}
@media (max-width:760px), (orientation:landscape) and (max-height:540px) and (max-width:1100px){
  .is-map .full-trail .journey-layout .map-window{flex:1 1 0%;height:100%;min-height:0}
  .is-map .full-trail .map-node>span{width:max-content;max-width:min(108px,28vw);text-wrap:balance;overflow-wrap:normal}
  .is-map .full-trail .map-node.node-battle>span{font-size:12px!important;line-height:1.3;padding:3px 4px}
  .modal .catalog-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,155px),1fr));gap:20px 14px}
  .modal .catalog-grid>.card-wrap{width:min(100%,255px);justify-self:center}
  @container (max-width:234px){
    .game-card:not([data-action="select-card"]) .card-place>span:not(.card-location){display:none!important}
    .game-card:not([data-action="select-card"]) .phone-card-kind{display:inline}
  }
}
@media (max-width:540px) and (orientation:portrait){
  .reward-pick{align-content:center;width:100%;min-width:0;padding:16px 0;gap:18px}
  .reward-pick .reward-offer{box-sizing:border-box;width:100%;display:flex;justify-content:flex-start;align-items:start;gap:16px;overflow-x:auto;padding:14px 18px 12px;scroll-snap-type:x proximity;scroll-padding-inline:18px;scrollbar-color:#8fb8c1 #edf3f5}
  .reward-pick .reward-offer>.card-wrap,.reward-pick .reward-offer>.card-wrap:last-child{flex:0 0 clamp(199px,58vw,232px);width:auto;scroll-snap-align:start}
}
@media (orientation:landscape) and (max-height:540px) and (max-width:1100px){
  .is-map .full-trail .town-atlas{display:block;overflow:auto}
  .is-map .full-trail .town-atlas>svg{display:block;min-height:290px;margin-inline:auto}
}

