/* Responsive layer for the approved Trainer screens.
   Desktop remains owned by the selected prototype styles; this file only
   changes composition when the game modal no longer has desktop room. */

@media (max-width: 1024px) {
  .rds-root[data-upi-screen="party"],
  .rds-root[data-upi-screen="pc"] {
    --rds-popup-width: 100vw;
    --rds-popup-height: 100dvh;
    padding: 8px;
  }

  .rds-root[data-upi-screen="party"] .rds-shell,
  .rds-root[data-upi-screen="pc"] .rds-shell {
    width: 100%;
    height: 100%;
    border-radius: 12px;
  }

  .rds-root[data-upi-screen="party"] .rds-content,
  .rds-root[data-upi-screen="pc"] .rds-content {
    overscroll-behavior: contain;
  }

  /* PC do Treinador ------------------------------------------------------ */
  .pc-screen {
    min-width: 0;
    min-height: 0;
  }

  .rds-root[data-upi-screen="pc"] .pc-screen--grid,
  .rds-root[data-upi-screen="pc"] .pc-screen--grid.is-editor-open {
    display: flex;
    height: 100%;
    min-height: 0;
    flex-direction: column;
    gap: 8px;
    padding: 0 8px 12px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-color: #4fa8d1 transparent;
    scrollbar-width: thin;
  }

  .pc-screen--grid .pc-header {
    position: sticky;
    z-index: 40;
    top: 0;
    display: grid;
    min-height: 60px;
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr) auto 42px;
    gap: 7px;
    margin: 0 -8px;
    padding: 8px 10px;
    background: rgba(2, 17, 31, .98);
    backdrop-filter: blur(10px);
  }

  .pc-heading h1 {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 5px;
    font-size: clamp(18px, 4.6vw, 26px);
    white-space: nowrap;
  }

  .pc-heading h1 span {
    display: inline;
    margin: 0;
    font-size: .72em;
  }

  .pc-wallet {
    min-width: 0;
    height: 42px;
    gap: 4px;
    padding: 0 6px;
    border-radius: 9px;
  }

  .pc-wallet-item {
    min-width: 0;
    height: auto;
    gap: 4px;
    padding: 0 4px;
  }

  .pc-wallet-item img,
  .pc-wallet-item .pc-coin,
  .pc-wallet-item .pc-gem {
    width: 15px;
    height: 15px;
  }

  .pc-wallet-item b { font-size: 12px; }
  .pc-icon-button { width: 42px; height: 42px; margin: 0; }

  .rds-root[data-upi-screen="pc"] .pc-grid-footer {
    order: 1;
    display: grid;
    min-height: 0;
    flex: 0 0 205px;
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 8px;
    border: 1px solid rgba(61, 120, 151, .55);
    border-radius: 10px;
    background: rgba(3, 22, 38, .9);
  }

  .pc-team-title {
    height: 22px;
    gap: 6px;
    white-space: nowrap;
  }

  .pc-team-title small {
    overflow: hidden;
    margin-left: auto;
    text-overflow: ellipsis;
  }

  .pc-team-members {
    display: grid;
    height: 74px;
    grid-template-columns: none;
    grid-auto-columns: 108px;
    grid-auto-flow: column;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 3px;
    scroll-snap-type: x proximity;
    scrollbar-color: #4fa8d1 transparent;
    scrollbar-width: thin;
  }

  .pc-team-member {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 4px;
    scroll-snap-align: start;
  }

  .pc-team-member--empty { min-width: 108px; }
  .pc-transfer-compact { width: 100%; height: 38px; margin: 0; font-size: 10px; }
  .pc-footer-command { grid-template-columns: minmax(0, 1fr) auto; align-content: stretch; gap: 5px; }
  .pc-swap-summary { grid-column: 1 / -1; height: 16px; }
  .pc-footer-command .pc-transfer-compact { min-width: 0; }
  .pc-swap-cancel { width: 92px; height: 38px; border: 1px solid rgba(75, 134, 164, .6); border-radius: 8px; background: rgba(4, 27, 43, .88); }

  .pc-grid-comparison { min-height: 540px; overflow: visible; }
  .pc-grid-comparison .rds-pc-compare-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pc-grid-comparison .rds-pc-compare-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .rds-root[data-upi-screen="pc"] .pc-grid-main {
    order: 2;
    display: grid;
    min-width: 0;
    min-height: 0;
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    overflow: visible;
  }

  .pc-grid-profile,
  .pc-screen--grid.is-editor-open .pc-grid-profile {
    height: 500px;
    min-height: 500px;
    grid-template-rows: minmax(0, 1fr) 142px 42px 62px;
  }

  .pc-screen--grid.is-editor-open .pc-grid-profile {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .pc-grid-profile .pc-pedestal,
  .pc-screen--grid.is-editor-open .pc-grid-profile .pc-pedestal {
    right: 5%;
    bottom: 96px;
    width: 90%;
    height: 68%;
  }

  .pc-grid-profile .pc-pedestal .pc-sprite {
    width: 96%;
    height: 104%;
    max-width: 270px;
    max-height: 270px;
    object-position: center bottom;
  }

  .pc-grid-profile .pc-hero-copy h2 { font-size: clamp(24px, 7vw, 34px); }

  .pc-grid-profile .pc-profile-facts {
    padding: 6px;
  }

  .rds-root[data-upi-screen="pc"] .pc-profile-facts--line {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 54px 72px;
  }

  .rds-root[data-upi-screen="pc"] .pc-profile-facts--line article {
    grid-column: auto;
  }

  .rds-root[data-upi-screen="pc"] .pc-profile-facts--line article.pc-profile-ivs {
    grid-column: 1 / -1;
    grid-template-columns: 52px minmax(0, 1fr);
    padding: 5px 6px;
  }

  .rds-root[data-upi-screen="pc"] .pc-quick-ivs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .rds-root[data-upi-screen="pc"] .pc-quick-ivs > span {
    padding: 5px 3px;
  }

  .pc-profile-facts--line article {
    min-width: 0;
    padding: 7px 5px;
  }

  .pc-grid-profile .pc-profile-facts b {
    overflow: hidden;
    font-size: 14px;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pc-grid-box {
    display: grid;
    min-width: 0;
    min-height: 0;
    grid-template-rows: auto auto auto;
    gap: 8px;
    padding: 10px 0 0;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .pc-grid-box .pc-section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 8px;
  }

  .pc-grid-box .pc-section-heading > span {
    padding: 0 2px;
  }

  .pc-grid-box .pc-section-heading .pc-filters {
    grid-column: 1;
    grid-row: 2;
  }

  .pc-section-heading .pc-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .pc-filters .pc-search {
    grid-column: 1 / -1;
  }

  .pc-filter-actions {
    grid-column: 1 / -1;
  }

  .pc-filters .pc-search,
  .pc-filters select,
  .pc-filter-actions button {
    width: 100%;
    min-width: 0;
    height: 40px;
    font-size: 10px;
  }

  .pc-selection-bar {
    flex-wrap: wrap;
    justify-content: flex-start;
    padding: 2px;
  }

  .pc-selection-bar > span {
    width: 100%;
  }

  .pc-selection-bar > span small { margin-left: auto; }
  .pc-team-save-control { margin-left: auto; }

  .pc-slot-scroll {
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 0 2px 8px;
  }

  .pc-slot-grid--five {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 154px;
    gap: 7px;
  }

  .pc-storage-card {
    padding: 7px 6px 6px;
  }

  .pc-storage-card .pc-sprite {
    min-height: 40px;
    max-height: 70px;
  }

  .pc-card-name { font-size: 11px; }
  .pc-card-status b { display: none; }
  .pc-card-status { width: 20px; height: 20px; justify-content: center; padding: 0; }

  /* Gerenciar Pokémon --------------------------------------------------- */
  .pc-editor-panel {
    display: grid;
    min-width: 0;
    min-height: 0;
    grid-template-rows: auto auto auto auto;
    gap: 8px;
    padding: 8px;
    overflow: visible;
  }

  .pc-editor-heading {
    align-items: flex-start;
    gap: 8px;
    padding: 4px;
  }

  .pc-editor-heading h2 {
    font-size: clamp(20px, 5.5vw, 27px);
    overflow-wrap: anywhere;
  }

  .pc-editor-heading > button {
    min-width: 118px;
    height: 38px;
    flex: 0 0 auto;
    padding: 0 8px;
    font-size: 9px;
  }

  .pc-editor-panel .rds-detail-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(96px, 1fr));
    overflow-x: auto;
    padding: 2px;
    scrollbar-width: thin;
  }

  .pc-editor-scroll {
    min-height: 0;
    overflow: visible;
    padding: 0;
  }

  .pc-editor-panel .rds-detail-pane { padding: 2px; }
  .pc-editor-panel .rds-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .pc-editor-panel .rds-info-tile { min-height: 112px; padding: 10px; border-radius: 8px; background: rgba(7, 32, 49, .84); }
  .pc-editor-panel .rds-info-tile.is-accent { background: rgba(14, 72, 70, .55); }
  .pc-editor-summary { grid-template-rows: auto auto; gap: 8px; }
  .pc-editor-summary-lower { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pc-editor-stat-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 7px; }
  .pc-editor-progress-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pc-editor-progress-stack article { border-radius: 8px; background: rgba(7, 30, 45, .78); }
  .pc-editor-current-moves { grid-column: auto; }
  .pc-editor-panel .rds-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pc-editor-panel .rds-move-list { grid-template-columns: minmax(0, 1fr); }
  .pc-editor-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 2px;
  }

  .pc-editor-actions .rds-button,
  .pc-editor-actions .rds-button.is-primary {
    min-width: 0;
    min-height: 44px;
    width: 100%;
  }
}

@media (max-width: 820px) {
  .rds-root[data-upi-screen="party"],
  .rds-root[data-upi-screen="pc"] {
    padding: 0;
  }

  .rds-root[data-upi-screen="party"] .rds-shell,
  .rds-root[data-upi-screen="pc"] .rds-shell {
    border: 0;
    border-radius: 0;
  }

  /* Equipe Pokémon ------------------------------------------------------ */
  .panorama-screen {
    display: grid;
    width: 100%;
    height: 100%;
    min-width: 0;
    grid-template-rows: auto auto auto auto;
    aspect-ratio: auto;
    overflow-x: hidden;
    overflow-y: auto;
    container-type: normal;
    overscroll-behavior: contain;
    scrollbar-color: #4fa8d1 transparent;
    scrollbar-width: thin;
  }

  .panorama-bg {
    position: fixed;
    inset: 0;
    background-position: 62% center;
  }

  .panorama-header {
    position: sticky;
    z-index: 20;
    inset: auto;
    top: 0;
    display: grid;
    min-height: 70px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 12px;
    background: rgba(2, 18, 33, .97);
    backdrop-filter: blur(10px);
  }

  .panorama-title { gap: 8px; }
  .panorama-title > img { width: 42px; }
  .panorama-title span { font-size: 9px; }
  .panorama-title h1 { margin: 2px 0; font-size: 19px; letter-spacing: -.4px; }
  .panorama-title p { max-width: 205px; font-size: 10px; line-height: 1.15; }
  .panorama-header__right { gap: 6px; }

  .panorama-wallet {
    height: 40px;
    gap: 7px;
    padding: 0 8px;
    border-width: 1px;
    border-radius: 8px;
  }

  .panorama-wallet > div { gap: 4px; }
  .panorama-wallet strong { font-size: 11px; }
  .panorama-wallet i { height: 20px; }
  .rds-root[data-upi-screen="party"] .panorama-wallet__coin,
  .rds-root[data-upi-screen="party"] .panorama-wallet__gem { width: 14px; height: 14px; }
  .panorama-settings { width: 40px; height: 40px; border-width: 1px; border-radius: 8px; }
  .rds-root[data-upi-screen="party"] .panorama-settings > span { font-size: 25px; }

  .panorama-lineup {
    position: relative;
    z-index: 3;
    inset: auto;
    display: flex;
    min-width: 0;
    height: 250px;
    align-items: flex-end;
    gap: 12px;
    padding: 18px 14px 22px;
    overflow-x: auto;
    overflow-y: hidden;
    pointer-events: auto;
    scroll-padding: 14px;
    scroll-snap-type: x mandatory;
    scrollbar-color: #4fa8d1 transparent;
    scrollbar-width: thin;
  }

  .panorama-platform,
  .panorama-platform.is-selected {
    --pw: 132px !important;
    --art: .92;
    position: relative;
    left: auto !important;
    bottom: auto;
    z-index: 2;
    flex: 0 0 var(--pw);
    scroll-snap-align: center;
  }

  .panorama-platform.is-selected {
    --pw: 158px !important;
    z-index: 5;
  }

  .panorama-platform > strong { font-size: 15px; }

  .panorama-details {
    position: relative;
    z-index: 5;
    left: auto;
    right: auto;
    bottom: auto;
    display: grid;
    width: auto;
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 0;
    margin: 0 10px;
    padding: 10px;
    border-width: 1px;
    border-radius: 10px;
  }

  .panorama-details__identity {
    height: auto;
    grid-column: 1 / -1;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 8px;
    padding-bottom: 9px;
  }

  .panorama-details__identity > img { width: 78px; height: 72px; }
  .panorama-details__identity span,
  .panorama-fact > span { font-size: 8px; }
  .panorama-details h2 { gap: 5px; margin: 3px 0 5px; font-size: 20px; }
  .panorama-sex { font-size: 17px; }
  .panorama-details__identity p { gap: 10px; font-size: 13px; }
  .panorama-meter { height: 7px; margin-top: 6px; }

  .panorama-fact {
    height: auto;
    min-height: 66px;
    gap: 6px;
    padding: 9px 8px;
    border-top: 1px solid rgba(83, 122, 145, .48);
    border-left: 0;
  }

  .panorama-fact:nth-of-type(even) { border-left: 1px solid rgba(83, 122, 145, .48); }
  .panorama-fact strong { font-size: 13px; white-space: normal; }
  .panorama-fact--ivs { grid-column: 1 / -1; min-height: 76px; border-left: 0 !important; }
  .panorama-fact--ivs > span b { font-size: 8px; }
  .panorama-quick-ivs { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .panorama-quick-ivs > span { flex-direction: column; gap: 2px; padding: 5px 2px; border-radius: 5px; }
  .panorama-quick-ivs small { font-size: 7px; }
  .panorama-quick-ivs b { font-size: 11px; }
  .panorama-ability { gap: 5px; }
  .panorama-ability img { width: 16px; height: 16px; }

  .panorama-actions {
    position: relative;
    z-index: 6;
    left: auto;
    right: auto;
    bottom: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 10px 14px 18px;
  }

  .panorama-button { width: 100%; height: 46px; gap: 7px; border-radius: 10px; font-size: 11px; }
  .rds-root[data-upi-screen="party"] .panorama-button img { width: 24px; height: 24px; }
  .panorama-button--open-pc { grid-column: 1 / -1; }

  .panorama-details__expanded {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    display: grid;
    min-height: 0;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 9px;
    padding: 8px;
    border-width: 1px;
    border-radius: 8px;
  }
  .panorama-details__expanded > article { padding: 9px; border-radius: 7px; }
  .panorama-details__expanded header span,
  .panorama-held-item small { font-size: 9px; }
  .panorama-details__expanded header b { font-size: 10px; }
  .panorama-held-item { grid-template-columns: 44px minmax(0, 1fr); gap: 7px; }
  .panorama-held-item__icon { width: 44px; height: 44px; border-radius: 7px; }
  .panorama-held-item__icon img { width: 34px; height: 34px; }
  .panorama-held-item b { font-size: 13px; }
  .panorama-held-item em { font-size: 10px; }
  .panorama-expanded-ivs,
  .panorama-quick-evs { gap: 4px; }
  .panorama-expanded-ivs > span,
  .panorama-quick-evs > span { gap: 3px; padding: 6px 3px 9px; border-radius: 5px; }
  .panorama-expanded-ivs small,
  .panorama-quick-evs small { font-size: 8px; }
  .panorama-expanded-ivs b,
  .panorama-quick-evs b { font-size: 11px; }
  .panorama-moves > div { grid-template-columns: 1fr; gap: 4px; }
  .panorama-moves > div > span { gap: 5px; padding: 5px; }
  .panorama-moves .rds-type { min-height: 18px; padding: 2px 4px; font-size: 8px; }
  .panorama-moves .rds-type img { width: 11px; height: 11px; }
  .panorama-moves b { font-size: 10px; }
  .panorama-moves small { font-size: 8px; }

  /* Compact portrait density ------------------------------------------- */
  .pc-slot-grid--five {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 148px;
  }

  .pc-grid-profile,
  .pc-screen--grid.is-editor-open .pc-grid-profile {
    height: 500px;
    min-height: 500px;
  }

  .pc-grid-profile .pc-pedestal,
  .pc-screen--grid.is-editor-open .pc-grid-profile .pc-pedestal {
    bottom: 96px;
  }

  .pc-editor-panel .rds-info-grid { grid-template-columns: minmax(0, 1fr); }
  .pc-editor-panel .rds-info-tile { min-height: 96px; }
  .pc-editor-progress-stack { grid-template-columns: minmax(0, 1fr); }
  .pc-editor-heading { display: grid; grid-template-columns: minmax(0, 1fr); }
  .pc-editor-heading > button { width: 100%; min-width: 0; }
}

@media (max-width: 430px) {
  .pc-screen--grid .pc-header { grid-template-columns: minmax(0, 1fr) auto 38px; }
  .pc-heading h1 { display: grid; gap: 0; font-size: 18px; }
  .pc-wallet { height: 38px; }
  .pc-wallet-item { padding: 0 2px; }
  .pc-wallet-item b { font-size: 10px; }
  .pc-icon-button { width: 38px; height: 38px; }
  .pc-team-title small { display: none; }
  .pc-selection-bar > span small { display: none; }
  .pc-team-save-control { width: 100%; margin: 0; }
  .pc-team-save-control > small { flex: 1; max-width: none; }
  .pc-team-save-control .rds-button.is-primary { flex: 0 0 108px; }
  .pc-card-traits small { font-size: 6px; }
  .pc-card-traits b { font-size: 7px; }
  .pc-editor-actions { grid-template-columns: minmax(0, 1fr); }
  .pc-editor-panel .rds-detail-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pc-editor-panel .rds-detail-tabs button { padding-inline: 3px; font-size: 8px; }

  .panorama-title p { display: none; }
  .panorama-title h1 { font-size: 17px; }
  .panorama-title > img { width: 36px; }
  .panorama-wallet { gap: 4px; padding: 0 5px; }
  .panorama-wallet strong { font-size: 9px; }
  .panorama-wallet i { margin: 0 1px; }
  .panorama-settings { width: 38px; height: 38px; }
}

@media (min-width: 701px) and (max-width: 820px) {
  .pc-slot-grid--five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pc-grid-profile,
  .pc-screen--grid.is-editor-open .pc-grid-profile { height: 500px; min-height: 500px; }
  .pc-editor-panel .rds-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pc-editor-progress-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pc-editor-heading { display: flex; }
  .pc-editor-heading > button { width: auto; min-width: 150px; }
}

@media (min-width: 821px) and (max-width: 1024px) {
  .pc-slot-grid--five { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pc-grid-profile,
  .pc-screen--grid.is-editor-open .pc-grid-profile { height: 500px; min-height: 500px; }
  .pc-editor-panel .rds-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pc-editor-progress-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1025px) and (max-width: 1450px) {
  .pc-editor-summary { min-height: 520px; grid-template-rows: auto auto; }
  .pc-editor-summary-lower { min-height: 224px; }
}
