:root {
  --ink: #27322f;
  --muted: #64706d;
  --brand: #2d7565;
  --brand-dark: #20594d;
  --brand-pale: #e8f4ef;
  --accent: #e89868;
  --cream: #fffaf2;
  --line: #dfe8e4;
  --white: #fff;
  --shadow: 0 18px 50px rgba(38, 74, 65, .1);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f4faf7 0, #fff 380px);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  line-height: 1.7;
}
a { color: inherit; }
button, input, select { font: inherit; }
.skip-link { position: fixed; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }
.skip-link:focus { top: 12px; }
.site-header { display: flex; align-items: center; justify-content: space-between; max-width: 1120px; margin: auto; padding: 22px 24px; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; font-weight: 800; font-size: 1.25rem; letter-spacing: .04em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: var(--brand); color: white; }
.site-nav { display: flex; gap: 22px; }
.site-nav a { text-decoration: none; color: var(--muted); font-size: .92rem; font-weight: 700; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--brand); }
.hero { max-width: 780px; text-align: center; margin: 64px auto 34px; padding: 0 24px; }
.eyebrow { display: inline-block; color: var(--brand); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { font-size: clamp(2.2rem, 7vw, 4rem); line-height: 1.18; letter-spacing: -.04em; margin: 12px 0 18px; }
.hero p { max-width: 620px; margin: auto; color: var(--muted); font-size: 1.05rem; }
.container { max-width: 960px; margin: auto; padding: 0 24px 84px; }
.calculator-card { background: var(--white); border: 1px solid rgba(45,117,101,.12); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(22px, 5vw, 42px); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: end; }
.form-grid.three { grid-template-columns: minmax(0, 1fr) minmax(170px, .6fr) auto; }
.form-grid, .form-grid > * { min-width: 0; }
label, .field-label { display: block; font-weight: 800; margin-bottom: 8px; }
input[type="date"], select { display: block; width: 100%; max-width: 100%; min-width: 0; height: 58px; border: 1.5px solid #bdccc7; border-radius: 14px; background: white; padding: 0 16px; color: var(--ink); }
input:focus, select:focus { outline: 3px solid rgba(45,117,101,.18); border-color: var(--brand); }
button { height: 58px; border: 0; border-radius: 14px; padding: 0 28px; background: var(--brand); color: white; font-weight: 800; cursor: pointer; box-shadow: 0 8px 20px rgba(45,117,101,.22); }
button:hover { background: var(--brand-dark); }
.privacy { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: .82rem; }
.privacy svg { vertical-align: -2px; margin-right: 4px; }
.error { color: #a13c30; font-size: .88rem; min-height: 1.5em; margin: 8px 0 0; }
.segmented { display: flex; background: #eef5f2; border-radius: 14px; padding: 4px; gap: 4px; }
.segmented label { margin: 0; flex: 1; text-align: center; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 11px 8px; border-radius: 10px; color: var(--muted); font-size: .9rem; }
.segmented input:checked + span { background: white; color: var(--brand); box-shadow: 0 2px 10px rgba(38,74,65,.1); }
.result { scroll-margin-top: 20px; margin-top: 28px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(22px, 5vw, 42px); box-shadow: 0 12px 40px rgba(38,74,65,.06); }
.result[hidden] { display: none; }
.result-heading { margin-bottom: 24px; }
.result-heading h2 { margin: 5px 0 2px; font-size: clamp(1.65rem, 4vw, 2.4rem); line-height: 1.3; }
.result-heading p { margin: 0; color: var(--muted); }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.metric { padding: 22px; background: #f7faf9; border-radius: 18px; min-height: 148px; }
.metric.primary { background: var(--brand); color: white; }
.metric > span { display: block; font-size: .83rem; font-weight: 700; opacity: .8; margin-bottom: 7px; }
.metric strong { display: block; font-size: clamp(1.1rem, 2.4vw, 1.45rem); line-height: 1.45; }
.metric strong small { font-size: .65em; margin: 0 2px; }
.metric p { margin: 7px 0 0; font-size: .82rem; opacity: .72; }
.events { margin-top: 30px; }
.events h3 { font-size: 1rem; margin-bottom: 8px; }
.event-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; border-top: 1px solid var(--line); padding: 14px 0; }
.event-icon { display: grid; place-items: center; background: var(--cream); width: 38px; height: 38px; border-radius: 12px; }
.event-row strong, .event-row span { display: block; }
.event-row div span { color: var(--muted); font-size: .82rem; }
.event-row > b { color: var(--brand); font-size: .85rem; white-space: nowrap; }
.tools-section, .content-section { margin-top: 70px; }
.section-heading { margin-bottom: 24px; }
.section-heading h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 4px 0; }
.section-heading p { color: var(--muted); margin: 0; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tool-card { display: block; padding: 24px; border: 1px solid var(--line); border-radius: 18px; text-decoration: none; background: white; transition: transform .2s, box-shadow .2s; }
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tool-card span { font-size: 1.4rem; }
.tool-card h3 { margin: 10px 0 4px; }
.tool-card p { color: var(--muted); font-size: .88rem; margin: 0; }
.info-box { background: var(--cream); border-radius: 18px; padding: 22px; font-size: .92rem; }
.info-box h3 { margin-top: 0; }
.info-box p:last-child { margin-bottom: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; min-width: 540px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); }
th { background: #f4f8f6; font-size: .8rem; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.active-row { background: var(--brand-pale); }
.boundary-note { background: var(--brand-pale); border-radius: 14px; color: var(--brand-dark); font-weight: 700; padding: 14px 18px; margin-bottom: 24px; }
.timeline { border-left: 2px solid var(--line); margin-left: 17px; }
.timeline-row { display: grid; grid-template-columns: 36px 1fr; gap: 12px; margin: 0 0 22px -19px; }
.timeline-row > span { display: grid; place-items: center; align-self: start; width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: white; font-weight: 800; }
.timeline-row strong { display: block; }
.timeline-row p { margin: 1px 0; color: var(--muted); }
.celebration-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.celebration-card { border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.celebration-card > span { display: block; font-weight: 800; color: var(--brand); margin-bottom: 12px; }
.celebration-card div { display: flex; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--line); padding: 10px 0; }
.celebration-card small { color: var(--muted); }
.celebration-card strong { font-size: 1.15rem; }
.celebration-card p { margin: 8px 0 0; color: var(--muted); font-size: .76rem; }
.site-footer { border-top: 1px solid var(--line); padding: 34px 24px; text-align: center; color: var(--muted); font-size: .82rem; }
.site-footer strong { color: var(--ink); }

@media (max-width: 760px) {
  .site-header { align-items: flex-start; }
  .site-nav { gap: 12px; flex-wrap: wrap; justify-content: flex-end; max-width: 220px; }
  .site-nav a { font-size: .76rem; }
  .hero { margin-top: 38px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  input[type="date"], select { width: -webkit-fill-available; width: stretch; }
  button { width: 100%; }
  .summary-grid, .tool-grid, .celebration-grid { grid-template-columns: 1fr; }
  .metric { min-height: auto; }
}

@media (max-width: 480px) {
  .site-header { padding: 16px 18px; }
  .brand { font-size: 1rem; }
  .brand-mark { width: 30px; height: 30px; }
  .site-nav { display: none; }
  .hero { padding: 0 18px; }
  .container { padding-left: 14px; padding-right: 14px; }
  .calculator-card, .result { border-radius: 19px; }
  .event-row { grid-template-columns: 40px 1fr; }
  .event-row > b { grid-column: 2; }
  .segmented span { font-size: .78rem; padding: 10px 4px; }
}

/* Public-release readability and mobile navigation */
.hero { margin: 24px auto; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: 1.4; }
.privacy,.metric p,.metric > span,.event-row div span,.site-footer,.celebration-card p,th { font-size: .875rem; }
.site-nav a { font-size: .875rem; }
.segmented input:focus-visible + span { outline: 3px solid var(--brand); }
input[type="date"] { min-width: 0; max-width: 100%; }
.legal { padding-top: 24px; max-width: 800px; }
.legal h1 { font-size: 2rem; line-height: 1.5; }
.legal h2 { font-size: 1.25rem; margin-top: 32px; }
.site-footer nav { margin-top: 12px; }
@media (max-width: 480px) {
 .site-header { flex-direction: column; gap: 12px; }
 .site-nav { display: flex; max-width: none; justify-content: flex-start; gap: 8px 16px; }
 .site-nav a { font-size: .875rem; }
 .hero { margin: 16px auto 20px; }
 .hero p { font-size: 1rem; }
 .segmented span { font-size: .875rem; }
 table { min-width: 0; font-size: .875rem; }
 th,td { padding: 10px 8px; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

/* Crawlable reference content follows the calculator. */
.guide { font-size: 1rem; }
.guide h2,.info-box h2 { font-size: 1.3rem; line-height: 1.5; }
caption { text-align: left; padding: 14px 16px; font-weight: 700; }
.guide details { border-bottom: 1px solid var(--line); padding: 16px 0; }
.guide summary { cursor: pointer; font-weight: 700; }
.guide li { margin: 12px 0; }
.breadcrumbs { max-width: 960px; margin: 8px auto; padding: 0 24px; font-size: .875rem; color: var(--muted); }
.review-note { margin-top: 36px; font-size: .875rem; color: var(--muted); }

.grade-list { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 20px; }
.grade-list > p { color: var(--muted); font-size: .875rem; }
.grade-list h3 { font-size: 1.2rem; }
