:root {
  --bg-1: #05070c;
  --bg-2: #0a0f18;
  --panel: rgba(12, 18, 30, 0.82);
  --text: #e8eefb;
  --muted: #9fb0cf;
  --accent: #2a58a8;
  --accent-2: #2f79b5;
  --line: #22314f;
  --ok: #4bc48a;
  --warn: #d0a64f;
  --risk: #e15c6a;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: var(--fw-regular);
  color: var(--text);
  background:
    radial-gradient(1200px 520px at -10% -10%, rgba(52, 98, 205, 0.12), transparent 62%),
    radial-gradient(900px 420px at 110% 0%, rgba(40, 143, 226, 0.09), transparent 55%),
    radial-gradient(circle at 1px 1px, rgba(171, 194, 231, 0.07) 1px, transparent 0),
    linear-gradient(170deg, var(--bg-1), var(--bg-2));
  background-size: auto, auto, 28px 28px, auto;
}

.page {
  width: min(1248px, 95vw);
  margin: 2rem auto 2.2rem;
  display: grid;
  gap: 1rem;
}

.hero h1 {
  margin: 0.2rem 0;
  font-size: clamp(2rem, 6vw, 3.2rem);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: var(--fw-bold);
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.hero-actions {
  margin-top: 0.8rem;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  text-decoration: none;
}

.panel {
  background: linear-gradient(180deg, rgba(38, 44, 54, 0.9), rgba(31, 37, 46, 0.9));
  border: 1px solid rgba(160, 172, 194, 0.24);
  border-radius: 16px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 26px rgba(8, 11, 16, 0.36);
  padding: 1.35rem;
}

form {
  display: grid;
  gap: 1.3rem;
}

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

label {
  font-weight: var(--fw-semibold);
  letter-spacing: 0.01em;
}

select,
input,
button {
  font: inherit;
}

select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0d1626;
  color: var(--text);
  padding: 0.7rem 0.78rem;
  min-height: 44px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23b7c8e8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6.5 8 10l4-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 14px 14px;
  background-position: right 0.95rem center;
  padding-right: 2.6rem;
}

#cockpit-search,
#product-search {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ca4c9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16.65' y1='16.65' x2='21' y2='21'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 16px 16px;
  background-position: 12px center;
  padding-left: 2.2rem;
}

.product-toolbar {
  display: flex;
  justify-content: flex-end;
}

.cockpit-toolbar {
  display: flex;
  justify-content: flex-end;
}

.compare-toolbar {
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.compare-slots {
  display: inline-flex;
  gap: 0.45rem;
}

.compare-slot {
  background: #0d1626;
  color: #b7c8e8;
  border: 1px solid #2a3b5f;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.76rem;
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.compare-slot.active {
  background: rgba(43, 110, 232, 0.15);
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.15rem;
}

.preset-row {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.products-field {
  gap: 0.7rem;
}

.products-field > label {
  margin-bottom: 0.07rem;
}

.products-field #product-search {
  margin-bottom: 0.25rem;
}

.products-field #brand-filter {
  margin-bottom: 0.32rem;
}

.products-field #category-chips {
  gap: 0.45rem;
  margin-top: 0.2rem;
  margin-bottom: 0.45rem;
}

.products-field .presets-block {
  display: grid;
  gap: 1.02rem;
  margin-top: 0.9rem;
  margin-bottom: 0.14rem;
}

.products-field .preset-row {
  gap: 1.02rem;
  margin-top: 0;
}

.products-field #preset-status {
  margin: 0;
  line-height: 1.35;
}

.products-field .product-toolbar {
  margin-top: 0;
  margin-bottom: 0.35rem;
}

.products-field .preset-buttons {
  gap: 0.3rem;
  margin-top: 0;
}

.products-field .preset-btn {
  margin: 0;
  padding: 0.22rem 0.5rem;
}

.preset-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.preset-btn {
  padding: 0.46rem 0.84rem;
  font-size: 0.84rem;
  font-weight: var(--fw-semibold);
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  background: #0d1626;
  color: #b7c8e8;
  border: 1px solid #2a3b5f;
  border-radius: 999px;
  padding: 0.4rem 0.82rem;
  font-size: 0.8rem;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.category-chip.active {
  background: rgba(43, 110, 232, 0.15);
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.category-chip-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.02rem;
  height: 1.02rem;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #ff5c5c;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(286px, 1fr));
  gap: 0.94rem;
  max-height: 680px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.96rem;
  background: rgba(8, 13, 22, 0.82);
}

.product-card {
  text-align: left;
  background: #0d1626;
  color: var(--text);
  border: 1px solid #233453;
  border-radius: 12px;
  padding: 0.92rem 0.92rem 1.08rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  min-height: 196px;
  overflow: visible;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.cockpit-grid {
  max-height: 560px;
}

.cockpit-card {
  min-height: 292px;
  transition: opacity 0.16s ease, filter 0.16s ease;
}

.cockpit-card .card-media {
  height: auto;
  min-height: 0;
  aspect-ratio: 3 / 2;
  padding: 0.25rem;
}

.cockpit-card .card-media img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  background: #0c1422;
}

.card-media {
  width: 100%;
  height: 110px;
  border: 1px solid #2a3b5f;
  border-radius: 10px;
  background: #101b2c;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  font-weight: var(--fw-bold);
  color: #9ab4e2;
  background: linear-gradient(140deg, #13233a, #1c3152);
}

.product-card:hover {
  transform: translateY(-1px);
  border-color: #3c5687;
  box-shadow: 0 10px 16px rgba(18, 34, 62, 0.35);
}

.product-card.selected {
  border-color: var(--accent-2);
  background: rgba(31, 159, 214, 0.14);
  box-shadow: inset 0 0 0 1px rgba(31, 159, 214, 0.35);
}

.cockpit-card.selected-a {
  border-color: #4bc48a;
  box-shadow: inset 0 0 0 1px rgba(75, 196, 138, 0.38);
}

.cockpit-card.selected-b {
  border-color: #d0a64f;
  box-shadow: inset 0 0 0 1px rgba(208, 166, 79, 0.38);
}

.cockpit-grid.has-selection .cockpit-card:not(.selected-a):not(.selected-b) {
  opacity: 0.45;
  filter: saturate(0.65) brightness(0.72);
}

.cockpit-grid.has-selection .cockpit-card.selected-a,
.cockpit-grid.has-selection .cockpit-card.selected-b {
  opacity: 1;
  filter: none;
}

body.single-mode #slot-b-btn,
body.single-mode #cockpit-selected-b {
  display: none;
}

body.single-mode .cockpit-card.selected-a {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(31, 159, 214, 0.35);
}

.product-brand {
  color: var(--muted);
  font-size: 0.81rem;
  font-weight: var(--fw-medium);
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.product-name {
  display: block;
  font-size: 1rem;
  font-weight: var(--fw-semibold);
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.product-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.platform-chip {
  display: inline-block;
  border: 1px solid #3f6ea6;
  background: rgba(31, 89, 154, 0.18);
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
  font-weight: var(--fw-semibold);
  color: #bfd6ff;
  letter-spacing: 0.02em;
}

.product-category {
  display: inline-block;
  max-width: 100%;
  width: auto;
  border: 1px solid #2a3b5f;
  background: #122038;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.75rem;
  color: #a8bbdf;
  white-space: normal;
  overflow-wrap: anywhere;
  margin-top: auto;
}

.product-actions {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 0.5rem;
  padding-bottom: 0.14rem;
  flex-shrink: 0;
}

.details-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.36rem 0.72rem;
  min-height: 2rem;
  font-size: 0.79rem;
  font-weight: var(--fw-semibold);
}

.empty-state {
  margin: 0.3rem;
  color: var(--muted);
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.empty-state p {
  margin: 0;
}

.empty-state strong {
  color: var(--text);
}

.empty-reset-btn {
  justify-self: start;
}

.build-save-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 0.6rem;
}

.saved-builds {
  display: grid;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem;
  background: rgba(8, 13, 22, 0.82);
}

.saved-build-row {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
  border: 1px solid #233453;
  border-radius: 10px;
  background: #0d1626;
  padding: 0.5rem 0.6rem;
}

.saved-build-meta {
  display: grid;
  gap: 0.15rem;
}

.saved-build-meta strong {
  line-height: 1.25;
}

.saved-build-actions {
  display: inline-flex;
  gap: 0.4rem;
}

.saved-build-actions .secondary {
  padding: 0.35rem 0.55rem;
}

.saved-empty {
  margin: 0;
  color: var(--muted);
}

#build-status.error {
  color: var(--risk);
}

#preset-status.error {
  color: var(--risk);
}

#preset-status {
  display: block;
  margin-top: 0.05rem;
  margin-bottom: 0.3rem;
  line-height: 1.45;
}

#selected-count {
  font-weight: var(--fw-semibold);
  letter-spacing: 0.01em;
}

.product-toolbar {
  margin-top: 0.15rem;
  margin-bottom: 0.35rem;
}

.bundle-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  border: 1px solid rgba(72, 112, 168, 0.55);
  border-radius: 10px;
  background: rgba(23, 40, 66, 0.62);
  padding: 0.45rem 0.58rem;
  margin-top: -0.06rem;
  margin-bottom: 0.46rem;
}

#bundle-note-text {
  color: #b8c9e6;
  line-height: 1.35;
}

.bundle-note-btn {
  padding: 0.34rem 0.72rem;
  font-size: 0.76rem;
  flex-shrink: 0;
}

.specs-panel {
  margin-top: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(11, 17, 29, 0.92);
  padding: 0.85rem 0.95rem;
  width: min(460px, 94vw);
  max-height: 72vh;
  overflow: auto;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.inline-specs {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  min-height: 220px;
  max-height: 460px;
  margin-top: 0;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
  overflow: auto;
}

.floating-specs {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
}

.specs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.specs-close-btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.specs-block + .specs-block {
  margin-top: 0.7rem;
}

.specs-block h5 {
  margin: 0.2rem 0 0.35rem;
  color: #c4d2ee;
  font-size: 0.84rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.specs-panel h4 {
  margin: 0 0 0.35rem;
}

.specs-panel p {
  margin: 0.2rem 0 0.45rem;
}

.specs-panel ul {
  margin: 0;
}

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

button {
  cursor: pointer;
  border-radius: 999px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.product-card:focus-visible {
  outline: 2px solid #86b7ff;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(64, 122, 214, 0.24);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

#submit-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font-weight: var(--fw-bold);
  color: #fff;
  background: linear-gradient(90deg, var(--accent), #1c8bd4);
}

.hidden {
  display: none;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 1rem 0 0.8rem;
}

.secondary {
  background: #0d1626;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
  padding: 0.6rem 0.86rem;
  line-height: 1.25;
  font-weight: var(--fw-medium);
  white-space: normal;
}

.result-header h2 {
  margin: 0;
}

.badge {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  text-transform: uppercase;
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
}

.badge.pass {
  background: #133528;
  color: #8ef7bd;
}

.badge.adapter {
  background: #3b2d14;
  color: #ffd67d;
}

.badge.intervention {
  background: #11314a;
  color: #7dcbff;
}

.badge.partial {
  background: #202d52;
  color: #b8c8ff;
}

.badge.fail {
  background: #47151b;
  color: #ff9da9;
}

.summary h3 {
  margin-bottom: 0.45rem;
}

.compare-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.compare-summary {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(11, 17, 29, 0.92);
  padding: 0.85rem;
}

.compare-summary h4 {
  margin: 0.45rem 0;
}

.line-card {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  background: rgba(11, 17, 29, 0.92);
}

.line-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  align-items: center;
}

.line-head h3 {
  margin: 0;
  font-size: 1rem;
}

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

.line-grid h4 {
  margin: 0.7rem 0 0.45rem;
  font-size: 0.9rem;
}

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

.compare-column {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(13, 22, 38, 0.62);
  padding: 0.7rem 0.75rem;
}

.compare-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.compare-column-head h4,
.compare-column-head h3 {
  margin: 0;
}

ul {
  margin: 0;
  padding-left: 1.2rem;
}

.error {
  margin: 0;
  color: var(--risk);
  font-weight: var(--fw-bold);
}

@media (max-width: 760px) {
  .build-save-row {
    grid-template-columns: 1fr;
  }

  .saved-build-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel {
    padding: 0.95rem;
  }

  form {
    gap: 0.95rem;
  }

  .product-grid {
    grid-template-columns: 1fr;
    max-height: 520px;
    gap: 0.68rem;
    padding: 0.68rem;
  }

  .products-field {
    gap: 0.45rem;
  }

  .products-field #brand-filter {
    margin-bottom: 0.22rem;
  }

  .products-field #category-chips {
    gap: 0.33rem;
    margin-bottom: 0.3rem;
  }

  .bundle-note {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    margin-bottom: 0.34rem;
  }

  .bundle-note-btn {
    width: 100%;
  }

  .products-field .presets-block {
    gap: 0.72rem;
    margin-bottom: 0.1rem;
  }

  .products-field .preset-row {
    gap: 0.72rem;
    margin: 0;
  }

  .products-field #preset-status {
    margin: 0;
  }

  .products-field .preset-buttons {
    gap: 0.24rem;
  }

  .cockpit-grid {
    max-height: 440px;
  }

  .product-card {
    min-height: 126px;
    padding: 0.7rem 0.7rem 0.82rem;
    gap: 0.34rem;
  }

  .product-name {
    font-size: 0.9rem;
    line-height: 1.2;
  }

  .product-brand {
    font-size: 0.75rem;
  }

  .product-category {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
  }

  .product-actions {
    padding-top: 0.25rem;
  }

  .details-btn {
    padding: 0.28rem 0.58rem;
    font-size: 0.74rem;
  }

  .cockpit-card {
    min-height: 220px;
  }

  .cockpit-card .card-media {
    min-height: 0;
    aspect-ratio: 3 / 2;
  }

  .card-media {
    height: 92px;
  }

  .inline-specs {
    min-height: 180px;
    max-height: 52vh;
  }

  #submit-btn {
    position: sticky;
    bottom: 0.45rem;
    z-index: 50;
    width: 100%;
    margin-top: 0.2rem;
    box-shadow: 0 12px 26px rgba(10, 16, 28, 0.75);
  }

  .floating-specs {
    right: 0.5rem;
    left: 0.5rem;
    bottom: 0.5rem;
  }
}

body.embed-mode .hero {
  display: none;
}

body.embed-mode .page {
  width: min(1280px, 98vw);
  margin: 0.5rem auto;
}
