/* MP-KNO-004-06: isolated visual convergence for Teams, Builder, Calc and Speed Tiers. */

.competitive-tool-page {
  --tool-rgb: 0, 160, 255;
  --tool-accent: #58c7ff;
  --tool-accent-soft: rgba(var(--tool-rgb), .14);
  --tool-accent-faint: rgba(var(--tool-rgb), .055);
  --tool-line: rgba(var(--tool-rgb), .34);
  background: #050710;
}

.competitive-tool--teams {
  --tool-rgb: 161, 139, 255;
  --tool-accent: #b8a8ff;
}

.competitive-tool--builder {
  --tool-rgb: 255, 104, 127;
  --tool-accent: #ff899d;
}

.competitive-tool--calc {
  --tool-rgb: 0, 160, 255;
  --tool-accent: #61c9ff;
}

.competitive-tool--speed {
  --tool-rgb: 79, 209, 197;
  --tool-accent: #67e0d4;
}

.competitive-tool-main {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 5%, var(--tool-accent-soft), transparent 25rem),
    linear-gradient(180deg, #080b17 0, #060812 31rem, #050710 100%);
}

.competitive-tool-main::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: .24;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 62%);
}

.competitive-tool-hero {
  position: relative;
  min-height: 390px;
  display: grid;
  align-items: center;
  padding: 72px 0 54px;
  overflow: hidden;
  border-bottom: 1px solid var(--tool-line);
  background:
    linear-gradient(108deg, rgba(7,10,24,.98) 8%, rgba(7,10,24,.88) 52%, rgba(var(--tool-rgb),.09)),
    radial-gradient(circle at 82% 48%, rgba(var(--tool-rgb),.2), transparent 18rem);
}

.competitive-tool-hero::before,
.competitive-tool-hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.competitive-tool-hero::before {
  width: 48rem;
  height: 1px;
  right: -8rem;
  bottom: 4.7rem;
  background: linear-gradient(90deg, transparent, var(--tool-line), transparent);
  transform: rotate(-18deg);
}

.competitive-tool-hero::after {
  right: -5rem;
  bottom: -11rem;
  width: 34rem;
  height: 34rem;
  border: 1px solid rgba(var(--tool-rgb),.17);
  border-radius: 50%;
  box-shadow: 0 0 0 3.8rem rgba(var(--tool-rgb),.025), 0 0 0 7rem rgba(var(--tool-rgb),.018);
}

.competitive-tool-hero .knowledge-header-grid {
  position: relative;
  z-index: 2;
  grid-template-columns: minmax(0, 1.15fr) minmax(350px, .72fr);
  gap: clamp(34px, 5vw, 78px);
  align-items: center;
}

.competitive-tool-copy {
  position: relative;
  max-width: 760px;
  animation: competitive-tool-enter .55s cubic-bezier(.2,.75,.2,1) both;
}

.competitive-tool-copy .eyebrow {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--tool-line);
  border-radius: 999px;
  background: var(--tool-accent-faint);
  color: var(--tool-accent);
  font-size: .82rem;
  letter-spacing: .08em;
}

.competitive-tool-copy .eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--tool-accent);
  box-shadow: 0 0 14px rgba(var(--tool-rgb),.8);
}

.competitive-tool-hero .competitive-tool-copy h1 {
  max-width: 14ch;
  margin: 20px 0 14px;
  color: #fff;
  font-family: var(--font-brand, var(--font));
  font-size: clamp(3rem, 6vw, 5.4rem);
  line-height: .94;
  letter-spacing: -.035em;
  text-wrap: balance;
  text-shadow: 0 14px 42px rgba(0,0,0,.38);
}

.competitive-tool-hero .competitive-tool-copy p {
  max-width: 650px;
  color: #b9c5d8;
  font-size: clamp(1rem, 1.5vw, 1.16rem);
  line-height: 1.65;
}

.competitive-tool-mark {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: max(4vw, 36px);
  width: 235px;
  aspect-ratio: 1;
  border: 1px solid rgba(var(--tool-rgb),.34);
  border-radius: 50%;
  opacity: .44;
  pointer-events: none;
  transform: translateY(-50%) rotate(-12deg);
  background:
    linear-gradient(90deg, transparent 49.5%, rgba(var(--tool-rgb),.42) 50%, transparent 50.5%),
    linear-gradient(transparent 49.5%, rgba(var(--tool-rgb),.42) 50%, transparent 50.5%),
    radial-gradient(circle, rgba(var(--tool-rgb),.2) 0 3px, transparent 4px),
    repeating-radial-gradient(circle, transparent 0 24px, rgba(var(--tool-rgb),.12) 25px 26px);
  box-shadow: inset 0 0 55px rgba(var(--tool-rgb),.08), 0 0 70px rgba(var(--tool-rgb),.12);
}

.competitive-tool-mark::before,
.competitive-tool-mark::after {
  content: "";
  position: absolute;
  inset: 25%;
  border: 1px solid rgba(var(--tool-rgb),.55);
  transform: rotate(45deg);
}

.competitive-tool-mark::after {
  inset: 40%;
  border-width: 2px;
  background: rgba(var(--tool-rgb),.16);
  box-shadow: 0 0 30px rgba(var(--tool-rgb),.28);
}

.competitive-tool--teams .competitive-tool-mark { border-radius: 28%; transform: translateY(-50%) rotate(8deg); }
.competitive-tool--builder .competitive-tool-mark { border-radius: 18%; transform: translateY(-50%) rotate(18deg); }
.competitive-tool--calc .competitive-tool-mark { transform: translateY(-50%) rotate(-18deg); }
.competitive-tool--speed .competitive-tool-mark { border-style: dashed; transform: translateY(-50%) rotate(24deg); }

.competitive-tool-console {
  position: relative;
  z-index: 2;
  animation: competitive-tool-enter .55s .08s cubic-bezier(.2,.75,.2,1) both;
  border-color: var(--tool-line);
  background: linear-gradient(145deg, rgba(13,18,36,.9), rgba(var(--tool-rgb),.075));
  box-shadow: 0 22px 70px -44px rgba(var(--tool-rgb),.75), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(14px);
}

.competitive-tool-workspace {
  position: relative;
  padding: 42px 0 92px;
}

.competitive-tool-workspace::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: min(1180px, calc(100% - 36px));
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--tool-line), transparent);
  transform: translateX(-50%);
}

.competitive-tool-workspace > .container {
  position: relative;
  z-index: 1;
}

.competitive-tool-page :is(a, button, input, select, summary):focus-visible {
  outline: 3px solid rgba(var(--tool-rgb),.82);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(var(--tool-rgb),.14);
}

.competitive-tool-page :is(.btn, button, input, select, summary) {
  min-height: 44px;
}

.competitive-tool-page :is(input, select) {
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.competitive-tool-page :is(input, select):focus {
  border-color: rgba(var(--tool-rgb),.72);
  background: #10162a;
}

/* Teams */
.competitive-tool--teams .knowledge-summary {
  border-color: var(--tool-line);
  border-radius: 18px;
  overflow: hidden;
}

.competitive-tool--teams .knowledge-summary > div {
  min-height: 108px;
  display: grid;
  align-content: center;
  padding: 20px;
}

.competitive-tool--teams .knowledge-summary strong {
  color: var(--tool-accent);
  font-size: 2rem;
}

.competitive-tool--teams .knowledge-summary > p {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: #d8d1ff;
  border-top-color: rgba(var(--tool-rgb),.22);
}

.competitive-tool--teams .teams-source-control {
  width: 100%;
  max-width: none;
  margin-bottom: 16px;
  padding: 5px;
  border: 1px solid var(--tool-line);
  border-radius: 14px;
  background: rgba(10,13,27,.92);
}

.competitive-tool--teams .teams-source-control button {
  min-height: 48px;
  border-radius: 9px;
  color: #aeb9cb;
}

.competitive-tool--teams .teams-source-control button.active {
  background: linear-gradient(135deg, rgba(var(--tool-rgb),.36), rgba(var(--tool-rgb),.18));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(var(--tool-rgb),.35);
}

.competitive-tool--teams .teams-toolbar {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid rgba(var(--tool-rgb),.18);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(13,17,32,.96), rgba(var(--tool-rgb),.035));
}

.competitive-tool--teams .team-advanced-filters {
  border-color: rgba(var(--tool-rgb),.2);
  border-radius: 10px;
}

.competitive-tool--teams .knowledge-sourcebar {
  border-color: rgba(var(--tool-rgb),.25);
  border-left-color: var(--tool-accent);
  border-radius: 12px;
  background: rgba(12,16,31,.9);
}

.competitive-tool--teams :is(.team-meta-card, .team-archetype-card, .team-core-card, .team-card) {
  border-color: rgba(var(--tool-rgb),.18);
  background: linear-gradient(155deg, #0b0f1e, rgba(var(--tool-rgb),.035));
  box-shadow: 0 18px 42px -34px rgba(var(--tool-rgb),.72);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.competitive-tool--teams :is(.team-meta-card, .team-archetype-card, .team-core-card, .team-card):hover {
  border-color: rgba(var(--tool-rgb),.52);
  box-shadow: 0 24px 52px -34px rgba(var(--tool-rgb),.85);
  transform: translateY(-2px);
}

/* Builder */
.competitive-tool--builder .builder-actions {
  justify-content: center;
  padding: 12px;
  border: 1px solid var(--tool-line);
  border-radius: 16px;
}

.competitive-tool--builder .builder-actions .btn,
.competitive-tool--builder .icon-command {
  border-color: rgba(var(--tool-rgb),.3);
  background: rgba(8,11,23,.72);
}

.competitive-tool--builder .builder-actions .btn:hover,
.competitive-tool--builder .icon-command:hover {
  border-color: var(--tool-accent);
  color: #fff;
  background: rgba(var(--tool-rgb),.13);
}

.competitive-tool--builder .builder-status {
  min-height: 58px;
  margin-bottom: 12px;
  padding: 0 16px;
  border: 1px solid rgba(var(--tool-rgb),.2);
  border-radius: 12px;
  background: rgba(12,16,31,.86);
}

.competitive-tool--builder .builder-status span:first-child { color: var(--tool-accent); }

.competitive-tool--builder .builder-slot {
  position: relative;
  overflow: hidden;
  border-color: rgba(var(--tool-rgb),.17);
  background: linear-gradient(145deg, #0b0f1e, rgba(var(--tool-rgb),.035));
  box-shadow: 0 18px 40px -34px rgba(var(--tool-rgb),.72);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.competitive-tool--builder .builder-slot::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(var(--tool-accent), transparent);
  opacity: .7;
}

.competitive-tool--builder .builder-slot:focus-within {
  border-color: rgba(var(--tool-rgb),.62);
  box-shadow: 0 22px 50px -35px rgba(var(--tool-rgb),.9);
  transform: translateY(-1px);
}

.competitive-tool--builder .slot-identity > span {
  background: linear-gradient(135deg, var(--tool-accent), #c72d52);
  box-shadow: 0 7px 18px rgba(var(--tool-rgb),.24);
}

.competitive-tool--builder .builder-analyze {
  border: 1px solid rgba(var(--tool-rgb),.72);
  background: linear-gradient(110deg, #d82d55, var(--tool-accent));
  box-shadow: 0 18px 38px -24px rgba(var(--tool-rgb),.85);
}

.competitive-tool--builder .analysis-panel {
  border-color: rgba(var(--tool-rgb),.22);
  background: linear-gradient(160deg, #0b0f1e, rgba(var(--tool-rgb),.04));
  box-shadow: 0 28px 65px -48px rgba(var(--tool-rgb),.75);
}

.competitive-tool--builder .analysis-heading {
  border-bottom-color: rgba(var(--tool-rgb),.18);
  background: rgba(var(--tool-rgb),.075);
}

/* Calculator */
.competitive-tool--calc .tool-tabs,
.competitive-tool--speed .tool-tabs {
  min-width: 340px;
  padding: 6px;
  border-color: var(--tool-line);
  border-radius: 14px;
}

.competitive-tool--calc .tool-tabs a,
.competitive-tool--speed .tool-tabs a {
  min-height: 50px;
  border-radius: 9px;
}

.competitive-tool--calc .tool-tabs a.active,
.competitive-tool--speed .tool-tabs a.active {
  background: linear-gradient(120deg, rgba(var(--tool-rgb),.85), rgba(var(--tool-rgb),.52));
  box-shadow: 0 12px 30px -20px rgba(var(--tool-rgb),.95), inset 0 1px rgba(255,255,255,.18);
}

.competitive-tool--calc .calculator-sides { gap: 18px; }

.competitive-tool--calc .combatant-panel {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border-color: rgba(var(--tool-rgb),.2);
  background: linear-gradient(155deg, #0b0f1e, rgba(var(--tool-rgb),.035));
  box-shadow: 0 20px 46px -38px rgba(var(--tool-rgb),.7);
}

.competitive-tool--calc .combatant-panel::after {
  content: "";
  position: absolute;
  top: -70px;
  right: -70px;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(var(--tool-rgb),.13);
  border-radius: 50%;
}

.competitive-tool--calc .combatant-panel[data-side="attacker"] { border-top-color: #ff667f; }
.competitive-tool--calc .combatant-panel[data-side="defender"] { border-top-color: var(--tool-accent); }

.competitive-tool--calc .damage-controls {
  padding: 20px;
  border: 1px solid rgba(var(--tool-rgb),.19);
  border-radius: 14px;
  background: rgba(11,15,30,.82);
}

.competitive-tool--calc .damage-primary .btn {
  border: 1px solid rgba(var(--tool-rgb),.72);
  background: linear-gradient(110deg, #087ec1, var(--tool-accent));
}

.competitive-tool--calc .condition-row label {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid rgba(var(--tool-rgb),.14);
  border-radius: 999px;
  background: rgba(255,255,255,.018);
}

.competitive-tool--calc .damage-result {
  border-color: rgba(var(--tool-rgb),.22);
  border-left-color: var(--tool-accent);
  border-radius: 14px;
  background: linear-gradient(110deg, rgba(var(--tool-rgb),.09), #0b0f1e 42%);
  box-shadow: 0 24px 54px -42px rgba(var(--tool-rgb),.8);
}

.competitive-tool--calc .methodology-band {
  overflow: hidden;
  border: 1px solid rgba(var(--tool-rgb),.16);
  border-radius: 14px;
  background: rgba(10,14,27,.72);
}

.competitive-tool--calc .methodology-band p { font-size: .8rem; }

/* Speed tiers */
.competitive-tool--speed .speed-toolbar {
  padding: 20px;
  border: 1px solid rgba(var(--tool-rgb),.2);
  border-radius: 16px;
  background: linear-gradient(145deg, #0b0f1e, rgba(var(--tool-rgb),.04));
}

.competitive-tool--speed .speed-toolbar .btn {
  border: 1px solid rgba(var(--tool-rgb),.7);
  background: linear-gradient(110deg, #188b82, var(--tool-accent));
  color: #03110f;
}

.competitive-tool--speed .speed-toolbar .toggle-control {
  min-height: 48px;
  border-color: rgba(var(--tool-rgb),.24);
}

.competitive-tool--speed .speed-source {
  min-height: 68px;
  color: var(--tool-accent);
  font-size: .9rem;
  font-weight: 650;
}

.competitive-tool--speed .speed-table-wrap {
  border-color: rgba(var(--tool-rgb),.22);
  border-radius: 16px;
  background: linear-gradient(155deg, #0b0f1e, rgba(var(--tool-rgb),.025));
  box-shadow: 0 24px 58px -46px rgba(var(--tool-rgb),.8);
}

.competitive-tool--speed .speed-table thead { background: rgba(var(--tool-rgb),.075); }

.competitive-tool--speed .speed-table tbody tr {
  transition: background .18s ease, transform .18s ease;
}

.competitive-tool--speed .speed-table tbody tr:hover { background: rgba(var(--tool-rgb),.06); }
.competitive-tool--speed .speed-value { color: var(--tool-accent); }

.competitive-tool--speed .speed-more .btn {
  border-color: rgba(var(--tool-rgb),.36);
  color: var(--tool-accent);
}

@keyframes competitive-tool-enter {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .competitive-tool-hero { min-height: 0; padding: 58px 0 46px; }
  .competitive-tool-hero .knowledge-header-grid { grid-template-columns: 1fr; gap: 30px; }
  .competitive-tool-copy { max-width: 780px; }
  .competitive-tool-console { width: 100%; max-width: 680px; }
  .competitive-tool-mark { right: -65px; width: 220px; opacity: .28; }
  .competitive-tool--builder .builder-actions { justify-content: flex-start; }
  .competitive-tool--calc .tool-tabs,
  .competitive-tool--speed .tool-tabs { min-width: 0; }
}

@media (max-width: 620px) {
  .competitive-tool-main::before { background-size: 30px 30px; }
  .competitive-tool-hero { padding: 44px 0 34px; }
  .competitive-tool-hero .knowledge-header-grid { gap: 24px; }
  .competitive-tool-hero .competitive-tool-copy h1 { max-width: 12ch; font-size: clamp(2.6rem, 14vw, 3.7rem); }
  .competitive-tool-hero .competitive-tool-copy p { font-size: .98rem; line-height: 1.55; }
  .competitive-tool-copy .eyebrow { font-size: .76rem; }
  .competitive-tool-mark { top: 32%; right: -92px; width: 190px; opacity: .2; }
  .competitive-tool-workspace { padding: 28px 0 68px; }
  .competitive-tool--teams .knowledge-summary > div { min-height: 90px; padding: 14px 8px; }
  .competitive-tool--teams .knowledge-summary strong { font-size: 1.55rem; }
  .competitive-tool--teams .teams-toolbar { padding: 15px; }
  .competitive-tool--builder .builder-actions { display: grid; grid-template-columns: 1fr 1fr 48px; }
  .competitive-tool--builder .builder-actions .btn { min-width: 0; }
  .competitive-tool--calc .combatant-panel { padding: 18px; }
  .competitive-tool--calc .damage-controls { padding: 16px; }
  .competitive-tool--calc .condition-row label { width: 100%; border-radius: 8px; }
  .competitive-tool--speed .speed-toolbar { padding: 16px; }
  .competitive-tool--speed .speed-table th,
  .competitive-tool--speed .meta-pokemon-link small { font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .competitive-tool-copy,
  .competitive-tool-console { animation: none; }
  .competitive-tool-page *,
  .competitive-tool-page *::before,
  .competitive-tool-page *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
