:root {
  color-scheme: light;
  --ink: #17342f;
  --muted: #64736f;
  --line: #dce6e2;
  --surface: #ffffff;
  --soft: #f1f7f4;
  --brand: #176b5b;
  --brand-dark: #0f5246;
  --accent: #e19a38;
  --accent-soft: #fff3df;
  --danger: #b43a35;
  --danger-soft: #fff1f0;
  --shadow: 0 16px 42px rgba(26, 65, 57, 0.09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: #f7faf8;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.65;
}

button, input { font: inherit; }

.hero {
  position: relative;
  overflow: hidden;
  color: white;
  background: linear-gradient(125deg, #0e4c43 0%, #176b5b 58%, #23806c 100%);
}

.hero::after {
  content: "";
  position: absolute;
  width: 390px;
  height: 390px;
  right: -100px;
  top: -210px;
  border: 70px solid rgba(255,255,255,.08);
  border-radius: 50%;
}

.hero__inner {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 58px 0 70px;
}

.eyebrow { margin: 0 0 8px; color: #cce6df; font-weight: 700; letter-spacing: .08em; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.3; letter-spacing: .02em; }
.hero__lead { max-width: 680px; margin: 18px 0 0; color: #e8f4f0; font-size: 1.05rem; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, .95fr);
  gap: 24px;
  width: min(1180px, calc(100% - 40px));
  margin: -34px auto 60px;
  position: relative;
  z-index: 2;
}

.panel { background: var(--surface); border: 1px solid rgba(23,107,91,.08); border-radius: 20px; box-shadow: var(--shadow); }
.input-panel, .results-panel { padding: 30px; }
.results-panel { align-self: start; position: static; }

.section-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 26px; }
.section-heading h2 { margin: 0; font-size: 1.35rem; line-height: 1.4; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.step { flex: 0 0 auto; display: inline-block; padding: 4px 9px; color: var(--brand-dark); background: #dcefe9; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .06em; }
.step--accent { color: #744811; background: var(--accent-soft); }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 18px; }
.field { display: flex; flex-direction: column; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.input-theme { border: 1px solid var(--line); border-radius: 13px; background: #fbfdfc; }
.input-theme--personnel { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 18px; grid-column: 1 / -1; padding: 20px; }
.input-theme--single { padding: 17px; }
.theme-heading { grid-column: 1 / -1; margin: 0 0 -3px; padding-bottom: 10px; color: var(--brand-dark); border-bottom: 1px solid var(--line); font-size: 1rem; }
.personnel-cost-field { grid-column: 1 / -1; width: calc(50% - 9px); }
.mode-field { margin: 0; padding: 0; border: 0; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-switch label { cursor: pointer; }
.mode-switch input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.mode-switch span { display: grid; place-items: center; min-height: 48px; padding: 8px 12px; border: 1px solid #cbd8d3; border-radius: 10px; color: var(--muted); text-align: center; font-size: .84rem; font-weight: 700; }
.mode-switch input:checked + span { color: var(--brand-dark); border-color: var(--brand); background: #e5f3ef; box-shadow: inset 0 0 0 1px var(--brand); }
.mode-switch input:focus-visible + span { outline: 3px solid rgba(23,107,91,.22); outline-offset: 2px; }
.field__label { margin-bottom: 7px; font-weight: 700; font-size: .92rem; }
.field__control { display: flex; align-items: center; overflow: hidden; min-height: 50px; border: 1px solid #cbd8d3; border-radius: 10px; background: white; transition: border-color .15s, box-shadow .15s; }
.field__control:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23,107,91,.12); }
.field input { width: 100%; min-width: 0; padding: 11px 12px; border: 0; outline: 0; color: var(--ink); background: transparent; font-weight: 700; }
.unit { flex: 0 0 auto; align-self: stretch; display: grid; place-items: center; padding: 0 12px; color: var(--muted); background: var(--soft); border-left: 1px solid var(--line); font-size: .84rem; font-weight: 700; }
.field__hint { margin-top: 6px; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.mode-explanation { padding: 11px 13px; color: #3f5b54; background: var(--soft); border-left: 3px solid var(--brand); border-radius: 7px; font-size: .8rem; }
.field__error { min-height: 1.2em; margin-top: 3px; color: var(--danger); font-size: .8rem; font-weight: 700; }
.field.is-invalid .field__control { border-color: var(--danger); background: var(--danger-soft); }

.reset-button { margin-top: 12px; padding: 9px 14px; color: var(--brand-dark); background: transparent; border: 1px solid #bdd1ca; border-radius: 9px; cursor: pointer; font-weight: 700; }
.reset-button:hover { background: var(--soft); }
.reset-button:focus-visible { outline: 3px solid rgba(23,107,91,.22); outline-offset: 2px; }

.global-error { margin-bottom: 18px; padding: 13px 15px; color: #852f2a; background: var(--danger-soft); border-left: 4px solid var(--danger); border-radius: 8px; font-weight: 700; }
.noscript-message { margin: 16px auto; width: min(1180px, calc(100% - 40px)); }
#results-content.is-disabled { opacity: .28; filter: grayscale(.5); pointer-events: none; }

.hero-result { padding: 24px; color: white; background: linear-gradient(135deg, var(--brand-dark), var(--brand)); border-radius: 16px; text-align: center; }
.hero-result--time { margin-top: 22px; }
.hero-result p { margin: 0 0 3px; color: #cfe9e2; font-size: .9rem; }
.hero-result strong { display: block; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.25; }
.hero-result span { color: #dceee9; font-size: .88rem; }

.result-group { margin-top: 25px; }
.result-group h3 { margin: 0 0 10px; color: var(--muted); font-size: .84rem; letter-spacing: .06em; }
.result-group .primary-result-title { color: var(--brand-dark); font-size: .95rem; }
.result-list { margin: 0; border-top: 1px solid var(--line); }
.result-list div { display: flex; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.result-list dt { color: var(--muted); }
.result-list dd { margin: 0; font-weight: 800; text-align: right; }
.result-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-cards article { padding: 14px; background: var(--soft); border-radius: 11px; }
.result-cards span { display: block; color: var(--muted); font-size: .76rem; }
.result-cards strong { display: block; margin-top: 3px; color: var(--brand-dark); font-size: 1.3rem; }
.result-cards small { display: block; min-height: 1.2em; color: var(--muted); font-size: .76rem; }
.result-cards--primary article { color: white; background: linear-gradient(135deg, var(--brand-dark), var(--brand)); }
.result-cards--primary span, .result-cards--primary small { color: #dceee9; }
.result-cards--primary strong { color: white; font-size: 1.45rem; }
.rounding-note { margin: 13px 0 0; color: var(--muted); font-size: .78rem; }
.fte-note { margin: 9px 0 0; padding: 10px 12px; color: #4b5f5a; background: #f4f6f5; border-radius: 8px; font-size: .76rem; }
.surplus-message { margin: 14px 0 0; padding: 12px; color: var(--brand-dark); background: #e6f6ef; border-radius: 9px; font-weight: 700; font-size: .85rem; }

.explanation-panel { grid-column: 1 / -1; overflow: hidden; }
.explanation-panel summary { display: flex; justify-content: space-between; align-items: center; padding: 22px 28px; cursor: pointer; list-style: none; font-weight: 800; }
.explanation-panel summary::-webkit-details-marker { display: none; }
.explanation-panel summary > span:first-child { display: flex; align-items: center; gap: 12px; }
.summary-icon { font-size: 1.5rem; color: var(--brand); transition: transform .2s; }
.explanation-panel[open] .summary-icon { transform: rotate(45deg); }
.explanation-content { padding: 0 28px 28px; color: #465a55; }
.explanation-content > p { margin-top: 0; }
.explanation-content ol { margin: 18px 0; padding-left: 1.5em; }
.explanation-content li { margin: 7px 0; }
.notice { padding: 16px 18px; background: var(--accent-soft); border-radius: 10px; }
.notice p { margin: 4px 0 0; }

.public-info-panel { grid-column: 1 / -1; padding: 30px; }
.public-info-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 22px; }
.public-info-heading h2 { margin: 0; font-size: 1.35rem; line-height: 1.4; }
.public-info-heading p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-grid article { padding: 20px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; }
.info-grid h3 { margin: 0 0 9px; color: var(--brand-dark); font-size: 1rem; }
.info-grid p { margin: 7px 0 0; color: #465a55; font-size: .88rem; }
.info-grid ul { margin: 0; padding-left: 1.4em; color: #465a55; font-size: .88rem; }
.info-grid li { margin: 5px 0; }
.info-card--wide { grid-column: 1 / -1; }
.liability-note { margin-top: 14px !important; padding: 12px 14px; color: #594822 !important; background: var(--accent-soft); border-radius: 8px; }
.operator-info { margin-top: 16px; padding-top: 18px; border-top: 1px solid var(--line); }
.operator-info dl { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0; }
.operator-info dl div { display: flex; gap: 8px; }
.operator-info dt { color: var(--muted); font-size: .8rem; }
.operator-info dd { margin: 0; font-size: .8rem; font-weight: 700; }
.operator-info p { margin: 10px 0 0; color: var(--muted); font-size: .78rem; }

footer { padding: 0 20px 35px; color: var(--muted); text-align: center; font-size: .8rem; }
footer p { margin: 3px 0; }
.copyright { color: var(--ink); font-weight: 700; letter-spacing: .02em; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 11px; }
.footer-links a { color: var(--brand-dark); text-underline-offset: 3px; }
.footer-links a:hover { color: var(--brand); }

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

@media (max-width: 600px) {
  .hero__inner { width: min(100% - 28px, 1180px); padding: 40px 0 55px; }
  .layout { width: min(100% - 20px, 1180px); gap: 14px; margin-top: -24px; }
  .input-panel, .results-panel { padding: 22px 18px; border-radius: 15px; }
  .field-grid, .result-cards, .mode-switch { grid-template-columns: 1fr; }
  .input-theme--personnel { grid-template-columns: 1fr; padding: 17px; }
  .personnel-cost-field { width: 100%; }
  .field--wide { grid-column: auto; }
  .explanation-panel summary { padding: 19px 18px; }
  .explanation-content { padding: 0 18px 22px; font-size: .9rem; }
  .public-info-panel { padding: 22px 18px; }
  .info-grid { grid-template-columns: 1fr; }
  .info-card--wide { grid-column: auto; }
  .operator-info dl { display: grid; gap: 6px; }
  .result-list div { display: block; }
  .result-list dd { margin-top: 3px; text-align: left; }
}

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