/* ==========================================================================\n   PokéLocke v15.98 — Profile mobile layout refinement\n   Mobile-only overrides. Desktop/tablet layout remains untouched.\n   ========================================================================== */

@media (max-width: 760px){
  body.v1543-profile-page{
    overflow-x:hidden!important;
  }

  .v1543-profile-page .v1543-profile-shell{
    width:min(100% - 12px, 520px)!important;
    padding-top:10px!important;
    padding-bottom:14px!important;
    margin-inline:auto!important;
  }

  .v1543-profile-page #profileView{
    gap:10px!important;
  }

  /* --- Hero --------------------------------------------------------------- */
  .v1543-profile-hero{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
    min-height:0!important;
    padding:14px!important;
    border-radius:24px!important;
    border:1px solid rgba(112,185,230,.58)!important;
    background:
      linear-gradient(180deg,rgba(232,248,255,.68),rgba(218,242,255,.78)),
      url('../ui/page-backgrounds/profile-bg.png') center 44%/cover no-repeat!important;
    box-shadow:0 12px 28px rgba(20,67,101,.13),inset 0 1px 0 rgba(255,255,255,.82)!important;
    overflow:hidden!important;
  }
  .v1543-profile-hero::before{
    content:""!important;
    position:absolute!important;
    inset:0!important;
    pointer-events:none!important;
    background:linear-gradient(180deg,rgba(255,255,255,.13),rgba(45,139,203,.04))!important;
  }
  .v1543-profile-hero::after{display:none!important;}
  .v1543-legend-sign{display:none!important;}

  .v1543-avatar-stage{
    grid-column:1!important;
    height:148px!important;
    min-height:148px!important;
    display:flex!important;
    align-items:flex-end!important;
    justify-content:center!important;
    overflow:visible!important;
  }
  .v1543-avatar-glow{
    inset:18px 20% 0!important;
    border-radius:50%!important;
    background:radial-gradient(circle at 50% 55%,rgba(255,255,255,.82),rgba(183,224,248,.22) 54%,transparent 72%)!important;
  }
  .v1543-avatar-stage>img{
    width:170px!important;
    height:148px!important;
    max-width:170px!important;
    max-height:148px!important;
    object-fit:contain!important;
    transform:none!important;
    image-rendering:auto!important;
    filter:drop-shadow(0 10px 12px rgba(25,58,83,.18))!important;
  }
  .v1543-avatar-button{
    right:8px!important;
    bottom:6px!important;
    min-height:34px!important;
    padding:0 10px!important;
    border-radius:12px!important;
    font-size:10px!important;
  }

  .v1543-profile-identity{
    grid-column:1!important;
    min-width:0!important;
    text-align:center!important;
  }
  .v1543-kicker{
    justify-content:center!important;
    font-size:9px!important;
    letter-spacing:.12em!important;
  }
  .v1543-name-line{
    justify-content:center!important;
    gap:8px!important;
    margin-top:3px!important;
  }
  .v1543-name-line h1{
    max-width:100%!important;
    margin:0!important;
    font-size:clamp(30px,9vw,38px)!important;
    line-height:1.02!important;
    letter-spacing:-.04em!important;
    overflow-wrap:anywhere!important;
  }
  .v1543-handle{
    display:block!important;
    margin-top:4px!important;
    font-size:13px!important;
  }
  .v1543-profile-identity>small{
    display:block!important;
    margin-top:3px!important;
    font-size:10px!important;
  }

  .v1543-bio-card{
    width:100%!important;
    max-width:none!important;
    margin:12px 0 0!important;
    padding:12px 13px!important;
    border-radius:16px!important;
    border:1px solid rgba(91,159,207,.34)!important;
    background:rgba(255,255,255,.80)!important;
    box-shadow:0 8px 18px rgba(21,71,108,.07),inset 0 1px 0 rgba(255,255,255,.85)!important;
    text-align:left!important;
  }
  .v1543-bio-card .v149-bio-head{
    font-size:10px!important;
  }
  .v1543-bio-card .v14-profile-bio{
    margin-top:6px!important;
    font-size:13px!important;
    line-height:1.45!important;
    overflow-wrap:anywhere!important;
  }
  .v149-bio-editor textarea{
    width:100%!important;
    min-height:86px!important;
  }
  .v149-bio-editor>div{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:7px!important;
  }
  .v149-bio-editor .v11-outline-button,
  .v149-bio-editor .v11-primary-button{
    min-width:0!important;
    width:100%!important;
  }

  .v1543-tags{
    justify-content:center!important;
    flex-wrap:wrap!important;
    gap:6px!important;
    margin-top:9px!important;
  }
  .v1543-tags span{
    padding:6px 9px!important;
    border-radius:999px!important;
    font-size:9px!important;
  }

  /* Rank becomes a compact full-width card. */
  .v1543-rank-card{
    grid-column:1!important;
    width:100%!important;
    min-height:138px!important;
    margin-top:16px!important;
    padding:24px 14px 13px!important;
    border-radius:20px!important;
  }
  .v1543-rank-medal{
    top:-24px!important;
    width:52px!important;
    height:52px!important;
    border-width:4px!important;
  }
  .v1543-rank-medal img{width:100%!important;height:100%!important;}
  .v1543-rank-card small{
    margin-top:7px!important;
    font-size:9px!important;
  }
  .v1543-rank-card>b{
    margin-top:2px!important;
    font-size:25px!important;
  }
  .v1543-rank-stars{
    gap:5px!important;
    margin-top:4px!important;
  }
  .v1543-rank-stars i{font-size:20px!important;}
  .v1543-rank-progress{
    height:9px!important;
    margin-top:7px!important;
  }
  .v1543-rank-card em{
    margin-top:4px!important;
    font-size:9px!important;
  }

  /* Social cards side by side where possible. */
  .v1543-social-summary{
    grid-column:1!important;
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
  }
  .v1543-social-item{
    min-width:0!important;
    grid-template-columns:34px minmax(0,1fr)!important;
    gap:7px!important;
    padding:9px!important;
    border-radius:15px!important;
    background:rgba(255,255,255,.78)!important;
  }
  .v1543-social-icon{
    width:34px!important;
    height:34px!important;
    border-radius:11px!important;
  }
  .v1543-social-icon img{width:21px!important;height:21px!important;}
  .v1543-social-item small{font-size:8px!important;}
  .v1543-social-item b{
    font-size:10px!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  .v1543-social-item em{font-size:8px!important;}
  .v1543-social-item a{
    grid-column:1 / -1!important;
    width:100%!important;
    margin-top:2px!important;
    padding:7px 6px!important;
    text-align:center!important;
    border-radius:10px!important;
    font-size:8.5px!important;
  }

  .v1543-profile-hero .v11-profile-actions{
    grid-column:1!important;
    width:100%!important;
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:7px!important;
    position:static!important;
    margin-top:0!important;
  }
  .v1543-profile-hero .v11-profile-actions .v11-outline-button{
    width:100%!important;
    min-width:0!important;
    min-height:38px!important;
    padding:0 8px!important;
    border-radius:12px!important;
    font-size:9px!important;
    white-space:normal!important;
  }

  /* --- Statistics --------------------------------------------------------- */
  .v1543-statistics{
    padding:11px!important;
    border-radius:18px!important;
  }
  .v1543-statistics>header{
    display:flex!important;
    flex-direction:column!important;
    align-items:flex-start!important;
    gap:5px!important;
    padding:0 2px 9px!important;
  }
  .v1543-statistics h2{font-size:16px!important;}
  .v1543-statistics>header img{width:24px!important;height:24px!important;}
  .v1543-statistics>header p{
    font-size:9px!important;
    line-height:1.4!important;
  }
  .v1543-stat-grid{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:7px!important;
    margin-top:9px!important;
  }
  .v1543-stat-grid article{
    min-width:0!important;
    min-height:98px!important;
    grid-template-columns:40px minmax(0,1fr)!important;
    gap:8px!important;
    padding:9px!important;
    border-radius:13px!important;
  }
  .v1543-stat-grid article>img{
    width:40px!important;
    height:40px!important;
  }
  .v1543-stat-grid strong{font-size:24px!important;}
  .v1543-stat-grid span{
    margin-top:4px!important;
    font-size:8px!important;
    line-height:1.15!important;
  }
  .v1543-stat-grid a{
    margin-top:6px!important;
    font-size:8px!important;
    overflow-wrap:anywhere!important;
  }

  /* --- Mode navigation ---------------------------------------------------- */
  .v1543-mode-tabs{
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:5px!important;
  }
  .v1543-mode-tabs button{
    min-width:0!important;
    height:58px!important;
    padding:5px 3px!important;
    border-radius:13px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:2px!important;
    font-size:8px!important;
    line-height:1!important;
  }
  .v1543-mode-tabs button span{
    margin:0!important;
    line-height:1!important;
  }
  .v1543-mode-tabs button span img{
    width:22px!important;
    height:22px!important;
  }
  .v1543-mode-tabs button b{
    display:block!important;
    max-width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:8px!important;
  }
  .v1543-mode-panels{margin-top:0!important;}
  .v1543-mode-panel{
    padding:10px 11px!important;
    border-radius:13px!important;
  }
  .v1543-mode-panel>div{
    display:flex!important;
    flex-direction:column!important;
    gap:3px!important;
  }
  .v1543-mode-panel b{font-size:11px!important;}
  .v1543-mode-panel span{font-size:9px!important;line-height:1.35!important;}

  /* --- Main content cards ------------------------------------------------- */
  .v1543-profile-grid{
    grid-template-columns:1fr!important;
    gap:10px!important;
  }
  .v1543-profile-main,
  .v1543-profile-side{
    gap:10px!important;
  }
  .v1543-profile-grid .v11-data-card{
    padding:11px!important;
    border-radius:18px!important;
  }
  .v1543-profile-grid .v11-data-card>header{
    min-height:0!important;
    margin-bottom:9px!important;
    padding:0 1px 8px!important;
    gap:8px!important;
    align-items:flex-start!important;
  }
  .v1543-profile-grid .v11-data-card>header>div{
    min-width:0!important;
    gap:8px!important;
  }
  .v1543-section-icon{
    flex:0 0 34px!important;
    width:34px!important;
    height:34px!important;
    display:grid!important;
    place-items:center!important;
  }
  .v1543-section-icon img{width:28px!important;height:28px!important;}
  .v1543-profile-grid h2{
    font-size:15px!important;
    line-height:1.1!important;
  }
  .v1543-profile-grid header p{
    margin-top:3px!important;
    font-size:9px!important;
    line-height:1.3!important;
  }
  .v1543-header-actions{
    align-items:flex-end!important;
    gap:5px!important;
    flex:0 0 auto!important;
  }
  .v1543-header-actions>b,
  .v14-card-hint{
    font-size:8px!important;
  }
  .v1543-edit-showcase{
    height:30px!important;
    padding:0 9px!important;
    border-radius:9px!important;
    font-size:8px!important;
  }

  .v1543-showcase-grid{
    grid-template-columns:1fr 1fr!important;
    gap:7px!important;
  }
  .v1543-showcase-grid .v14-showcase-slot{
    min-height:132px!important;
    padding:8px!important;
    border-radius:12px!important;
  }
  .v1543-showcase-grid .v1476-case-badge{
    width:58px!important;
    height:58px!important;
    margin-bottom:7px!important;
    font-size:28px!important;
  }
  .v1543-showcase-grid .v14-showcase-slot b{font-size:9px!important;}
  .v1543-showcase-grid .v14-showcase-slot small{font-size:7.5px!important;}

  .v1543-achievement-progress{
    grid-template-columns:1fr!important;
    gap:7px!important;
  }
  .v1543-achievement-progress article{
    min-height:0!important;
    padding:10px!important;
    border-radius:12px!important;
  }
  .v1543-achievement-progress article>div:first-child>span{
    width:36px!important;
    height:36px!important;
  }
  .v1543-achievement-progress article>div:first-child>span img{
    width:28px!important;
    height:28px!important;
  }
  .v1543-achievement-progress b{font-size:10px!important;}
  .v1543-achievement-progress small{font-size:8px!important;}
  .v1543-progress{height:9px!important;margin:8px 0 5px!important;}

  .v11-achievement-group-head{
    gap:6px!important;
    padding:9px!important;
  }
  .v11-achievement-grid,
  .v14-achievement-list{
    grid-template-columns:1fr!important;
  }

  .v1543-runs-card .v11-run-list{gap:7px!important;}
  .v1543-runs-card .v14-run-entry,
  .v1543-runs-card .v11-run-entry{
    min-height:0!important;
    border-radius:12px!important;
  }
  #profileChronicleLink{
    font-size:8px!important;
    white-space:nowrap!important;
  }

  .v1543-wall-card{
    min-height:0!important;
  }
  .v1543-wall-card .v14-wall-list{
    min-height:100px!important;
    max-height:230px!important;
  }
  .v1543-wall-card .v14-textarea{
    min-height:90px!important;
    width:100%!important;
  }
  .v1543-wall-card .v11-primary-button{
    min-height:42px!important;
  }

  .v1543-friends-card>header>a{
    padding:6px 7px!important;
    font-size:8px!important;
    white-space:nowrap!important;
  }
  .v1543-friend-list{min-height:90px!important;}
  .v1543-friend-mini{
    grid-template-columns:38px minmax(0,1fr) 8px!important;
    padding:8px!important;
  }
  .v1543-friend-mini img{width:38px!important;height:38px!important;}
  .v1543-friend-mini b{font-size:10px!important;}
  .v1543-friend-mini small{font-size:8px!important;}
  .v1543-search-friends{
    width:100%!important;
    height:38px!important;
    margin-top:8px!important;
  }

  /* --- Dialogs ------------------------------------------------------------ */
  .v1543-profile-page .v11-dialog{
    width:min(calc(100% - 14px),520px)!important;
    max-width:none!important;
    max-height:88svh!important;
    padding:18px 14px 14px!important;
    border-radius:22px!important;
    overflow:auto!important;
  }
  .v1543-profile-page .v11-dialog h2{
    font-size:23px!important;
    line-height:1.1!important;
  }
  .v1543-profile-page .v11-dialog>p{
    font-size:11px!important;
    line-height:1.45!important;
  }
  .v149-avatar-picker,
  .v1476-showcase-choices,
  .v26-pokedex-grid{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
  }
  .v26-pokedex-tabs{
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:5px!important;
  }
  .v26-pokedex-tabs button{
    min-width:0!important;
    padding:7px 4px!important;
    font-size:8px!important;
  }

  /* The old mobile layout reserved room for a bottom navigation bar. The
     current global menu lives at the top, so remove that dead space. */
  .v1543-profile-page .v1539-footer{
    padding-bottom:14px!important;
  }
}

@media (max-width: 390px){
  .v1543-profile-page .v1543-profile-shell{
    width:calc(100% - 8px)!important;
  }
  .v1543-profile-hero{
    padding:12px!important;
    border-radius:21px!important;
  }
  .v1543-social-summary{
    grid-template-columns:1fr!important;
  }
  .v1543-stat-grid{
    gap:6px!important;
  }
  .v1543-stat-grid article{
    grid-template-columns:36px minmax(0,1fr)!important;
    padding:8px!important;
  }
  .v1543-stat-grid article>img{
    width:36px!important;
    height:36px!important;
  }
  .v1543-stat-grid strong{font-size:22px!important;}
  .v1543-mode-tabs{
    grid-template-columns:1fr 1fr!important;
  }
  .v1543-mode-tabs button{
    height:48px!important;
    flex-direction:row!important;
    gap:5px!important;
    font-size:9px!important;
  }
  .v1543-mode-tabs button span img{
    width:19px!important;
    height:19px!important;
  }
  .v1543-mode-tabs button b{font-size:8.5px!important;}
  .v1543-profile-grid .v11-data-card>header{
    flex-wrap:wrap!important;
  }
  .v1543-header-actions{
    width:100%!important;
    flex-direction:row!important;
    justify-content:space-between!important;
    align-items:center!important;
  }
  .v149-avatar-picker,
  .v1476-showcase-choices,
  .v26-pokedex-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}
