﻿:root {
  color-scheme: light;
  --paper: #F4F8F7;
  --paper-alt: #E6F2EF;
  --ink: #1f2a28;
  --muted: #5b6f6b;
  --accent: #2F7F73;
  --accent-dark: #25685E;
  --teal: #2F7F73;
  --olive: #D6E5E1;
  --card: #FFFFFF;
  --line: #D6E5E1;
  --shadow: 0 8px 20px rgba(31, 42, 40, 0.08);
  --screen-gap: 16px;
  --nav-btn-height: 44px;
  --nav-height: 68px;
  --nav-top-offset: 12px;
  --nav-gap: calc(var(--screen-gap) - var(--nav-top-offset));
  --card-width: min(760px, 100%);
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  overflow-y: scroll;
}

.backdrop {
  display: none;
}

#app {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 24px 88px;
}

h1,
h2,
h3,
h4 {
  font-family: "Cormorant Garamond", serif;
  margin: 0 0 12px;
  letter-spacing: 0.2px;
  color: var(--ink);
}

h1 {
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.12;
}

.hero-card h1 {
  margin-bottom: 0;
}

h2 {
  font-size: clamp(28px, 3.4vw, 38px);
}

h3 {
  font-size: 24px;
}

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

.lead {
  font-size: 16px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  color: var(--ink);
  margin-top: 16px;
  margin-bottom: 16px;
}

.hero {
  display: flex;
  justify-content: center;
  margin-top: -40px;
}

.hero-card {
  background: var(--card);
  border-radius: 24px;
  padding: 36px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  width: min(760px, 100%);
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  text-decoration: none;
  cursor: pointer;
  border-radius: 10px;
  animation: badge-pulse 2.4s ease-in-out infinite;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.hero-badge:hover {
  transform: scale(1.06);
}

.hero-badge:active {
  transform: scale(0.97);
}

.hero-badge svg {
  display: block;
  width: min(175px, 70vw);
  height: auto;
  filter: drop-shadow(0 10px 26px rgba(47, 127, 115, 0.22));
}

@keyframes badge-pulse {
  0%, 100% {
    box-shadow:
      0 6px 18px rgba(47, 127, 115, 0.15),
      0 0 0 0 rgba(47, 127, 115, 0);
  }
  50% {
    box-shadow:
      0 14px 36px rgba(47, 127, 115, 0.3),
      0 0 0 8px rgba(47, 127, 115, 0.18);
  }
}


.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
  justify-content: center;
}

.primary-wide {
  width: min(620px, 100%);
  justify-content: center;
}

.hero-meta-line {
  margin-top: 12px;
  color: var(--ink);
  font-size: 16px;
}

.hero-links {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 16px;
}

.hero-links .meta-link {
  font-size: 16px;
}

.lead-extra {
  display: inline;
}

.lead-toggle {
  display: none;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  padding: 0;
  margin-top: 6px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.hero-divider {
  width: 64px;
  height: 1px;
  background: var(--line);
  margin: 16px auto;
}

.hero-list {
  list-style: none;
  padding: 0;
  margin: 0 auto 22px;
  display: grid;
  gap: 6px;
  max-width: 520px;
  text-align: left;
}

.hero-list li {
  position: relative;
  padding-left: 32px;
  color: var(--ink);
  line-height: 1.35;
}

.hero-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 700;
}

.question-screen {
  margin: -56px -24px -88px;
  padding: var(--screen-gap) 16px 0;
  background: var(--paper);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  gap: var(--nav-gap);
}

.question-card {
  width: var(--card-width);
  max-width: 760px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 24px;
}

.question-card h2,
.question-card .step,
.question-card .prompt,
.question-card .score-title,
.question-card .score-sub,
.question-card .diff-title,
.question-card .diff-sub,
.question-card .diff-value,
.question-card .details-link {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.question-card .step {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
}

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

.question-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.details-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  padding: 0;
  margin-top: 2px;
  cursor: pointer;
}

@media (hover: hover) {
  .details-link:hover {
    color: var(--accent);
  }
}

.question-divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}

.question-card .prompt {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 20px;
}

.score-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 16px;
}

@media (min-width: 721px) {
  .score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.score-trigger {
  display: none;
}

.score-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.score-sub {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.score-scale {
  display: grid;
  grid-template-columns: repeat(5, 40px);
  gap: 8px;
  margin-top: 16px;
}

.score-pill {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #FFFFFF;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.score-pill.is-active {
  border-color: var(--accent);
  background: var(--paper-alt);
}

@media (hover: hover) {
  .score-pill:hover {
    border-color: var(--accent);
  }

  .nav-btn:not(:disabled):hover {
    border-color: var(--accent-dark);
    color: var(--accent-dark);
  }
}

.diff-block {
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 16px;
}

.diff-number {
  font-size: 40px;
  font-weight: 600;
  line-height: 40px;
  color: var(--ink);
  justify-self: center;
}

.diff-number-btn {
  background: transparent;
  padding: 0;
}

.diff-number.is-animated {
  opacity: 0;
  transform: translateY(6px);
  animation: diff-reveal 1s ease forwards;
}

.diff-cta {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  padding: 0;
  justify-self: end;
}

.diff-cta.is-animated {
  opacity: 0;
  transform: translateY(6px);
  animation: diff-reveal 1s ease forwards;
}

.diff-cta:hover {
  color: var(--accent-dark);
}

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

.modal-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.diff-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.diff-sub {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.diff-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
}

.nav-bar {
  position: sticky;
  bottom: var(--screen-gap);
  height: var(--nav-height);
  padding: 0;
  border-top: none;
  background: rgba(244, 248, 247, 0.9);
  backdrop-filter: blur(6px);
  z-index: 10;
  display: flex;
  align-items: center;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: var(--card-width);
  margin: 0 auto;
  flex-wrap: wrap;
}

.nav-btn {
  position: relative;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: #FFFFFF;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--accent);
  padding-left: 18px;
  padding-right: 44px;
  text-transform: uppercase;
  min-width: 200px;
}

.nav-back {
  padding-left: 44px;
  padding-right: 18px;
  min-width: 180px;
}

.nav-mid {
  padding-left: 18px;
  padding-right: 44px;
  min-width: 260px;
  background: var(--accent);
  color: #FFFFFF;
}

.nav-label {
  display: block;
  width: 100%;
  text-align: center;
}

.nav-circle {
  position: absolute;
  top: 3px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  line-height: 1;
}

.nav-arrow {
  width: 18px;
  height: 12px;
  display: block;
}

.nav-circle-next {
  right: 4px;
  background: var(--accent);
  color: #FFFFFF;
}

.nav-circle-back {
  left: 4px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: #FFFFFF;
}

.nav-circle-help {
  right: 4px;
  border: 1px solid var(--accent);
  background: #FFFFFF;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
}

.nav-mid:hover {
  border-color: var(--accent);
  color: #FFFFFF;
}

.nav-btn.nav-mid:not(:disabled):hover {
  border-color: var(--accent);
  color: #FFFFFF;
}

.nav-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.nav-btn.is-revealing {
  opacity: 0;
  animation: nav-reveal 5s ease forwards;
}

.nav-help-pulse {
  animation: help-pulse 3s ease-in-out infinite;
}

.nav-btn.nav-help-pulse.is-revealing {
  animation: nav-reveal 5s ease forwards, help-pulse 3s ease-in-out infinite;
}

@keyframes help-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

@keyframes nav-reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .hero {
    margin-top: -16px;
  }

  .question-screen {
    margin: -32px -18px -72px;
    padding: var(--screen-gap) 16px 0;
  }

  .question-card {
    padding: 16px;
  }

  .question-screen {
    padding-bottom: calc(12px + var(--nav-height) + 12px + env(safe-area-inset-bottom));
  }

  /* Mobile: compact question layout to fit small screens while keeping tap targets */
  .question-card .step {
    margin-bottom: 6px;
  }

  .question-divider {
    margin: 12px 0;
  }

  .question-card .prompt {
    margin-bottom: 12px;
  }

  .score-grid {
    gap: 12px;
    margin-bottom: 12px;
  }

  .score-card {
    padding: 12px;
  }

  .score-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .score-sub {
    display: none;
  }

  .score-trigger {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #FFFFFF;
    color: var(--accent);
    display: grid;
    place-items: center;
  }

  .score-trigger.is-set {
    border-color: var(--accent);
    background: var(--paper-alt);
    color: var(--accent-dark);
  }

  .score-trigger.is-attn {
    animation: score-attn-shadow 2.4s ease-in-out infinite;
  }

  .score-trigger-icon {
    width: 22px;
    height: 22px;
    display: block;
  }

  .score-trigger-value {
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
  }

  .score-picker {
    display: none;
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #FFFFFF;
  }

  .score-card.is-picker-open .score-picker {
    display: block;
  }

  .score-card .score-picker .score-scale {
    margin-top: 0;
  }

  .score-scale {
    margin-top: 10px;
  }

  .diff-block {
    padding: 12px;
  }

  @media (max-height: 740px) {
    .question-card {
      padding: 14px;
    }

    .question-divider {
      margin: 10px 0;
    }

    .question-card .prompt {
      margin-bottom: 10px;
    }

    .score-grid {
      gap: 10px;
      margin-bottom: 10px;
    }

    .score-card {
      padding: 10px;
    }

    .score-scale {
      margin-top: 8px;
      gap: 4px;
    }

    .diff-block {
      padding: 10px;
    }

    .score-sub {
      display: none;
    }
  }

  body.modal-open {
    overflow: hidden;
  }

  .nav-bar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    height: auto;
    padding: 10px;
    border-radius: 18px;
    border: 1px solid var(--line);
    box-shadow: 0 12px 30px rgba(31, 42, 42, 0.18);
  }

  .nav-bar .nav-buttons {
    width: 100%;
    margin: 0;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .nav-btn {
    flex: 1 1 0;
    min-width: 0;
    font-size: 12px;
    letter-spacing: 0.04em;
    padding-left: 14px;
    padding-right: 40px;
    touch-action: manipulation;
    transition: transform 0.08s ease;
  }

  .nav-back {
    padding-left: 40px;
    padding-right: 14px;
  }

  .results {
    margin: -32px -18px -72px;
    padding: var(--screen-gap) 12px 0;
    padding-bottom: calc(var(--results-footer-offset, 220px) + env(safe-area-inset-bottom));
  }

  .results-table-title {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    letter-spacing: 0;
  }

  .results-footer {
    position: fixed;
    left: calc(12px + env(safe-area-inset-left));
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: auto;
    margin: 0;
    padding: 10px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(244, 248, 247, 0.92);
    backdrop-filter: blur(8px);
    box-shadow: 0 12px 30px rgba(31, 42, 42, 0.18);
    z-index: 15;
  }

  .results-footer .nav-buttons {
    width: 100%;
    margin: 0;
    gap: 8px;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
  }

  .results-footer .nav-btn {
    width: 100%;
    height: auto;
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .results-footer .nav-label {
    white-space: normal;
    line-height: 1.2;
  }

  .results-footer .nav-circle {
    top: 50%;
    transform: translateY(-50%);
  }

  /* Results footer: round back + long primary action on mobile */
  .results-footer .nav-back {
    flex: 0 0 48px;
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    border-radius: 999px;
  }

  .results-footer .nav-back .nav-label {
    display: none;
  }

  .results-footer .nav-back .nav-circle {
    top: 50%;
    left: 50%;
    right: auto;
    width: 40px;
    height: 40px;
    transform: translate(-50%, -50%);
  }

  .results-footer .nav-back .nav-circle {
    border-color: var(--accent);
  }

  .results-footer .nav-next {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: 48px;
    min-height: 48px;
    padding-left: 18px;
    padding-right: 54px;
  }

  .results-footer .nav-next .nav-label {
    position: absolute;
    left: 18px;
    right: 54px;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    display: block;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
  }

  .results-footer .nav-next .nav-circle {
    right: 4px;
    left: auto;
    width: 40px;
    height: 40px;
    transform: translateY(-50%);
  }

  .results .nav-btn.nav-help-pulse {
    animation: none;
  }

  .results .nav-btn.nav-help-pulse.is-revealing {
    animation: nav-reveal 5s ease forwards;
  }

  .results-help-slot {
    margin-top: 12px;
  }

  .results-help-slot:empty {
    display: none;
    margin-top: 0;
  }

  .results-help-slot .nav-btn {
    width: 100%;
    min-width: 0;
  }

  .results-explain-slot {
    margin-top: 14px;
  }

  .results-explain-slot .nav-btn {
    width: 100%;
    min-width: 0;
    box-shadow: 0 10px 24px rgba(47, 127, 115, 0.22);
  }

  .results-explain-slot .nav-label {
    text-align: center;
  }

  .results-share-slot {
    margin-top: 10px;
  }

  .results-share-slot .results-share {
    position: relative;
    width: 100%;
    min-height: 44px;
    padding: 10px 54px 10px 18px;
    border-radius: 999px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #FFFFFF;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(47, 127, 115, 0.25);
    display: block;
    text-align: center;
  }

  .results-share-slot .results-icon {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    padding: 10px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 1px solid var(--accent);
    background: #FFFFFF;
    color: var(--accent);
  }

  .results-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .results-share {
    margin-left: 0;
    align-self: flex-end;
  }

  .status-button {
    touch-action: manipulation;
  }

  @media (hover: none) {
    .status-button:hover {
      transform: none;
      box-shadow: none;
    }
  }

  .status {
    padding: 10px 12px;
  }

  .table-wrap {
    overflow-x: visible;
    -webkit-overflow-scrolling: auto;
  }

  .table-wrap::after {
    display: none;
  }

  .results table th:nth-child(2),
  .results table td:nth-child(2) {
    text-align: right;
    padding-right: 0;
  }

  .results table {
    table-layout: fixed;
  }

  .results table th:first-child,
  .results table td:first-child {
    width: 62%;
  }

  .results table th:nth-child(2),
  .results table td:nth-child(2) {
    width: 38%;
  }

  .status-button.is-attn,
  .results-explain-slot .nav-btn.is-attn {
    animation: results-attn-glow 1.8s ease-in-out 1;
    will-change: filter;
  }

  .results .table-hint {
    display: block;
  }

  .results table {
    font-size: 13px;
  }

  .results table td:first-child {
    overflow-wrap: anywhere;
  }

  .chart-label {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(244, 248, 247, 0.85);
    backdrop-filter: blur(6px);
    touch-action: manipulation;
  }

  @media (hover: none) {
    .nav-btn:not(:disabled):active {
      transform: translateY(1px);
    }
  }

  .score-grid {
    gap: 12px;
  }

  .score-scale {
    gap: 6px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    justify-items: center;
  }

  .score-pill {
    width: 100%;
    max-width: 44px;
    height: auto;
    aspect-ratio: 1;
    touch-action: manipulation;
  }

  .diff-block {
    grid-template-columns: 1fr auto;
    grid-template-areas: "text num";
    row-gap: 10px;
  }

  .diff-text {
    grid-area: text;
  }

  .diff-number {
    grid-area: num;
    font-size: 36px;
    line-height: 36px;
  }

  .diff-number-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    background: #FFFFFF;
    color: var(--accent);
    display: grid;
    place-items: center;
    font-size: 14px;
    line-height: 1;
    font-weight: 700;
    justify-self: end;
    box-shadow: 0 6px 18px rgba(31, 42, 40, 0.08);
  }

  .diff-number-icon {
    display: none;
    line-height: 0;
  }

  .diff-number-icon .score-trigger-icon {
    width: 22px;
    height: 22px;
    display: block;
  }

  .diff-number-value {
    display: block;
  }

  .diff-number-btn:not(:disabled) .diff-number-icon {
    display: none;
  }

  .diff-number-btn.is-attn:not(:disabled) .diff-number-value {
    display: none;
  }

  .diff-number-btn.is-attn:not(:disabled) .diff-number-icon {
    display: block;
  }

  .diff-number-btn.is-attn:not(:disabled) {
    animation: score-attn-shadow 2.4s ease-in-out infinite;
  }

  .diff-number-btn:not(:disabled) {
    opacity: 1;
  }

  .diff-number-btn:disabled {
    border-color: var(--line);
    color: var(--muted);
    opacity: 1;
    box-shadow: none;
  }

  @keyframes score-attn-shadow {
    0%,
    100% {
      box-shadow:
        0 6px 18px rgba(31, 42, 40, 0.1),
        0 0 0 0 rgba(47, 127, 115, 0);
    }
    50% {
      box-shadow:
        0 18px 44px rgba(31, 42, 40, 0.24),
        0 0 0 10px rgba(47, 127, 115, 0.22);
    }
  }

  @keyframes results-attn-glow {
    0%,
    100% {
      filter: drop-shadow(0 0 0 rgba(47, 127, 115, 0));
    }
    50% {
      filter: drop-shadow(0 0 8px rgba(47, 127, 115, 0.78));
    }
  }

  .diff-cta {
    display: none !important;
  }

  .diff-cta {
    grid-area: cta;
    justify-self: start;
    padding: 10px 0 0;
    font-size: 14px;
  }

}

.meta-link {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.meta-sep {
  color: var(--muted);
  font-size: 13px;
}

.meta-link:hover {
  color: var(--accent-dark);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 40, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
  z-index: 20;
}

.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--paper-alt);
  border-radius: 20px;
  padding: 28px 76px 24px 28px;
  border: 1px solid var(--line);
  width: min(720px, 92vw);
  max-height: 80vh;
  overflow: auto;
  box-shadow: 0 24px 60px rgba(31, 42, 40, 0.22);
  position: relative;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 1s ease, opacity 1s ease;
}

.modal-overlay.is-open .modal-card {
  transform: translateY(0);
  opacity: 1;
}

.modal-close {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid var(--line);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transform: translateY(-50%);
}

.modal-close::after {
  content: "×";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transform: translate(0, -2px);
}

.modal-close:hover {
  border-color: var(--accent);
}

.modal-content {
  opacity: 0;
  visibility: hidden;
  max-height: 0;
  overflow: hidden;
  transition: opacity 1s ease;
}

.modal-content.is-open {
  opacity: 1;
  visibility: visible;
  max-height: 2000px;
}

.modal-card ul,
.modal-card ol,
.modal-card .dash-list {
  margin: 12px 0 12px 20px;
  padding: 0;
  color: var(--muted);
  line-height: 1.6;
}

.modal-card strong {
  font-weight: 600;
  color: var(--ink);
}

.modal-card h4 {
  font-family: "Cormorant Garamond", serif;
  font-size: 24px;
  margin: 16px 0 8px;
  color: var(--ink);
}

.modal-block h3 {
  line-height: 1.2;
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum" 1;
}

.modal-block + .modal-block {
  margin-top: 16px;
}

#resultsDiffBlock > .modal-block {
  margin-bottom: 16px;
}


.dash-list {
  list-style: none;
}

.dash-list li::before {
  content: "— ";
}

.rules-lines p {
  margin: 0 0 8px;
}

.rules-note {
  margin-top: 10px;
}

.start-rules-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}

.start-rules-list li {
  position: relative;
  padding-left: 32px;
  margin-bottom: 12px;
  line-height: 1.5;
  color: var(--ink);
}

.start-rules-list li::before {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 700;
}

.start-rules-yes::before {
  content: "✓";
  color: var(--accent);
}

.start-rules-no::before {
  content: "✗";
  color: #9A4C4C;
}

.mobile-cta {
  display: none;
}

@media (max-width: 720px) {
  #app {
    padding-bottom: calc(72px + var(--app-bottom-offset, 140px));
    min-height: 100svh;
  }

  .hero-card {
    padding: 28px 22px 30px;
    text-align: left;
    overflow: hidden;
  }

  .hero-actions {
    display: none;
  }

  .lead-toggle {
    display: none;
  }

  .lead-extra {
    display: inline;
  }

  .hero-divider {
    margin-left: 0;
  }

  .hero-list {
    max-width: none;
  }

  .hero-links {
    display: none;
  }

  .mobile-cta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px rgba(31, 42, 42, 0.18);
    z-index: 15;
  }

  .mobile-cta .primary-wide {
    width: 100%;
  }

  .mobile-cta-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 16px;
    color: var(--muted);
    align-items: center;
    flex-wrap: wrap;
    line-height: 1.4;
  }

  .mobile-cta-links {
    display: inline-flex;
    gap: 8px;
    align-items: center;
  }

  .mobile-cta-links .meta-link {
    font-size: 16px;
  }

  .mobile-cta-meta .meta-sep {
    font-size: 16px;
  }

  .modal-card {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100svh;
    max-height: none;
    border-radius: 0;
  }

  .modal-card::before {
    display: none;
  }
}

button {
  border: none;
  font: inherit;
  cursor: pointer;
}

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

@media (prefers-reduced-motion: reduce) {
  .score-trigger.is-attn,
  .diff-number-btn.is-attn:not(:disabled),
  .status-button.is-attn,
  .results-explain-slot .nav-btn.is-attn,
  .hero-badge {
    animation: none !important;
  }
}

.primary {
  background: var(--accent);
  color: #FFFFFF;
  padding: 13px 24px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(47, 127, 115, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
  box-shadow: 0 12px 28px rgba(37, 104, 94, 0.3);
}

.ghost {
  background: #FFFFFF;
  color: var(--ink);
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid rgba(31, 42, 42, 0.12);
  box-shadow: 0 6px 18px rgba(31, 42, 42, 0.08);
}


.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.results {
  margin: -56px -24px -88px;
  padding: var(--screen-gap) 16px 0;
  background: var(--paper);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  gap: var(--screen-gap);
  max-width: var(--card-width);
  margin-left: auto;
  margin-right: auto;
}

.results-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}

.results-grid > * {
  min-width: 0;
}

.results .card {
  min-width: 0;
}

.results-footer {
  width: var(--card-width);
  margin: 0 auto;
}

.results-card-header {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 12px;
}

.results-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.results-share {
  margin-left: auto;
}

.results-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-transform: lowercase;
}

.results-toggle:hover {
  color: var(--accent-dark);
}

.results-toggle-arrow {
  width: 18px;
  height: 12px;
  display: block;
}

.results-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.chart-card .results-card-header {
  width: 100%;
  justify-self: stretch;
}

.results table th:nth-child(2),
.results table th:nth-child(3),
.results table th:nth-child(4),
.results table td:nth-child(2),
.results table td:nth-child(3),
.results table td:nth-child(4) {
  text-align: center;
}

.status-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 127, 115, 0.25);
}

.status-button {
  border: none;
  cursor: pointer;
}

@media (hover: hover) {
  .status-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(31, 42, 40, 0.12);
  }
}

.status-button:active {
  transform: translateY(0);
  box-shadow: 0 6px 12px rgba(31, 42, 40, 0.1);
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--muted);
}

.card {
  background: var(--card);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

.table-hint {
  display: none;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.table-wrap {
  position: relative;
}

.table-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 34px;
  background: linear-gradient(to left, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.table-wrap.has-overflow:not(.is-at-end)::after {
  opacity: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  padding-bottom: 10px;
}

tbody td {
  border-top: 1px solid var(--line);
  padding: 10px 6px 10px 0;
  color: var(--ink);
}

.results table td:first-child {
  font-size: 15px;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: 0;
}

.results table th:nth-child(2),
.results table td:nth-child(2) {
  text-align: center;
  padding-left: 0;
  padding-right: 0;
}

.status {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .results .table-wrap {
    overflow-x: hidden !important;
  }

  .results .table-wrap::after {
    display: none !important;
  }

  .results table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
}

/* Mobile overrides for results screen must be after base .results/.results-footer rules. */
@media (max-width: 720px) {
  :root {
    --safe-inset-h: max(env(safe-area-inset-left), env(safe-area-inset-right));
  }

  #resultsSwitch .results-table-title {
    width: 100%;
    text-align: center;
  }

  .results-card-header {
    margin-bottom: 24px;
  }

  .chart-card .results-card-header h3 {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    letter-spacing: 0;
    width: 100%;
    text-align: center;
  }

  .chart-card .results-card-header {
    margin-bottom: 8px;
  }

  .chart-card .results-share {
    display: none;
  }

  .chart-card {
    gap: 12px;
  }

  .chart-card .legend {
    margin-top: 8px;
  }

  .results {
    margin: -32px -18px -72px;
    padding: var(--screen-gap) calc(12px + var(--safe-inset-h)) 0;
    padding-bottom: calc(var(--results-footer-offset, 220px) + env(safe-area-inset-bottom));
    max-width: none;
  }

  .results-grid,
  #resultsSwitch,
  #resultsSwitch .card {
    width: 100%;
  }

  .results-footer {
    left: calc(12px + var(--safe-inset-h));
    right: calc(12px + var(--safe-inset-h));
    width: auto;
    margin: 0;
    box-sizing: border-box;
  }

  .results table th:nth-child(2),
  .results table td:nth-child(2) {
    text-align: right !important;
    padding-right: 8px !important;
  }

  .status {
    padding: 10px 14px;
    font-size: 12px;
  }

  .results-explain-slot .nav-circle-help {
    display: none;
  }

  .results-explain-slot .nav-btn.nav-mid {
    padding-right: 18px;
  }

  .results-help-slot .nav-circle-help {
    display: none;
  }

  .results-help-slot .nav-btn.nav-mid {
    padding-right: 18px;
  }

  .results-explain-slot .nav-btn.is-revealing,
  .results-help-slot .nav-btn.is-revealing {
    opacity: 1 !important;
    animation: none !important;
  }

  .results-share-slot .results-icon {
    display: none;
  }

  .results-share-slot .results-share {
    padding-right: 18px;
  }

  .results-share-slot .results-share {
    background: #FFFFFF;
    color: var(--accent);
    box-shadow: 0 10px 22px rgba(31, 42, 40, 0.1);
  }

  .results table {
    --status-col-width: 148px;
  }

  .results table th:first-child,
  .results table td:first-child {
    width: calc(100% - var(--status-col-width));
    padding-left: 0;
    padding-right: 12px;
    text-align: left;
  }

  .results table th:nth-child(2),
  .results table td:nth-child(2) {
    width: var(--status-col-width);
    padding-left: 0;
    padding-right: 0;
  }

  .results table th:nth-child(2) {
    text-align: center !important;
  }

  .results table td:nth-child(2) .status-button {
    width: 100%;
    min-width: 0;
    display: inline-flex;
    justify-content: center;
    box-sizing: border-box;
    white-space: nowrap;
  }

  .results table td {
    padding-top: 12px;
    padding-bottom: 12px;
  }
}


.status.good {
  background: var(--paper-alt);
  color: var(--accent);
}

.status.warn {
  background: #F8EDC7;
  color: #8A6A00;
}

.status.risk,
.status.critical {
  background: #F3E6E6;
  color: #9A4C4C;
}

.chart-card {
  display: grid;
  place-items: center;
  gap: 16px;
}

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

.chart-wrap {
  position: relative;
}

.chart-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chart-leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.chart-label {
  position: absolute;
  background: transparent;
  border: none;
  font: 600 14px "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  padding: 0;
  pointer-events: auto;
  cursor: pointer;
}

@media (max-width: 720px) {
  .chart-label {
    font-size: 13px;
    padding: 2px 5px;
    border-radius: 999px;
    background: rgba(244, 248, 247, 0.86);
    backdrop-filter: blur(3px);
  }
}

/* Адаптация для очень узких экранов */
@media (max-width: 360px) {
  .chart-label {
    font-size: 11px;
    padding: 2px 4px;
    line-height: 1.3;
    max-width: 80px;
    white-space: normal;
    word-break: break-word;
  }
}

.chart-label.good {
  color: var(--accent);
}

.chart-label.warn {
  color: #8A6A00;
}

.chart-label.risk,
.chart-label.critical {
  color: #9A4C4C;
}

.legend {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

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

.dot.user {
  background: #2F7F7A;
}

.dot.partner {
  background: #9BBFBC;
}

.notes ul {
  margin: 12px 0 0 20px;
  color: var(--muted);
}

.topics {
  margin-top: 10px;
}

[data-animate] {
  opacity: 0;
  transform: translateY(12px);
  animation: reveal 0.6s ease forwards;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 720px) {
  #app {
    padding: 32px 18px 72px;
  }

  .score-scale {
    grid-template-columns: repeat(5, minmax(28px, 1fr));
  }

  .nav {
    flex-direction: column;
  }

  .results-header {
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .modal-card {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100svh !important;
    max-height: none !important;
    border-radius: 0 !important;
    overflow: auto !important;
    padding: calc(16px + env(safe-area-inset-top)) 72px calc(16px + env(safe-area-inset-bottom)) 18px !important;
    transform: none !important;
  }

  .modal-overlay.is-open .modal-card {
    transform: none !important;
  }

  .modal-card::before {
    display: none !important;
  }

  .modal-close {
    position: fixed !important;
    top: 50% !important;
    right: 14px !important;
    transform: translateY(-50%) !important;
    z-index: 25;
  }

  .modal-close::after {
    transform: none !important;
  }
}

.modal-made-by {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid rgba(91, 111, 107, 0.15);
  text-align: center;
}

.modal-made-by a {
  color: var(--muted);
  font-size: 0.75rem;
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.modal-made-by a:hover {
  opacity: 1;
}
