:root {
  color-scheme: light dark;
  font-family: "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  --surface: rgba(255, 255, 255, 0.75);
  --surface-dark: rgba(28, 28, 38, 0.85);
  --text: #1f2933;
  --text-dark: #e2e8f0;
  --accent: #2563eb;
  --border: rgba(15, 23, 42, 0.1);
  --border-dark: rgba(148, 163, 184, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #e0f2fe, #f1f5f9 50%, #e2e8f0 100%);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  body {
    background: radial-gradient(circle at top, #1e293b, #0f172a 65%, #020617 100%);
    color: var(--text-dark);
  }
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

header {
  text-align: center;
}

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

.tagline {
  margin: 0.25rem 0 0;
  color: #475569;
}

@media (prefers-color-scheme: dark) {
  .tagline {
    color: #cbd5f5;
  }
}

.card {
  background: var(--surface);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

@media (prefers-color-scheme: dark) {
  .card {
    background: var(--surface-dark);
    border-color: var(--border-dark);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.5);
  }
}

h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field label {
  font-weight: 600;
}

.field small,
.hint {
  color: #64748b;
  font-size: 0.85rem;
}

@media (prefers-color-scheme: dark) {
  .field small,
  .hint {
    color: #94a3b8;
  }
}

input[type="number"],
select {
  appearance: none;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.8);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  input[type="number"],
  select {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(148, 163, 184, 0.35);
    color: inherit;
  }
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.pill-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill-bar button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border 0.2s ease;
}

.pill-bar button:hover {
  transform: translateY(-1px);
  background: rgba(37, 99, 235, 0.2);
}

@media (prefers-color-scheme: dark) {
  .pill-bar button {
    background: rgba(96, 165, 250, 0.25);
    color: #bfdbfe;
  }
}

.checkbox-group {
  display: grid;
  gap: 0.6rem;
}

.checkbox-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
}

.actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
}

.actions button {
  border: none;
  border-radius: 0.75rem;
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  box-shadow: 0 15px 30px rgba(37, 99, 235, 0.25);
}

.actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
}

.actions button:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

.results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tab-bar {
  display: inline-flex;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
}

.tab-button {
  border: none;
  background: transparent;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tab-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tab-button--active {
  background: rgba(37, 99, 235, 0.15);
  color: #1d4ed8;
}

@media (prefers-color-scheme: dark) {
  .tab-bar {
    border-bottom-color: rgba(148, 163, 184, 0.35);
  }

  .tab-button {
    color: #cbd5f5;
  }

  .tab-button--active {
    background: rgba(96, 165, 250, 0.25);
    color: #e0f2fe;
  }
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.details-intro {
  margin: 0;
  font-size: 0.95rem;
  color: #475569;
}

@media (prefers-color-scheme: dark) {
  .details-intro {
    color: #cbd5f5;
  }
}

.score {
  font-size: 1.8rem;
  font-weight: 700;
}

.severity {
  font-size: 1.2rem;
  font-weight: 600;
}

.breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
  margin: 0;
}

.breakdown div {
  background: rgba(15, 23, 42, 0.05);
  border-radius: 0.75rem;
  padding: 0.65rem 0.75rem;
}

@media (prefers-color-scheme: dark) {
  .breakdown div {
    background: rgba(148, 163, 184, 0.15);
  }
}

dl {
  margin: 0;
}

dt {
  font-weight: 600;
  font-size: 0.9rem;
  color: #334155;
}

@media (prefers-color-scheme: dark) {
  dt {
    color: #cbd5f5;
  }
}

.details {
  font-size: 0.95rem;
  color: #475569;
}

@media (prefers-color-scheme: dark) {
  .details {
    color: #cbd5f5;
  }
}

.controls-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.controls-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-item {
  padding: 1rem;
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.04);
  border: 1px dashed rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (prefers-color-scheme: dark) {
  .control-item {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.25);
  }
}

.control-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.control-item .remove {
  align-self: flex-end;
  border: none;
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
  border-radius: 0.6rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.control-item .remove:hover {
  background: rgba(220, 38, 38, 0.2);
  transform: translateY(-1px);
}

.ghost {
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: transparent;
  color: #1d4ed8;
  padding: 0.6rem 1rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: border 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.ghost:hover {
  transform: translateY(-1px);
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.5);
}

@media (prefers-color-scheme: dark) {
  .ghost {
    color: #bfdbfe;
    border-color: rgba(148, 163, 184, 0.35);
  }

  .ghost:hover {
    border-color: rgba(148, 163, 184, 0.6);
  }
}

.two-col {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

@media (max-width: 768px) {
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions button {
    width: 100%;
  }

  .breakdown {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
  .controls-grid {
    grid-template-columns: 1fr;
  }
}
