:root {
  color-scheme: dark;
  --brand: #283164;
  --ink: #f7f9ff;
  --muted: #b9c0d7;
  --line: rgba(255, 255, 255, 0.14);
  --panel: rgba(12, 16, 31, 0.82);
  --panel-strong: #0a0d18;
  --good: #43d17b;
  --medium: #ffd166;
  --poor: #ff6b6b;
  --focus: #8ea0ff;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(40, 49, 100, 0.84), rgba(4, 6, 14, 0.96) 54%, #000 100%),
    #050712;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.75fr);
  gap: 34px;
  align-items: end;
  padding: 42px 0 34px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 12px;
  color: #c8d0ff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 880px;
  margin-bottom: 20px;
  font-size: clamp(2.55rem, 5vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.intro {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.7;
}

.check-form,
.status-panel,
.error-panel,
.device-card,
.lead-cta {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.check-form {
  padding: 22px;
}

.check-form label {
  display: block;
  margin-bottom: 10px;
  color: #fff;
  font-weight: 800;
}

.input-row {
  display: flex;
  gap: 10px;
}

.input-row input {
  min-width: 0;
  width: 100%;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 0 15px;
  color: #fff;
  background: rgba(0, 0, 0, 0.34);
  outline: none;
}

.input-row input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(142, 160, 255, 0.18);
}

.input-row button {
  flex: 0 0 auto;
  min-width: 148px;
  height: 52px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
  cursor: pointer;
}

.input-row button:hover:not(:disabled) {
  background: #333e7a;
}

.input-row button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.form-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.status-panel,
.error-panel {
  margin-top: 26px;
  padding: 22px;
}

.status-panel {
  display: flex;
  gap: 16px;
  align-items: center;
}

.status-panel h2 {
  margin-bottom: 4px;
  font-size: 1.1rem;
}

.status-panel p,
.error-panel {
  color: var(--muted);
}

.error-panel {
  border-color: rgba(255, 107, 107, 0.45);
  color: #ffd4d4;
  background: rgba(80, 10, 18, 0.5);
}

.spinner {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.results {
  margin-top: 34px;
}

.results__head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.results__head h2 {
  max-width: 820px;
  margin-bottom: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.results__head p:last-child {
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
}

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

.device-card {
  padding: 22px;
}

.device-card__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.device-card h3 {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  line-height: 1.45;
}

.device-badge {
  border-radius: 999px;
  padding: 7px 11px;
  color: #07100a;
  background: var(--good);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.score-item {
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 10px;
  background: rgba(255, 255, 255, 0.045);
}

.score-item__value {
  display: block;
  font-size: 1.8rem;
  font-weight: 950;
  line-height: 1;
}

.score-item__label {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

[data-level="good"] .score-item__value,
.metric-row[data-level="good"] dd {
  color: var(--good);
}

[data-level="medium"] .score-item__value,
.metric-row[data-level="medium"] dd {
  color: var(--medium);
}

[data-level="poor"] .score-item__value,
.metric-row[data-level="poor"] dd {
  color: var(--poor);
}

.device-badge[data-level="medium"] {
  color: #191200;
  background: var(--medium);
}

.device-badge[data-level="poor"] {
  color: #210305;
  background: var(--poor);
}

.device-badge[data-level="unknown"] {
  color: #fff;
  background: #5d667f;
}

.metric-block,
.opportunity-block {
  margin-top: 22px;
}

.metric-block h4,
.opportunity-block h4 {
  margin-bottom: 12px;
  font-size: 1rem;
}

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

.metric-row {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: rgba(0, 0, 0, 0.2);
}

.metric-row dt {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.metric-row dd {
  margin: 0;
  color: #fff;
  font-weight: 900;
}

.opportunity-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.opportunity-item {
  padding-left: 4px;
}

.opportunity-item strong {
  display: block;
  margin-bottom: 4px;
}

.opportunity-item p {
  margin-bottom: 5px;
  color: var(--muted);
  line-height: 1.55;
}

.opportunity-item span {
  color: #fff;
  font-size: 0.86rem;
  font-weight: 850;
}

.lead-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 30px;
  align-items: center;
  margin-top: 22px;
  padding: 30px;
  border-color: rgba(142, 160, 255, 0.4);
  background: #111737;
}

.lead-cta__content {
  max-width: 720px;
}

.lead-cta h2 {
  margin-bottom: 10px;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.15;
}

.lead-cta__content > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.lead-cta__button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 13px 20px;
  color: #07100a;
  background: var(--good);
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.lead-cta__button:hover {
  background: #67df94;
}

.lead-cta__button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

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

@media (max-width: 940px) {
  .hero,
  .device-grid,
  .lead-cta {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 22px, 1180px);
    padding: 28px 0;
  }

  .hero {
    padding-top: 18px;
  }

  h1 {
    font-size: clamp(2.25rem, 12vw, 3.4rem);
  }

  .input-row,
  .results__head,
  .device-card__head {
    flex-direction: column;
  }

  .input-row button {
    width: 100%;
  }

  .score-grid,
  .metric-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .results__head p:last-child {
    white-space: normal;
  }

  .lead-cta {
    padding: 22px;
  }

  .lead-cta__button {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .score-grid,
  .metric-list {
    grid-template-columns: 1fr;
  }
}
