:root {
  --text: #111;
  --muted: #666;
  --border: #eee;
  --bg: #fff;
  --bg-soft: #f7f7f5;
  --accent: #1f4d3a;
  --accent-soft: #e8f0eb;
  --warn: #8a4b2e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 20px;
}

header {
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.back {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--muted);
}

h1 {
  font-size: 28px;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 22px;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 17px;
  margin: 0 0 8px;
}

h4 {
  font-size: 15px;
  margin: 0 0 10px;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
  max-width: 42em;
}

.section {
  margin-top: 56px;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.small {
  font-size: 14px;
}

.note-box {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 28px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.toc a {
  color: var(--muted);
}

a {
  color: inherit;
  text-decoration: underline;
}

.ladder {
  margin: 12px 0 16px;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.8;
}

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

.viz-block {
  margin-top: 28px;
}

.viz-frame {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
}

.viz-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 340px;
}

.svg-text,
.svg-label {
  font-size: 12px;
  fill: #222;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.svg-muted {
  font-size: 11px;
  fill: #777;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.svg-tiny {
  font-size: 10px;
  fill: #666;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.svg-on {
  font-size: 11px;
  fill: #111;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.skills-list {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.skill-def {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.skill-def:last-child {
  border-bottom: none;
}

.skill-def h3 {
  margin-bottom: 6px;
}

.skill-def p {
  margin: 0;
}

/* Matrix */
.matrix-desktop {
  margin-top: 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 860px;
}

.matrix-table th,
.matrix-table td {
  vertical-align: top;
  padding: 12px 10px;
  border: 1px solid var(--border);
  text-align: left;
}

.matrix-table thead th {
  background: var(--bg-soft);
  font-weight: 600;
  font-size: 12px;
}

.matrix-table .level-name {
  display: block;
}

.matrix-table .level-own {
  display: block;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.matrix-table .skill-cell {
  background: var(--bg-soft);
  font-weight: 600;
  width: 88px;
  vertical-align: top;
}

.matrix-table .level-jump-cell {
  background: #eef2f0;
  padding: 10px 12px;
  border: 1px solid var(--border);
}

.level-jump {
  margin: 0;
  font-style: italic;
  font-size: 12px;
  line-height: 1.45;
  color: #3d5248;
}

.matrix-acc .level-jump {
  margin: 0 0 10px;
  padding: 8px 10px;
  background: #eef2f0;
  border-radius: 6px;
}

.evidence {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  line-height: 1.45;
}

.evidence li + li {
  margin-top: 6px;
}

.matrix-mobile {
  display: none;
  margin-top: 16px;
}

.matrix-acc {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 0 14px 8px;
  background: #fff;
}

.matrix-acc summary {
  cursor: pointer;
  font-weight: 600;
  padding: 14px 0;
  list-style: none;
}

.matrix-acc summary::-webkit-details-marker {
  display: none;
}

.matrix-acc summary::after {
  content: "+";
  float: right;
  color: var(--muted);
  font-weight: 400;
}

.matrix-acc[open] summary::after {
  content: "–";
}

.acc-level {
  padding: 8px 0 12px;
  border-top: 1px solid var(--border);
}

.acc-level h4 {
  margin: 8px 0;
  font-size: 14px;
}

@media (max-width: 820px) {
  .matrix-desktop {
    display: none;
  }
  .matrix-mobile {
    display: block;
  }
}

/* Quiz */
.quiz-panel,
.quiz-results {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
}

.quiz-meta {
  margin-bottom: 8px;
}

.quiz-hint {
  margin: 0 0 16px;
  font-size: 14px;
}

.quiz-question {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.quiz-question:first-of-type {
  margin-top: 8px;
  padding-top: 0;
  border-top: none;
}

.quiz-q-prompt {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.quiz-form {
  display: grid;
  gap: 10px;
}

.radio-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.radio-card:hover {
  border-color: #ccc;
}

.radio-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.radio-card input {
  margin-top: 3px;
  flex-shrink: 0;
}

.radio-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 15px;
  font-weight: 400;
}

.radio-label {
  font-weight: 400;
  color: var(--text);
  line-height: 1.45;
}

.radio-text strong {
  font-size: 15px;
  font-weight: 400;
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.quiz-error {
  color: var(--warn);
  font-size: 14px;
  margin: 12px 0 0;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 18px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #163828;
}

.btn-ghost {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.btn-text {
  display: inline-block;
  margin-top: 16px;
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0 24px;
}

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

.result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.result-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.result-value {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.result-value-sm {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

.result-viz {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

@media (max-width: 700px) {
  .result-viz {
    grid-template-columns: 1fr;
  }
}

.bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 88px 1fr 72px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar-label {
  font-weight: 600;
}

.bar-track {
  height: 10px;
  background: #e4e4e0;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  width: 0;
  animation: grow 0.55s ease forwards;
}

@keyframes grow {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

.bar-level {
  color: var(--muted);
  text-align: right;
}

.radar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.radar-ring {
  fill: none;
  stroke: #ddd;
  stroke-width: 1;
}

.radar-axis {
  stroke: #ddd;
  stroke-width: 1;
}

.radar-shape {
  fill: rgba(31, 77, 58, 0.2);
  stroke: var(--accent);
  stroke-width: 2;
  animation: fadeIn 0.5s ease;
}

.radar-dot {
  fill: var(--accent);
}

.radar-label {
  font-size: 11px;
  fill: #444;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.tips {
  margin-bottom: 20px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tips ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.tips li + li {
  margin-top: 8px;
}

footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill,
  .radar-shape {
    animation: none;
  }
  .radio-card {
    transition: none;
  }
}
