:root {
  --bg: #24262b;
  --surface: #30333a;
  --surface-deep: #25282e;
  --surface-soft: #3a3e47;
  --text: #f8fafc;
  --muted: #c8ced8;
  --subtle: #929aa8;
  --line: rgba(255, 255, 255, 0.13);
  --accent: #ff7417;
  --accent-strong: #ff8a35;
  --accent-dark: #3a1f10;
  --danger: #ffb27b;
  --focus: #ffffff;
  --radius: 8px;
  --shadow: 0 28px 90px rgba(35, 39, 47, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(255, 116, 23, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.035) 0,
      rgba(255, 255, 255, 0.035) 1px,
      transparent 1px,
      transparent 18px
    );
  opacity: 0.45;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.diagnostic {
  width: min(1120px, calc(100vw - 56px));
  height: min(720px, calc(100dvh - 56px));
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.4fr);
  overflow: hidden;
  background: rgba(48, 51, 58, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.diagnostic-aside {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 24px;
  padding: 28px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 116, 23, 0.22), transparent 44%),
    linear-gradient(180deg, #343840, #282b31);
  border-right: 1px solid var(--line);
}

.diagnostic-aside::after {
  content: "";
  position: absolute;
  inset: auto -80px -90px auto;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(255, 116, 23, 0.34);
  transform: rotate(18deg);
}

.brand-panel {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  overflow: visible;
  background: transparent;
  color: var(--accent);
  font-weight: 900;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  box-shadow:
    0 7px 14px rgba(35, 39, 47, 0.34),
    0 1px 2px rgba(35, 39, 47, 0.24);
  transform: perspective(240px) rotateY(-2deg) rotateX(1deg);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.brand-mark img:hover {
  box-shadow:
    0 9px 16px rgba(35, 39, 47, 0.38),
    0 1px 2px rgba(35, 39, 47, 0.24);
  transform: perspective(240px) rotateY(-1deg) rotateX(0.5deg) translateY(-1px);
}

.brand-mark.has-logo span {
  display: none;
}

.brand-kicker,
.brand-line,
.panel-tag,
.aside-title,
.aside-text,
.eyebrow,
.helper,
.field-help,
.result-copy,
.progress-meta {
  margin: 0;
}

.brand-kicker {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.brand-line {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.aside-copy {
  position: relative;
  z-index: 1;
  align-self: center;
}

.panel-tag,
.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.aside-title {
  margin-top: 14px;
  max-width: 360px;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.02;
}

.aside-text {
  margin-top: 18px;
  max-width: 330px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.stage-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.stage-item {
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--subtle);
  font-size: 13px;
  font-weight: 800;
}

.stage-item.is-active {
  background: rgba(255, 116, 23, 0.13);
  border-color: rgba(255, 116, 23, 0.44);
  color: var(--text);
}

.progress-wrap {
  position: relative;
  z-index: 1;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  background: rgba(35, 39, 47, 0.55);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ffbf85);
  border-radius: inherit;
  transition: width 260ms ease;
}

.diagnostic-main {
  min-width: 0;
  display: grid;
  padding: 34px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
    var(--surface);
}

.screen {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: center;
  gap: 22px;
  overflow: hidden;
}

.screen-head {
  max-width: 640px;
}

.step-code {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-bottom: 14px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 116, 23, 0.38);
  border-radius: var(--radius);
  background: rgba(255, 116, 23, 0.11);
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

h1,
h2 {
  margin: 10px 0 0;
  overflow-wrap: break-word;
  line-height: 1.04;
}

h2 {
  max-width: 680px;
  font-size: clamp(34px, 4.5vw, 58px);
}

.result-heading {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.helper {
  max-width: 610px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.impact-strip {
  align-self: center;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.impact-strip span {
  min-height: 78px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-deep);
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
}

.impact-strip b {
  margin-right: 7px;
  color: var(--accent);
  font-size: 17px;
}

.actions,
.answer-list,
.fields {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 12px;
}

.actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: end;
}

.actions-single {
  grid-template-columns: minmax(0, 360px);
}

.btn {
  position: relative;
  overflow: hidden;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  padding: 14px 18px;
  border: 1px solid transparent;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-align: center;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

.btn:active,
.answer-btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #ff6414 0%, #ff7f2e 54%, #ffad6d 100%);
  border-color: rgba(255, 255, 255, 0.46);
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 12px 24px rgba(205, 84, 22, 0.3),
    0 3px 8px rgba(48, 52, 61, 0.22);
  text-shadow: 0 1px 1px rgba(98, 45, 20, 0.24);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ff741d 0%, #ff9146 54%, #ffc08d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    0 16px 30px rgba(205, 84, 22, 0.36),
    0 4px 10px rgba(48, 52, 61, 0.2);
  transform: translateY(-1px);
}

.btn-secondary {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035));
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
  border-color: rgba(255, 152, 81, 0.82);
  background: linear-gradient(135deg, rgba(255, 139, 59, 0.17), rgba(255, 255, 255, 0.07));
  transform: translateY(-1px);
}

.answer-list {
  align-self: center;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 100%;
}

.answer-list .answer-btn:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.answer-btn {
  position: relative;
  min-height: 82px;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-deep);
  color: var(--text);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.answer-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: #30343c;
  font-size: 16px;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 160ms ease, transform 220ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.answer-btn.is-selected {
  border-color: var(--accent);
  background: rgba(255, 116, 23, 0.18);
  transform: scale(0.985);
}

.answer-btn.is-selected .answer-check {
  opacity: 1;
  transform: scale(1);
}

.answer-btn:hover {
  border-color: rgba(255, 116, 23, 0.72);
  background: var(--surface-soft);
}

.answer-key {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent-dark);
  color: var(--accent);
  font-weight: 900;
}

.answer-text {
  color: var(--text);
  line-height: 1.35;
}

.fields {
  align-self: center;
  max-width: 560px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 14px;
  font-weight: 900;
}

.field input {
  min-height: 56px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  background: var(--surface-deep);
  color: var(--text);
}

.field-help {
  color: var(--subtle);
  font-size: 13px;
}

.error {
  display: none;
  margin: 0;
  color: var(--danger);
  font-weight: 800;
}

.error.is-visible {
  display: block;
}

.result-card {
  align-self: start;
  display: grid;
  gap: 22px;
  max-height: none;
  overflow: visible;
  max-width: 620px;
}

.result-summary {
  max-width: 600px;
  color: var(--text);
  font-size: 18px;
}

.result-opening {
  margin: 0;
  color: var(--text);
  font-size: clamp(20px, 2.2vw, 27px);
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.result-copy {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.result-next {
  display: grid;
  gap: 6px;
  max-width: 600px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
}

.result-next-label,
.voucher-label {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.voucher {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  column-gap: 12px;
  row-gap: 4px;
  padding: 16px 18px;
  border: 1px dashed rgba(255, 116, 23, 0.72);
  border-radius: var(--radius);
  background: rgba(255, 116, 23, 0.09);
}

.voucher-label {
  grid-column: 1 / -1;
}

.voucher strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.voucher p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.3;
}

.loading-screen,
.pass-screen {
  place-items: center;
}

.loading-state,
.ready-state,
.pass-state {
  width: min(100%, 610px);
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
}

.loading-state .helper,
.ready-state .helper,
.pass-state .helper {
  margin-top: 0;
}

.loader {
  width: 58px;
  height: 58px;
  border: 4px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.success-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 34px;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(255, 116, 23, 0.28);
  animation: success-pop 360ms cubic-bezier(0.2, 1.45, 0.45, 1) both;
}

.pass-state .voucher {
  width: 100%;
  margin-top: 8px;
  text-align: left;
}

.evo-note {
  margin: 0;
  color: var(--subtle);
  font-size: 12px;
}

.result-screen {
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 24px;
  overflow: hidden;
}

.result-screen .result-actions {
  align-self: end;
  margin: 0;
}

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

@keyframes success-pop {
  from { opacity: 0; transform: scale(0.55); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 860px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    min-height: 100dvh;
    padding: 0;
  }

  .diagnostic {
    width: 100vw;
    max-width: 100vw;
    min-height: 0;
    height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    border: 0;
    border-radius: 0;
  }

  .diagnostic-aside {
    grid-template-rows: auto auto auto;
    gap: 12px;
    padding: 14px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
  }

  .aside-copy {
    display: none;
  }

  .stage-list {
    display: none;
  }

  .diagnostic-main {
    width: 100vw;
    max-width: 100vw;
    min-height: 0;
    padding: 22px 16px;
    overflow: hidden;
  }

  .screen {
    width: 100%;
    max-width: calc(100vw - 32px);
    min-height: 0;
    gap: 16px;
  }

  .screen-head,
  .helper,
  h2 {
    width: min(100%, 340px);
    max-width: min(100%, 340px);
  }

  .impact-strip,
  .actions,
  .answer-list,
  .fields,
  .result-card {
    width: 100%;
    max-width: calc(100vw - 32px);
  }

  .actions-single {
    grid-template-columns: 1fr;
  }

  h2 {
    font-size: clamp(30px, 8vw, 42px);
    overflow-wrap: anywhere;
  }

  .helper {
    font-size: 16px;
  }

  .result-heading {
    margin-bottom: 6px;
    font-size: 16px;
  }

  .impact-strip {
    grid-template-columns: 1fr;
    align-self: stretch;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .impact-strip span {
    min-height: 42px;
  }

  .answer-list {
    grid-template-columns: 1fr;
    align-self: stretch;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    scrollbar-color: var(--accent) rgba(35, 39, 47, 0.5);
    scrollbar-width: thin;
  }

  .answer-list .answer-btn:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .answer-list::-webkit-scrollbar {
    width: 6px;
  }

  .answer-list::-webkit-scrollbar-track {
    background: rgba(35, 39, 47, 0.5);
    border-radius: 999px;
  }

  .answer-list::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 999px;
  }

  .answer-btn {
    min-height: 60px;
  }

  .answer-check {
    top: 9px;
    right: 9px;
  }

  .actions {
    grid-template-columns: 1fr;
    position: relative;
    z-index: 2;
  }

  .fields,
  .result-card {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .fields {
    align-self: stretch;
    align-content: center;
  }

  .result-card {
    align-self: stretch;
  }

  .loading-screen,
  .pass-screen {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .pass-screen {
    place-items: start center;
  }
}

@media (max-width: 430px) {
  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .brand-line {
    font-size: 13px;
  }

}

@media (max-width: 860px) and (max-height: 740px) {
  .diagnostic-aside {
    gap: 8px;
    padding-block: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .diagnostic-main {
    padding-block: 14px;
  }

  .screen {
    gap: 10px;
  }

  .step-code {
    min-height: 26px;
    margin-bottom: 6px;
    padding-block: 3px;
  }

  .eyebrow {
    font-size: 11px;
  }

  h2 {
    margin-top: 6px;
    font-size: clamp(26px, 7vw, 34px);
  }

  .helper {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.35;
  }

  .impact-strip {
    gap: 6px;
  }

  .impact-strip span {
    min-height: 34px;
    padding: 8px 12px;
  }

  .answer-list,
  .fields,
  .actions {
    gap: 8px;
  }

  .answer-btn {
    min-height: 50px;
    padding: 8px 10px;
    gap: 10px;
  }

  .answer-key {
    width: 36px;
    height: 36px;
  }

  .btn {
    min-height: 46px;
    padding-block: 10px;
  }

  .field {
    gap: 4px;
  }

  .field input {
    min-height: 46px;
    padding-block: 10px;
  }

  .field-help {
    font-size: 12px;
  }

  .result-card {
    gap: 16px;
  }

  .result-summary {
    font-size: 16px;
    line-height: 1.4;
  }

  .result-copy {
    font-size: 14px;
    line-height: 1.35;
  }

  .result-next {
    gap: 4px;
    padding-left: 10px;
  }

  .result-screen {
    width: calc(100vw - 48px);
    max-width: 100%;
    justify-self: start;
    gap: 16px;
  }

  .result-opening {
    font-size: 19px;
  }

  .voucher {
    column-gap: 8px;
    padding: 11px 12px;
  }

  .voucher strong {
    font-size: 20px;
  }

  .voucher p {
    font-size: 13px;
  }
}

@media (min-width: 500px) and (max-width: 860px) {
  .result-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) and (max-height: 520px) {
  .result-card {
    gap: 12px;
  }

  .result-summary {
    font-size: 14px;
    line-height: 1.28;
  }

  .result-copy {
    font-size: 13px;
    line-height: 1.22;
  }

  .voucher {
    padding: 7px 10px;
  }

  .voucher p {
    display: none;
  }

  .voucher strong {
    font-size: 18px;
  }
}

@media (max-width: 860px) and (orientation: landscape) and (max-height: 520px) {
  .diagnostic-aside {
    grid-template-columns: auto minmax(180px, 1fr);
    grid-template-rows: auto;
    align-items: center;
    gap: 20px;
    padding: 8px 16px;
  }

  .brand-line {
    display: none;
  }

  .progress-wrap {
    min-width: 0;
  }

  .diagnostic-main {
    padding: 10px 16px 14px;
  }

  .screen {
    gap: 8px;
  }

  .screen-head,
  .helper,
  h2 {
    width: 100%;
    max-width: 100%;
  }

  .screen-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
  }

  .screen-head .step-code {
    margin-bottom: 0;
  }

  .screen-head h2,
  .screen-head .helper {
    grid-column: 1 / -1;
  }

  h2 {
    font-size: clamp(23px, 4.6vw, 30px);
  }

  .impact-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .impact-strip span {
    min-height: 44px;
    padding: 8px 10px;
  }

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

  .answer-list .answer-btn:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .answer-btn {
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
  }

  .fields .actions,
  .result-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .loading-state,
  .ready-state,
  .pass-state {
    gap: 10px;
  }

  .loader {
    width: 44px;
    height: 44px;
  }

  .success-mark {
    width: 48px;
    height: 48px;
    font-size: 26px;
  }
}

@media (max-height: 680px) and (min-width: 861px) {
  .app-shell {
    padding: 18px;
  }

  .diagnostic {
    width: min(1120px, calc(100vw - 36px));
    height: calc(100dvh - 36px);
  }

  .diagnostic-aside,
  .diagnostic-main {
    padding: 22px;
  }

  .diagnostic-aside {
    gap: 16px;
  }

  .aside-title {
    font-size: 36px;
  }

  .aside-text {
    margin-top: 12px;
    font-size: 14px;
  }

  .stage-list {
    gap: 4px;
  }

  .stage-item {
    min-height: 30px;
    padding-block: 5px;
  }

  .screen {
    gap: 14px;
  }

  .step-code {
    min-height: 28px;
    margin-bottom: 8px;
    padding-block: 4px;
  }

  h2 {
    font-size: clamp(30px, 4vw, 46px);
  }

  .helper {
    margin-top: 10px;
    font-size: 16px;
  }

  .impact-strip span {
    min-height: 64px;
  }

  .answer-btn {
    min-height: 68px;
    padding: 10px 12px;
  }

  .fields {
    gap: 8px;
  }

  .field input {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
