/* Small screens retain every choice; scrolling remains available for enlarged text. */
#app :is(#character-screen,#opponent-screen,#difficulty-screen,#arena-screen,#length-screen) .setup-content,#app #equipment-detail{
  scrollbar-width:thin;scrollbar-color:#b5c78b #123b35;
}
#app .setup-screen .setup-content::-webkit-scrollbar,#app #equipment-detail::-webkit-scrollbar{width:5px;height:5px}
#app .setup-screen .setup-content::-webkit-scrollbar-track,#app #equipment-detail::-webkit-scrollbar-track{background:#123b35;border-radius:8px}
#app .setup-screen .setup-content::-webkit-scrollbar-thumb,#app #equipment-detail::-webkit-scrollbar-thumb{background:#b5c78b;border:1px solid #123b35;border-radius:8px}

@media(max-width:760px) and (orientation:portrait){
  #app :is(#character-screen,#opponent-screen,#difficulty-screen,#arena-screen,#length-screen).setup-screen{
    padding:58px 12px max(8px,env(safe-area-inset-bottom));gap:6px;grid-template-rows:auto minmax(0,1fr) auto;
  }
  #app :is(#character-screen,#opponent-screen,#difficulty-screen,#arena-screen,#length-screen) .setup-head{gap:2px;padding:0;width:100%;align-items:center}
  #app :is(#character-screen,#opponent-screen,#difficulty-screen,#arena-screen,#length-screen) .setup-head h2{font-size:23px;line-height:1.15;letter-spacing:-.6px}
  #app .setup-screen .setup-steps{align-self:center;height:24px}
  #app .setup-screen .setup-step{height:24px;width:29px}
  #app .setup-screen .setup-step[data-state="current"]{width:42px}
  #app .setup-screen .setup-chips{gap:4px;margin:0}
  #app .setup-screen .setup-chips li{padding:2px 7px;font-size:10px}
  #app :is(#character-screen,#opponent-screen,#difficulty-screen,#arena-screen,#length-screen) .setup-content{padding:5px 6px 10px;scroll-padding:6px;overflow-x:hidden}
  #app :is(#character-screen,#opponent-screen,#difficulty-screen,#arena-screen,#length-screen) .setup-footer{gap:8px;padding-top:0;grid-template-columns:minmax(0,.75fr) minmax(0,1.25fr)}
  #app :is(#character-screen,#opponent-screen,#difficulty-screen,#arena-screen,#length-screen) .setup-footer :is(.text-button,.primary){height:60px;min-height:60px;padding:19px 17px 17px;font-size:14px;gap:8px;white-space:nowrap}
  #app #length-screen .setup-footer .primary{height:64px;min-height:64px;padding:20px 22px 18px;font-size:14px}

  /* Keep the duration artwork wide, as in the rest of the game. */
  #app #length-screen .length-options{gap:8px}
  #app #length-screen .length-options .event-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:2px 0 5px}
  #app #length-screen .length-options .event-options .event-card{padding:8px 8px 26px;gap:3px;border-width:3px}
  #app #length-screen .event-kicker{display:none}
  #app #length-screen .event-stamp{top:7px;font-size:8px;padding:2px 5px}
  #app #length-screen .event-art{height:86px;margin-top:20px}
  #app #length-screen .event-duel{gap:4px}
  #app #length-screen .length-options .event-options .event-card strong{font-size:18px;letter-spacing:-.3px}
  #app #length-screen .length-options .event-options .event-card small{font-size:10px;line-height:1.3}
  #app #length-screen .event-check{width:18px;height:18px;right:9px;bottom:7px;font-size:12px}
  #app #length-screen .duration-head h3{font-size:17px;line-height:1.25}
  #app #length-screen .duration-head p{font-size:10px;line-height:1.35;margin-top:3px}
  #app #length-screen .length-options .format-options{grid-template-columns:1fr;gap:7px;padding:3px 0}
  #app #length-screen .length-options .format-options button{grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto;min-height:76px;height:76px;padding:25px 44px 19px;gap:10px;align-content:center;text-align:left}
  #app #length-screen .format-kicker,#app #length-screen .format-scope{display:none}
  #app #length-screen .length-options .format-options button strong{grid-column:1;grid-row:1;max-width:none;justify-self:start;font-size:19px;line-height:1.2;align-self:center;white-space:nowrap;color:#0b2924;text-shadow:none}
  #app #length-screen .length-options .format-options button small{grid-column:2;grid-row:1;font-size:14px;line-height:1.2;text-align:right;color:#0b2924;font-variant-numeric:tabular-nums;text-shadow:none}
  #app #length-screen .length-options .format-options button .selection-mark{width:18px;height:18px;top:43%;right:5%;font-size:12px;border-width:1px}
  #app #length-screen .match-estimate{font-size:10px;line-height:1.35}
  #app #length-screen .tournament-preview{padding:5px 8px;border-radius:8px;text-align:center}
  #app #length-screen .tournament-preview strong{font-size:11px;line-height:1.4}
  #app #length-screen .tournament-preview p{display:none}

  /* Three columns put the five original outfits into two compact rows. */
  #app #character-screen .equipment-content{gap:10px}
  #app #character-screen .equipment-summary{border-width:2px}
  #app #character-screen .equipment-card{padding:8px 6px;gap:3px}
  #app #character-screen .equipment-card h3{font-size:9px;padding:3px 7px}
  #app #character-screen .equipment-card .equipment-model-stage{height:clamp(80px,16dvh,120px)}
  #app #character-screen .equipment-card>strong{font-size:20px;line-height:1.2}
  #app #character-screen .equipment-card .text-button{height:48px;min-height:48px;margin:2px 0 0;padding:12px 20px 15px;font-size:12px}
  #app #character-screen .equipment-content:has(.equipment-picker:not([hidden])){gap:9px;padding-bottom:10px}
  #app #character-screen .equipment-content:has(.equipment-picker:not([hidden])) .equipment-summary{min-height:0}
  #app #character-screen .equipment-content:has(.equipment-picker:not([hidden])) .equipment-card{grid-template-columns:32px minmax(0,1fr);padding:6px 5px;gap:2px 4px}
  #app #character-screen .equipment-content:has(.equipment-picker:not([hidden])) .equipment-card .equipment-model-stage{height:78px}
  #app #character-screen .equipment-content:has(.equipment-picker:not([hidden])) .equipment-card>strong{font-size:15px}
  #app #character-screen .equipment-content:has(.equipment-picker:not([hidden])) .equipment-card .text-button{height:44px;min-height:44px;font-size:11px;padding:11px 11px 14px;gap:4px}
  #app #character-screen .equipment-picker{padding:0 3px 8px}
  #app #character-screen .equipment-picker h3{font-size:17px;margin-bottom:8px;text-align:center}
  #app #character-screen .equipment-picker .character-options,#app #character-screen .racket-options{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px 8px}
  #app #character-screen :is(button.character-option,button.racket-option){padding:6px 4px 0;border-width:2px}
  #app #character-screen :is(button.character-option,button.racket-option)::before{display:none}
  #app #character-screen .equipment-picker .equipment-model-stage,#app #character-screen .racket-option .equipment-model-stage{height:clamp(44px,8.5dvh,66px);margin:2px 0 5px}
  #app #character-screen .equipment-picker button strong,#app #character-screen .equipment-picker .racket-option strong{width:calc(100% + 8px);font-size:14px;padding:6px 3px 7px;border-top-width:2px}
  #app #character-screen .equipment-picker button strong::after{display:none}
  #app #character-screen .equipment-picker .selection-mark{width:17px;height:17px;top:4px;right:4px;font-size:11px;border-width:1px;box-shadow:none}

  /* The detail still shows the original art and all copy, with smaller staging. */
  #app #equipment-detail .equipment-detail-stage{height:clamp(110px,20dvh,165px)}
  #app #equipment-detail .equipment-detail-art{inset:20px 20px 25px}
  #app #equipment-detail .equipment-detail-stage::before{font-size:38px;top:8px}
  #app #equipment-detail .equipment-detail-copy{padding:12px 20px 16px}
  #app #equipment-detail h2{font-size:26px;margin:5px 0 9px}
  #app #equipment-detail blockquote{font-size:16px;line-height:1.3;padding:9px 12px;margin-bottom:14px}
  #app #equipment-detail #equipment-detail-description{font-size:12px;line-height:1.4}
  #app #equipment-detail .equipment-current{margin-top:7px;padding:3px 7px}
  #app #equipment-detail .equipment-detail-actions{margin-top:10px;gap:4px}
  #app #equipment-detail button.equipment-confirm{height:64px;min-height:64px;padding:20px 30px 18px;font-size:16px;gap:12px}
  #app #equipment-detail button.equipment-back{height:50px;min-height:50px;padding:11px 26px 16px;font-size:14px}

  #app #opponent-screen .opponent-content{height:100%;align-self:stretch;padding:7px 26px 15px;scroll-padding:8px}
  #app #opponent-screen .rival-collectible{--rival-art-height:clamp(75px,15dvh,130px);width:min(350px,100%);height:auto;max-height:none;min-height:0}
  #app #opponent-screen .rival-sheet{padding:8px 9px 10px;gap:7px}
  #app #opponent-screen .fighter{gap:5px;height:auto}
  #app #opponent-screen .rival-card-header{min-height:26px}
  #app #opponent-screen .fighter-name{font-size:23px}
  #app #opponent-screen .rival-emblem,#app #opponent-screen .rival-sheet[data-character="classic"] .rival-emblem{width:26px;height:26px;background-size:contain}
  #app #opponent-screen .rival-emblem img,#app #opponent-screen .rival-sheet[data-character="classic"] .rival-emblem img{width:25px;height:25px}
  #app #opponent-screen .rival-dossier{gap:7px;padding:0;border:0;background:none;box-shadow:none}
  #app #opponent-screen .rival-intro .rival-quote{font-size:13px;line-height:1.3;padding:6px 8px 8px;margin:0 0 5px}
  #app #opponent-screen .trait-columns{gap:7px;grid-template-columns:repeat(2,minmax(0,1fr))}
  #app #opponent-screen .rival-traits{gap:5px;padding:5px}
  #app #opponent-screen .rival-traits h4{font-size:9px;padding:3px 4px;letter-spacing:0}
  #app #opponent-screen .rival-traits ul{gap:4px}
  #app #opponent-screen .rival-traits li{font-size:11px;line-height:1.25;padding-left:15px}
  #app #opponent-screen .rival-traits li::before{width:11px;height:12px;top:1px;font-size:10px}
  #app #opponent-screen .rival-arrow{top:36%;width:44px;height:44px;min-width:44px;min-height:44px;padding:11px}
  #app #opponent-screen .rival-arrow.previous{left:-24px}
  #app #opponent-screen .rival-arrow.next{right:-24px}
  #app #opponent-screen .rival-swipe-hint{margin:14px 0 0;font-size:10px}

  #app #difficulty-screen .setup-content{padding-inline:10px}
  #app #difficulty-screen .difficulty.setup-choices{width:100%;grid-template-columns:1fr;gap:8px;padding:5px 0;margin:0}
  #app #difficulty-screen .difficulty .diff-card{display:flex;flex-direction:row;min-height:96px;height:auto;padding:14px 28px;gap:12px;justify-content:flex-start}
  #app #difficulty-screen .diff-face{width:48px;height:48px;flex-shrink:0}
  #app #difficulty-screen .difficulty .diff-card .diff-copy{align-items:flex-start;text-align:left;gap:3px}
  #app #difficulty-screen .difficulty .diff-card strong{font-size:20px}
  #app #difficulty-screen .diff-kicker{display:none}
  #app #difficulty-screen .diff-text{font-size:11px;line-height:1.3;margin:0}
  #app #difficulty-screen .pips{display:none}
  #app #difficulty-screen .difficulty-note{display:none}

  #app #arena-screen .arena-options{display:flex;flex-direction:column;gap:9px;justify-content:flex-start}
  #app #arena-screen .arena-stage{width:100%;height:clamp(100px,20dvh,160px);aspect-ratio:auto;flex-shrink:0}
  #app #arena-screen .arena-preview-badge{top:7px;left:7px;font-size:8px;padding:3px 6px}
  #app #arena-screen .arena-caption{inset:auto 10px 9px;gap:2px}
  #app #arena-screen .arena-caption strong{font-size:19px}
  #app #arena-screen .arena-caption>span{font-size:10px;line-height:1.3}
  #app #arena-screen .arena-side{width:100%;gap:8px}
  #app #arena-screen .arena-choice-section{gap:4px}
  #app #arena-screen .arena-section-title{font-size:10px;margin-bottom:4px}
  #app #arena-screen .arena-choices{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
  #app #arena-screen .arena-choices :is(.clay-court,.locked-option){grid-column:auto;display:flex;align-items:center;justify-content:center;min-height:58px;padding:8px 6px;gap:0}
  #app #arena-screen .court-thumb,#app #arena-screen .arena-name small{display:none}
  #app #arena-screen .arena-name{align-items:center;text-align:center;gap:3px}
  #app #arena-screen .arena-name strong{font-size:12px}
  #app #arena-screen .locked-label{font-size:9px;gap:3px}
  #app #arena-screen .locked-label svg{width:11px;height:11px}
  #app #arena-screen .arena-side .time-mode{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
  #app #arena-screen .arena-side .time-mode button{min-height:55px;padding:8px 22px 8px 8px;gap:6px}
  #app #arena-screen [data-time-of-day="superdark"]{grid-column:auto}
  #app #arena-screen .time-mode button svg{flex-basis:18px;width:18px;height:18px}
  #app #arena-screen .time-copy strong{font-size:12px}
  #app #arena-screen .time-copy small{font-size:9px;line-height:1.25}
  #app #arena-screen .match-summary{display:none}
}
@media(max-width:760px) and (orientation:portrait) and (max-height:620px){
  #app #length-screen .event-art{height:42px}
  #app #length-screen .length-options .event-options .event-card{padding-bottom:23px}
  #app #length-screen .length-options .event-options .event-card small,#app #length-screen .duration-head p{display:none}
  #app #arena-screen .arena-stage{height:95px}
  #app #opponent-screen .rival-collectible{--rival-art-height:80px}
}
@media(max-width:760px) and (orientation:portrait) and (max-height:720px){
  #app #length-screen .length-options{gap:6px}
  #app #length-screen .length-options .event-options .event-card{padding-bottom:20px}
  #app #length-screen .length-options .event-options .event-card small,#app #length-screen .duration-head p{display:none}
  #app #length-screen .length-options .format-options{gap:6px}
  #app #length-screen .length-options .format-options button{height:64px;min-height:64px;padding:23px 44px 13px}
  #app #length-screen .length-options .format-options button strong{font-size:18px}
}
@media(max-width:340px) and (orientation:portrait){
  #app #length-screen .length-options .format-options button{padding-inline:36px;gap:8px}
  #app #length-screen .length-options .format-options button strong{font-size:17px}
  #app #length-screen .length-options .format-options button small{font-size:13px}
}

/* Grow the artwork into the space between heading and navigation. Keep the
   compact overview when a picker is open so every option remains reachable. */
@media(max-width:760px) and (orientation:portrait){
  #app #character-screen .equipment-content:not(:has(.equipment-picker:not([hidden]))) .equipment-summary{
    flex:1;min-height:420px;grid-template-columns:1fr;grid-template-rows:repeat(2,minmax(0,1fr));
  }
  #app #character-screen .equipment-content:not(:has(.equipment-picker:not([hidden]))) .equipment-card{
    min-height:0;padding:10px 12px;gap:4px;
  }
  #app #character-screen .equipment-content:not(:has(.equipment-picker:not([hidden]))) .equipment-model-stage{
    flex:1;height:auto;min-height:100px;
  }
  #app #character-screen .equipment-content:not(:has(.equipment-picker:not([hidden]))) .equipment-card .text-button{
    width:min(300px,100%);flex-shrink:0;
  }
  #app #opponent-screen .rival-collectible{
    flex:1 0 340px;width:100%;min-height:340px;
  }
  #app #opponent-screen .opponent-content{padding-block:16px 32px}
  #app #opponent-screen .rival-pile{height:100%}
  #app #opponent-screen .rival-sheet{
    height:100%;grid-template-rows:minmax(170px,1fr) auto;
  }
  #app #opponent-screen .fighter{
    height:100%;min-height:0;grid-template-rows:auto minmax(130px,1fr);
  }
  #app #opponent-screen .fighter-stage{height:100%;min-height:130px}
  #app #opponent-screen .rival-arrow{top:40%}
  #app #difficulty-screen .difficulty.setup-choices{
    flex:1;grid-template-rows:repeat(3,minmax(96px,1fr));
  }
  #app #difficulty-screen .difficulty .diff-card{height:100%}
  #app #arena-screen .arena-stage{flex:1 0 100px;height:auto;max-height:none}
  #app #arena-screen .arena-side{flex-shrink:0}
}
@media(max-width:760px) and (orientation:portrait) and (max-height:620px){
  #app #character-screen .equipment-content:not(:has(.equipment-picker:not([hidden]))) .equipment-summary{
    min-height:260px;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr);
  }
}
