:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-soft: #0b1728;
  --panel: #0e1d31;
  --panel-strong: #10233c;
  --paper: #f7f9fc;
  --paper-soft: #edf2f7;
  --text: #f7fafc;
  --muted: #a9b6c8;
  --ink: #111827;
  --ink-muted: #4b5563;
  --line: rgba(255, 255, 255, 0.14);
  --line-dark: rgba(17, 24, 39, 0.12);
  --gold: #dba742;
  --gold-strong: #f0bd55;
  --blue: #4c9dff;
  --green: #84cc16;
  --orange: #f97316;
  --violet: #a855f7;
  --danger: #ef4444;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.26);
  --radius: 8px;
  --focus: 0 0 0 3px rgba(76, 157, 255, 0.28);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(14, 29, 49, 0.88) 0%, rgba(7, 17, 31, 0.98) 56%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 88px),
    var(--bg);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.app {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 17, 31, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  min-width: 205px;
  color: var(--text);
  text-decoration: none;
}

.brand-isotype {
  display: block;
  width: auto;
  height: clamp(44px, 5vw, 56px);
  max-width: 46px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.brand-copy strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 2vw, 1.36rem);
  line-height: 1;
  letter-spacing: 0.08em;
}

.brand-copy small {
  display: block;
  color: var(--gold);
  font-size: clamp(0.62rem, 1.2vw, 0.75rem);
  font-weight: 800;
  text-transform: uppercase;
}

.nav-tabs {
  display: inline-flex;
  justify-self: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab {
  min-height: 40px;
  min-width: 112px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.nav-tab.is-active {
  background: linear-gradient(180deg, #1f6fd1, #1b58a7);
  color: white;
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.connection {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(132, 204, 22, 0.3);
  border-radius: 999px;
  color: #d9f99d;
  font-size: 0.88rem;
  background: rgba(132, 204, 22, 0.08);
}

.connection.is-offline {
  border-color: rgba(239, 68, 68, 0.3);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.08);
}

.icon-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  min-width: 108px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  border: 1px solid rgba(240, 189, 85, 0.4);
  background: linear-gradient(180deg, #f4c96c, #c99126);
  color: #1b1305;
}

.secondary-button,
.icon-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.secondary-button:hover,
.icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.secondary-button.danger {
  border-color: rgba(239, 68, 68, 0.42);
  color: #fecaca;
}

.secondary-button.compact {
  min-width: 78px;
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.88rem;
}

main {
  padding-top: 26px;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.page-heading,
.history-heading,
.result-toolbar {
  width: min(1180px, 100%);
  margin: 0 auto 18px;
}

.page-heading {
  display: grid;
  gap: 8px;
  text-align: center;
}

.page-heading h1,
.history-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 2.45rem;
  line-height: 1.08;
}

.page-heading p,
.history-heading p {
  margin: 0;
  color: var(--muted);
}

.eyebrow,
.panel-label {
  margin: 0;
  color: var(--gold-strong);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.score-panel {
  position: sticky;
  top: 110px;
  display: grid;
  gap: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(17, 38, 67, 0.96), rgba(8, 21, 38, 0.96)),
    var(--panel);
  box-shadow: var(--shadow);
}

.score-display {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 8px;
}

.score-display strong {
  color: var(--blue);
  font-size: 4.2rem;
  line-height: 0.92;
}

.score-display span {
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
}

.score-display.large strong {
  font-size: 5.2rem;
}

.meter {
  width: 100%;
  height: 16px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2b7fdc, #62b0ff);
  transition: width 180ms ease;
}

.large-meter {
  height: 18px;
}

.profile-preview {
  display: grid;
  gap: 6px;
}

.profile-preview strong {
  color: var(--text);
  font-size: 1.35rem;
}

.profile-preview span {
  color: var(--muted);
}

.progress-list {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.progress-list div,
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-list span {
  color: var(--muted);
}

.progress-list strong {
  color: var(--text);
}

.advisor-note {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.advisor-note strong {
  color: var(--gold-strong);
}

.advisor-note p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.evaluation-form {
  display: grid;
  gap: 16px;
}

.client-strip {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 2fr);
  gap: 18px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.client-strip h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0 12px;
}

input::placeholder {
  color: rgba(169, 182, 200, 0.72);
}

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

.question-card {
  min-height: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.15);
}

.question-card.is-complete {
  border-color: rgba(76, 157, 255, 0.65);
}

.question-head {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: start;
}

.question-number {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f3c86a, #c89126);
  color: #130d03;
  font-size: 1.25rem;
  font-weight: 900;
}

.question-head h3 {
  min-height: 46px;
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.options {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.option {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
}

.option:hover {
  border-color: rgba(76, 157, 255, 0.55);
  background: #f3f8ff;
}

.option.is-selected {
  border-color: #2563eb;
  background: #e8f2ff;
}

.option-dot {
  width: 18px;
  height: 18px;
  border: 2px solid #9ca3af;
  border-radius: 50%;
  background: white;
}

.option.is-selected .option-dot {
  border: 5px solid #2563eb;
}

.option-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.option-points {
  color: #a16207;
  font-weight: 900;
  white-space: nowrap;
}

.city-card .options {
  margin-top: 16px;
}

.city-card input {
  border-color: var(--line-dark);
  background: white;
  color: var(--ink);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 4px 0 24px;
}

.result-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.result-toolbar div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.report {
  width: min(1180px, 100%);
  margin: 0 auto 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(9, 22, 39, 0.98), rgba(6, 14, 25, 0.98)),
    var(--bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.report-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 28px;
  border-bottom: 1px solid var(--line);
}

.report-title-block {
  display: grid;
  gap: 8px;
}

.report-identity {
  display: inline-flex;
  gap: 14px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 6px;
}

.report-isotype {
  display: block;
  width: auto;
  height: clamp(54px, 7vw, 72px);
  max-width: 60px;
  object-fit: contain;
  flex: 0 0 auto;
}

.report-identity span {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.report-identity strong {
  display: block;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3vw, 2.05rem);
  line-height: 1;
  letter-spacing: 0.1em;
}

.report-identity small {
  color: var(--gold);
  font-size: clamp(0.68rem, 1.4vw, 0.86rem);
  font-weight: 800;
  text-transform: uppercase;
}

.report-header h2 {
  margin: 4px 0 6px;
  font-size: 2.4rem;
  line-height: 1.05;
}

.report-header p {
  margin: 0;
  color: var(--muted);
}

.report-badge {
  display: grid;
  gap: 8px;
  min-width: 230px;
  padding: 18px;
  border: 1px solid rgba(219, 167, 66, 0.36);
  border-radius: var(--radius);
  background: rgba(219, 167, 66, 0.08);
  text-align: right;
}

.report-badge span {
  color: var(--gold-strong);
  font-weight: 900;
}

.report-badge strong {
  font-size: 1.2rem;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  padding: 16px;
}

.report-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.report-card h3 {
  margin: 0 0 14px;
  font-size: 1.18rem;
}

.score-card,
.profile-card {
  grid-column: span 6;
}

.answers-card {
  grid-column: span 6;
  grid-row: span 3;
}

.traits-card {
  grid-column: span 6;
}

.investment-card,
.success-card {
  grid-column: span 3;
}

.advisor-card,
.thank-card {
  grid-column: span 6;
}

.profile-card h3 {
  margin: 6px 0 10px;
  font-size: 2.75rem;
  line-height: 1;
  color: white;
}

.level-pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  border-radius: 6px;
  background: #1f6fd1;
  color: white;
  font-weight: 900;
}

.profile-card p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.56;
}

.scale {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--muted);
}

.answers-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: answer;
}

.answers-list li {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  counter-increment: answer;
}

.answers-list li::before {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1f6fd1;
  color: white;
  content: counter(answer);
  font-weight: 900;
}

.answers-list strong {
  color: var(--text);
  font-weight: 800;
}

.answers-list span {
  color: #8dc4ff;
  text-align: right;
}

.check-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 34px;
  color: var(--text);
  line-height: 1.5;
}

.check-list li::before {
  position: absolute;
  top: 1px;
  left: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1f6fd1;
  color: white;
  content: "✓";
  font-weight: 900;
}

.investment-card strong {
  display: block;
  margin: 8px 0 8px;
  color: var(--gold-strong);
  font-size: 1.55rem;
  line-height: 1.18;
}

.investment-card span {
  color: var(--muted);
}

.success-layout {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 18px;
  align-items: center;
}

.donut {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #081525 0 53%, transparent 54%),
    conic-gradient(#4c9dff calc(var(--value) * 1%), rgba(255, 255, 255, 0.16) 0);
}

.donut span {
  color: white;
  font-size: 1.55rem;
  font-weight: 900;
}

.success-layout p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.thank-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 124px;
  background:
    linear-gradient(90deg, rgba(247, 249, 252, 0.96), rgba(247, 249, 252, 0.82)),
    var(--paper);
  color: var(--ink);
}

.thank-isotype {
  display: block;
  width: auto;
  height: clamp(62px, 8vw, 86px);
  max-width: 72px;
  object-fit: contain;
  padding: 6px;
  border-radius: var(--radius);
  background: #07111f;
}

.thank-card h3 {
  color: var(--ink);
}

.thank-card p {
  margin: 0;
  color: var(--ink-muted);
}

.history-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.history-list {
  display: grid;
  gap: 12px;
  width: min(980px, 100%);
  margin: 0 auto 36px;
}

.history-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.history-item > div {
  display: grid;
  gap: 4px;
}

.history-item > div:last-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-client {
  color: var(--text);
}

.history-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.history-score {
  color: var(--gold-strong);
  font-weight: 900;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  padding: 14px 16px;
  border: 1px solid rgba(76, 157, 255, 0.4);
  border-radius: var(--radius);
  background: #10233c;
  color: var(--text);
  box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .score-panel {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .advisor-note,
  .progress-list {
    border-top: 0;
    padding-top: 0;
  }

  .investment-card,
  .success-card,
  .score-card,
  .profile-card,
  .answers-card,
  .traits-card,
  .advisor-card,
  .thank-card {
    grid-column: span 12;
  }
}

@media (max-width: 840px) {
  .app {
    padding: 10px;
  }

  .topbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .brand {
    min-width: 0;
  }

  .brand-isotype {
    height: 48px;
    max-width: 40px;
  }

  .nav-tabs {
    justify-self: stretch;
    overflow-x: auto;
  }

  .nav-tab {
    min-width: 104px;
    flex: 1 0 auto;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .page-heading {
    text-align: left;
  }

  .page-heading h1,
  .history-heading h2,
  .report-header h2 {
    font-size: 1.8rem;
  }

  .client-strip,
  .field-grid,
  .questions-grid,
  .score-panel {
    grid-template-columns: 1fr;
  }

  .report-header {
    grid-template-columns: 1fr;
  }

  .report-badge {
    min-width: 0;
    text-align: left;
  }

  .report-grid {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .score-card,
  .profile-card,
  .answers-card,
  .traits-card,
  .investment-card,
  .success-card,
  .advisor-card,
  .thank-card {
    grid-column: auto;
  }

  .result-toolbar,
  .history-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .result-toolbar div {
    justify-content: stretch;
  }

  .result-toolbar button,
  .history-heading button,
  .form-actions button {
    width: 100%;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .success-layout {
    grid-template-columns: 1fr;
  }

  .thank-card {
    grid-template-columns: 1fr;
  }

  .thank-isotype {
    height: 72px;
    justify-self: start;
  }

  .answers-list li {
    grid-template-columns: 30px 1fr;
  }

  .answers-list span {
    grid-column: 2;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .score-display strong,
  .score-display.large strong {
    font-size: 3.5rem;
  }

  .profile-card h3 {
    font-size: 2rem;
  }

  .option {
    grid-template-columns: 22px 1fr;
  }

  .option-points {
    grid-column: 2;
  }

  .history-item,
  .history-item > div:last-child {
    display: grid;
    align-items: stretch;
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: white;
    color: black;
  }

  .topbar,
  .result-toolbar,
  #screen-evaluation,
  #screen-history,
  .toast {
    display: none !important;
  }

  .app {
    width: 100%;
    padding: 0;
  }

  main {
    padding: 0;
  }

  .screen {
    display: block;
  }

  .report {
    width: 100%;
    margin: 0;
    border: 0;
    box-shadow: none;
    background: #07111f;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .report-card,
  .report-header,
  .report-badge {
    break-inside: avoid;
  }
}
