:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --surface: #ffffff;
  --ink: #1f2933;
  --muted: #607080;
  --line: #dfe5e9;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #c2410c;
  --shadow: 0 14px 30px rgba(24, 39, 56, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  flex: 0 0 auto;
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 1.2rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.site-nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: .92rem;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: #e7f4f2;
  color: var(--brand-dark);
}

.menu-button { display: none; }

.layout {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.hero,
.section,
.tool-panel,
.ad-space {
  margin-bottom: 24px;
}

.hero {
  padding: clamp(28px, 6vw, 56px);
  background: linear-gradient(135deg, #ffffff 0%, #eef8f6 58%, #fff2e8 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero.compact { padding: 32px; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 700;
}

h1, h2 {
  margin: 0 0 14px;
  line-height: 1.25;
  letter-spacing: 0;
}

h1 { font-size: clamp(2rem, 6vw, 4rem); }
h2 { font-size: 1.35rem; }

.summary-grid,
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 20px;
}

.summary-item,
.card,
.tool-panel,
.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-item { padding: 18px; }
.summary-item span { display: block; color: var(--muted); font-size: .9rem; }
.summary-item strong { display: block; margin-top: 4px; font-size: 1.7rem; color: var(--brand-dark); }

.card {
  display: block;
  min-height: 112px;
  padding: 18px;
}

.card strong { display: block; margin-bottom: 8px; color: var(--brand-dark); }
.card span { color: var(--muted); font-size: .95rem; }

.tool-panel,
.section {
  padding: 22px;
}

.ad-space {
  display: grid;
  place-items: center;
  min-height: 96px;
  color: #7a8793;
  background: repeating-linear-gradient(135deg, #fff, #fff 10px, #f0f3f5 10px, #f0f3f5 20px);
  border: 1px dashed #b6c2cc;
  border-radius: 8px;
  font-size: .92rem;
}

label {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: end;
  margin-top: 8px;
}

.input-row.two label { flex: 1; }

input,
select,
button {
  min-height: 44px;
  border-radius: 8px;
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid #cbd5dc;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
}

button {
  flex: 0 0 auto;
  border: 0;
  padding: 8px 18px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--brand-dark); }

.result {
  margin: 16px 0 0;
  color: var(--brand-dark);
  font-size: 1.15rem;
  font-weight: 800;
}

.note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: .92rem;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--brand-dark);
  background: #eef8f6;
}

.site-footer {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .site-header {
    align-items: center;
    flex-wrap: wrap;
  }
  .menu-button {
    display: inline-flex;
    margin-left: auto;
    min-height: 38px;
    padding: 6px 12px;
  }
  .site-nav {
    display: none;
    width: 100%;
    margin: 0;
    padding-top: 10px;
  }
  .site-nav.open { display: grid; grid-template-columns: repeat(2, 1fr); }
  .summary-grid,
  .card-grid { grid-template-columns: 1fr; }
  .input-row { align-items: stretch; flex-direction: column; }
  .input-row.two { display: grid; grid-template-columns: 1fr 1fr; }
  .input-row.two button { grid-column: 1 / -1; }
  h1 { font-size: 2rem; }
}

@page {
  size: A5 portrait;
  margin: 10mm;
}

@media print {
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 10pt;
    line-height: 1.45;
  }

  header,
  nav,
  .menu-button,
  .ad-space,
  button {
    display: none !important;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  .layout {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .hero,
  .section,
  .tool-panel,
  .summary-item,
  .card {
    background: #fff !important;
    border: 0;
    border-radius: 0;
    color: #000;
  }

  .hero,
  .hero.compact,
  .section,
  .tool-panel {
    margin: 0 0 6mm;
    padding: 0;
    break-inside: avoid;
  }

  h1 {
    margin-bottom: 4mm;
    color: #000;
    font-size: 18pt;
  }

  h2 {
    margin: 0 0 3mm;
    color: #000;
    font-size: 12pt;
  }

  p,
  label,
  .note,
  .eyebrow,
  .result,
  .summary-item span,
  .summary-item strong,
  .card strong,
  .card span {
    color: #000;
  }

  .result,
  .summary-item strong {
    font-size: 12pt;
    font-weight: 700;
  }

  .summary-grid,
  .card-grid {
    display: block;
    margin-top: 3mm;
  }

  .summary-item,
  .card {
    min-height: 0;
    margin: 0 0 3mm;
    padding: 0;
    break-inside: avoid;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    background: #fff;
    color: #000;
    font-size: 8.5pt;
    page-break-inside: auto;
  }

  thead {
    display: table-header-group;
  }

  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  th,
  td {
    border: 1px solid #000;
    padding: 3px 5px;
    color: #000;
    white-space: normal;
  }

  th {
    background: #fff !important;
    font-weight: 700;
  }

  input,
  select {
    min-height: 0;
    border: 1px solid #000;
    border-radius: 0;
    padding: 2px 4px;
    color: #000;
    background: #fff;
  }

  .input-row,
  .input-row.two {
    display: block;
    margin-top: 2mm;
  }

  .site-footer {
    margin-top: 8mm;
    padding: 3mm 0 0;
    border-top: 1px solid #000;
    color: #000;
    font-size: 8pt;
    text-align: left;
  }

  .site-footer::after {
    content: "https://hayamihyo-navi.pages.dev/";
    display: block;
  }
}
