/* PVPium v120 Team Builder premium layer */
.team-builder-app{max-width:1240px}.tb-grid{display:grid;grid-template-columns:380px minmax(0,1fr);gap:20px;align-items:start}.tb-panel{position:sticky;top:18px}.tb-panel h2,.intro-card h2{letter-spacing:-.025em}.small{font-size:13px}.file-row{display:grid;grid-template-columns:1fr;gap:8px;border:1px solid rgba(255,255,255,.1);border-radius:18px;padding:14px;background:rgba(255,255,255,.045);margin-bottom:12px}.file-row input{background:rgba(2,6,23,.45)}.file-row strong{justify-self:start;border:1px solid rgba(255,255,255,.12);border-radius:999px;padding:5px 9px;color:#bae6fd;background:rgba(34,211,238,.1)}.settings-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}.selection-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}.selection-actions button{background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12)}.primary-action{margin-top:14px}.opponent-list{max-height:360px;overflow:auto;border:1px solid rgba(255,255,255,.12);border-radius:18px;background:rgba(2,6,23,.35);padding:10px}.empty-list{color:var(--txt3);padding:18px}.opponent-item{display:flex;align-items:center;gap:10px;border-radius:14px;padding:10px;cursor:pointer}.opponent-item:hover{background:rgba(139,92,246,.14)}.opponent-item input{width:auto;margin:0}.tb-results{display:grid;gap:16px}.intro-card{padding:22px}.intro-card ol{color:var(--txt2);line-height:1.7}.intro-card a{color:#7dd3fc;font-weight:900;text-decoration:none}.intro-card a:hover{text-decoration:underline}.output-stack{display:grid;gap:16px}.output-card,.result-block,.team-result,.tb-result-card{border:1px solid rgba(255,255,255,.12);border-radius:22px;background:linear-gradient(180deg,rgba(255,255,255,.07),rgba(255,255,255,.035));box-shadow:0 18px 60px rgba(0,0,0,.26);padding:18px}.output-stack table{width:100%;border-collapse:separate;border-spacing:0 8px}.output-stack th{color:var(--txt3);text-align:left}.output-stack td,.output-stack th{padding:10px}.output-stack tbody tr{background:rgba(255,255,255,.045)}.shield-buttons,.role-buttons,.source-buttons{display:flex;gap:8px;flex-wrap:wrap}.shield-buttons button,.role-buttons button,.source-buttons button,.change-team-btn{width:auto;padding:9px 12px;border-radius:999px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12)}
.ranking-source-box{display:grid;gap:10px;border:1px solid rgba(255,255,255,.12);border-radius:18px;padding:14px;background:rgba(34,211,238,.07);margin:0 0 18px}.ranking-source-box label{display:grid;gap:7px}.ranking-source-box button{width:100%}.ranking-source-box strong{justify-self:start;border:1px solid rgba(255,255,255,.12);border-radius:999px;padding:5px 9px;color:#bae6fd;background:rgba(34,211,238,.1)}
.opp-item{display:flex;align-items:flex-start;gap:10px;border-radius:14px;padding:10px;cursor:pointer;border:1px solid transparent}.opp-item:hover{background:rgba(34,211,238,.08);border-color:rgba(34,211,238,.18)}.opp-item input{width:auto;margin:3px 0 0;accent-color:#22d3ee}.opp-item span{min-width:0;line-height:1.3}.tb-mode-tabs{display:flex;justify-content:center;gap:10px;margin:0 auto 20px}.tb-mode-tabs button,.build-size-row button{width:auto;margin:0;border:1px solid rgba(255,255,255,.12);border-radius:999px;background:rgba(15,23,42,.72);color:#dbeafe;box-shadow:none}.tb-mode-tabs button.active,.build-size-row button.active{background:linear-gradient(135deg,#2563eb,#0891b2);color:#fff;border-color:rgba(125,211,252,.48)}.tb-mode-panel{display:none}.tb-mode-panel.active{display:block}.choose-opponents-panel,.build-team-panel,.my-team-analyzer-panel{padding:22px}.choose-opponents-panel input[type=search],.build-team-panel input[type=search],.my-team-analyzer-panel input[type=search]{margin:12px 0}.build-team-panel label{margin-top:14px}.build-size-row{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}.analyzer-opponent-list,.build-pokemon-list,.my-team-pokemon-list{max-height:330px;margin-top:10px;background:linear-gradient(180deg,rgba(2,6,23,.48),rgba(15,23,42,.38))}.analyzer-opponent-item,.build-pokemon-item,.my-team-pokemon-item{background:rgba(255,255,255,.035);margin-bottom:7px}.analyzer-opponent-item:last-child,.build-pokemon-item:last-child,.my-team-pokemon-item:last-child{margin-bottom:0}.my-team-analyzer-panel .selection-actions,.my-team-picker-panel .selection-actions{grid-template-columns:1fr}.secondary-action{background:linear-gradient(135deg,#0891b2,#0f766e)}.build-team-results{display:grid;gap:12px}.build-team-card{padding:12px;border:1px solid rgba(125,211,252,.12);border-radius:16px;background:rgba(2,6,23,.18)}.weakness-box{display:grid;gap:6px;border:1px solid rgba(248,113,113,.26);border-radius:12px;background:rgba(127,29,29,.16);padding:10px;color:#fecaca}.weakness-box span{color:#fca5a5;line-height:1.45}
.team-audit-roster{margin-top:10px}.team-audit-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:14px 0}.team-audit-summary span{display:grid;gap:3px;padding:12px;border:1px solid rgba(125,211,252,.16);border-radius:14px;background:rgba(2,6,23,.28)}.team-audit-summary b{color:#f8fafc;font-size:20px;line-height:1}.team-audit-summary small{color:var(--txt3);font-weight:800}.team-audit-heading{margin:18px 0 10px;font-size:18px}.team-threat-grid,.team-loss-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.team-threat-card,.team-loss-card{min-width:0;padding:12px;border:1px solid rgba(255,255,255,.12);border-radius:14px;background:rgba(15,23,42,.5)}.team-threat-card{display:grid;gap:8px}.team-threat-card.is-open{border-color:rgba(248,113,113,.3);background:rgba(127,29,29,.16)}.team-threat-card.is-covered{border-color:rgba(34,197,94,.2);background:rgba(20,83,45,.13)}.team-threat-card div{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}.team-threat-card strong,.team-loss-card strong{color:#f8fafc}.team-threat-card span,.team-threat-card small,.team-loss-card p{color:var(--txt2)}.team-threat-card p{margin:0;color:#fecaca;line-height:1.45}.team-loss-card p{display:flex;flex-wrap:wrap;gap:7px;margin:8px 0 0}.team-loss-card span{padding:6px 8px;border-radius:999px;background:rgba(255,255,255,.07);color:#dbeafe;font-size:12px;font-weight:800}.team-loss-card b{color:#fca5a5}
@media(max-width:980px){.tb-grid{grid-template-columns:1fr}.tb-panel{position:static}}@media(max-width:640px){.settings-grid,.selection-actions,.analysis-action-row,.team-audit-summary,.team-threat-grid,.team-loss-grid{grid-template-columns:1fr}}


/* v128 Team Builder result polish */
.mon-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
  gap:12px;
  margin:14px 0;
}

.premium-mon-card{
  position:relative;
  display:grid;
  min-height:168px;
  padding:14px;
  padding-left:54px;
  border:1px solid rgba(125,211,252,.16);
  border-radius:14px;
  background:linear-gradient(180deg,rgba(15,23,42,.72),rgba(2,6,23,.46));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05);
  overflow:hidden;
}

.mon-rank-badge{
  position:absolute;
  left:14px;
  top:50%;
  transform:translateY(-50%);
  width:28px;
  height:28px;
  border-radius:999px;
  display:grid;
  place-items:center;
  font-weight:900;
  font-size:13px;
  color:#07111f;
  background:linear-gradient(135deg,#8b5cf6,#22d3ee);
}

.mon-main{
  min-width:0;
  display:grid;
  align-content:start;
  gap:8px;
}

.mon-name-line{
  display:grid;
  align-items:start;
  gap:7px;
  line-height:1.2;
  min-width:0;
}

.mon-name-line strong{
  font-size:14px;
  line-height:1.15;
  color:#f8fafc;
}

.mon-name-wrap{
  position:relative;
  display:inline-flex;
  min-width:0;
  max-width:100%;
}
.server-team-card .mon-name-wrap,
.build-team-card .mon-name-wrap{
  position:relative;
}
.result-block,
.result-body,
.server-team-card,
.build-team-card,
.server-team-card .premium-mon-card,
.build-team-card .premium-mon-card{
  overflow:visible;
}

.mon-type-trigger{
  width:100%;
  border:0;
  margin:0;
  padding:0;
  background:transparent;
  color:#f8fafc;
  font:inherit;
  font-size:14px;
  line-height:1.15;
  font-weight:900;
  text-align:left;
  cursor:help;
  touch-action:manipulation;
  box-shadow:none;
  overflow-wrap:anywhere;
}

.mon-type-trigger:hover,
.mon-type-trigger:focus-visible{
  color:#7dd3fc;
  outline:0;
}

.type-popover{
  position:absolute;
  left:0;
  bottom:calc(100% + 8px);
  z-index:2000;
  display:none;
  width:min(320px,calc(100vw - 42px));
  border:1px solid rgba(125,211,252,.26);
  border-radius:14px;
  padding:12px;
  background:linear-gradient(180deg,rgba(15,23,42,.98),rgba(2,6,23,.98));
  box-shadow:0 18px 50px rgba(0,0,0,.42);
  color:#e2e8f0;
}

.mon-grid .premium-mon-card:nth-child(3n) .type-popover{
  left:auto;
  right:0;
}

.mon-name-wrap:hover .type-popover,
.mon-name-wrap:focus-within .type-popover,
.mon-name-wrap.is-type-open .type-popover{
  display:grid;
  gap:9px;
}

@media(max-width:700px){
  .mon-type-trigger{
    cursor:pointer;
  }

  .type-popover{
    display:none!important;
  }

  .mon-grid .premium-mon-card:nth-child(3n) .type-popover{
    left:var(--type-popover-left,50%);
    right:auto;
  }

  .type-row-mini,
  .type-section span{
    gap:6px;
  }

  .type-chip{
    padding:6px 8px;
    font-size:11px;
  }
}

.type-popover-mobile{
  position:fixed;
  left:14px;
  top:80px;
  z-index:2147483000;
  display:grid;
  gap:9px;
  width:calc(100vw - 28px);
  max-width:360px;
  max-height:calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  border:1px solid rgba(125,211,252,.32);
  border-radius:16px;
  padding:14px;
  background:linear-gradient(180deg,rgba(15,23,42,.99),rgba(2,6,23,.99));
  box-shadow:0 22px 70px rgba(0,0,0,.68);
  color:#e2e8f0;
}

.type-popover-mobile[hidden]{
  display:none!important;
}

.type-popover-title{
  font-size:13px;
  font-weight:1000;
  color:#fff;
}

.type-row-mini,
.type-section span{
  display:flex;
  flex-wrap:wrap;
  gap:5px;
}

.type-section{
  display:grid;
  gap:5px;
}

.type-section>b{
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:#93c5fd;
}

.type-chip{
  display:inline-flex;
  align-items:center;
  gap:4px;
  border:1px solid rgba(255,255,255,.18);
  border-radius:999px;
  padding:4px 7px;
  background:rgba(148,163,184,.18);
  color:#f8fafc;
  font-size:10px;
  font-style:normal;
  font-weight:900;
  line-height:1;
}

.type-chip b{
  color:#dbeafe;
  font-size:9px;
}

.type-normal{background:#a8a77a;color:#10131c;border-color:#c7c69a}
.type-fire{background:#ee8130;color:#170a03;border-color:#ffad69}
.type-water{background:#6390f0;color:#061226;border-color:#98b8ff}
.type-electric{background:#f7d02c;color:#171000;border-color:#ffe889}
.type-grass{background:#7ac74c;color:#071606;border-color:#a8e77c}
.type-ice{background:#96d9d6;color:#061817;border-color:#c7fffb}
.type-fighting{background:#c22e28;color:#fff;border-color:#f06b66}
.type-poison{background:#a33ea1;color:#fff;border-color:#d87bd6}
.type-ground{background:#e2bf65;color:#181004;border-color:#f4dc9a}
.type-flying{background:#a98ff3;color:#130d24;border-color:#d0c0ff}
.type-psychic{background:#f95587;color:#240511;border-color:#ff94b6}
.type-bug{background:#a6b91a;color:#111400;border-color:#d3e84d}
.type-rock{background:#b6a136;color:#161202;border-color:#dfcc6b}
.type-ghost{background:#735797;color:#fff;border-color:#a58aca}
.type-dragon{background:#6f35fc;color:#fff;border-color:#a17dff}
.type-dark{background:#705746;color:#fff;border-color:#a28672}
.type-steel{background:#b7b7ce;color:#10131c;border-color:#dedeee}
.type-fairy{background:#d685ad;color:#190912;border-color:#ffb8d5}

.type-fighting b,
.type-poison b,
.type-psychic b,
.type-ghost b,
.type-dragon b,
.type-dark b{
  color:#fff;
}

.type-normal b,
.type-fire b,
.type-water b,
.type-electric b,
.type-grass b,
.type-ice b,
.type-ground b,
.type-flying b,
.type-bug b,
.type-rock b,
.type-steel b,
.type-fairy b{
  color:rgba(2,6,23,.76);
}

.type-empty{
  color:#94a3b8;
  font-size:11px;
  font-weight:800;
}

.move-codes{
  display:inline-flex;
  align-items:center;
  justify-self:start;
  max-width:100%;
  border:1px solid rgba(34,211,238,.28);
  background:rgba(34,211,238,.10);
  color:#bae6fd;
  border-radius:12px;
  padding:4px 8px;
  font-size:10px;
  font-weight:800;
  line-height:1.08;
  white-space:normal;
  overflow-wrap:anywhere;
}

.mon-stats{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:6px;
}

.mon-stats span{
  display:grid;
  gap:2px;
  justify-items:center;
  border:1px solid rgba(255,255,255,.09);
  background:rgba(2,6,23,.42);
  border-radius:10px;
  padding:6px 5px;
  min-width:0;
}

.mon-stats b{
  display:block;
  font-size:13px;
  line-height:1;
  color:#fff;
}

.mon-stats small{
  display:block;
  margin-top:0;
  color:var(--txt3);
  font-size:8px;
  line-height:1;
  text-transform:uppercase;
  letter-spacing:0;
}

.mon-role-line{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  align-items:center;
}

.mon-role-line span,
.mon-role-line small{
  border-radius:999px;
  padding:3px 7px;
  font-weight:800;
  font-size:10px;
}

.mon-role-line span{
  color:#e9d5ff;
  background:rgba(139,92,246,.16);
  border:1px solid rgba(139,92,246,.28);
}

.mon-role-line small{
  color:#bae6fd;
  background:rgba(34,211,238,.10);
  border:1px solid rgba(34,211,238,.24);
}

.mon-actions{
  margin-top:1px;
}

.change-mon-btn{
  width:auto;
  margin:0;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(34,211,238,.35);
  background:rgba(8,145,178,.14);
  color:#bae6fd;
  font-weight:800;
  font-size:12px;
  box-shadow:none;
  min-width:78px;
}

.change-mon-btn:hover{
  background:rgba(34,211,238,.22);
  color:#fff;
}

.team-title{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  margin-bottom:8px;
}

.score-pill{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:4px 9px;
  font-size:12px;
  font-weight:900;
  color:#07111f;
  background:linear-gradient(135deg,#8b5cf6,#22d3ee);
}

.result-block{
  padding:0;
  overflow:hidden;
}

.result-block.is-open{
  overflow:visible;
}

.result-heading{
  width:100%;
  margin:0;
  padding:18px 20px;
  border:0;
  border-radius:0;
  background:linear-gradient(135deg,rgba(14,165,233,.2),rgba(139,92,246,.16) 48%,rgba(15,23,42,.95));
  border-bottom:1px solid rgba(125,211,252,.18);
  color:#f8fafc;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  text-align:left;
  font-size:20px;
  font-weight:900;
  letter-spacing:0;
  box-shadow:none;
  cursor:pointer;
}

.result-heading::after{
  content:"";
  width:10px;
  height:10px;
  flex:0 0 10px;
  border-right:2px solid #a5f3fc;
  border-bottom:2px solid #a5f3fc;
  transform:rotate(45deg) translateY(-3px);
  transition:transform .18s ease;
}

.result-body{
  display:block;
  padding:18px 20px 20px;
}

.result-block:not(.is-open) .result-body{
  display:none;
}

.result-block:not(.is-open){
  overflow:hidden;
}

.result-block:not(.is-open) .result-heading::after{
  transform:rotate(-45deg) translateY(3px);
}

.result-body > h2:first-child,
.result-block > h2:first-child{
  display:none;
}

.result-body .build-team-results{
  margin-top:14px;
}

.busy-card{
  display:flex;
  align-items:center;
  gap:14px;
  border:1px solid rgba(56,189,248,.22);
  border-radius:16px;
  padding:16px;
  background:rgba(14,165,233,.08);
}

.busy-card strong{
  color:#e0f2fe;
}

.busy-card p{
  margin:4px 0 0;
}

.busy-spinner{
  width:28px;
  height:28px;
  flex:0 0 28px;
  border-radius:999px;
  border:3px solid rgba(125,211,252,.25);
  border-top-color:#38bdf8;
  animation:pvpium-spin .8s linear infinite;
}

button.is-busy,
button:disabled.is-busy{
  opacity:.85;
  cursor:wait;
}

@keyframes pvpium-spin{
  to{transform:rotate(360deg);}
}

@media(max-width:640px){
  .result-heading{
    padding:15px 14px;
    font-size:17px;
  }

  .result-body{
    padding:14px;
  }
}

@media(max-width:900px){
  .mon-grid{grid-template-columns:1fr;}
}

/* v129 Team Builder mobile responsive hardening */
html,body{max-width:100%;overflow-x:hidden !important;}
.tb-app,.tb-grid,.tb-panel,.tb-card,.team-card,.mon-grid,.team-title,.mon-stats,.mon-role-line{min-width:0;max-width:100%;}
@media(max-width:640px){
  .tb-app{width:100%;padding-left:12px !important;padding-right:12px !important;}
  .tb-panel,.tb-card,.team-card{width:100%;margin-left:0;margin-right:0;overflow:hidden;}
  .tb-grid,.mon-grid,.mon-stats{grid-template-columns:1fr !important;}
  .tb-actions,.shield-row,.team-actions{display:grid !important;grid-template-columns:1fr;gap:10px;width:100%;}
  .tb-actions button,.shield-row button,.team-actions button{width:100% !important;min-width:0 !important;}
  table{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;}
}


/* v134 mobile nav tap fix */
@media (max-width: 760px){
  header,
  .site-header,
  .topbar,
  .nav,
  .tools-nav,
  .main-nav,
  .header-nav,
  .nav-links{
    position:relative !important;
    z-index:9999 !important;
    pointer-events:auto !important;
  }

  header a,
  .site-header a,
  .topbar a,
  .nav a,
  .tools-nav a,
  .main-nav a,
  .header-nav a,
  .nav-links a{
    position:relative !important;
    z-index:10000 !important;
    pointer-events:auto !important;
    touch-action:manipulation !important;
    -webkit-tap-highlight-color:rgba(34,211,238,.25);
  }

  header::before,
  header::after,
  .site-header::before,
  .site-header::after,
  .topbar::before,
  .topbar::after,
  .hero::before,
  .hero::after,
  .page-hero::before,
  .page-hero::after{
    pointer-events:none !important;
  }
}

/* v227 Ranking-source first layout */
.tb-page-head{
  display:none;
  align-items:end;
  justify-content:space-between;
  gap:16px;
  margin:0 0 16px;
}
.tb-page-head h1{
  margin:0 0 6px;
  font-size:34px;
  line-height:1.1;
  letter-spacing:0;
}
.tb-page-head p{
  display:none;
}
.source-type-tabs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-bottom:14px;
  padding:5px;
  border:1px solid rgba(125,211,252,.16);
  border-radius:16px;
  background:rgba(2,6,23,.34);
}
.source-type-tabs button{
  margin:0;
  width:100%;
  min-width:0;
  border:1px solid transparent;
  border-radius:12px;
  padding:10px 9px;
  background:transparent;
  color:var(--txt3);
  font-weight:900;
  box-shadow:none;
}
.source-type-tabs button.active{
  color:#fff;
  border-color:rgba(125,211,252,.35);
  background:linear-gradient(135deg,rgba(37,99,235,.88),rgba(8,145,178,.82));
}
.source-panel{
  display:none;
}
.source-panel.active{
  display:block;
}
.source-panel h2{
  margin-top:0;
}
.ranking-source-box{
  margin-bottom:18px;
}
.settings-grid{
  margin-top:4px;
  padding-top:14px;
  border-top:1px solid rgba(255,255,255,.10);
}
.settings-note{
  margin:12px 0 0;
  color:var(--txt3);
  font-size:12px;
  line-height:1.45;
}
.choose-opponents-panel,
.build-team-panel,
.my-team-analyzer-panel{
  background:linear-gradient(180deg,rgba(15,23,42,.76),rgba(2,6,23,.42));
}
.primary-action{
  width:100%;
}
@media(max-width:640px){
  .tb-page-head h1{font-size:27px}
  .source-type-tabs{grid-template-columns:1fr}
}

/* v260 mobile team result layout */
.build-team-card .mon-grid{
  grid-template-columns:repeat(2,minmax(0,1fr));
}

@media(max-width:640px){
  .team-card .mon-grid,
  .build-team-card .mon-grid{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px;
  }
  .team-card .premium-mon-card,
  .build-team-card .premium-mon-card{
    min-height:118px;
    padding:9px;
    padding-top:34px;
    overflow:visible;
  }
  .team-card .mon-rank-badge,
  .build-team-card .mon-rank-badge{
    left:8px;
    top:8px;
    transform:none;
    width:22px;
    height:22px;
    font-size:12px;
  }
  .team-card .mon-main,
  .build-team-card .mon-main{
    min-width:0;
  }
  .team-card .mon-name-line,
  .build-team-card .mon-name-line{
    display:block;
  }
  .team-card .mon-type-trigger,
  .build-team-card .mon-type-trigger{
    max-width:100%;
    white-space:normal;
    overflow-wrap:anywhere;
    line-height:1.15;
    font-size:12px;
    text-align:left;
  }
  .team-card .move-codes,
  .build-team-card .move-codes{
    display:block;
    margin-top:4px;
    font-size:10px;
    line-height:1.15;
    overflow-wrap:anywhere;
  }
  .team-card .mon-stats,
  .build-team-card .mon-stats{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:4px;
    margin-top:8px;
  }
  .team-card .mon-stats span,
  .build-team-card .mon-stats span{
    padding:5px 3px;
  }
  .team-card .mon-stats b,
  .build-team-card .mon-stats b{
    font-size:12px;
  }
  .team-card .mon-stats small,
  .build-team-card .mon-stats small{
    font-size:8px;
  }
}
