:root {
  --primary: #0000cc;
  --primary-hover: #0000aa;
  --accent: #cdf7f6;
  --highlight: #f4e04d;
  --warning: #e8871e;
  --text: #1d1e18;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --white: #ffffff;
  --radius: 12px;
  font-family: "Krub", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #dbeafe 0%, #ffffff 55%, #ffffff 100%);
}

a {
  color: var(--primary);
}

.wrap {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.wrap-wide {
  width: min(880px, calc(100% - 2rem));
}

.lede-tight {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}

.score-pill {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.35rem 0.75rem;
  background: var(--accent);
  color: var(--text);
  border-radius: 999px;
  font-size: 0.95rem;
}

.result-map {
  margin: 1.25rem 0;
}

.result-map .result-hero {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.result-title {
  margin: 1.25rem 0 0.75rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.result-map .result-hero h1 {
  margin: 0.45rem 0 0.4rem;
}

.result-map .one-liner {
  margin: 0 0 0.75rem;
}

.result-map .diagnosis {
  margin: 0.75rem 0 0;
}

.chart-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.85rem 0 0.15rem;
  padding: 0.35rem 0.65rem;
  max-width: 100%;
  color: #9ca3af;
  font-size: 0.8rem;
  line-height: 1.35;
  background: transparent;
  border: none;
}

.chart-hint-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #9ca3af;
  opacity: 0.9;
}

.result-map .phase-detail {
  margin: 1.15rem 0 0;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}

.result-map .phase-block h4,
.result-map .phase-ai-head h4 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.result-map .phase-ai-head h4 {
  margin: 0;
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.chart-header-text h2 {
  margin: 0.25rem 0 0.35rem;
  font-size: 1.2rem;
}

.chart-header-text p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.chart-share {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.chart-share-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 0.15rem;
}

.share-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: var(--bg);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.share-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.share-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f5f5ff;
}

.maturity-chart {
  width: 100%;
  height: min(420px, 62vw);
  min-height: 280px;
}

.phase-detail {
  margin: 0;
}

.phase-detail h2,
.playbook h2 {
  margin: 0 0 0.65rem;
  font-size: 1.35rem;
}

.phase-detail h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.phase-detail > p,
.phase-ai p,
.phase-block p,
.playbook .lede-tight {
  margin: 0;
  line-height: 1.55;
  color: var(--text);
}

.panel-summary {
  margin: 0 0 1.15rem !important;
  color: var(--muted) !important;
  font-size: 1.02rem;
  line-height: 1.5;
}

.phase-grid {
  display: grid;
  gap: 0.85rem;
}

.phase-block {
  padding: 0.95rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.phase-block h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.35rem 1.4rem;
  margin: 0 0 1.25rem;
  box-shadow: 0 8px 24px rgba(29, 30, 24, 0.04);
}

.panel-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary);
}

.phase-ai {
  margin-top: 0;
  padding: 0.95rem 1rem;
  background: rgba(205, 247, 246, 0.45);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.phase-ai-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.4rem;
}

.phase-ai-head h3 {
  margin: 0;
}

.ai-level {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem 0.2rem 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.ai-emoji {
  font-size: 1rem;
  line-height: 1;
}

.ai-level-label {
  color: var(--muted);
  font-weight: 600;
}

.playbook {
  border-color: rgba(0, 0, 204, 0.18);
}

.playbook .lede-tight {
  margin: 0 0 1.1rem;
  color: var(--muted);
}

/* ECharts injects tooltip on body with white-space:nowrap by default */
body > div:has(> .tt),
body > div:has(.tt) {
  white-space: normal !important;
  max-width: min(280px, calc(100vw - 32px)) !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.tt {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.tt-head {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  max-width: 100%;
}

.tt-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tt-you {
  background: var(--highlight);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.tt-line,
.tt-next {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #374151;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.tt-next {
  color: var(--primary);
  margin-top: 0.4rem;
}

.tt-steps {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #1d1e18;
  max-width: 100%;
  box-sizing: border-box;
}

.tt-steps li {
  margin-bottom: 0.2rem;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .chart-header {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-share {
    justify-content: flex-start;
  }

  .chart-share-label {
    display: none;
  }
}

.brand {
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  text-decoration: none;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  line-height: 1.15;
  margin: 0.75rem 0 0.5rem;
}

.lede {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 0 0 2rem;
}

.progress {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.25s ease;
}

.step {
  display: none;
  animation: fade 0.2s ease;
}

.step.active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.q-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.q-header {
  margin-bottom: 1.25rem;
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.q-meta .q-label {
  margin: 0;
}

.q-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(205, 247, 246, 0.65);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
}

.q-text {
  font-size: clamp(1.2rem, 2.6vw, 1.45rem);
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.q-help {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
}

.field {
  display: block;
  margin-top: 0.5rem;
}

.field input[type="text"] {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  font: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 0, 204, 0.12);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.answers {
  display: grid;
  gap: 0.65rem;
}

.answer {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.answer:hover {
  border-color: var(--primary);
}

.answer input {
  margin-top: 0.2rem;
  accent-color: var(--primary);
  width: 1.05rem;
  height: 1.05rem;
}

.answer-body {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.answer-title {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.35;
  color: var(--text);
}

.answer-detail {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.answer:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 0, 204, 0.12);
  background: #f5f5ff;
}

.answer:has(input:checked) .answer-title {
  color: var(--primary);
}

/* legacy selector kept for company step / older markup */
.answers label:hover {
  border-color: var(--primary);
}

.answers input {
  accent-color: var(--primary);
}

.nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.75rem;
}

button,
.btn {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

[hidden] {
  display: none !important;
}

.btn-primary,
button.primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover,
button.primary:hover {
  background: var(--primary-hover);
}

.btn-secondary,
button.secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}

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

.badge {
  display: inline-block;
  background: var(--highlight);
  color: var(--text);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.result-hero {
  margin: 1.25rem 0 1.5rem;
}

.result-hero h1 {
  margin-bottom: 0.35rem;
}

.one-liner {
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.diagnosis {
  line-height: 1.55;
  margin: 0 0 1.5rem;
}

.bars {
  display: grid;
  gap: 0.85rem;
  margin: 1.5rem 0;
}

.bar-row {
  display: grid;
  gap: 0.35rem;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.bar-track {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.bar-fill.low {
  background: var(--warning);
}

.tips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
  counter-reset: none;
}

.tips li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: start;
  background: rgba(249, 250, 251, 0.95);
  border: 1px solid var(--border);
  padding: 0.95rem 1rem;
  border-radius: var(--radius);
  line-height: 1.45;
}

.tip-num {
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
  line-height: 1.45;
  min-width: 1.4rem;
}

.tip-body {
  min-width: 0;
}

.rec-block {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.35rem 1.5rem;
  margin: 0 0 2rem;
}

.rec-block h2 {
  margin: 0.25rem 0 0.75rem;
  font-size: 1.35rem;
}

.alt-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr 1fr;
}

.alt-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
}

.alt-card:hover {
  border-color: var(--primary);
}

.alt-card span {
  color: var(--muted);
  font-size: 0.85rem;
}

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

.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 2rem;
}

.cta-box {
  background: var(--primary);
  color: var(--white);
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1rem;
}

.cta-box p {
  margin: 0 0 1rem;
  opacity: 0.9;
}

.cta-box .btn {
  background: var(--white);
  color: var(--primary);
}

.cta-box .btn:hover {
  background: var(--accent);
}

.retake-wrap {
  display: flex;
  justify-content: center;
  margin: 2rem 0 0.5rem;
}

.btn-retake {
  background: var(--warning);
  color: #fff;
  min-width: 180px;
}

.btn-retake:hover {
  background: #d4781a;
  color: #fff;
}

@media (max-width: 520px) {
  .nav {
    flex-direction: column-reverse;
  }
  .nav button,
  .nav .btn {
    width: 100%;
  }
}
