:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #edf4f1;
  --ink: #111827;
  --muted: #5b6474;
  --line: #d8dee8;
  --emerald: #0f9f6e;
  --cobalt: #2458d3;
  --rose: #bd1e59;
  --amber: #d99a18;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(15, 159, 110, 0.06), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 48%, #eef2f7 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 12px 0;
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  padding: 0;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(15, 159, 110, 0.92), rgba(36, 88, 211, 0.86)),
    #111827;
  border-radius: 8px;
  font-weight: 900;
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.nav-button,
.ghost-action,
.secondary-action,
.primary-action,
.danger-action {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
}

.nav-button {
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
}

.nav-button.is-active {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.08);
}

.screen {
  display: none;
  animation: fade-up 260ms ease-out;
}

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

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 28px;
  align-items: stretch;
  min-height: 620px;
  padding: 26px 0 30px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--emerald);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  max-width: 820px;
  margin: 0;
  font-size: 4.2rem;
  line-height: 0.96;
}

h2 {
  margin: 0;
  font-size: 2.35rem;
  line-height: 1.05;
}

h3 {
  margin: 0;
  font-size: 1.05rem;
}

.lead {
  max-width: 690px;
  margin: 20px 0 0;
  color: #364152;
  font-size: 1.15rem;
  line-height: 1.65;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
}

.trust-strip span {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.segment-panel {
  margin-top: 28px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 12px;
  color: var(--ink);
  font-weight: 900;
}

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

.segment-option {
  position: relative;
  display: grid;
  min-height: 122px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.segment-option:hover,
.segment-option:focus-within {
  transform: translateY(-2px);
  border-color: rgba(15, 159, 110, 0.7);
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.1);
}

.segment-option input {
  position: absolute;
  inset: 12px auto auto 12px;
  width: 18px;
  height: 18px;
  accent-color: var(--emerald);
}

.segment-option strong {
  margin-top: 24px;
  font-size: 0.95rem;
}

.segment-option span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.segment-option:has(input:checked) {
  border-color: var(--emerald);
  background: #eefaf5;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 178px;
  margin-top: 18px;
  padding: 0 20px;
  color: #ffffff;
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 16px 34px rgba(17, 24, 39, 0.18);
}

.primary-action:hover {
  background: #1f2937;
}

.secondary-action,
.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.secondary-action:hover,
.ghost-action:hover {
  border-color: var(--emerald);
}

.danger-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

.visual-stage {
  position: relative;
  display: flex;
  min-height: 620px;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  border: 1px solid #202a39;
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(17, 24, 39, 0.92), rgba(16, 89, 94, 0.86)),
    #111827;
  box-shadow: var(--shadow);
}

.city-lines {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background:
    linear-gradient(90deg, transparent 0 10%, rgba(255, 255, 255, 0.15) 10% 11%, transparent 11% 100%),
    linear-gradient(0deg, transparent 0 13%, rgba(255, 255, 255, 0.13) 13% 14%, transparent 14% 100%);
  background-size: 92px 92px;
  mask-image: linear-gradient(180deg, transparent 0%, black 22%, black 72%, transparent 100%);
}

.phone-frame {
  position: relative;
  z-index: 1;
  width: 270px;
  min-height: 540px;
  padding: 14px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.phone-top {
  width: 84px;
  height: 8px;
  margin: 0 auto 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.32);
}

.sample-card {
  display: flex;
  min-height: 492px;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border-radius: 22px;
  color: #ffffff;
  background:
    linear-gradient(145deg, rgba(15, 159, 110, 0.88), rgba(189, 30, 89, 0.72)),
    #111827;
}

.sample-kicker {
  color: rgba(255, 255, 255, 0.74);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.sample-card strong {
  font-size: 2rem;
  line-height: 1.02;
}

.sample-avatar {
  display: grid;
  width: 120px;
  height: 120px;
  place-items: center;
  align-self: center;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.46);
  font-size: 2.2rem;
  font-weight: 950;
}

.sample-stat {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.sample-stat span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
}

.sample-stat b {
  font-size: 3rem;
  line-height: 0.9;
}

.sample-bars {
  display: grid;
  gap: 8px;
}

.sample-bars i {
  display: block;
  height: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
}

.proof-grid {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.proof-grid div {
  min-height: 74px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  backdrop-filter: blur(10px);
}

.proof-grid span {
  display: block;
  font-size: 1.55rem;
  font-weight: 950;
}

.proof-grid small {
  color: rgba(255, 255, 255, 0.74);
}

.section-band {
  margin-top: 22px;
  padding: 30px 0 4px;
  border-top: 1px solid var(--line);
}

.band-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

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

.profile-teaser,
.score-tile,
.admin-section,
.history-card,
.premium-card,
.locked-map,
.question-surface,
.loading-surface,
.story-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.06);
}

.profile-teaser {
  min-height: 176px;
  padding: 16px;
  overflow: hidden;
}

.profile-teaser .avatar-token,
.history-card .avatar-token {
  margin-bottom: 12px;
}

.profile-teaser p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.avatar-token {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--profile-color, var(--emerald));
  font-weight: 950;
}

.quiz-layout {
  width: min(760px, 100%);
  margin: 34px auto 0;
}

.quiz-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

.progress-track {
  height: 12px;
  margin: 18px 0;
  overflow: hidden;
  border-radius: 8px;
  background: #dfe6ef;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--emerald), var(--cobalt), var(--rose));
  transition: width 220ms ease;
}

.question-surface {
  min-height: 520px;
  padding: 26px;
}

.question-surface h2 {
  max-width: 680px;
}

.answers {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

.answer-button {
  display: grid;
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.answer-button:hover,
.answer-button:focus {
  transform: translateY(-1px);
  border-color: var(--emerald);
  background: #f1fbf6;
  outline: none;
}

.answer-button strong {
  font-size: 1rem;
}

.answer-button span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.loading-surface {
  display: grid;
  width: min(520px, 100%);
  min-height: 430px;
  place-items: center;
  margin: 56px auto 0;
  padding: 32px;
  text-align: center;
}

.scan-ring {
  width: 138px;
  height: 138px;
  border: 8px solid #dfe6ef;
  border-top-color: var(--emerald);
  border-right-color: var(--rose);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}

.loading-surface p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
  padding-top: 24px;
}

.result-main {
  min-width: 0;
}

.result-heading {
  padding: 20px 0;
}

.result-heading p:last-child {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

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

.score-tile {
  min-height: 118px;
  padding: 16px;
}

.score-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.score-tile strong {
  display: block;
  margin-top: 10px;
  font-size: 3rem;
  line-height: 0.95;
}

.map-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 12px;
  margin-top: 12px;
}

.radar-panel {
  min-height: 380px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.radar-panel canvas {
  display: block;
  width: 100%;
  height: 380px;
}

.insight-list {
  display: grid;
  gap: 12px;
}

.insight-item {
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.insight-item strong {
  display: block;
  margin-bottom: 6px;
}

.insight-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.locked-map {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 12px;
  padding: 18px;
  background: linear-gradient(90deg, #ffffff, #f4f9f6);
}

.locked-map p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.premium-card {
  display: grid;
  min-height: 238px;
  padding: 16px;
}

.premium-card .price {
  margin: 10px 0;
  font-size: 1.9rem;
  font-weight: 950;
}

.premium-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.premium-card button {
  align-self: end;
  margin-top: 14px;
}

.story-panel {
  position: sticky;
  top: 92px;
  padding: 14px;
}

.story-panel canvas {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  background: #111827;
}

.story-actions,
.share-row,
.admin-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.story-actions .secondary-action,
.admin-actions .secondary-action,
.admin-actions .danger-action {
  min-width: 0;
  padding: 0 8px;
  font-size: 0.88rem;
}

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

.share-row a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 800;
  text-decoration: none;
}

.story-panel .primary-action {
  width: 100%;
}

.panel-page {
  padding-top: 28px;
}

.page-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 20px;
}

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

.history-card {
  min-height: 210px;
  padding: 16px;
}

.history-card p {
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.45;
}

.history-card button {
  margin-top: 8px;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.64);
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric-card {
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.metric-card span {
  color: var(--muted);
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2.4rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-section {
  padding: 16px;
}

.admin-section.wide {
  grid-column: 1 / -1;
}

.hook-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.hook-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfe;
  color: #303949;
}

.package-editor {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.package-row {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 8px;
  align-items: center;
}

.package-row input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: var(--ink);
}

.legal-copy {
  max-width: 760px;
}

.legal-copy p {
  color: var(--muted);
  line-height: 1.7;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.48);
  backdrop-filter: blur(8px);
}

.modal {
  position: relative;
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  font-size: 1.4rem;
}

.modal p {
  color: var(--muted);
  line-height: 1.55;
}

.modal-price {
  margin: 12px 0;
  font-size: 2.2rem;
  font-weight: 950;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-weight: 800;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100% - 22px, 760px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions {
    width: 100%;
    overflow-x: auto;
  }

  .nav-button {
    flex: 1;
  }

  .hero-grid,
  .result-grid,
  .map-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    min-height: unset;
  }

  h1 {
    font-size: 3.2rem;
  }

  h2 {
    font-size: 1.95rem;
  }

  .segment-grid,
  .profile-teasers,
  .history-list,
  .premium-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .visual-stage {
    min-height: 560px;
  }

  .story-panel {
    position: static;
    max-width: 460px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: calc(100% - 18px);
    padding-top: 8px;
  }

  .brand {
    min-width: 0;
  }

  .nav-actions {
    gap: 4px;
    padding: 4px;
  }

  .nav-button {
    min-width: 78px;
    padding: 0 8px;
    font-size: 0.88rem;
  }

  h1 {
    font-size: 2.55rem;
  }

  h2 {
    font-size: 1.55rem;
  }

  .lead {
    font-size: 1rem;
  }

  .segment-grid,
  .profile-teasers,
  .history-list,
  .premium-grid,
  .result-score-row,
  .admin-metrics {
    grid-template-columns: 1fr;
  }

  .segment-option {
    min-height: 96px;
  }

  .question-surface {
    min-height: 500px;
    padding: 20px;
  }

  .quiz-status {
    flex-wrap: wrap;
  }

  .visual-stage {
    min-height: 520px;
  }

  .phone-frame {
    width: 246px;
    min-height: 500px;
  }

  .sample-card {
    min-height: 452px;
  }

  .story-actions,
  .admin-actions {
    grid-template-columns: 1fr;
  }

  .locked-map {
    align-items: stretch;
    flex-direction: column;
  }
}

