:root {
  --page: #020907;
  --page-soft: #06130f;
  --panel: rgba(5, 22, 17, 0.94);
  --panel-deep: rgba(2, 13, 10, 0.96);
  --cream: #eee8dc;
  --muted: #aaa99e;
  --teal: #68cbbd;
  --teal-deep: #1f8578;
  --copper: #bd7847;
  --copper-soft: rgba(189, 120, 71, 0.52);
  --line: rgba(127, 184, 161, 0.2);
  --good: #6cd9a7;
  --close: #e4b36c;
  --bad: #ef8b83;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

html { color-scheme: dark; scroll-behavior: smooth; }

button,
select { font: inherit; }

button,
select,
a { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(104, 203, 189, 0.62);
  outline-offset: 3px;
}

.whatif-app {
  width: min(100%, 1380px);
  margin: 0 auto;
  padding: 26px clamp(18px, 4vw, 58px) 72px;
}

.prototype-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 94px;
  border: 1px solid var(--copper-soft);
  border-radius: 18px;
  background: rgba(4, 18, 14, 0.9);
  padding: 18px 24px;
  box-shadow: var(--shadow);
}

.prototype-brand {
  color: var(--cream);
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  font-weight: 950;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.prototype-brand sup {
  margin-left: 0.1rem;
  color: var(--teal);
  font-size: 0.45em;
  vertical-align: super;
}

.prototype-badge,
.engine-pill,
.locked-pill,
.change-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.prototype-badge {
  border: 1px solid rgba(239, 139, 131, 0.38);
  background: rgba(101, 34, 29, 0.26);
  color: #ffaaa3;
  padding: 0.55rem 0.75rem;
}

.whatif-hero {
  max-width: 920px;
  margin: 0 auto 30px;
  text-align: center;
}

.eyebrow,
.card-kicker {
  margin: 0 0 0.75rem;
  color: #e9a26f;
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.whatif-hero h1 {
  margin: 0;
  color: var(--cream);
  font-size: clamp(2.8rem, 8vw, 5.35rem);
  line-height: 0.95;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.whatif-hero > p:last-child {
  max-width: 850px;
  margin: 1.45rem auto 0;
  color: #c9c6bc;
  font-size: clamp(1rem, 2vw, 1.14rem);
  line-height: 1.7;
}

.safety-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  max-width: 930px;
  margin: 0 auto 18px;
  border: 1px solid rgba(104, 203, 189, 0.31);
  border-radius: 14px;
  background: rgba(10, 41, 32, 0.72);
  padding: 0.8rem 1rem;
}

.safety-note p { margin: 0; color: #c9c8bd; line-height: 1.45; }
.safety-note strong { color: var(--teal); }

.safety-icon {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(104, 203, 189, 0.18);
  color: var(--teal);
  font-weight: 950;
}

.selection-panel,
.comparison-builder,
.rating-panel,
.whatif-auth-callout {
  border: 1px solid var(--copper-soft);
  border-radius: 20px;
  background: var(--panel);
  padding: clamp(20px, 3vw, 32px);
  box-shadow: var(--shadow);
}

.comparison-builder,
.rating-panel { margin-top: 18px; }

.whatif-auth-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  max-width: 930px;
  margin: 18px auto 0;
}

.whatif-auth-callout h2 {
  margin: 0;
  color: var(--cream);
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.whatif-auth-callout p:last-child {
  max-width: 680px;
  margin: 0.6rem 0 0;
  color: var(--muted);
}

.whatif-auth-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.whatif-auth-actions a,
.rating-premium-lock a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.045em;
  text-decoration: none;
  text-transform: uppercase;
}

.whatif-auth-actions .primary-link,
.rating-premium-lock a {
  border: 1px solid #4ab5a5;
  background: linear-gradient(135deg, #176c61, #2c9487);
  color: white;
}

.whatif-auth-actions .secondary-link {
  border: 1px solid var(--copper-soft);
  color: #d6d2c8;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}

.section-heading h2 {
  margin: 0;
  color: var(--cream);
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  line-height: 1.05;
}

.section-note {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  text-align: right;
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.field { display: grid; gap: 0.45rem; }

.field > span {
  color: #c5c4ba;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(116, 181, 161, 0.38);
  border-radius: 11px;
  background: #030b18;
  color: #f3eee3;
  padding: 0 1rem;
}

.source-note,
.comparison-status {
  margin: 0.9rem 0 0;
  color: #82d8a9;
  font-size: 0.88rem;
  line-height: 1.5;
}

.pokemon-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-deep);
  padding: 17px 20px;
}

.pokemon-identity > div:first-child { display: grid; gap: 0.28rem; }
.pokemon-identity > div:first-child strong { color: var(--teal); font-size: 1.45rem; }
.pokemon-identity > div:first-child span { color: #92958b; font-size: 0.86rem; }

.pokemon-identity dl {
  display: flex;
  align-items: center;
  gap: clamp(20px, 5vw, 54px);
  margin: 0;
}

.pokemon-identity dl > div { display: grid; gap: 0.3rem; }
.pokemon-identity dt { color: #82877e; font-size: 0.65rem; font-weight: 950; letter-spacing: 0.09em; text-transform: uppercase; }
.pokemon-identity dd { margin: 0; color: var(--cream); font-weight: 850; }

.build-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.build-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-deep);
  padding: clamp(18px, 2.5vw, 25px);
}

.simulated-build { border-color: rgba(104, 203, 189, 0.43); }

.build-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.build-card-heading h3 { margin: 0; color: var(--cream); font-size: 1.45rem; }
.card-kicker { margin-bottom: 0.4rem; font-size: 0.68rem; }

.locked-pill {
  background: rgba(189, 120, 71, 0.15);
  color: #e4a477;
  padding: 0.42rem 0.62rem;
}

.change-pill {
  background: rgba(104, 203, 189, 0.14);
  color: var(--teal);
  padding: 0.42rem 0.62rem;
}

.change-pill.has-changes { background: rgba(189, 120, 71, 0.18); color: #f2aa75; }

.move-selectors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 17px;
}

.move-selectors select { min-height: 48px; }

.move-stack { display: grid; gap: 10px; margin-top: 17px; }
.move-stack.compact { margin-top: 15px; }

.move-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem 1rem;
  border-left: 4px solid var(--teal);
  border-radius: 7px 11px 11px 7px;
  background: rgba(18, 72, 61, 0.55);
  padding: 0.74rem 0.85rem;
}

.move-card.charged { border-left-color: var(--copper); background: rgba(73, 43, 25, 0.52); }
.move-card strong { min-width: 0; overflow-wrap: anywhere; }
.move-card .move-type { align-self: start; color: #9bddcf; font-size: 0.68rem; font-weight: 950; letter-spacing: 0.06em; text-transform: uppercase; }
.move-card.charged .move-type { color: #efb48a; }
.move-card dl { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; grid-column: 1 / -1; margin: 0; }
.move-card dl div { display: flex; gap: 0.28rem; color: #b8b8ae; font-size: 0.78rem; }
.move-card dt { color: #7f867d; }
.move-card dd { margin: 0; font-weight: 800; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 14px;
}

.metric {
  display: grid;
  gap: 0.27rem;
  border: 1px solid rgba(127, 184, 161, 0.13);
  border-radius: 10px;
  background: rgba(6, 25, 20, 0.8);
  padding: 0.58rem 0.62rem;
}

.metric span { color: #7f867d; font-size: 0.56rem; font-weight: 900; letter-spacing: 0.06em; line-height: 1.25; text-transform: uppercase; }
.metric strong { color: #d8d7cd; font-size: 0.82rem; line-height: 1.25; overflow-wrap: anywhere; }
.metric strong.positive { color: var(--good); }
.metric strong.negative { color: var(--bad); }

.builder-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  width: auto;
  border-radius: 10px;
  padding: 0.75rem 1.15rem;
  font-weight: 950;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  cursor: pointer;
}

.primary-button { border: 1px solid #4ab5a5; background: linear-gradient(135deg, #176c61, #2c9487); color: white; }
.secondary-button { border: 1px solid var(--copper-soft); background: transparent; color: #d6d2c8; }
.primary-button:hover,
.secondary-button:hover { filter: brightness(1.12); }
.primary-button:disabled {
  cursor: wait;
  filter: saturate(0.65);
  opacity: 0.76;
}

.rating-heading {
  padding-inline: clamp(14px, 2vw, 20px);
}

.rating-kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.rating-kicker-row .eyebrow { margin: 0; }

.rating-heading h2 {
  margin: 0.42rem 0 0;
  color: var(--cream);
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  line-height: 1.05;
}

.premium-rating-comparison {
  margin-top: 18px;
  border: 1px solid rgba(104, 203, 189, 0.24);
  border-radius: 16px;
  background: rgba(3, 16, 12, 0.72);
  padding: clamp(15px, 2vw, 20px);
}

.premium-rating-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.premium-rating-heading h3 {
  margin: 0;
  color: var(--cream);
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
}

.premium-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid rgba(226, 162, 112, 0.44);
  border-radius: 999px;
  background: rgba(99, 55, 27, 0.26);
  color: #efb083;
  padding: 0.38rem 0.58rem;
  font-size: 0.64rem;
  font-weight: 950;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.rating-access-status {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.84rem;
}

.rating-premium-lock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 14px;
  border: 1px solid rgba(189, 120, 71, 0.3);
  border-radius: 13px;
  background: linear-gradient(115deg, rgba(49, 31, 18, 0.42), rgba(8, 27, 21, 0.75));
  padding: 1rem 1.1rem;
}

.rating-premium-lock strong { color: #efb083; }
.rating-premium-lock p { margin: 0.3rem 0 0; color: var(--muted); line-height: 1.5; }

.engine-pill {
  gap: 0.45rem;
  border: 1px solid rgba(228, 179, 108, 0.28);
  background: rgba(77, 54, 23, 0.28);
  color: #e5b875;
  padding: 0.55rem 0.7rem;
}

.engine-pill > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e5b875;
  box-shadow: 0 0 0 4px rgba(229, 184, 117, 0.12);
}

.engine-pill.ready {
  border-color: rgba(89, 191, 161, 0.35);
  background: rgba(21, 78, 61, 0.28);
  color: #8ad6c4;
}

.engine-pill.ready > span { background: var(--good); box-shadow: 0 0 0 4px rgba(89, 191, 161, 0.12); }
.engine-pill.running > span { animation: engine-pulse 1s ease-in-out infinite alternate; }

@keyframes engine-pulse {
  from { opacity: 0.35; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1.1); }
}

.rating-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) minmax(180px, 0.65fr);
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.rating-card {
  display: grid;
  gap: 0.35rem;
  min-height: 126px;
  place-content: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel-deep);
  padding: 1rem;
  text-align: center;
}

.rating-card p { margin: 0; color: #aba99e; font-size: 0.74rem; font-weight: 950; letter-spacing: 0.08em; text-transform: uppercase; }
.rating-card strong { color: var(--cream); font-size: clamp(2.25rem, 4.2vw, 3.4rem); line-height: 1; }
.rating-card > span { color: #81867d; font-size: 0.8rem; }
.simulated-rating-card { border-color: rgba(104, 203, 189, 0.44); }
.delta-card { border-color: rgba(189, 120, 71, 0.36); }
.rating-arrow { color: var(--teal); font-size: 1.8rem; font-weight: 950; }

.engine-explanation {
  margin-top: 14px;
  border: 1px solid rgba(228, 179, 108, 0.22);
  border-radius: 12px;
  background: rgba(60, 43, 18, 0.2);
  padding: 1rem 1.1rem;
}

.engine-explanation strong { color: #e5b875; }
.engine-explanation p { margin: 0.35rem 0 0; color: #aaa99e; line-height: 1.55; }

.outcome-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.outcome-summary > div {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(4, 18, 14, 0.75);
  padding: 0.82rem 0.9rem;
}

.outcome-summary strong { color: #c8c6bc; font-size: 0.82rem; }
.outcome-summary b { color: var(--cream); font-size: 1.1rem; }
.outcome-dot { width: 9px; height: 9px; border-radius: 50%; }
.outcome-dot.favorable { background: var(--good); }
.outcome-dot.close { background: var(--close); }
.outcome-dot.unfavorable { background: var(--bad); }

.matchup-table-wrap {
  margin-top: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.matchup-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: rgba(2, 13, 10, 0.73);
}

.matchup-table caption {
  padding: 0.85rem 1rem;
  color: #8d9188;
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: left;
}

.matchup-table th,
.matchup-table td { padding: 0.9rem 1rem; border-top: 1px solid var(--line); text-align: left; }
.matchup-table th { color: #e3a273; font-size: 0.68rem; letter-spacing: 0.075em; text-transform: uppercase; }
.matchup-table td { color: #bcbbb1; font-size: 0.88rem; }
.matchup-table td:first-child { color: var(--cream); font-weight: 850; }
.pending-cell { color: #7e837a !important; font-style: italic; }
.matchup-table th[scope="row"] { color: var(--cream); font-size: 0.88rem; letter-spacing: 0; text-transform: none; }
.matchup-score { display: inline-block; min-width: 2.15rem; color: var(--cream); font-size: 0.94rem; }
.outcome-label {
  display: inline-flex;
  justify-content: center;
  min-width: 6.3rem;
  border-radius: 999px;
  margin-left: 0.42rem;
  padding: 0.22rem 0.48rem;
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}
.outcome-label.favorable { background: rgba(31, 117, 84, 0.32); color: #8bd7b9; }
.outcome-label.close { background: rgba(148, 108, 43, 0.27); color: #e7c28b; }
.outcome-label.unfavorable { background: rgba(137, 53, 48, 0.3); color: #f0aaa4; }
.matchup-table td:nth-child(2),
.matchup-table td:nth-child(3) { white-space: nowrap; }
.rating-change { font-weight: 950; }
.positive { color: #7ed7b7 !important; }
.negative { color: #efaaa4 !important; }
.neutral { color: #aaa99e !important; }

.prototype-footer {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  margin-top: 26px;
  border-top: 1px solid rgba(189, 120, 71, 0.25);
  padding: 24px 16px 0;
  color: #858a80;
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
}

.prototype-footer strong { color: #a6a79e; }

@media (max-width: 900px) {
  .section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .section-note { text-align: left; }
  .build-grid { grid-template-columns: 1fr; }
  .rating-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rating-arrow { display: none; }
  .delta-card { grid-column: auto; }
  .rating-card { min-height: 116px; padding: 0.8rem 0.5rem; }
  .rating-card p { font-size: 0.61rem; }
  .rating-card > span { font-size: 0.7rem; }
}

@media (max-width: 680px) {
  .whatif-app { padding-top: 12px; }
  .safety-note { align-items: flex-start; justify-content: flex-start; }
  .selection-grid { grid-template-columns: 1fr; }
  .whatif-auth-callout,
  .rating-premium-lock { align-items: stretch; flex-direction: column; }
  .whatif-auth-actions { width: 100%; }
  .whatif-auth-actions a { flex: 1 1 0; }
  .rating-premium-lock a { width: 100%; }
  .pokemon-identity { align-items: flex-start; flex-direction: column; gap: 17px; }
  .pokemon-identity dl { width: 100%; justify-content: space-between; gap: 12px; }
  .move-selectors { gap: 6px; }
  .move-selectors .field > span { font-size: 0.56rem; letter-spacing: 0.045em; }
  .move-selectors select { min-height: 44px; padding: 0 0.45rem; font-size: 0.78rem; }
  .builder-actions { flex-direction: column-reverse; }
  .primary-button,
  .secondary-button { width: 100%; }
  .outcome-summary { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .selection-panel,
  .comparison-builder,
  .rating-panel,
  .whatif-auth-callout { border-radius: 15px; padding: 17px 14px; }
  .whatif-auth-actions { flex-direction: column; }
  .pokemon-identity dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pokemon-identity dd { font-size: 0.86rem; overflow-wrap: anywhere; }
  .metric-grid { gap: 3px; }
  .metric { min-width: 0; border-radius: 7px; padding: 0.43rem 0.28rem; }
  .metric span { font-size: 0.43rem; letter-spacing: 0.025em; }
  .metric strong { font-size: 0.65rem; }
  .rating-heading { padding-inline: 7px; }
  .rating-kicker-row { gap: 9px; }
  .engine-pill { max-width: 170px; padding: 0.42rem 0.52rem; font-size: 0.55rem; text-align: center; }
  .rating-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .rating-card { min-height: 104px; border-radius: 11px; padding: 0.66rem 0.24rem; }
  .rating-card p { font-size: 0.5rem; letter-spacing: 0.035em; }
  .rating-card strong { font-size: 1.9rem; }
  .rating-card > span { font-size: 0.57rem; line-height: 1.25; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .engine-pill.running > span { animation: none; }
}
