:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background: #111827;
  color: #e5e7eb;
}

* { box-sizing: border-box; }
body { margin: 0; }

.app-shell { width: min(1200px, 100%); margin: 0 auto; padding: 2rem 1rem 3rem; }
.page-header, .matchup, .unit-panel, .chart-card { border: 1px solid #334155; border-radius: .75rem; background: #1e293b; }
.page-header { padding: 1.25rem 1.5rem; }
.page-header h1, h2, h3, p { margin-top: 0; }
.page-header h1 { margin-bottom: 0; }
.connection-error {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #b45309;
  border-radius: .75rem;
  background: #451a03;
  color: #fed7aa;
}

.eyebrow { margin-bottom: .35rem; color: #94a3b8; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.matchup { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: end; margin-top: 1rem; padding: 1rem; }
.field { display: grid; gap: .4rem; font-weight: 700; }
select, .swap-button { min-height: 2.75rem; border: 1px solid #475569; border-radius: .5rem; background: #0f172a; color: inherit; font: inherit; }
select { width: 100%; padding: 0 .75rem; }
.swap-button { padding: 0 .9rem; font-weight: 800; cursor: pointer; }

.unit-grid, .results { display: grid; gap: 1rem; margin-top: 1rem; }
.unit-grid { grid-template-columns: 1fr; }
.results { grid-template-columns: 1fr; }
.unit-panel, .chart-card { padding: 1.25rem; }
.unit-overview { display: flex; gap: 1rem; align-items: center; margin: 0 0 1rem 0; }
fieldset { min-width: 0; margin: 1rem 0; padding: .8rem; border: 1px solid #475569; border-radius: .5rem; }
legend { padding: 0 .25rem; font-weight: 700; }
.squad-size { display: flex; gap: 1rem; margin: 0; }
.squad-size label { white-space: nowrap; }
.squad-size label.is-disabled { opacity: .45; }
h3 { margin-bottom: .5rem; font-size: .9rem; }
.unit-summary, .weapons { margin: 0; font: .85rem/1.55 ui-monospace, Consolas, monospace; color: #cbd5e1; }
.unit-summary { min-width: 0; overflow-x: auto; }
.weapons { padding: 0; list-style: none; }
.weapons li { overflow-x: auto; white-space: pre; }
.weapons .weapon--inactive { color: #64748b; }
#attacker-weapons { padding-bottom: 1rem; }
.upgrade-list { display: grid; gap: .5rem; }
.upgrade-list .upgrade { cursor: pointer; }
.placeholder { margin: 0; color: #94a3b8; }
.chart-card h2 { font-size: 1.05rem; }
.results-container { position: relative; }
.chart-card img { display: block; width: 100%; height: auto; transition: opacity .15s ease; }
.results-loading {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  gap: .5rem;
  background: rgb(15 23 42 / 65%);
}
.results-container.is-loading .results-loading { display: grid; }
.results-container.is-loading img { opacity: .45; }
.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid #94a3b8;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
.site-footer {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto 2rem;
  padding-top: 1rem;
  border-top: 1px solid #334155;
  color: #94a3b8;
  font-size: .8rem;
  line-height: 1.5;
}
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: .35rem; }
.site-footer a { color: #cbd5e1; }

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

@media (max-width: 760px) {
  .app-shell { padding-top: 1rem; }
  .unit-grid, .results { grid-template-columns: 1fr; }
  .matchup { gap: .5rem; }
  .unit-overview { flex-wrap: wrap; }
}
