:root {
  color-scheme: dark;
  --ink: #f2f0e8;
  --muted: #a8ada6;
  --line: #343a3a;
  --panel: #191d1d;
  --paper: #101313;
  --primary: #39b9a8;
  --primary-dark: #7ad9cd;
  --accent: #e0a12f;
  --danger: #ff7d72;
  --danger-bg: #3a1f1c;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--primary);
  text-decoration: none;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--primary-dark);
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

label {
  display: grid;
  gap: 6px;
  color: #314052;
  font-size: 0.91rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
}

h2 {
  margin-bottom: 16px;
  font-size: 1.15rem;
}

h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.card h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.card-title-line {
  padding-bottom: 0;
}

.count-inline {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  transform: translateY(-1px);
  vertical-align: middle;
}

.expires-inline {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid #e0e7ef;
  border-radius: 999px;
  padding: 1px 7px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  transform: translateY(-1px);
  vertical-align: middle;
}

.official-inline {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  border: 1px solid #b8d8d6;
  border-radius: 999px;
  padding: 1px 6px;
  background: #eaf7f5;
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  transform: translateY(-2px);
  vertical-align: middle;
}

.reward-inline {
  border-color: #d6a82d;
  background: rgba(214, 168, 45, 0.18);
  color: #ffc857;
}

.squad-inline {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  border: 1px solid #8cc7b1;
  border-radius: 999px;
  padding: 1px 6px;
  background: #e7f6ef;
  color: #064536;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  transform: translateY(-2px);
  vertical-align: middle;
}

.evolved-inline {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  border: 1px solid #b8d8d6;
  border-radius: 999px;
  padding: 1px 6px;
  background: #eaf7f5;
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  transform: translateY(-2px);
  vertical-align: middle;
}

.potential-callout {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  border: 1px solid #efc36f;
  border-left-width: 4px;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff8ed;
  color: #6f4700;
  font-size: 0.78rem;
  font-weight: 900;
}

.potential-callout:hover,
.potential-callout:focus-visible {
  border-color: #d8841f;
  background: #fff3dd;
  color: #5d3b00;
  text-decoration: none;
}

.potential-callout.optimal-squad-callout {
  display: inline-flex;
  min-height: 19px;
  width: fit-content;
  gap: 0;
  margin-top: 0;
  border-color: #efc36f;
  border-left-width: 1px;
  border-radius: 999px;
  padding: 1px 6px;
  background: #fff8ed;
  color: #6f4700;
  font-size: 0.72rem;
  line-height: 1;
  text-transform: uppercase;
}

.potential-callout.optimal-squad-callout:hover,
.potential-callout.optimal-squad-callout:focus-visible {
  border-color: #d8841f;
  background: #fff3dd;
  color: #5d3b00;
}

.potential-callout::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d8841f;
}

.potential-callout[hidden] {
  display: none;
}

h4 {
  margin: 0;
  font-size: 0.88rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 900;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 0.8rem;
}

nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

nav form {
  margin: 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px clamp(16px, 4vw, 42px);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.site-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 6px 0 0;
}

.footer-links a {
  color: var(--primary-dark);
  font-weight: 850;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.legal-content {
  max-width: 900px;
}

.legal-content h2 {
  margin-top: 28px;
}

.legal-content p,
.legal-content li {
  color: var(--muted);
  line-height: 1.65;
}

.legal-content ul {
  padding-left: 20px;
}

nav a {
  border-radius: 7px;
  padding: 7px 9px;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

nav a:hover,
nav a:focus-visible {
  background: #eef2f7;
  color: var(--ink);
  text-decoration: none;
}

.ghost,
.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost:hover,
.secondary:hover {
  background: #eef2f7;
  color: var(--ink);
}

.page {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 130px);
  place-items: center;
}

.auth-panel,
.panel,
.card,
.empty,
.flash {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(480px, 100%);
  padding: 34px;
}

.auth-panel h1 {
  white-space: nowrap;
  font-size: clamp(2.75rem, 8vw, 3.4rem);
}

.auth-panel form {
  margin-bottom: 14px;
}

.stack {
  display: grid;
  gap: 16px;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.flash {
  margin-bottom: 16px;
  padding: 13px 16px;
  border-color: #b8d8d6;
  color: var(--primary-dark);
}

.import-help {
  margin-bottom: 16px;
}

.import-review {
  margin-bottom: 18px;
  border-color: #b8d8d6;
  background: #f7fbfb;
}

.import-review ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.section-head > div:first-child {
  flex: 1 0 auto;
}

.section-head h1 {
  white-space: nowrap;
}

.actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-head .actions {
  justify-content: flex-end;
}

.filter-toggles {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border-radius: 8px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.filter-toggle:hover,
.filter-toggle:focus-visible {
  background: #f5f8fb;
  color: var(--ink);
}

.filter-toggle.active {
  background: #eaf7f5;
  color: var(--primary-dark);
}

.filter-switch {
  position: relative;
  width: 28px;
  height: 16px;
  border: 1px solid #cfd8e3;
  border-radius: 999px;
  background: #eef2f7;
}

.filter-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
  transition: left 0.15s ease;
}

.filter-toggle.active .filter-switch {
  border-color: #8cc7b1;
  background: var(--primary);
}

.filter-toggle.active .filter-switch::after {
  left: 14px;
}

.player-disabled-toggle {
  position: relative;
  cursor: pointer;
}

.player-disabled-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.split {
  display: grid;
  grid-template-columns: minmax(330px, 0.75fr) minmax(0, 1.25fr);
  gap: 26px;
}

.grid {
  display: grid;
  gap: 14px;
}

.player-grid {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  align-items: stretch;
}

.evolution-grid {
  grid-template-columns: minmax(0, 1fr);
}


.evolution-search-bar {
  margin: -10px 0 18px;
}

.evolution-search-bar label {
  max-width: 420px;
}

.evolution-search-empty {
  padding: 18px;
}

.chain-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.chain-meta,
.chain-path,
.priority-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chain-meta span,
.chain-path button,
.chain-path span,
.priority-list span {
  min-height: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
  color: #314052;
  font-size: 0.8rem;
  font-weight: 750;
}

.chain-path button {
  justify-content: flex-start;
  cursor: pointer;
}

.chain-path button:hover,
.chain-path button:focus-visible {
  border-color: #b8d8d6;
  background: #eaf7f5;
  color: var(--primary-dark);
}

.chain-path .removed-chain-step {
  border-color: #efc7c2;
  background: var(--danger-bg);
  color: var(--danger);
}

.chain-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.chain-card .attribute-details {
  margin-top: 14px;
}

.compact-chain-path {
  margin-bottom: 12px;
}

.player-chain-stack {
  display: none;
}

.player-chain-stack:has(.used-evo-chain:not([hidden])) {
  display: grid;
  gap: 12px;
  margin-top: auto;
  margin-bottom: 20px;
}

.used-evo-chain {
  margin: 0;
  padding-top: 0;
  border-top: 0;
}

.used-evo-chain-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  border: 1px solid #d7e0ea;
  border-radius: 999px;
  padding: 5px 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}

.used-evo-chain-label::-webkit-details-marker {
  display: none;
}

.used-evo-chain-label::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid currentColor;
  transform: translateY(1px);
}

.used-evo-chain[open] > .used-evo-chain-label {
  margin-bottom: 8px;
}

.used-evo-chain[open] > .used-evo-chain-label::before {
  transform: translateY(1px) rotate(90deg);
}

.used-evo-chain-label span:last-child {
  min-width: 20px;
  border: 1px solid #d7e0ea;
  border-radius: 999px;
  padding: 2px 6px;
  text-align: center;
  font-size: 0.72rem;
}

.used-evo-chain-path {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.used-evo-chain-path [data-used-evo-chain-item] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #b8d8d6;
  border-radius: 6px;
  padding: 4px 8px 4px 4px;
  background: #f3fbf9;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
}

.remove-chain-step-form {
  display: inline-flex;
  margin: 0;
}

.remove-chain-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid #efc7c2;
  border-radius: 5px;
  padding: 0;
  background: var(--danger-bg);
  color: var(--danger);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
}

.remove-chain-step:hover,
.remove-chain-step:focus-visible {
  border-color: #f0c9c4;
  background: #ffece8;
  color: #7a1710;
}

.used-evo-chain-path [data-used-evo-chain-item].dragging {
  opacity: 0.45;
}

.used-evo-chain-path .drag-handle {
  width: 22px;
  min-height: 22px;
  border-radius: 5px;
  font-size: 0.72rem;
  cursor: grab;
}

.recommended-evo-chain .used-evo-chain-label {
  border-color: #e5b54a;
  background: #fff7df;
  color: #7a4b00;
}

.recommended-evo-chain[open] > .used-evo-chain-label {
  margin-bottom: 8px;
}

.recommended-evo-chain > .used-evo-chain-path {
  margin-top: 8px;
}

.recommended-evo-chain .recommended-chain-step,
.recommended-evo-chain .removed-chain-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #e5b54a;
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff7df;
  color: #7a4b00;
  font-size: 0.8rem;
  font-weight: 850;
}

.recommended-evo-chain .recommended-chain-step:has(.apply-chain-step) {
  gap: 8px;
  padding-right: 4px;
}

.recommended-evo-chain .removed-chain-step {
  border-color: #efc7c2;
  background: var(--danger-bg);
  color: var(--danger);
}

.apply-chain-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  border: 1px solid #b8d8d6;
  border-radius: 5px;
  padding: 0;
  background: #f3fbf9;
  color: var(--primary-dark);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
}

.apply-chain-step:hover,
.apply-chain-step:focus-visible {
  border-color: #9fc9c6;
  background: #dff2ef;
}

.apply-chain-step:disabled {
  cursor: wait;
  opacity: 0.6;
}

.used-evo-chain-label .apply-chain-all {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
  margin-left: -2px;
  border-color: transparent;
  border-left-color: rgba(224, 161, 47, 0.42);
  border-radius: 0;
  background: transparent;
  color: currentColor;
  transform: none;
}

.used-evo-chain-label .apply-chain-all:hover,
.used-evo-chain-label .apply-chain-all:focus-visible {
  border-color: rgba(224, 161, 47, 0.55);
  border-radius: 5px;
  background: rgba(224, 161, 47, 0.18);
  color: #ffd27b;
}

.used-evo-chain-status {
  display: block;
  min-height: 16px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.used-evo-chain-status[data-state="error"] {
  color: #b42318;
}

.chain-step-modal {
  width: min(620px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 28px));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  background: #fff;
  box-shadow: 0 24px 70px rgba(24, 39, 75, 0.24);
}

.chain-step-modal::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.modal-head h2 {
  margin: 0;
}

.modal-close {
  flex: 0 0 auto;
}

.chain-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.chain-step summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 9px 11px;
  color: #314052;
  font-size: 0.86rem;
  font-weight: 850;
  cursor: pointer;
}

.chain-step[open] summary {
  border-bottom: 1px solid var(--line);
}

.chain-step-body {
  padding: 12px;
}

.ideal-chain-controls {
  margin-bottom: 18px;
}

.ideal-chain-results {
  margin-top: 18px;
}

.ideal-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 34px;
  border: 1px solid #b8d8d6;
  border-radius: 8px;
  padding: 6px 10px;
  background: #eaf7f5;
  color: var(--primary-dark);
  font-size: 0.92rem;
  font-weight: 950;
}

.ideal-chain-body {
  display: grid;
  gap: 16px;
}

.ideal-profile .mini-list {
  margin-top: 12px;
}

.ideal-notes {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.ideal-notes span {
  border: 1px solid #f0d5a8;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff8ed;
  color: #7a4b00;
  font-size: 0.8rem;
  font-weight: 800;
}

.ideal-chain-steps {
  display: grid;
  gap: 8px;
}

.chain-step-meta {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.chain-step-meta span {
  border: 1px solid #eef2f7;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.official-list {
  display: grid;
  gap: 10px;
}

.highlight-status {
  margin: -10px 0 16px;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.highlight-status[data-state="loading"] {
  border-color: #b8d8d6;
  background: #f3fbf9;
  color: var(--primary-dark);
}

.highlight-status[data-state="ready"] {
  border-color: #f0d5a8;
  background: #fff8ed;
  color: #7a4b00;
}

.highlight-status[data-state="empty"] {
  color: var(--muted);
}

.highlight-status[data-state="error"] {
  border-color: #efc7c2;
  background: var(--danger-bg);
  color: var(--danger);
}

.highlight-status[hidden] {
  display: none;
}

.potential-status {
  margin: -10px 0 16px;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.potential-status[data-state="loading"] {
  border-color: #b8d8d6;
  background: #f3fbf9;
  color: var(--primary-dark);
}

.potential-status[data-state="ready"] {
  border-color: #b8d8d6;
  background: #f3fbf9;
  color: var(--primary-dark);
}

.potential-status[data-state="error"] {
  border-color: #efc7c2;
  background: var(--danger-bg);
  color: var(--danger);
}

.potential-status[hidden] {
  display: none;
}

.official-row {
  margin: 0;
}

.evolution-card.chain-highlight {
  border: 2px solid #d8841f;
  background: #fff7ed;
  box-shadow: 0 14px 35px rgba(216, 132, 31, 0.12);
}

.evolution-chain-context {
  margin: 4px 0 0;
  color: #7a4b00;
  font-size: 0.78rem;
  font-weight: 850;
}

.evolution-chain-context a {
  color: var(--primary-dark);
  font-weight: 950;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.evolution-chain-context a:hover,
.evolution-chain-context a:focus-visible {
  color: var(--primary);
}

.evolution-chain-context[hidden] {
  display: none;
}

.count-card-top {
  align-items: center;
  margin-bottom: 0;
  position: relative;
  padding-right: 390px;
}

.official-controls {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 342px;
}

.official-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
}

.official-toggle:has(input:checked) {
  color: var(--primary-dark);
}

.official-toggle input {
  width: 14px;
  height: 14px;
  min-height: auto;
  margin: 0;
  accent-color: var(--primary);
}

.official-controls .expires-inline + .official-toggle {
  border-left: 1px solid #e6edf5;
  padding-left: 10px;
}

.official-count {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  border-left: 1px solid #e6edf5;
  padding-left: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  cursor: default;
}

.official-controls > .official-count:first-child {
  border-left: 0;
  padding-left: 0;
}

.official-row .official-toggle:not(:has(input:checked)) + .official-count {
  visibility: hidden;
  pointer-events: none;
}

.official-count input {
  width: 48px;
  min-height: 26px;
  padding: 3px 7px;
}

.official-controls .expires-inline {
  min-height: 24px;
  transform: none;
}

.official-save-status {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 52px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: right;
}

.official-save-status[data-state="error"] {
  color: var(--danger);
}

.scoring-panel {
  padding: 0;
  overflow: hidden;
}

.scoring-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 34px;
  padding: 14px 18px 18px;
}

.scoring-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 28px;
  row-gap: 10px;
}

.scoring-playstyle-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.scoring-playstyle-columns .scoring-grid {
  grid-template-columns: 1fr;
}

.scoring-grid label {
  grid-template-columns: minmax(0, 1fr) 96px;
  align-items: center;
  column-gap: 12px;
  font-size: 0.82rem;
}

.scoring-grid input {
  min-height: 36px;
  padding: 6px 8px;
}

.scoring-group-stack {
  display: grid;
  gap: 14px;
}

.scoring-subgroup {
  display: grid;
  gap: 8px;
}

.scoring-subgroup h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
}

.priority-list {
  padding: 12px;
}

.settings-options {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.settings-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
}

.settings-option input {
  width: 16px;
  min-height: 16px;
  margin-top: 3px;
  accent-color: var(--primary);
}

.settings-option span {
  display: grid;
  gap: 4px;
}

.settings-option small {
  color: var(--muted);
  font-weight: 700;
}

.settings-datetime {
  max-width: 360px;
}

.card,
.empty,
.panel {
  padding: 18px;
}

.player-card.in-squad {
  border: 2px solid var(--primary);
  background: #eefbf9;
  box-shadow: 0 14px 35px rgba(15, 118, 110, 0.12);
}

.player-card.beats-squad {
  border: 2px solid #d8841f;
  background: #fff7ed;
  box-shadow: 0 14px 35px rgba(216, 132, 31, 0.12);
}

.player-card.optimal-squad {
  border: 2px solid var(--primary);
  box-shadow: 0 14px 35px rgba(15, 118, 110, 0.12);
}

.player-card.in-squad.beats-squad {
  border-color: var(--primary);
  background: #eefbf9;
  box-shadow: 0 14px 35px rgba(15, 118, 110, 0.12);
}

.player-card.player-disabled {
  border-color: #d7b58e;
  background: #fffaf0;
  opacity: 0.78;
  box-shadow: none;
}

.player-card {
  display: flex;
  flex-direction: column;
}

.player-card .row-actions {
  margin-top: auto;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 0;
  border-bottom: 0;
  margin-bottom: 16px;
}

.collapsible-card {
  padding: 0;
}

.collapsible-card-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-content: initial;
  margin: 0;
  padding: 18px;
  cursor: pointer;
  list-style: none;
}

.collapsible-card-summary::-webkit-details-marker {
  display: none;
}

.collapsible-card-summary::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid var(--muted);
  transform: translateY(1px);
}

.collapsible-card[open] > .collapsible-card-summary::before {
  transform: translateY(1px) rotate(90deg);
}

.collapsible-card[open] > .collapsible-card-summary {
  border-bottom: 1px solid #eef2f7;
}

.collapsible-card-summary .card-title-line {
  padding-bottom: 0;
  border-bottom: 0;
}

.collapsible-card-summary h3 {
  margin-bottom: 0;
}

.collapsible-card-body {
  padding: 14px 18px 18px;
}

.evolution-detail-surface {
  display: grid;
  gap: 14px;
}

.evolution-detail-block {
  display: grid;
  gap: 9px;
}

.evolution-detail-block + .evolution-detail-block {
  margin-top: 14px;
}

.evolution-detail-block h4 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.evolution-detail-block .evolution-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
}

.evolution-detail-block .evolution-meta-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  min-height: 44px;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  padding: 7px 9px;
  background: #f8fafc;
}

.evolution-detail-block .evolution-meta dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  white-space: normal;
}

.evolution-detail-block .evolution-meta dd {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.evolution-detail-block .mini-list,
.evolution-detail-block .chips {
  margin: 0;
  padding-top: 0;
  border-top: 0;
}

.evolution-detail-block .upgrade-chip {
  border-radius: 8px;
}

.evolution-detail-block .rarity-boost {
  border-color: #d2ae48;
  background: #fff7d6;
  color: #664800;
}

.evolution-detail-block .position-boost {
  border-color: #b8d8d6;
  background: #f3fbf9;
  color: var(--primary-dark);
}

.card-top > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.card-meta,
.evolution-meta {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 8px 0 0;
}

.card-meta {
  margin-top: 7px;
  padding-bottom: 0;
  border-bottom: 0;
}

.player-card .card-meta-item {
  grid-template-columns: 98px minmax(0, 1fr);
  column-gap: 10px;
}

.card-meta-item,
.evolution-meta-item {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: baseline;
  column-gap: 12px;
  min-width: 0;
}

.card-meta dt,
.card-meta dd,
.evolution-meta dt,
.evolution-meta dd {
  margin: 0;
}

.card-meta dt,
.evolution-meta dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
  text-align: left;
}

.card-meta dd,
.evolution-meta dd {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 900;
  min-width: 0;
}

.position-score {
  display: grid;
  grid-template-columns: 42px max-content;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  margin-bottom: 3px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 850;
}

.position-score-list {
  display: grid;
  gap: 3px;
}

.position-score:last-child {
  margin-bottom: 0;
}

.position-score.preferred {
  color: var(--ink);
  font-weight: 950;
}

.position-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  min-height: 16px;
  margin-left: 3px;
  border: 1px solid rgba(57, 185, 168, 0.42);
  border-radius: 999px;
  background: rgba(57, 185, 168, 0.12);
  color: var(--primary-dark);
  font-size: 0.62rem;
  font-weight: 950;
  line-height: 1;
}

.position-score strong {
  justify-self: start;
  font-size: 0.8rem;
  font-weight: inherit;
}

.position-score-value {
  position: relative;
  display: inline-flex;
  align-items: baseline;
}

.position-potential-arrow {
  color: var(--muted);
  font: inherit;
  font-weight: inherit;
}

.rating {
  flex: 0 0 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  min-width: 54px;
  max-width: 54px;
  height: 54px;
  font-variant-numeric: tabular-nums;
  border-radius: 8px;
  background: var(--accent);
  color: #151515;
  font-size: 1.5rem;
  font-weight: 950;
}

.stats-six {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding-top: 12px;
  margin-bottom: 14px;
}

.stats-six > div {
  position: relative;
  min-height: 54px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 8px;
  background: #f8fafc;
}

.stats-six > div:focus-visible {
  outline: 2px solid rgba(57, 185, 168, 0.46);
  outline-offset: 2px;
}

.stats-six > div > span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.stats-six > div > strong {
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex-wrap: wrap;
  font-size: 1.08rem;
  color: var(--ink);
}

.stats-six strong small,
.stats-six strong .chem-boost,
.stats-six .stat-before,
.stats-six .stat-arrow {
  color: inherit;
  font: inherit;
  font-weight: inherit;
}

.stats-six .chem-boost {
  margin-left: 0;
}

.stats-six .stat-before {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}

.face-stat-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: grid;
  gap: 6px;
  width: max-content;
  min-width: 190px;
  max-width: min(260px, 82vw);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.score-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 40;
  display: grid;
  gap: 9px;
  width: max-content;
  min-width: 300px;
  max-width: min(520px, 86vw);
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.position-score-value:hover .score-tooltip,
.position-score-value:focus-visible .score-tooltip,
.position-score-value:focus-within .score-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.score-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  transform: translateX(-50%) rotate(45deg);
}

.score-tooltip-summary,
.score-tooltip-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.score-tooltip-summary {
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.score-tooltip-summary span,
.score-tooltip-title,
.score-tooltip-row span,
.score-tooltip-empty {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.score-tooltip-summary strong,
.score-tooltip-row small {
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

.score-tooltip-groups,
.score-tooltip-group {
  display: grid;
  gap: 7px;
}

.score-tooltip-title {
  color: var(--primary);
  text-transform: uppercase;
}

.face-stat:hover .face-stat-tooltip,
.face-stat:focus-visible .face-stat-tooltip,
.face-stat:focus-within .face-stat-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.face-stat-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  transform: translateX(-50%) rotate(45deg);
}

.face-stat-tooltip div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.face-stat-tooltip span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.face-stat-tooltip strong {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  color: var(--ink);
  font-size: 0.86rem;
  white-space: nowrap;
}

.attribute-details {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.attribute-details summary {
  min-height: 40px;
  padding: 10px 12px;
  color: #314052;
  font-size: 0.86rem;
  font-weight: 850;
  cursor: pointer;
}

.attribute-details[open] summary {
  border-bottom: 1px solid var(--line);
}

.attribute-detail-groups {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.attribute-detail-group {
  display: grid;
  gap: 8px;
}

.attribute-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.attribute-detail-grid div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 30px;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  padding: 5px 8px;
  background: #f8fafc;
}

.attribute-detail-grid span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.attribute-detail-grid strong {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 850;
}

.attribute-detail-grid strong small,
.attribute-detail-grid strong .chem-boost {
  color: inherit;
  font: inherit;
  font-weight: inherit;
}

.chem-boost {
  color: var(--primary-dark);
  font-size: 0.76rem;
  font-weight: 850;
}

.attribute-flow {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
}

.attribute-before::after {
  content: "->";
}

.attribute-flow strong {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}

.attribute-flow .chem-boost {
  margin-left: 0;
}

.attribute-flow small .chem-boost {
  margin-left: 1px;
}

.attribute-flow small,
.attribute-flow strong,
.attribute-flow .chem-boost {
  color: inherit;
  font: inherit;
  font-weight: inherit;
}

.score-detail-groups {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

.score-detail-group {
  display: grid;
  gap: 8px;
}

.score-detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.score-detail-list div {
  display: grid;
  gap: 2px;
  min-height: 44px;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  padding: 6px 8px;
  background: #f8fafc;
}

.score-detail-list span {
  color: #314052;
  font-size: 0.78rem;
  font-weight: 850;
}

.score-detail-list small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.alternate-pos {
  color: var(--muted);
}

.rarity-label {
  display: inline-flex;
  margin: 2px 0 0;
  border: 1px solid #d2ae48;
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff7d6;
  color: #664800;
  font-size: 0.75rem;
  font-weight: 850;
}

.chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
  color: #314052;
  font-size: 0.8rem;
  font-weight: 750;
}

.mini-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  padding-top: 12px;
  border-top: 1px solid #eef2f7;
}

.upgrade-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 30px;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 5px 9px;
  background: #fff;
  color: #314052;
  font-size: 0.8rem;
  font-weight: 850;
}

.upgrade-chip strong {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 950;
}

.chip.plus {
  border-color: #e4bd54;
  background: #fff7d6;
  color: #664800;
}

.upgrade-chip.ovr-boost {
  border-color: #b8d8d6;
  background: #eaf7f5;
  color: var(--primary-dark);
  font-weight: 950;
}

.upgrade-chip.ovr-boost strong {
  color: var(--primary-dark);
}

.mini-list + .chips {
  padding-top: 12px;
  border-top: 1px solid #eef2f7;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eef2f7;
}

.player-card .row-actions {
  margin-top: auto;
  padding-top: 0;
  border-top: 0;
}

.player-card .player-chain-stack:has(.used-evo-chain:not([hidden])) + .row-actions {
  margin-top: 0;
}

.row-actions-main,
.row-actions-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.row-actions-main {
  flex: 1 1 auto;
}

.player-card .row-actions-main {
  flex-wrap: wrap;
}

.row-actions-icons {
  flex: 0 0 auto;
}

.row-actions form {
  margin: 0;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  padding: 6px 9px;
  background: #f8fafc;
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.03);
  white-space: nowrap;
}

.icon-action {
  width: 32px;
  min-width: 32px;
  padding: 0;
}

.icon-action svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-button:hover,
.action-button:focus-visible {
  text-decoration: none;
}

.primary-action {
  border-color: #b9d8d6;
  background: #ecf8f6;
  color: var(--primary-dark);
}

.primary-action:hover,
.primary-action:focus-visible {
  border-color: #9fc9c6;
  background: #dff2ef;
  color: var(--primary-dark);
}

.edit-action {
  border-color: #c7d7f0;
  background: #f2f6ff;
  color: #244a7f;
}

.secondary-action {
  border-color: #b9d8d6;
  background: #f4fbfa;
  color: var(--primary-dark);
}

.edit-action:hover,
.edit-action:focus-visible,
.secondary-action:hover,
.secondary-action:focus-visible {
  border-color: #acc5eb;
  background: #e7f6f4;
  color: var(--primary-dark);
}

.danger-action {
  border-color: #efc7c2;
  background: #fff7f5;
  color: var(--danger);
}

.danger-action:hover,
.danger-action:focus-visible {
  border-color: #f0c9c4;
  background: #ffece8;
  color: #7a1710;
}

.form-layout {
  display: grid;
  gap: 18px;
}

.two-cols,
.three-cols,
.player-basics-grid,
.evolution-requirements-grid,
.three-equal-cols,
.four-equal-cols,
.attr-grid {
  display: grid;
  gap: 14px;
}

.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-cols {
  grid-template-columns: 1.2fr repeat(2, minmax(150px, 0.4fr));
}

.player-basics-grid {
  grid-template-columns: repeat(24, minmax(0, 1fr));
  align-items: end;
}

.player-basics-grid > label:nth-child(1) {
  grid-column: span 5;
}

.player-basics-grid > label:nth-child(2) {
  grid-column: span 2;
}

.player-basics-grid > label:nth-child(3) {
  grid-column: span 4;
}

.player-basics-grid > label:nth-child(4) {
  grid-column: span 2;
}

.player-basics-grid > label:nth-child(5),
.player-basics-grid > label:nth-child(6) {
  grid-column: span 2;
}

.player-basics-grid > label:nth-child(7) {
  grid-column: span 4;
}

.player-basics-grid > label:nth-child(8) {
  grid-column: span 3;
}

.rarity-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.player-rarity-row {
  margin-top: 18px;
}

.evolution-rarity-row {
  margin-top: 18px;
}

.rarity-requirement-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.42fr);
  gap: 12px;
  align-items: end;
}

.rarity-check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rarity-check-pill {
  border-radius: 8px;
}

.custom-rarity-inline {
  display: grid;
  gap: 8px;
}

.form-check,
.inline-check {
  align-self: end;
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  color: #314052;
  cursor: pointer;
}

.form-check input,
.inline-check input {
  width: 15px;
  min-height: auto;
  margin: 0;
  accent-color: var(--primary);
}

.evolution-requirements-grid {
  grid-template-columns: minmax(190px, 1.45fr) minmax(72px, 0.4fr) minmax(96px, 0.48fr) minmax(160px, 0.9fr) minmax(86px, 0.5fr);
  align-items: end;
}

.toggle-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 850;
  cursor: pointer;
}

.toggle-card input {
  width: 15px;
  min-height: auto;
  margin: 0;
  accent-color: var(--primary);
}

.toggle-card:has(input:checked) {
  border-color: #1d9a8f;
  background: rgba(30, 154, 143, 0.18);
  color: #69f1e4;
}

.three-equal-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.four-equal-cols {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.limit-row {
  margin-top: 14px;
}

.result-rarity {
  margin-bottom: 16px;
}

.result-playstyle-limits {
  margin-top: 18px;
}

fieldset {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.attr-group {
  margin-top: 18px;
}

legend {
  margin-bottom: 10px;
  color: var(--ink);
  font-weight: 900;
}

.attr-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.position-picker {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.position-picker.alternate-only {
  grid-template-columns: 1fr;
}

.player-position-grid {
  grid-template-columns: minmax(150px, 0.18fr) minmax(0, 1fr);
  align-items: start;
}

.player-position-grid > label,
.player-position-grid > fieldset {
  align-self: start;
}

.player-position-grid legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.91rem;
  font-weight: 700;
}

.position-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.player-position-grid .position-options {
  justify-content: space-between;
}

.position-limit {
  margin-top: 18px;
}

.upgrade-position-add {
  margin-bottom: 18px;
}

.position-limit .muted {
  margin-bottom: 10px;
  font-size: 0.88rem;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: #fff;
  color: #314052;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.check-pill input {
  width: 15px;
  min-height: auto;
  margin: 0;
  accent-color: var(--primary);
}

.check-pill:has(input:checked) {
  border-color: #b8d8d6;
  background: #eaf7f5;
  color: var(--primary-dark);
}

.playstyle-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.playstyle-list-fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
}

.playstyle-column {
  min-width: 0;
}

.playstyle-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) repeat(3, auto);
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border-bottom: 1px solid #eef2f7;
  font-size: 0.9rem;
}

.drag-handle {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
  cursor: grab;
}

.drag-handle:hover {
  background: #eef2f7;
  color: var(--ink);
}

.selected-playstyle-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.selected-playstyle-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.selected-playstyle-panel h3 {
  margin-bottom: 10px;
}

.selected-playstyle-list {
  display: grid;
  gap: 8px;
}

.selected-playstyle-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  background: #fff;
  cursor: grab;
}

.selected-playstyle-item.dragging {
  opacity: 0.45;
}

.playstyle-row label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 650;
}

.playstyle-row input {
  width: auto;
  min-height: auto;
}

.upgrade-table {
  display: grid;
  gap: 8px;
}

.upgrade-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.upgrade-head,
.upgrade-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 120px 120px;
  gap: 10px;
  align-items: center;
}

.attribute-requirements {
  margin-top: 18px;
}

.attribute-requirement-list {
  display: grid;
  gap: 8px;
}

.attribute-requirement-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px 32px;
  gap: 10px;
  align-items: center;
}

.attribute-requirement-add {
  margin-top: 10px;
  width: fit-content;
}

.upgrade-head {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.apply-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.ideal-chain-meta {
  margin-top: 12px;
}

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

.result-card {
  border-color: #d2ae48;
}

.danger-panel {
  margin-top: 18px;
  border-color: #f2b8ae;
  background: var(--danger-bg);
  color: var(--danger);
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 14px 0;
  background: linear-gradient(to top, var(--paper) 72%, rgba(245, 247, 251, 0));
}

body {
  background:
    radial-gradient(circle at top left, rgba(57, 185, 168, 0.08), transparent 34rem),
    linear-gradient(180deg, #121616 0%, var(--paper) 28rem);
}

a {
  color: var(--primary-dark);
}

button,
.button {
  background: #168173;
  color: #f7fffc;
}

button:hover,
.button:hover {
  background: #1e9a8a;
}

input,
select {
  border-color: #3a4343;
  background-color: #111515;
  color: var(--ink);
}

select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a8ada6' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 14px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(57, 185, 168, 0.28);
  outline-offset: 1px;
}

label,
.card-meta dt,
.evolution-meta dt,
.attribute-detail-grid span,
.score-detail-list small,
.used-evo-chain-label {
  color: var(--muted);
}

.topbar {
  border-bottom-color: #2c3434;
  background: rgba(18, 21, 21, 0.9);
}

.brand,
nav a {
  color: var(--ink);
}

nav a:hover,
nav a:focus-visible {
  background: rgba(57, 185, 168, 0.08);
  color: var(--primary-dark);
}

.brand-mark {
  background: #f2f0e8;
  color: #101313;
}

.auth-panel,
.panel,
.card,
.empty,
.flash {
  border-color: var(--line);
  background: rgba(25, 29, 29, 0.96);
}

.ghost,
.secondary {
  border-color: var(--line);
  background: #161a1a;
  color: var(--ink);
}

.ghost:hover,
.secondary:hover {
  background: #222827;
  color: var(--ink);
}

.flash,
.import-review {
  border-color: rgba(57, 185, 168, 0.34);
  background: rgba(57, 185, 168, 0.1);
  color: var(--primary-dark);
}

.card-title-line,
.card-top,
.stats-six,
.used-evo-chain,
.row-actions,
.mini-list,
.mini-list + .chips,
.collapsible-card[open] > .collapsible-card-summary,
.chain-step[open] summary,
.attribute-details[open] summary,
.modal-head {
  border-color: #2a3131;
}

.count-inline,
.expires-inline,
.chain-meta span,
.chain-path button,
.chain-path span,
.priority-list span,
.chain-step-meta span,
.chip,
.upgrade-chip,
.check-pill,
.form-check,
.inline-check,
.selected-playstyle-item,
.drag-handle,
.action-button {
  border-color: #3a4343;
  background: #171c1c;
  color: var(--ink);
}

.chain-path button:hover,
.chain-path button:focus-visible,
.check-pill:has(input:checked),
.form-check:has(input:checked),
.inline-check:has(input:checked),
.filter-toggle.active {
  border-color: rgba(57, 185, 168, 0.42);
  background: rgba(57, 185, 168, 0.14);
  color: var(--primary-dark);
}

.official-inline,
.evolved-inline,
.upgrade-chip.ovr-boost,
.ideal-score {
  border-color: rgba(57, 185, 168, 0.42);
  background: rgba(57, 185, 168, 0.14);
  color: var(--primary-dark);
}

.squad-inline {
  border-color: rgba(57, 185, 168, 0.42);
  background: rgba(57, 185, 168, 0.14);
  color: var(--primary-dark);
}

.potential-callout,
.highlight-status[data-state="ready"],
.ideal-notes span,
.rarity-label,
.chip.plus,
.evolution-detail-block .rarity-boost {
  border-color: rgba(224, 161, 47, 0.5);
  background: rgba(224, 161, 47, 0.13);
  color: #f3c363;
}

.potential-callout:hover,
.potential-callout:focus-visible {
  border-color: rgba(224, 161, 47, 0.75);
  background: rgba(224, 161, 47, 0.2);
  color: #ffd27b;
}

.potential-callout.optimal-squad-callout {
  border-color: rgba(224, 161, 47, 0.5);
  background: rgba(224, 161, 47, 0.13);
  color: #f3c363;
}

.potential-callout.optimal-squad-callout:hover,
.potential-callout.optimal-squad-callout:focus-visible {
  border-color: rgba(224, 161, 47, 0.75);
  background: rgba(224, 161, 47, 0.2);
  color: #ffd27b;
}

.potential-callout::before {
  background: var(--accent);
}

.potential-callout.optimal-squad-callout::before {
  display: none;
}

.stats-six > div,
.attribute-detail-grid div,
.score-detail-list div,
.evolution-detail-block .evolution-meta-item,
.selected-playstyle-panel,
.highlight-status,
.potential-status,
.filter-toggles {
  border-color: #313939;
  background: #141818;
}

.filter-toggle {
  color: var(--muted);
}

.filter-toggle:hover,
.filter-toggle:focus-visible {
  background: rgba(57, 185, 168, 0.08);
  color: var(--ink);
}

.filter-switch {
  border-color: #3a4343;
  background: #222827;
}

.filter-toggle:hover .filter-switch,
.filter-toggle:focus-visible .filter-switch {
  border-color: rgba(57, 185, 168, 0.42);
  background: #27302f;
}

.attribute-details,
.chain-step,
.chain-step-modal,
.auth-panel {
  border-color: var(--line);
  background: #181c1c;
}

.attribute-details summary {
  border-radius: 7px;
  background: #202626;
  color: var(--ink);
}

.chain-step summary {
  color: var(--ink);
}

.chain-step summary:hover,
.chain-step summary:focus-visible {
  background: #202626;
  color: var(--primary-dark);
}

.chain-step[open] summary {
  border-bottom-color: #313939;
  background: rgba(57, 185, 168, 0.08);
  color: var(--primary-dark);
}

.attribute-details summary:hover,
.attribute-details summary:focus-visible {
  background: #27302f;
  color: var(--primary-dark);
}

.attribute-details[open] summary {
  border-bottom-color: #313939;
  border-radius: 7px 7px 0 0;
}

.card-meta dd,
.evolution-meta dd,
.stats-six > div > strong,
.attribute-detail-grid strong,
.score-detail-list span,
.upgrade-chip strong {
  color: var(--ink);
}

.highlight-status[data-state="loading"],
.highlight-status[data-state="empty"],
.potential-status[data-state="loading"],
.potential-status[data-state="ready"],
.evolution-detail-block .position-boost,
.used-evo-chain-path [data-used-evo-chain-item] {
  border-color: rgba(57, 185, 168, 0.4);
  background: rgba(57, 185, 168, 0.11);
  color: var(--primary-dark);
}

.remove-chain-step {
  border-color: rgba(255, 125, 114, 0.45);
  background: rgba(255, 125, 114, 0.12);
  color: var(--danger);
}

.remove-chain-step:hover,
.remove-chain-step:focus-visible {
  border-color: rgba(255, 125, 114, 0.72);
  background: rgba(255, 125, 114, 0.18);
  color: #ffb0a8;
}

.used-evo-chain-label {
  border-color: rgba(57, 185, 168, 0.24);
  background: rgba(57, 185, 168, 0.06);
  color: var(--muted);
}

.used-evo-chain-label:hover,
.used-evo-chain-label:focus-visible {
  border-color: rgba(57, 185, 168, 0.44);
  background: rgba(57, 185, 168, 0.11);
  color: var(--primary-dark);
}

.used-evo-chain-label span:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  min-width: 22px;
  height: 20px;
  padding: 0;
  border-color: rgba(57, 185, 168, 0.36);
  background: rgba(57, 185, 168, 0.12);
  color: var(--primary-dark);
  line-height: 1;
}

.recommended-evo-chain .used-evo-chain-label {
  border-color: rgba(224, 161, 47, 0.5);
  background: rgba(224, 161, 47, 0.13);
  color: #f3c363;
}

.recommended-evo-chain .used-evo-chain-label span:last-child {
  border-color: rgba(224, 161, 47, 0.5);
  background: rgba(224, 161, 47, 0.14);
  color: #f3c363;
}

.recommended-evo-chain .used-evo-chain-label:hover,
.recommended-evo-chain .used-evo-chain-label:focus-visible {
  border-color: rgba(224, 161, 47, 0.75);
  background: rgba(224, 161, 47, 0.2);
  color: #ffd27b;
}

.recommended-evo-chain .used-evo-chain-label:hover span:last-child,
.recommended-evo-chain .used-evo-chain-label:focus-visible span:last-child {
  border-color: rgba(224, 161, 47, 0.75);
  background: rgba(224, 161, 47, 0.2);
  color: #ffd27b;
}

.recommended-evo-chain .recommended-chain-step {
  border-color: rgba(224, 161, 47, 0.5);
  background: rgba(224, 161, 47, 0.13);
  color: #f3c363;
}

.recommended-evo-chain .removed-chain-step {
  border-color: rgba(255, 125, 114, 0.45);
  background: rgba(255, 125, 114, 0.12);
  color: var(--danger);
}

.apply-chain-step {
  border-color: rgba(224, 161, 47, 0.55);
  background: rgba(224, 161, 47, 0.14);
  color: #f3c363;
}

.apply-chain-step:hover,
.apply-chain-step:focus-visible {
  border-color: rgba(224, 161, 47, 0.8);
  background: rgba(224, 161, 47, 0.22);
  color: #ffd27b;
}

.primary-action,
.secondary-action,
.icon-action.secondary-action {
  border-color: rgba(57, 185, 168, 0.34);
  background: rgba(57, 185, 168, 0.1);
  color: var(--primary-dark);
}

.primary-action:hover,
.primary-action:focus-visible,
.secondary-action:hover,
.secondary-action:focus-visible,
.icon-action.secondary-action:hover,
.icon-action.secondary-action:focus-visible {
  border-color: rgba(57, 185, 168, 0.58);
  background: rgba(57, 185, 168, 0.17);
  color: #a6eee5;
}

.icon-action.danger-action {
  border-color: rgba(255, 125, 114, 0.42);
  background: rgba(255, 125, 114, 0.12);
  color: #ff9d95;
}

.icon-action.danger-action:hover,
.icon-action.danger-action:focus-visible {
  border-color: rgba(255, 125, 114, 0.62);
  background: rgba(255, 125, 114, 0.2);
  color: #ffb9b3;
}

.player-card.in-squad {
  border-color: var(--primary);
  background: rgba(25, 29, 29, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(57, 185, 168, 0.08);
}

.player-card.beats-squad,
.evolution-card.chain-highlight {
  border-color: var(--accent);
  background: rgba(25, 29, 29, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
}

.player-card.optimal-squad {
  border-color: var(--primary);
  background: rgba(25, 29, 29, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(57, 185, 168, 0.1);
}

.player-card.in-squad.beats-squad {
  border-color: var(--primary);
  background: rgba(25, 29, 29, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(57, 185, 168, 0.08);
}

.player-card.player-disabled {
  border-color: rgba(224, 161, 47, 0.5);
  background: rgba(24, 23, 19, 0.96);
  opacity: 0.82;
  box-shadow: none;
}

.evolution-chain-context,
.evolution-chain-context a {
  color: #f3c363;
}

.danger-panel,
.highlight-status[data-state="error"],
.potential-status[data-state="error"],
.chain-path .removed-chain-step {
  border-color: rgba(255, 125, 114, 0.45);
  background: rgba(255, 125, 114, 0.12);
  color: var(--danger);
}

.danger-action {
  border-color: rgba(255, 125, 114, 0.42);
  background: rgba(255, 125, 114, 0.11);
  color: var(--danger);
}

.danger-action:hover,
.danger-action:focus-visible {
  border-color: rgba(255, 125, 114, 0.62);
  background: rgba(255, 125, 114, 0.18);
  color: #ffaaa3;
}

.rating {
  background: linear-gradient(180deg, #e5aa33, #c9871a);
  color: #11100d;
}

.modal-head,
.collapsible-card-body,
.chain-step-body {
  background: transparent;
}

.playstyle-row,
.official-controls .expires-inline + .official-toggle,
.official-count {
  border-color: #2a3131;
}

.sticky-actions {
  background: linear-gradient(to top, var(--paper) 72%, rgba(16, 19, 19, 0));
}

@media (max-width: 860px) {
  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-head > div:first-child {
    flex: initial;
  }

  .section-head h1 {
    white-space: normal;
  }

  .section-head .actions {
    justify-content: flex-start;
  }

  .filter-toggles {
    flex-wrap: wrap;
  }

  .split,
  .chain-summary,
  .two-cols,
  .three-cols,
  .player-basics-grid,
  .evolution-requirements-grid,
  .three-equal-cols,
  .four-equal-cols,
  .attr-grid,
  .position-picker,
  .player-grid,
  .scoring-columns,
  .playstyle-groups,
  .playstyle-list-fieldset,
  .selected-playstyle-panels,
  .upgrade-columns,
  .compare,
  .apply-form {
    grid-template-columns: 1fr;
  }

  .scoring-playstyle-columns {
    grid-template-columns: 1fr;
  }

  .player-basics-grid > label {
    grid-column: auto;
  }

  .rarity-inputs {
    grid-template-columns: 1fr;
  }

  .rarity-requirement-grid {
    grid-template-columns: 1fr;
  }

  .chain-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .chain-grid {
    grid-template-columns: 1fr;
  }

  .stats-six {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .upgrade-head,
  .upgrade-row {
    grid-template-columns: minmax(120px, 1fr) 88px 88px;
  }

  .attribute-requirement-row {
    grid-template-columns: minmax(120px, 1fr) 88px 32px;
  }

  .count-card-top {
    padding-right: 18px;
  }

  .official-controls {
    position: static;
    transform: none;
    grid-column: 2;
    justify-content: flex-start;
    margin-top: 8px;
  }
}

@media (max-width: 520px) {
  .page {
    width: min(100% - 20px, 1180px);
  }

  .auth-panel,
  .panel,
  .card {
    padding: 14px;
  }

  .stats-six {
    grid-template-columns: 1fr;
  }

  .playstyle-row {
    grid-template-columns: 1fr repeat(3, auto);
  }

  .selected-playstyle-item {
    grid-template-columns: 30px 1fr auto;
  }

  .scoring-grid {
    grid-template-columns: 1fr;
  }

  .scoring-grid label {
    grid-template-columns: minmax(0, 1fr) 92px;
  }

  .score-detail-list {
    grid-template-columns: 1fr;
  }
}
