:root {
  --cream: #f7f0e6;
  --cream-deep: #efe4d4;
  --ink: #1c1915;
  --ink-soft: #4a453c;
  --muted: #6e675c;
  --green: #008c45;
  --green-deep: #006b34;
  --red: #cd212a;
  --white: #fffdf9;
  --line: rgba(28, 25, 21, 0.12);
  --shadow: 0 18px 50px rgba(28, 25, 21, 0.08);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(0, 140, 69, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(205, 33, 42, 0.1), transparent 50%),
    linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 45%, #e8dcc8 100%);
  line-height: 1.55;
}

a {
  color: var(--green-deep);
  text-underline-offset: 0.15em;
}

.flag-rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: 10px;
  background: linear-gradient(180deg, var(--green) 0 33.33%, #fff 33.33% 66.66%, var(--red) 66.66%);
  z-index: 20;
}

.hero {
  position: relative;
  min-height: 22svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  color: #fffaf3;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
  transform: scale(1.02);
  animation: ken 18s ease-in-out infinite alternate;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(18, 14, 10, 0.18) 0%, rgba(18, 14, 10, 0.55) 55%, rgba(18, 14, 10, 0.78) 100%),
    linear-gradient(90deg, rgba(0, 100, 50, 0.18), transparent 40%, rgba(180, 30, 40, 0.12));
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 1.6rem clamp(1.25rem, 4vw, 3.5rem) 1.4rem calc(clamp(1.25rem, 4vw, 3.5rem) + 10px);
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.45rem;
  max-width: 42rem;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4.2vw, 2.6rem);
  letter-spacing: -0.02em;
  text-transform: none;
  color: #fffaf3;
  font-weight: 700;
  line-height: 1.08;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.25);
}

.version {
  flex: 0 0 auto;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 250, 243, 0.28);
  background: rgba(18, 14, 10, 0.35);
  color: rgba(255, 250, 243, 0.9);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
}

.hero h1 {
  margin: 0;
  max-width: 14ch;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 4.2vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: #fffaf3;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.25);
  animation: rise 0.8s ease both;
}

.lede {
  margin: 1.25rem 0 0;
  max-width: 32rem;
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  color: rgba(255, 250, 243, 0.86);
  animation: rise 0.9s ease 0.08s both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
  animation: rise 1s ease 0.14s both;
}

.hero .btn-ghost {
  background: rgba(255, 250, 243, 0.14);
  border-color: rgba(255, 250, 243, 0.35);
  color: #fffaf3;
  backdrop-filter: blur(8px);
}

.hero .btn-ghost:hover {
  background: rgba(255, 250, 243, 0.22);
}

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

@keyframes ken {
  from { transform: scale(1.02) translateY(0); }
  to { transform: scale(1.07) translateY(-1.5%); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

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

.btn-primary:hover {
  background: var(--green-deep);
  color: #fff;
}

.btn-ghost {
  background: rgba(255, 253, 249, 0.55);
  border-color: var(--line);
  color: var(--ink);
  backdrop-filter: blur(6px);
}

.btn-wide {
  width: 100%;
  margin-top: 0.5rem;
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 0 calc(clamp(1.25rem, 4vw, 3.5rem) + 10px) 4rem;
}

.section {
  margin-top: 3.5rem;
  padding: 1.75rem 0 0;
}

@media (min-width: 960px) {
  .hero-content {
    padding-left: calc(clamp(2rem, 5vw, 3.5rem) + 10px);
    padding-right: clamp(2rem, 5vw, 3.5rem);
    padding-bottom: 1.6rem;
    padding-top: 1.8rem;
  }

  .brand {
    font-size: clamp(2rem, 3.2vw, 2.8rem);
  }

  .quiz-layout {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 1.5rem;
  }

  .doc-live {
    max-height: calc(100vh - 2rem);
    overflow: auto;
  }

  .tools-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
  }

  .tools-row .accordions {
    display: contents;
  }

  .footer {
    width: min(1120px, 100%);
    margin: 0 auto;
  }
}

.section h2,
.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  letter-spacing: -0.02em;
}

.page-title {
  margin-bottom: 1.1rem;
}

.section-note {
  margin: 0.6rem 0 1.4rem;
  color: var(--muted);
  max-width: 40rem;
}

.path-figure {
  margin: 0;
  padding: 0.75rem;
  background: rgba(255, 253, 249, 0.72);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.path-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.path-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;
}

.section-note.tight {
  margin-top: 1rem;
}

.choice-shell {
  max-width: 720px;
  padding: 1.15rem;
  background: rgba(255, 253, 249, 0.88);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow);
}

.choice-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0 0 1rem;
}

.choice-tab {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.95);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.9rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.choice-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 140, 69, 0.35);
}

.choice-tab.is-active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.choice-panel {
  max-width: none;
}

.diy-card {
  padding: 0.35rem 0.15rem 0.15rem;
  display: grid;
  gap: 1rem;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.diy-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.55;
}

.choice-shell .help-calc {
  max-width: none;
  padding: 0.25rem 0.1rem 0.1rem;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: grid;
  gap: 0.85rem;
}

.help-lead {
  margin: 0 0 0.15rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.help-who {
  margin: 0.35rem 0 0;
  font-weight: 700;
  color: var(--ink);
  font-size: 1rem;
}

.choice-shell .help-calc .calc-grid {
  margin-top: 0.35rem;
}

.diy {
  margin: 1.5rem 0 0;
  padding: 1.1rem 1.25rem;
  border-left: 4px solid var(--green);
  background: rgba(255, 253, 249, 0.65);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.quiz-layout {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 860px) {
  .quiz-layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.quiz-panel,
.doc-live,
.help-calc,
.accordion {
  background: rgba(255, 253, 249, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.quiz-panel {
  padding: 1.25rem;
}

.quiz-form {
  margin-top: 1.25rem;
  display: grid;
  gap: 1rem;
}

.quiz-form fieldset {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 0.55rem;
}

.quiz-form legend {
  padding: 0 0.35rem;
  font-weight: 700;
}

.quiz-form label {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  cursor: pointer;
}

.doc-live {
  padding: 1.25rem 1.35rem 1.4rem;
  position: sticky;
  top: 1rem;
}

.doc-live h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.doc-hint {
  margin: 0.45rem 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

#doc-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.55rem;
}

#doc-list li {
  padding-left: 0.2rem;
}

#doc-list li.tag-optional {
  color: var(--ink-soft);
}

#doc-list li.tag-optional::marker {
  content: "○ ";
  color: var(--red);
}

.accordions {
  display: grid;
  gap: 0.85rem;
}

.accordions.stacked {
  max-width: 920px;
}

.quiz-panel.nested,
.doc-live.nested {
  box-shadow: none;
  background: rgba(255, 253, 249, 0.55);
}

.section-choice .help-calc {
  max-width: none;
}

.section-help {
  margin-top: 2.5rem;
}

.section-help .help-calc {
  max-width: 560px;
}

.accordion-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.05rem 1.2rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}

.chev {
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex: 0 0 auto;
}

.accordion-btn[aria-expanded="true"] .chev {
  transform: rotate(-135deg);
}

.accordion-panel {
  padding: 0 1.2rem 1.25rem;
  border-top: 1px solid var(--line);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1rem 0 0.75rem;
}

.calc-grid label,
.help-calc > label:not(.check) {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
}

input[type="number"] {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  font: inherit;
  color: var(--ink);
}

.calc-note {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.calc-result {
  padding: 0.95rem 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 140, 69, 0.1), rgba(205, 33, 42, 0.08));
  border: 1px solid var(--line);
  font-weight: 600;
}

.calc-result .lines {
  display: grid;
  gap: 0.35rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 0.55rem;
}

.calc-result .total {
  font-size: 1.15rem;
  color: var(--ink);
}

.section-help .help-calc {
  padding: 1.25rem;
  display: grid;
  gap: 0.85rem;
}

.check {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  cursor: pointer;
  font-weight: 500;
}

.footer {
  padding: 2rem calc(clamp(1.25rem, 4vw, 3.5rem) + 10px) 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer p {
  margin: 0;
  max-width: 46rem;
}

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

  .doc-live {
    position: static;
  }

  .path-figure {
    padding: 0.45rem;
  }

  .choice-tabs {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .hero-media img {
    transform: none;
  }
}
