:root {
  color-scheme: light;
  font-family: system-ui, "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.65;
  --paper: #f4f7fb;
  --card: #fff;
  --ink: #142840;
  --muted: #435670;
  --accent: #2358ba;
  --accent-hover: #194795;
  --accent-surface: #e3ecff;
  --accent-surface-hover: #d8e5ff;
  --border: #cdd8eb;
  --input-border: #6b7d99;
  --focus: #275fbd;
  --caution: #fff1d6;
  --caution-ink: #775016;
  --error: #9f2929;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.35; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }
a { color: var(--accent); text-underline-offset: 0.22em; }
a:hover { color: var(--accent-hover); }
button, input, select { font: inherit; }
button, select, summary, .choice { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--card);
}

[id] { scroll-margin-block: 1.5rem; }

.shell {
  width: min(70rem, 100% - 2rem);
  margin-inline: auto;
}

.site-header {
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-size: 1.125rem;
  font-weight: 750;
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.25rem;
}

.site-nav a, .site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
}

.site-nav a { text-decoration: none; }
.site-nav a:hover, .brand:hover { text-decoration: underline; }

.hero {
  display: grid;
  gap: 1.5rem;
  align-items: start;
  margin-block: 1.5rem 2.5rem;
}

.hero-label { color: var(--accent); font-size: 0.875rem; font-weight: 750; }

h1 {
  margin-top: 0.75rem;
  font-size: 1.875rem;
  font-weight: 750;
  line-height: 1.28;
  line-break: strict;
}

h1 span { display: block; }

.hero-description { margin-block: 0.75rem 1.5rem; max-width: 32rem; color: var(--muted); }
.desktop-break { display: none; }
.note { color: var(--muted); font-size: 0.875rem; }
.hero-note { margin-top: 0.625rem; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 0.625rem 1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--accent);
  font-weight: 750;
  text-decoration: none;
}

.button.primary { color: white; background: var(--accent); }
.hero .primary { min-inline-size: min(100%, 14rem); }
.button.primary:hover { color: white; background: var(--accent-hover); }
.button.primary:disabled { background: var(--muted); cursor: default; }

.hero-check {
  padding: 0.875rem;
  border-radius: 16px;
  background: var(--accent-surface);
  color: var(--accent);
}

.hero-check h2 { font-size: 0.875rem; }
.hero-check dl { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; margin-top: 0.25rem; }
.hero-check dt { font-size: 0.875rem; font-weight: 750; }
.hero-check dd { display: none; }

.card { border: 1px solid var(--border); border-radius: 16px; background: var(--card); }
.narrow { max-width: 45rem; margin-inline: auto; padding: 1rem; }
.section-intro { margin-top: 0.5rem; color: var(--muted); }

.questions, .field-pair, .cost-fields, .field, .choices {
  display: grid;
  min-width: 0;
}

.questions, .field-pair, .cost-fields { gap: 1.25rem; }
.questions { margin-top: 1.5rem; }
.field, .choices { gap: 0.5rem; }
.field > label, legend { font-weight: 700; }
.field > .note { margin: 0; }
fieldset.field { margin: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 0.375rem; }
.choices { margin-top: 0.25rem; }

select, input[type="text"] {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
}

select:hover, input[type="text"]:hover, .choice:hover { border-color: var(--accent); }

.choice {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--input-border);
  border-radius: 10px;
}

.choice:has(:checked) { border-color: var(--accent); background: var(--accent-surface); }
.choice input {
  flex: none;
  width: 1rem;
  height: 1rem;
  margin: 0;
  align-self: flex-start;
  margin-top: 0.28em;
  accent-color: var(--accent);
}

.costs { margin-top: 1.25rem; }
.costs > summary {
  min-height: 44px;
  padding: 0.625rem 0.875rem;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-surface);
  font-weight: 750;
}

.costs > summary:hover, .text-button:hover { background: var(--accent-surface-hover); }
.cost-fields { margin-block: 1rem 0.5rem; }
.field-note { color: var(--muted); font-size: 0.875rem; font-weight: 400; }

.yen-input {
  display: grid;
  grid-template-columns: minmax(0, 15rem) auto;
  align-items: center;
  justify-content: start;
  gap: 0.5rem;
}

input[type="text"][aria-invalid="true"] { border: 2px solid var(--error); }
.field-error, .error-summary { color: var(--error); font-size: 0.875rem; }
.error-summary { margin-top: 1rem; font-weight: 700; }
.submit { width: 100%; margin-top: 1rem; }

.result { margin-top: 1.5rem; overflow-wrap: anywhere; }
.result-banner { padding: 0.875rem; border-radius: 12px; background: var(--accent-surface); color: var(--accent); }
.result[data-status="safety"] .result-banner,
.result[data-status="incomplete"] .result-banner,
.result[data-status="operations"] .result-banner {
  color: var(--caution-ink);
  background: var(--caution);
}

.result-label { margin-bottom: 0.375rem; font-size: 0.875rem; font-weight: 750; }
.result-banner h2 { font-size: 1.375rem; text-wrap: balance; }
.result-reason { margin-block: 1rem 1.25rem; color: var(--muted); }
.result ol, .result ul { margin-block: 0.75rem 0; padding-inline-start: 1.5em; }
.result li + li { margin-top: 0.5rem; }
.result-detail { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.result-detail .note { margin-top: 0.5rem; }
.totals { display: grid; gap: 0.75rem; margin-top: 0.875rem; }
.totals dt { font-size: 0.875rem; color: var(--muted); }
.totals dd { font-size: clamp(1.25rem, 3vw, 1.5rem); font-weight: 750; font-variant-numeric: tabular-nums; }
.difference { margin-top: 0.75rem; font-weight: 700; }
.text-button { margin-top: 1rem; background: transparent; border-color: var(--border); }

.guide { margin-block: 3rem; }
.guide-grid { display: grid; gap: 1rem; margin-top: 1rem; }
.guide-card { padding: 1rem; }
.guide-card h3 { color: var(--accent); }
.guide-card p { margin-top: 0.5rem; color: var(--muted); }

.site-footer { padding-block: 0.75rem 1.5rem; border-top: 1px solid var(--border); }
.footer-heading { display: flex; flex-wrap: wrap; justify-content: space-between; column-gap: 1rem; }
.footer-heading .brand, .footer-heading a { font-size: 0.875rem; }
.footer-operator { margin-bottom: 0.75rem; font-weight: 700; }
.about summary { min-height: 44px; padding-block: 0.625rem; color: var(--accent); font-size: 0.875rem; font-weight: 700; }
.about p { max-width: 45rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 375px) {
  h1 { font-size: 2rem; }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 960px) {
  h2 { font-size: 1.75rem; }
  .shell { width: min(70rem, 100% - 3rem); }
  .site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 76px;
  }

  .site-header .brand { font-size: 1.25rem; }
  .hero {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 3rem;
    margin-block: 3rem 4rem;
  }

  .hero-label { font-size: 1rem; }
  h1 { margin-top: 1rem; font-size: clamp(2.75rem, 4vw, 3rem); }
  .hero-description { margin-block: 1rem 1.5rem; }
  .desktop-break { display: initial; }
  .hero-check { padding: 1.5rem; border-radius: 24px; }
  .hero-check h2 { font-size: 1.375rem; }
  .hero-check dl { display: grid; gap: 0.75rem; margin-top: 0.875rem; }
  .hero-check dl div {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: 0.75rem;
    padding: 1rem 0.875rem;
    border-radius: 12px;
    background: var(--card);
  }
  .hero-check dt { font-size: 1rem; }
  .hero-check dd { display: block; color: var(--muted); }
  .narrow { padding: 1.5rem; }
  .field-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .submit { width: auto; }
  .result-banner { padding: 1rem; }
  .result-banner h2 { font-size: 1.75rem; }
  .guide { margin-block: 4rem; }
  .guide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 1.5rem; }
}
