/* 21:9 플레이 스테이지(.play-stage) 기준 반응형 — 뷰포트가 아니라 스테이지 크기에 맞춤 */

/* ----- 좁은 스테이지 폭 ----- */
@container play (max-width:900px){
  .top-bar{
    gap:var(--gap-2);
    padding:6px 10px;
    min-height:44px;
  }
  .screen-title{font-size:var(--fs-md)}
  .pill{padding:3px 8px;font-size:11px;gap:4px}
  .pill b{font-size:var(--fs-md)}
  .icon-btn{min-width:40px;min-height:40px;border-radius:12px;font-size:var(--fs-md)}

  .side-menu{
    left:8px;
    width:clamp(100px,16cqw,124px);
    gap:8px;
  }
  .side-menu button{
    min-height:48px;
    border-width:3px;
    border-radius:14px;
    font-size:var(--fs-lg);
    padding:8px 8px;
    box-shadow:
      inset 0 2px 0 rgba(255,255,255,.65),
      inset 0 -1px 0 rgba(120,80,30,.1),
      0 4px 0 rgba(90,55,25,.28);
  }
  .side-menu button:active{
    transform:translateY(2px);
    box-shadow:inset 0 1px 0 rgba(255,255,255,.4),0 1px 0 rgba(90,55,25,.28);
  }

  .lobby-battle-btns{right:10px;bottom:10px;gap:8px}
  .main-battle-btn{
    right:10px;
    bottom:10px;
    min-width:168px;
    min-height:56px;
    padding:8px 14px;
    border-width:3px;
    border-radius:16px;
    gap:1px;
    box-shadow:
      inset 0 2px 0 rgba(255,255,255,.45),
      inset 0 -2px 0 rgba(0,0,0,.12),
      0 5px 0 #b85e10,
      0 8px 14px rgba(160,80,20,.22);
  }
  .main-battle-btn b{font-size:var(--fs-xl)}
  .main-battle-btn small{font-size:11px}
  .main-battle-btn:active{
    transform:translateY(3px);
    box-shadow:inset 0 2px 0 rgba(255,255,255,.3),0 2px 0 #b85e10,0 4px 8px rgba(160,80,20,.2);
  }

  .lobby-sky-title{
    top:clamp(4px, 1.5cqh, 12px);
    width:min(96%, 1120px);
    max-height:clamp(112px, 36cqh, 240px);
  }
  .game-title-logo{height:clamp(36px, 7.5cqh, 51px);max-width:min(60%, 300px)}
  .loading-logo{max-height:120px}
  .lobby-base{width:clamp(140px,36cqh,280px);top:90%}
  .lobby-actor img{height:calc(clamp(40px,10cqh,72px) * var(--lobby-scale, 1))}
  .lobby-actor.rep img{height:calc(clamp(48px,12cqh,88px) * var(--lobby-scale, 1))}

  .stage-select-body{gap:var(--gap-2);padding:var(--gap-2)}
  .stage-node{min-height:70px;border-radius:14px;border-width:2px}
  .stage-node b{font-size:var(--fs-lg)}
  #screen-companion-list,#screen-party-edit{
    --unit-card-w:102px;
    --unit-card-h:136px;
    --unit-card-pad:8px;
    --unit-card-img:48px;
    --unit-card-radius:14px;
    --unit-card-gap:12px;
    --party-slot-size:80px;
  }
  .party-scroll-btn{width:36px;border-radius:12px;font-size:15px}
  .party-hint{padding:4px 12px;font-size:12px}

  .detail-body{gap:var(--gap-2);padding:var(--gap-2)}
  .detail-left img{width:min(22cqh,120px);height:min(22cqh,120px)}
  .primary-btn{min-height:44px;padding:9px 18px;font-size:var(--fs-lg);border-width:2px}
  .text-btn{min-height:38px;padding:7px 12px;font-size:var(--fs-sm);border-width:2px}
  .grow-btn{min-height:42px;font-size:var(--fs-md)}

  .mana-block{width:118px}
  .mana-line b{font-size:var(--fs-lg)}
  .mana-up-btn{min-height:38px;padding:4px 6px;font-size:12px;border-radius:8px;box-shadow:inset 0 1px 0 rgba(255,255,255,.45),0 2px 0 #1b7d70}
  .mana-up-title{font-size:12px}
  .mana-up-cost{font-size:9px}
  .summon-card{
    max-width:none;max-height:74px;
    width:clamp(48px, 10cqw, 64px);height:100%;
    border-radius:10px;border-width:2px;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.55),0 2px 0 rgba(90,55,25,.25);
  }
  .summon-card img{width:26px;height:26px}
  .summon-card .cost{font-size:var(--fs-sm)}
  .card-scroll-btn{width:28px;max-height:74px;border-radius:10px;border-width:2px;font-size:12px;box-shadow:inset 0 1px 0 rgba(255,255,255,.55),0 2px 0 rgba(90,55,25,.22)}
  .energy-pot-btn{flex-basis:54px;border-radius:10px;font-size:11px}
  .energy-pot-btn::before{font-size:16px}
  .battle-bottom{
    max-height:min(104px,26cqh);padding:4px 8px;gap:6px;
  }
  .card-row{gap:4px}
  .battle-top{padding:6px 8px}
  .battle-mid .icon-btn{min-width:36px;min-height:34px;font-size:var(--fs-sm)}

  .dialog{padding:var(--gap-4);max-width:min(440px,92cqw)}
  .result-dialog{max-height:100%}
  .result-dialog-body{padding:14px 14px 8px;gap:8px}
  .result-dialog-actions{padding:8px 14px 12px;gap:6px}
  #resultTitle{font-size:var(--fs-xl)}
  .result-stats div{padding:6px 10px}

  .settings-body{padding:var(--gap-4);gap:var(--gap-3)}
  .setting-row{padding:12px 14px;border-width:2px}
  .toggle-switch{width:96px;height:40px}
  .toggle-switch .toggle-knob{width:26px;height:26px;left:50px}
  .toggle-switch[aria-pressed="false"] .toggle-knob{left:5px}
}

/* ----- 짧은 스테이지 높이 (가로 폰) ----- */
@container play (max-height:500px){
  .app-shell{
    --fs-xs:11px;
    --fs-sm:12px;
    --fs-base:13px;
    --fs-md:13px;
    --fs-lg:15px;
    --fs-xl:17px;
    --fs-2xl:20px;
    --fs-3xl:22px;
  }

  .top-bar{min-height:38px;padding-top:4px;padding-bottom:4px}
  .icon-btn{min-width:34px;min-height:34px;border-radius:10px;box-shadow:inset 0 1px 0 rgba(255,255,255,.4),0 2px 0 #5c3e1c}
  .icon-btn:active{transform:translateY(2px);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #5c3e1c}

  .side-menu{
    top:50%;
    transform:translateY(-50%);
    gap:6px;
    width:clamp(94px,15cqw,112px);
  }
  .side-menu button{
    min-height:44px;
    height:auto;
    padding:7px 8px;
    border-width:2px;
    border-radius:12px;
    font-size:15px;
    line-height:1.15;
    white-space:nowrap;
    flex-shrink:0;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,.65),
      0 3px 0 rgba(90,55,25,.28);
  }
  .side-menu button:active{
    transform:translateY(1px);
    box-shadow:inset 0 1px 0 rgba(255,255,255,.4),0 1px 0 rgba(90,55,25,.28);
  }

  .lobby-battle-btns{gap:6px}
  .main-battle-btn{
    min-width:150px;
    min-height:50px;
    padding:6px 12px;
    border-width:3px;
    border-radius:14px;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,.45),
      0 3px 0 #b85e10,
      0 6px 10px rgba(160,80,20,.2);
  }
  .main-battle-btn b{font-size:18px;line-height:1.15}
  .main-battle-btn small{font-size:11px;line-height:1.2}
  .main-battle-btn em{margin-top:2px;padding:2px 7px;font-size:10px}
  .main-battle-btn:active{
    transform:translateY(2px);
    box-shadow:inset 0 1px 0 rgba(255,255,255,.3),0 1px 0 #b85e10;
  }

  .lobby-sky-title{
    top:clamp(3px, 1cqh, 10px);
    width:min(96%, 840px);
    max-height:clamp(88px, 30cqh, 176px);
  }
  .game-title-logo{height:33px;max-width:min(54%, 240px)}
  .loading-logo{max-height:96px}
  .lobby-base{width:clamp(110px,32cqh,200px)}
  .lobby-actor img{height:calc(clamp(32px,9cqh,56px) * var(--lobby-scale, 1))}
  .lobby-actor.rep img{height:calc(clamp(38px,11cqh,68px) * var(--lobby-scale, 1))}
  .lobby-actor .name-tag{font-size:10px;padding:1px 6px}

  .stage-select-body{flex-direction:row;padding:6px;gap:6px}
  .stage-node-map{
    grid-template-columns:repeat(auto-fill,minmax(72px,1fr));
    gap:6px;max-height:none;
  }
  .stage-node{min-height:56px;padding:4px;border-radius:12px}
  .stage-node b{font-size:var(--fs-md)}
  .stage-detail{border-width:3px}
  .stage-detail-body{padding:10px 12px 8px;gap:var(--gap-2)}
  .stage-detail-foot{padding:8px 12px 10px}
  .preview-enemies img{width:40px;height:40px;padding:2px}
  .party-preview img{width:32px;height:32px;padding:1px}

  #screen-party-edit,#screen-companion-list{
    min-height:0;overflow:hidden;
    --unit-card-w:88px;
    --unit-card-h:118px;
    --unit-card-pad:6px;
    --unit-card-img:40px;
    --unit-card-radius:12px;
    --unit-card-gap:10px;
    --party-slot-size:64px;
  }
  .party-slots-bar{padding:6px 8px 0;gap:6px}
  .party-scroll-btn{width:32px;border-radius:10px;font-size:14px}
  .party-slot{border-width:3px;border-radius:12px}
  .party-slot .slot-no{font-size:11px;top:2px;left:5px}
  .party-hint{
    padding:2px 10px;font-size:10px;line-height:1.25;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:0;
  }
  .companion-grid,.party-roster{padding:6px 10px 10px}

  .detail-body{flex-direction:row;padding:6px;gap:6px}
  .detail-left{padding:var(--gap-2);border-width:3px}
  .detail-right{border-width:3px}
  .detail-right-scroll{padding:10px 12px 8px;gap:var(--gap-2)}
  .detail-levelup-foot{padding:8px 12px 10px;gap:4px}
  .detail-left img{width:min(28cqh,96px);height:min(28cqh,96px)}
  .levelup-row{gap:6px}
  .primary-btn{
    min-height:40px;padding:8px 14px;font-size:var(--fs-md);border-width:2px;
    box-shadow:inset 0 2px 0 rgba(255,255,255,.45),0 3px 0 var(--green-dark);
  }
  .text-btn{min-height:34px;padding:6px 10px;border-width:2px;box-shadow:inset 0 1px 0 rgba(255,255,255,.65),0 2px 0 rgba(90,55,25,.28)}
  .grow-btn{min-height:36px;font-size:var(--fs-sm);border-width:2px;box-shadow:inset 0 1px 0 rgba(255,255,255,.45),0 3px 0 var(--green-dark)}

  .battle-bottom{max-height:min(96px,28cqh);padding:3px 6px;gap:4px;align-items:stretch}
  .mana-block{width:108px;gap:2px}
  .mana-line b{font-size:var(--fs-md)}
  .mana-up-btn{min-height:36px;height:auto;padding:3px 5px;font-size:11px;border-width:2px;box-shadow:inset 0 1px 0 rgba(255,255,255,.45),0 2px 0 #1b7d70}
  .mana-up-title{font-size:11px}
  .mana-up-cost{font-size:9px}
  .card-row{gap:3px;align-items:stretch}
  .summon-card{
    max-width:none;max-height:64px;
    width:clamp(44px, 9.5cqw, 56px);height:100%;
    border-radius:8px;border-width:2px;gap:0;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.55),0 2px 0 rgba(90,55,25,.25);
  }
  .summon-card img{width:20px;height:20px;flex-shrink:0}
  .summon-card .lv{top:1px;left:3px;font-size:9px}
  .summon-card .cost{font-size:10px}
  .summon-card .cd-mask{font-size:var(--fs-md)}
  .card-scroll-btn{width:26px;max-height:64px;border-radius:8px;border-width:2px;font-size:11px;box-shadow:inset 0 1px 0 rgba(255,255,255,.55),0 2px 0 rgba(90,55,25,.22)}
  .energy-pot-btn{flex-basis:48px;border-radius:8px;font-size:10px}
  .energy-pot-btn::before{font-size:14px}
  .battle-mid .icon-btn{min-width:32px;min-height:30px}
  .battle-notice{top:44px;padding:4px 12px;font-size:var(--fs-sm)}

  .settings-body{padding:var(--gap-2) var(--gap-3);gap:var(--gap-2);max-width:520px}
  .setting-row{padding:8px 10px;border-radius:14px}
  .toggle-switch{width:84px;height:34px}
  .toggle-switch .toggle-knob{width:22px;height:22px;top:3px;left:46px}
  .toggle-switch[aria-pressed="false"] .toggle-knob{left:4px}
  .speed-pick{min-width:60px;min-height:34px;font-size:var(--fs-sm)}

  #screen-result{padding:6px}
  .result-dialog-body{padding:10px 12px 6px;gap:6px}
  .result-dialog-actions{padding:8px 12px 10px;gap:5px}
  .result-dialog-actions .primary-btn{min-height:38px;padding:7px 12px;font-size:var(--fs-md)}
  .result-dialog-actions .text-btn{min-height:34px;padding:5px 10px}
  #resultTitle{font-size:var(--fs-lg)}
  .result-stats{gap:6px}
  .result-stats div{padding:5px 8px;border-radius:10px;font-size:11px}
  .result-unlock{padding:6px 10px;font-size:var(--fs-sm)}
}

/* ----- 매우 짧은 스테이지 ----- */
@container play (max-height:380px){
  .side-menu{gap:5px;width:clamp(88px,14cqw,102px)}
  .side-menu button{
    min-height:40px;
    height:auto;
    padding:6px 6px;
    font-size:13px;
    border-radius:10px;
  }
  .lobby-battle-btns{gap:5px}
  .main-battle-btn{
    min-width:136px;
    min-height:46px;
    padding:5px 10px;
    border-radius:12px;
    border-width:3px;
  }
  .main-battle-btn b{font-size:16px;line-height:1.15}
  .main-battle-btn small{font-size:10px}
  .main-battle-btn em{display:none}
  .lobby-sky-title{
    top:clamp(2px, 0.8cqh, 8px);
    width:min(96%, 640px);
    max-height:clamp(72px, 26cqh, 128px);
  }
  .game-title-logo{height:27px;max-width:min(51%, 210px)}
  .loading-logo{max-height:80px}
  .lobby-base{width:clamp(90px,28cqh,150px)}
  #screen-companion-list,#screen-party-edit{
    --unit-card-w:78px;
    --unit-card-h:104px;
    --unit-card-pad:5px;
    --unit-card-img:34px;
    --unit-card-radius:10px;
    --unit-card-gap:10px;
    --party-slot-size:64px;
  }
  .party-hint{display:none}
  .party-scroll-btn{width:30px;height:var(--party-slot-size);font-size:13px}
  .summon-card{max-width:none;max-height:54px;width:clamp(40px, 9cqw, 48px)}
  .summon-card img{width:18px;height:18px}
  .mana-block{width:96px}
  .mana-up-btn{min-height:34px;padding:3px 4px}
  .mana-up-title{font-size:10px}
  .mana-up-cost{font-size:8px}
  .card-scroll-btn{width:24px;max-height:54px;font-size:10px}
  .energy-pot-btn{flex-basis:42px;font-size:9px;border-radius:7px}
  .energy-pot-btn::before{font-size:12px}
  .battle-bottom{max-height:min(88px,30cqh)}
  .card-row{gap:3px}
}

/* 세로 모드: 전체 화면 안내 (스테이지는 16:9로 유지되지만 플레이 비권장) */
@media (orientation:portrait) and (max-width:640px){
  .rotate-hint{display:flex}
}
