:root {
  --ink: #1c1b18;
  --muted: #5f5a52;
  --panel: #ffffff;
  --accent: #2f6f64;
  --accent-strong: #1d4f46;
  --accent-warm: #d46a1f;
  --line: #e3ddd4;
  --bg: #f6f3ed;
  --shadow: 0 18px 45px rgba(20, 25, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #f7efe0, var(--bg) 50%)
      no-repeat,
    radial-gradient(circle at 90% 10%, #e0efe9, transparent 50%) no-repeat;
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 40px;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.header-main {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1;
}

.header-copy h1 {
  margin: 8px 0 10px;
  font-size: clamp(2rem, 3vw, 3rem);
  letter-spacing: -0.02em;
}

.header-copy p {
  margin: 0;
  color: var(--muted);
  max-width: 620px;
  line-height: 1.5;
}

.usage-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8f5ee;
  font-size: 0.92rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.yakflow-brand {
  width: 270px;
  min-height: 120px;
  padding: 8px;
  display: grid;
  place-items: center;
}

.yakflow-mascot {
  width: 100%;
  height: auto;
  display: block;
}

.yakflow-brand-fallback {
  display: none;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.35;
}

.yakflow-brand.missing .yakflow-brand-fallback {
  display: block;
}

button {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

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

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(32, 33, 34, 0.12);
}

button.primary {
  background: var(--accent);
  color: #ffffff;
}

button.secondary {
  background: var(--accent-warm);
  color: #fff8f0;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 24px;
  margin-top: 28px;
}

.sidebar {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress-bar {
  height: 8px;
  background: #efe9df;
  border-radius: 999px;
  overflow: hidden;
}

#progressFill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-warm));
  transition: width 0.3s ease;
}

.category-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.category h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.category-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-items button {
  border-radius: 12px;
  padding: 8px 10px;
  text-align: left;
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-items button.active {
  border-color: var(--accent);
  background: rgba(47, 111, 100, 0.08);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.done {
  background: var(--accent);
}

.dot.current {
  background: var(--accent-warm);
}

.dot.pending {
  border: 1px solid var(--muted);
}

.sidebar-footer {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.card {
  background: var(--panel);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.4s ease;
}

.card.hidden {
  display: none;
}

.card-header {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.card h2 {
  margin: 4px 0 10px;
  font-size: 1.8rem;
}

.card p {
  margin: 0 0 18px;
  line-height: 1.6;
  color: var(--muted);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 20, 21, 0.55);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 200;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--panel);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.start-callout {
  margin: 8px 0 18px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f8f5ee;
}

.start-callout strong {
  display: block;
  margin-bottom: 6px;
}

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

.start-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fdfaf5;
}

.start-block h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.start-block ul,
.start-block ol {
  margin: 0 0 0 18px;
  color: var(--muted);
}

.start-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.examples {
  margin: 18px 0 20px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f7f2e8;
}

.examples h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.examples ul {
  margin: 0 0 0 18px;
  padding: 0;
  color: var(--muted);
}

.examples li {
  margin-bottom: 6px;
}

.checks {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f8f6f2;
}

.checks h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.checks-list {
  display: grid;
  gap: 10px;
}

.check-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--ink);
}

.check-item input {
  margin-top: 2px;
}

.checks-summary {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

.slider-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-top: 12px;
  background: #faf6ef;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 12px;
}

.slider-card input[type="range"] {
  width: 100%;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-warm));
  outline: none;
  margin: 8px 0 14px;
}

.slider-card input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.slider-card input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.slider-ticks {
  position: relative;
  height: 54px;
  margin-top: 2px;
}

.slider-ticks .tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  text-align: center;
  width: 132px;
}

.slider-ticks .tick.tick-start {
  transform: translateX(0);
  text-align: left;
}

.slider-ticks .tick.tick-end {
  transform: translateX(-100%);
  text-align: right;
}

.slider-ticks .tick strong {
  display: block;
  font-size: 0.9rem;
}

.slider-ticks .tick span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.slider-hint {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

.score-rubric {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.followup {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: #f9f6f0;
  border: 1px dashed var(--line);
}

.followup label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  min-height: 90px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-family: "IBM Plex Sans", sans-serif;
  resize: vertical;
}

.nav-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  gap: 12px;
}

.results-section {
  margin-top: 18px;
}

.results-grid {
  display: grid;
  gap: 16px;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fdfaf5;
}

.chart-card canvas {
  width: 100%;
  height: auto;
  display: block;
}

.compare-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.compare-legend {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.legend-chip {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  border: 1px solid var(--line);
}

.current-chip {
  background: rgba(47, 111, 100, 0.14);
  border-color: rgba(47, 111, 100, 0.4);
}

.previous-chip {
  background: rgba(212, 106, 31, 0.14);
  border-color: rgba(212, 106, 31, 0.45);
}

.delta-list {
  display: grid;
  gap: 8px;
}

.delta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.delta-up {
  color: #1d4f46;
}

.delta-down {
  color: #a84a2e;
}

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

.impact-column {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fdfaf5;
}

.impact-column h4 {
  margin: 2px 0 10px;
}

.impact-node {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #ffffff;
  margin-bottom: 10px;
}

.impact-node h5 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.impact-score {
  font-weight: 700;
  color: var(--accent-strong);
}

.impact-band {
  font-size: 0.8rem;
  margin-top: 2px;
}

.impact-node p {
  margin: 8px 0 0;
  font-size: 0.82rem;
}

.impact-node.band-strong {
  border-color: rgba(47, 111, 100, 0.4);
}

.impact-node.band-watch {
  border-color: rgba(196, 160, 58, 0.45);
}

.impact-node.band-risk {
  border-color: rgba(168, 74, 46, 0.45);
}

.impact-node.band-none {
  border-style: dashed;
}

.impact-pathways {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.impact-path {
  font-size: 0.86rem;
  color: var(--muted);
}

.impact-note {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.metric {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #ffffff;
}

.metric h4 {
  margin: 0 0 6px;
}

.metric .score {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.next-step-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fdfaf5;
}

.metric.band-strong,
.next-step-card.band-strong {
  border-color: rgba(47, 111, 100, 0.4);
  background: rgba(47, 111, 100, 0.08);
}

.metric.band-watch,
.next-step-card.band-watch {
  border-color: rgba(196, 160, 58, 0.45);
  background: rgba(196, 160, 58, 0.08);
}

.metric.band-risk,
.next-step-card.band-risk {
  border-color: rgba(168, 74, 46, 0.45);
  background: rgba(168, 74, 46, 0.08);
}

.metric.band-none,
.next-step-card.band-none {
  border-style: dashed;
  background: #fbfaf8;
}

.next-step-card h5 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.next-step-card ul {
  margin: 8px 0 0 16px;
  color: var(--muted);
}

.category-focus {
  color: var(--muted);
  margin-top: 4px;
}

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

.references a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
}

.footer {
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer a {
  color: var(--accent-strong);
}

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

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

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

  .header-main {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions button {
    flex: 1;
  }

  .yakflow-brand {
    width: 100%;
    max-width: none;
    min-height: 120px;
  }

  .slider-ticks .tick {
    width: 92px;
  }

  .slider-ticks .tick span {
    font-size: 0.68rem;
  }

  .impact-grid {
    grid-template-columns: 1fr;
  }

  .compare-actions {
    flex-wrap: wrap;
  }

  .start-sections {
    grid-template-columns: 1fr;
  }

  .modal-overlay {
    padding: 10px;
  }

  .modal-card {
    max-height: calc(100vh - 20px);
    padding: 20px;
  }
}
