:root {
  --ink: #20242c;
  --muted: #687182;
  --line: #dce3df;
  --paper: #f8faf7;
  --panel: #ffffff;
  --accent: #2f7d63;
  --accent-soft: #e7f4ee;
  --gold: #b98228;
  --rose: #9d4e5b;
  --shadow: 0 18px 42px rgba(38, 52, 46, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(rgba(47, 125, 99, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 125, 99, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 22px;
  min-width: 0;
  min-height: 100vh;
  padding: 22px;
}

.diagnosis-panel,
.result-panel {
  min-width: 0;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.diagnosis-panel {
  padding: 20px;
  overflow: auto;
}

.result-panel {
  position: sticky;
  top: 22px;
  align-self: start;
  padding: 24px;
}

.app-header,
.result-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.result-header {
  display: block;
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h1 {
  font-size: 26px;
  line-height: 1.25;
}

h2 {
  font-size: 24px;
  line-height: 1.35;
}

h3 {
  font-size: 16px;
  line-height: 1.35;
}

#result-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.decision-note {
  display: inline-flex;
  max-width: 100%;
  margin: 14px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(47, 125, 99, 0.26);
  border-radius: 8px;
  background: var(--accent-soft);
  color: #174837;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.status-pill {
  min-width: 52px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.question-stack {
  display: grid;
  gap: 12px;
}

.live-summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(47, 125, 99, 0.28);
  border-radius: 8px;
  background: var(--accent-soft);
  color: #174837;
}

.live-summary span {
  font-size: 12px;
  font-weight: 800;
}

.live-summary strong {
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.live-summary em {
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
}

.question-card {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

legend {
  padding: 0 6px;
  font-size: 14px;
  font-weight: 700;
}

.segmented,
.choice-grid {
  display: grid;
  gap: 8px;
}

.segmented {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.segmented.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

label {
  min-width: 0;
}

input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

label span {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  cursor: pointer;
  overflow-wrap: anywhere;
}

input[type="radio"]:focus-visible + span {
  outline: 3px solid rgba(47, 125, 99, 0.22);
  outline-offset: 2px;
}

input[type="radio"]:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #174837;
}

.top-services {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

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

.service-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.rank {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.score {
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

.service-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.service-card a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-top: 12px;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
  padding: 8px 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

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

.detail-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.writer-copy-card {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.writer-copy-card h4 {
  margin: 18px 0 8px;
  font-size: 15px;
  line-height: 1.45;
}

.writer-copy-card h4:first-child {
  margin-top: 8px;
}

.writer-copy-card h5 {
  margin: 14px 0 6px;
  font-size: 14px;
  line-height: 1.45;
}

.writer-copy-card p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.75;
  font-size: 14px;
}

ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}

.disclaimer {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--rose);
  background: #fff7f7;
  color: #6d3e47;
  font-size: 13px;
  line-height: 1.65;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 12px;
    gap: 12px;
  }

  .diagnosis-panel,
  .result-panel {
    padding: 14px;
  }

  .app-header {
    display: block;
  }

  .status-pill {
    margin-top: 10px;
  }

  .live-summary {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 20px;
  }

  .segmented,
  .segmented.four,
  .choice-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  label span {
    min-height: 44px;
    font-size: 12px;
  }
}
