:root {
  --ink: #1f2933;
  --ink-soft: #52606d;
  --muted: #7b8794;
  --line: #d9e2ec;
  --line-dark: #9fb3c8;
  --paper: #ffffff;
  --bg: #f7f4ed;
  --bg-deep: #efe9dc;
  --accent: #1f5f5b;
  --accent-dark: #164743;
  --accent-soft: #e3efec;
  --warm: #b45f35;
  --warm-soft: #f8e9df;
  --yellow: #f2c94c;
  --shadow: 0 12px 32px rgba(31, 41, 51, 0.10);
  --radius: 18px;
  --radius-sm: 10px;
  --font-body: "BIZ UDGothic", "UD Digi Kyokasho NK-R", "Yu Gothic", "YuGothic", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  --font-heading: "BIZ UDGothic", "UD Digi Kyokasho NK-B", "Yu Gothic", "YuGothic", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.85;
  letter-spacing: 0.015em;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
img, svg { max-width: 100%; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff;
  padding: 10px 18px; z-index: 100;
}
.skip-link:focus { left: 10px; top: 10px; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 244, 237, 0.94);
  border-bottom: 1px solid rgba(31, 41, 51, 0.10);
  backdrop-filter: blur(10px);
}
.header-inner {
  max-width: 1140px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 22px;
}
.site-logo {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none; font-family: var(--font-heading);
  font-weight: 700; letter-spacing: 0.04em; white-space: nowrap;
}
.logo-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 20px; line-height: 1;
  box-shadow: 0 4px 0 rgba(22, 71, 67, 0.18);
}
.logo-text { display: flex; flex-direction: column; line-height: 1.25; }
.logo-text small { font-size: 10px; color: var(--ink-soft); font-weight: 500; letter-spacing: 0.12em; }
.logo-sub-short { display: none; }
@media (max-width: 380px) {
  .logo-sub-full { display: none; }
  .logo-sub-short { display: inline; }
}
.main-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.main-nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 8px 11px; border-radius: 999px;
}
.main-nav a:hover { background: #fff; color: var(--accent); }
.header-cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff !important; padding: 8px 15px !important;
  border-radius: 999px !important; font-size: 14px; box-shadow: 0 3px 0 rgba(22, 71, 67, 0.25);
}
.header-cta:hover { background: var(--accent-dark); color: #fff !important; }
.menu-toggle {
  display: none; margin-left: auto; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; width: 42px; height: 42px; align-items: center; justify-content: center;
}
.mobile-nav { display: none; }

.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 860px; }
.section { padding: 54px 0; }
.section-tight { padding: 30px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-head h2 { margin: 0; font-family: var(--font-heading); font-size: clamp(22px, 3vw, 30px); line-height: 1.4; letter-spacing: 0.03em; }
.section-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; }
.section-head a { font-size: 14px; font-weight: 700; white-space: nowrap; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  margin: 0 0 10px;
}
.eyebrow::before { content: ""; width: 18px; height: 2px; background: var(--accent); }
h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.45; letter-spacing: 0.025em; }
p { margin: 0 0 1em; }
.lead { font-size: 17px; color: var(--ink-soft); }
.small { font-size: 13px; color: var(--muted); }
.nowrap { white-space: nowrap; }

.hero { padding: 48px 0 30px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 42px; align-items: center; }
.hero h1 {
  margin: 0 0 18px; font-size: clamp(31px, 4.8vw, 52px); line-height: 1.35;
  letter-spacing: 0.04em;
}
.hero h1 .marker {
  background: linear-gradient(transparent 66%, rgba(242, 201, 76, 0.62) 66%);
  padding: 0 0.08em;
}
.hero-lead { font-size: 17px; color: var(--ink-soft); max-width: 34em; margin-bottom: 24px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 11px 20px; border-radius: 999px;
  border: 1px solid transparent; text-decoration: none; font-weight: 700; font-size: 15px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 5px 0 rgba(22, 71, 67, 0.24); }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-warm { background: var(--warm); color: #fff; box-shadow: 0 5px 0 rgba(122, 57, 28, 0.20); }
.btn-warm:hover { background: #974b27; color: #fff; }
.btn-outline { background: #fff; border-color: var(--line-dark); color: var(--ink); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--accent); border-color: transparent; padding-inline: 10px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.hero-note { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--ink-soft); font-size: 13px; }
.hero-note span { display: inline-flex; align-items: center; gap: 6px; }
.hero-note span::before { content: "✓"; color: var(--accent); font-weight: 800; }

.hero-preview {
  background: #fff; border-radius: 24px; padding: 18px;
  box-shadow: var(--shadow); border: 1px solid rgba(31, 41, 51, 0.08);
  position: relative; transform: rotate(1.2deg);
}
.hero-preview::before {
  content: "A4・答え付き"; position: absolute; right: 20px; top: -14px;
  background: var(--yellow); color: var(--ink); font-size: 12px; font-weight: 800;
  padding: 4px 11px; border-radius: 999px; transform: rotate(-2deg);
}
.preview-paper { border: 1px solid var(--line); border-radius: 8px; padding: 20px 18px; min-height: 300px; background: #fff; }
.preview-paper-head { display: flex; justify-content: space-between; border-bottom: 1.5px solid var(--ink); padding-bottom: 8px; margin-bottom: 12px; }
.preview-paper-head strong { font-size: 14px; }
.preview-paper-head span { font-size: 10px; color: var(--ink-soft); }
.preview-name { font-size: 10px; color: var(--ink-soft); text-align: right; margin-bottom: 10px; }
.preview-questions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 16px; font-size: 12px; }
.preview-q { border-bottom: 1px solid #cbd5df; padding-bottom: 2px; }
.preview-q b { color: var(--accent); margin-right: 4px; }
.preview-footer { margin-top: 16px; display: flex; justify-content: space-between; font-size: 9px; color: var(--muted); }

.trust-bar { display: flex; flex-wrap: wrap; gap: 10px 26px; padding: 16px 0 0; border-top: 1px dashed var(--line-dark); margin-top: 28px; color: var(--ink-soft); font-size: 13px; }
.trust-bar strong { color: var(--ink); }

.grade-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grade-card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; text-decoration: none; color: var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  overflow: hidden;
}
.grade-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); color: var(--ink); }
.grade-card::after {
  content: attr(data-grade); position: absolute; right: 10px; bottom: -18px;
  font-family: var(--font-heading); font-size: 80px; font-weight: 800; line-height: 1;
  color: var(--accent-soft); z-index: 0;
}
.grade-card > * { position: relative; z-index: 1; }
.grade-card .grade-label { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 0.1em; }
.grade-card h3 { margin: 0; font-size: 21px; }
.grade-card p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.grade-card .grade-link { margin-top: auto; font-size: 13px; font-weight: 700; color: var(--accent); }

.unit-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.unit-card {
  display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  text-decoration: none; color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.unit-card:hover { border-color: var(--accent); background: #fbfdfc; color: var(--ink); }
.unit-card .unit-icon {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 13px;
}
.unit-card strong { display: block; font-size: 15px; line-height: 1.5; }
.unit-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.special-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.special-card {
  display: flex; flex-direction: column; gap: 8px; min-height: 148px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; text-decoration: none; color: var(--ink);
}
.special-card:hover { border-color: var(--accent); color: var(--ink); }
.special-card .special-kicker { font-size: 11px; font-weight: 800; color: var(--warm); letter-spacing: 0.1em; }
.special-card h3 { margin: 0; font-size: 18px; }
.special-card p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.special-card .special-go { margin-top: auto; font-size: 13px; font-weight: 700; color: var(--accent); }

.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: step; }
.how-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.how-card::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 14px; margin-bottom: 12px;
}
.how-card h3 { margin: 0 0 6px; font-size: 17px; }
.how-card p { margin: 0; font-size: 13px; color: var(--ink-soft); }

.faq-list { border-top: 1px solid var(--line); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  list-style: none; cursor: pointer; padding: 16px 34px 16px 0; position: relative;
  font-weight: 700; font-size: 15px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "＋"; position: absolute; right: 4px; top: 15px; color: var(--accent); font-weight: 700;
}
.faq-item[open] summary::after { content: "－"; }
.faq-item .faq-answer { padding: 0 0 18px; color: var(--ink-soft); font-size: 14px; }
.faq-item .faq-answer p { margin: 0; }

.breadcrumb { padding: 14px 0 0; font-size: 12px; color: var(--muted); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; }
.breadcrumb li + li::before { content: "／"; margin: 0 4px; color: var(--line-dark); }
.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.page-hero { padding: 24px 0 20px; }
.page-hero h1 { margin: 0 0 12px; font-size: clamp(27px, 4vw, 40px); }
.page-hero .lead { max-width: 44em; margin: 0; }
.page-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pill { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 11px; font-size: 12px; color: var(--ink-soft); }
.pill-accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-dark); font-weight: 700; }

.generator-layout { display: grid; grid-template-columns: 0.92fr 1.08fr; gap: 22px; align-items: start; }
.generator-card {
  background: #fff; border: 1px solid var(--line); border-radius: 22px;
  padding: 24px; box-shadow: 0 8px 26px rgba(31, 41, 51, 0.06);
}
.generator-card h2 { margin: 0 0 4px; font-size: 21px; }
.generator-card .form-note { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.field { margin-bottom: 16px; }
.field > label, .field > .field-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field select {
  width: 100%; min-height: 46px; padding: 8px 38px 8px 13px; border-radius: 10px;
  border: 1px solid var(--line-dark); background: #fff; color: var(--ink);
  appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
.field select:focus { outline: 3px solid rgba(31, 95, 91, 0.22); border-color: var(--accent); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 50px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  cursor: pointer; font-size: 14px; font-weight: 700; line-height: 1.3;
}
.segmented label small { font-size: 10px; color: var(--muted); font-weight: 500; }
.segmented input:checked + label { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.segmented input:focus-visible + label { outline: 3px solid rgba(31, 95, 91, 0.25); }
.count-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.count-row input { position: absolute; opacity: 0; pointer-events: none; }
.count-row label { display: grid; place-items: center; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-weight: 700; font-size: 14px; }
.count-row input:checked + label { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.form-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.form-actions .btn { width: 100%; min-height: 52px; font-size: 17px; }
.form-actions .btn-sub { min-height: 40px; font-size: 13px; }
.form-disclaimer { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.generator-side { display: flex; flex-direction: column; gap: 14px; }
.example-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 22px; }
.example-card h2 { margin: 0 0 4px; font-size: 19px; }
.example-card .example-note { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.example-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.example-item { display: flex; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; background: #fcfdfc; }
.example-number { flex: 0 0 38px; font-size: 11px; font-weight: 800; color: var(--warm); padding-top: 2px; }
.example-body { min-width: 0; flex: 1; }
.example-body .question-stem { font-size: 14px; margin: 0 0 4px; }
.example-body .math-line { font-size: 18px; }
.example-body .answer-space { display: none; }
.example-body .question-list { display: block; }
.example-answer-line { display: block; width: 64%; border-bottom: 1px solid var(--line-dark); height: 18px; }
.example-body .hissan { font-size: 12px; margin-top: 8px; }
.example-process { margin-top: 7px; font-size: 9px; color: #5d6b66; }
.process-label { margin: 5px 0 2px; font-weight: 700; }
.process-row { display: flex; gap: 0; }
.process-cell { width: 1.55em; height: 1.35em; border: 0.5px solid #d3dce6; background: #fff; }
.example-body .clock-svg { width: 76px; height: 76px; }
.example-body .shape-svg { width: 70px; height: 70px; }
.example-body .fraction-bar { max-width: 180px; }
.example-body .table-wrap, .example-body .graph-wrap { overflow: hidden; }
.example-body .data-table { font-size: 11px; }
.example-body .bar graph, .example-body .graph-wrap svg { max-height: 130px; width: auto; }

.content-grid { display: grid; grid-template-columns: 1.5fr 0.8fr; gap: 32px; align-items: start; }
.prose h2 { margin: 30px 0 10px; font-size: 23px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 22px 0 8px; font-size: 18px; }
.prose p { color: var(--ink-soft); font-size: 15px; }
.prose ul { padding-left: 1.2em; color: var(--ink-soft); font-size: 15px; }
.prose li { margin-bottom: 5px; }
.point-box {
  border-left: 4px solid var(--warm); background: var(--warm-soft);
  padding: 14px 18px; border-radius: 0 12px 12px 0; margin: 18px 0;
}
.point-box strong { display: block; font-size: 14px; color: #7a391c; margin-bottom: 4px; }
.point-box p { margin: 0; color: #5f3520; font-size: 14px; }
.point-box ul { margin: 0; padding-left: 1.2em; color: #5f3520; font-size: 14px; }
.unit-range { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.term-box { margin: 18px 0; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfc; }
.term-box strong { display: block; margin-bottom: 6px; color: var(--accent-dark); font-size: 14px; }
.term-box ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.term-box li { padding: 4px 9px; border: 1px solid #cfe0d9; border-radius: 999px; background: #fff; color: #405a51; font-size: 12px; }
.tip-box {
  border: 1px dashed var(--accent); background: #f7fbfa; border-radius: 14px;
  padding: 16px 18px; margin: 18px 0;
}
.tip-box strong { display: block; font-size: 14px; color: var(--accent-dark); margin-bottom: 4px; }
.tip-box p { margin: 0; font-size: 14px; }
.side-panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 16px; }
.side-panel h2 { margin: 0 0 10px; font-size: 16px; }
.side-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.side-links a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 4px; font-size: 13px; text-decoration: none; border-bottom: 1px solid #edf2f7; color: var(--ink-soft); }
.side-links a:hover { color: var(--accent); }
.side-links li:last-child a { border-bottom: 0; }
.side-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.related-units { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.related-units a { display: block; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; font-size: 13px; color: var(--ink-soft); background: #fff; }
.related-units a:hover { border-color: var(--accent); color: var(--accent); }

.table-simple { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
.table-simple th, .table-simple td { border: 1px solid var(--line); padding: 9px 11px; text-align: left; }
.table-simple th { background: #f3f7f6; font-weight: 700; }

.callout-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--accent); color: #fff; border-radius: 22px; padding: 24px 26px;
}
.callout-cta h2 { margin: 0 0 3px; color: #fff; font-size: 20px; }
.callout-cta p { margin: 0; color: rgba(255,255,255,0.82); font-size: 13px; }
.callout-cta .btn { background: #fff; color: var(--accent-dark); box-shadow: 0 4px 0 rgba(0,0,0,0.15); }

.site-footer { background: #1e2b2a; color: #d7e2df; margin-top: 50px; padding: 38px 0 24px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 34px; }
.site-footer .site-logo { color: #fff; }
.site-footer .logo-mark { background: #f2c94c; color: #1e2b2a; }
.site-footer .logo-text small { color: #a9bdb8; }
.footer-about { margin: 14px 0 0; font-size: 12px; line-height: 1.9; color: #a9bdb8; max-width: 30em; }
.footer-col h3 { color: #fff; font-size: 13px; margin: 0 0 9px; letter-spacing: 0.08em; }
.footer-col a { display: block; color: #c7d4d0; text-decoration: none; font-size: 12px; padding: 3px 0; }
.footer-col a:hover { color: #fff; text-decoration: underline; }
.footer-grid-secondary { margin-top: 28px; grid-template-columns: 1.1fr 1fr 1fr; }
.footer-brand { margin: 22px 0 0; color: #d7e2df; font-size: 12px; letter-spacing: 0.04em; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); margin-top: 28px; padding-top: 16px; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; color: #9fb1ac; font-size: 11px; }

.notice { background: #fff8e6; border: 1px solid #f0d99a; border-radius: 12px; padding: 12px 15px; font-size: 13px; color: #6b5521; }
.error-message { background: #fff1ef; border: 1px solid #efb4aa; color: #7b2b20; border-radius: 12px; padding: 14px 16px; }

/* ---- 印刷プレビュー ---- */
.print-page { background: #e8e4da; }
.print-toolbar {
  position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  box-shadow: 0 4px 14px rgba(31,41,51,.06);
}
.print-toolbar .toolbar-title { font-weight: 700; font-size: 14px; margin-right: auto; }
.print-toolbar .toolbar-title small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.print-toolbar .btn { min-height: 38px; padding: 8px 14px; font-size: 13px; box-shadow: none; }
.print-toolbar .btn-primary { box-shadow: 0 3px 0 rgba(22,71,67,.24); }
.print-help { max-width: 820px; margin: 16px auto 0; padding: 0 20px; color: #52606d; font-size: 12px; text-align: center; }
.print-help strong { color: var(--ink); }
.paper-stack { padding: 22px 0 50px; display: flex; flex-direction: column; align-items: center; gap: 20px; }

.sheet {
  width: 210mm; height: 297mm; flex: 0 0 auto;
  background: #fff; color: #111;
  padding: 15mm 12mm;
  font-family: var(--font-body);
  font-size: 12pt; line-height: 1.55;
  display: flex; flex-direction: column;
  box-shadow: 0 10px 28px rgba(31,41,51,.14);
  border: 1px solid #d9e2ec;
  overflow: hidden;
  position: relative;
}
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10mm; border-bottom: 1.5px solid #111; padding-bottom: 2.4mm; }
.sheet-title { margin: 0; font-family: var(--font-heading); font-size: 18pt; line-height: 1.3; letter-spacing: 0.04em; }
.sheet-sub { margin: 1.2mm 0 0; font-size: 8.5pt; color: #444; letter-spacing: 0.03em; }
.sheet-meta { flex: 0 0 auto; text-align: right; font-size: 10pt; line-height: 2; min-width: 55mm; }
.name-line { white-space: nowrap; }
.date-line { white-space: nowrap; }
.sheet-instruction { margin: 2.4mm 0 2.5mm; font-size: 9.5pt; color: #333; display: flex; align-items: baseline; gap: 2mm; }
.instruction-label { display: inline-block; background: #111; color: #fff; font-size: 7.5pt; padding: 0.3mm 1.6mm; border-radius: 1mm; letter-spacing: .08em; }
.question-list { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; display: grid; gap: 2.2mm 7mm; align-content: space-between; }
.question-list[data-count="1"],
.question-list[data-count="2"],
.question-list[data-count="3"] { align-content: start; }
.layout-normal { grid-template-columns: 1fr 1fr; }
.layout-vertical { grid-template-columns: 1fr 1fr; gap: 2mm 6mm; }
.layout-word { grid-template-columns: 1fr; gap: 3mm; }
.layout-visual { grid-template-columns: 1fr 1fr; gap: 2.5mm 6mm; }
.layout-clock { grid-template-columns: 1fr 1fr; }
.layout-fraction { grid-template-columns: 1fr 1fr; }
.layout-shape { grid-template-columns: 1fr 1fr; }
.question {
  display: flex; gap: 2mm; align-items: flex-start; min-width: 0;
  break-inside: avoid; page-break-inside: avoid;
}
.q-number { flex: 0 0 7mm; font-weight: 700; font-size: 10pt; line-height: 1.5; }
.q-content { flex: 1 1 auto; min-width: 0; }
.question-stem { font-size: 11.5pt; line-height: 1.6; }
.math-line { font-size: 15pt; line-height: 1.5; letter-spacing: 0.02em; white-space: nowrap; }
.sheet.grade-1 .question-stem,
.sheet.grade-2 .question-stem { font-size: 18pt; line-height: 1.55; }
.sheet.grade-1 .math-line,
.sheet.grade-2 .math-line { font-size: 20pt; }
.sheet.grade-1 .answer-line,
.sheet.grade-2 .answer-line { height: 6mm; }
.sheet.grade-1 .q-number,
.sheet.grade-2 .q-number { font-size: 12pt; }
.sheet.grade-1 .hissan,
.sheet.grade-2 .hissan { font-size: 15pt; }
.sheet.grade-1 .sheet-title,
.sheet.grade-2 .sheet-title { font-size: 20pt; }
.answer-blank { display: inline-block; min-width: 4.2em; border-bottom: 1.2pt solid #111; height: 1em; vertical-align: -0.12em; }
.answer-space { margin-top: 1.2mm; }
.answer-line { display: block; width: 55%; border-bottom: 1px solid #777; height: 4mm; }
.word-answer { display: flex; align-items: flex-end; gap: 2mm; }
.word-answer .answer-prefix { flex: 0 0 10mm; font-size: 8pt; color: #444; }
.word-answer .answer-line { flex: 1 1 auto; width: auto; height: 7mm; }
.answer-block { margin-top: 1mm; font-size: 10pt; }
.answer-label { display: inline-block; font-size: 7pt; border: 1px solid #111; padding: 0 1.2mm; border-radius: 1mm; margin-right: 1mm; vertical-align: 1px; }
.answer-value { font-size: 11pt; }
.answer-sheet .answer-value { font-weight: 800; }
.answer-sheet .answer-line { border-bottom-color: #111; }
.answer-sheet .question-list { gap: 1.4mm 7mm; }
.answer-sheet .answer-block { margin-top: 0.4mm; }
.sheet-foot { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: flex-end; border-top: 1px solid #999; padding-top: 1.5mm; margin-top: 2mm; font-size: 8pt; color: #333; }
.foot-message { font-size: 9pt; }
.page-number { font-variant-numeric: tabular-nums; }

/* 算数プリント内の図 */
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; line-height: 1; text-align: center; margin: 0 0.12em; font-size: 0.95em; }
.frac-num { padding: 0 0.16em 0.05em; border-bottom: 1.2px solid currentColor; }
.frac-den { padding: 0.05em 0.16em 0; }
.mixed { display: inline-flex; align-items: center; gap: 0.12em; vertical-align: middle; }
.mixed-whole { font-size: 1.1em; }
.integer-answer { font-weight: 700; }
.hissan { display: inline-grid; grid-template-columns: 1.2em repeat(var(--hissan-cols), 1.55em); align-items: center; justify-items: center; font-size: 13pt; line-height: 1; margin: 0.5mm 0 0; }
.hissan-row { display: contents; }
.hissan-op { height: 1.35em; display: grid; place-items: center; font-size: 0.9em; }
.hissan-cell { height: 1.55em; width: 100%; display: grid; place-items: center; border: 0.5px solid #d3dce6; }
.hissan .answer-cell { background: #fcfcfc; }
.hissan-line { grid-column: 1 / -1; border-top: 1.3px solid #111; height: 0; margin: 0.15em 0; }
.hissan .answer-cell { color: #111; }
.hissan .dot-cell { font-size: 0.7em; border-color: transparent; }
.warizan { display: inline-flex; flex-direction: column; align-items: flex-start; margin: 1mm 0 0; font-size: 12pt; }
.warizan-top { display: flex; align-items: flex-end; }
.warizan-divisor-space { width: 1.6em; }
.warizan-quotient { display: flex; border-bottom: 1.2px solid #111; min-height: 1.5em; }
.warizan-cell { width: 1.5em; height: 1.5em; display: grid; place-items: center; border-right: 0.5px dotted #c9d3dc; }
.warizan-cell.filled { font-weight: 600; }
.warizan-main { display: flex; align-items: flex-start; }
.warizan-divisor { width: 1.6em; text-align: right; padding-right: 0.2em; font-size: 0.95em; line-height: 1.7; }
.warizan-bracket { font-size: 1.7em; line-height: 0.8; padding-right: 0.04em; transform: scaleY(1.8); transform-origin: center; }
.warizan-dividend { display: flex; border-top: 0; }
.warizan-work { min-height: 6mm; margin-left: 2.4em; font-size: 8pt; color: #444; }
.warizan-note { display: inline-block; margin-top: 1mm; }

.clock-wrap, .clock-pair { display: flex; justify-content: center; align-items: center; gap: 4mm; margin-top: 1mm; }
.clock-svg { display: block; }
.clock-face { fill: #fff; stroke: #111; stroke-width: 2; }
.clock-tick { stroke: #555; stroke-width: 0.7; }
.clock-number { font-family: var(--font-heading); font-size: 9px; fill: #111; }
.clock-hour { stroke: #111; stroke-width: 3.6; stroke-linecap: round; }
.clock-minute { stroke: #111; stroke-width: 2.1; stroke-linecap: round; }
.clock-center { fill: #111; }
.clock-arrow { font-size: 15pt; color: #555; }

.count-grid { display: flex; flex-wrap: wrap; gap: 1.4mm; max-width: 70mm; margin-top: 1mm; }
.count-shape { display: block; }
.compare-groups { display: flex; flex-direction: column; gap: 1.4mm; margin-top: 1mm; }
.compare-group { display: flex; flex-wrap: wrap; gap: 1mm; align-items: center; }
.group-label { font-weight: 700; font-size: 8pt; margin-right: 1mm; }
.tenframe { display: grid; grid-template-columns: repeat(5, 1fr); width: 62mm; border: 1.2px solid #111; margin-top: 1mm; }
.ten-cell { aspect-ratio: 1; border: 0.5px solid #9aa7b3; display: grid; place-items: center; }
.ten-cell.filled::after { content: ""; width: 55%; height: 55%; border-radius: 50%; background: #111; }
.ordinal-row { display: flex; gap: 2.5mm; margin-top: 1.5mm; }
.ordinal-item { display: flex; flex-direction: column; align-items: center; gap: 0.5mm; border: 1px solid #ccc; padding: 1.5mm 2mm; min-width: 10mm; }
.ordinal-symbol { font-size: 17pt; line-height: 1; }
.ordinal-choice { font-size: 7pt; color: #555; }
.length-compare { display: flex; flex-direction: column; gap: 2.2mm; margin-top: 1.5mm; }
.length-line-wrap { display: flex; align-items: center; gap: 1.5mm; }
.length-line { display: block; height: 4.2mm; border: 1.1px solid #111; background: repeating-linear-gradient(45deg, #fff, #fff 2px, #e9e9e9 2px, #e9e9e9 4px); }
.area-compare { display: flex; gap: 4mm; align-items: flex-end; margin-top: 1.2mm; }
.area-box { display: flex; flex-direction: column; align-items: center; gap: 1mm; }
.area-grid { display: grid; grid-template-columns: repeat(3, 5mm); border: 1px solid #111; }
.area-grid i { width: 5mm; height: 5mm; border: 0.5px solid #b9c4ce; }
.shape-wrap, .shape-row, .line-choices, .symmetry-choices { display: flex; justify-content: center; align-items: center; margin-top: 1mm; }
.shape-svg { color: #111; }
.shape-row { gap: 4mm; }
.shape-choice { display: flex; flex-direction: column; align-items: center; gap: 0.5mm; }
.shape-choice-label { font-size: 8pt; }
.tiles-row { display: flex; flex-wrap: wrap; gap: 1mm; max-width: 60mm; }
.array-grid { display: grid; grid-template-columns: repeat(var(--cols), 3.2mm); gap: 1.2mm; margin-top: 1.5mm; }
.array-dot { width: 3.2mm; height: 3.2mm; border-radius: 50%; background: #111; display: block; }
.fraction-visual { margin-top: 1mm; }
.fraction-bar { display: grid; grid-template-columns: repeat(var(--parts), 1fr); width: 60mm; height: 13mm; border: 1.2px solid #111; }
.fraction-cell { border-right: 0.7px solid #111; }
.fraction-cell:last-child { border-right: 0; }
.fraction-cell.shaded { background: repeating-linear-gradient(45deg, #111, #111 1.1px, #fff 1.1px, #fff 3.2px); }
.fraction-piece { fill: #fff; stroke: #111; stroke-width: 1.2; }
.fraction-piece.shaded { fill: url(#hatch); background: repeating-linear-gradient(45deg, #111, #111 1px, #fff 1px, #fff 3px); }
.fraction-outline { fill: none; stroke: #111; stroke-width: 2; }
.fraction-line-wrap, .numberline-wrap, .ruler-wrap, .graph-wrap, .angle-wrap { margin-top: 1mm; overflow: hidden; max-width: 100%; }
.line-label, .graph-label { font-size: 7px; fill: #333; }
.graph-grid { stroke: #d5dce3; stroke-width: 0.7; }
.graph-value { font-size: 7px; fill: #111; }
.bar-rect { fill: #fff; stroke: #111; stroke-width: 1.2; }
.line-path { fill: none; stroke: #111; stroke-width: 1.8; }
.line-dot { fill: #fff; stroke: #111; stroke-width: 1.6; }
.table-wrap { margin-top: 1mm; }
.table-title { font-size: 8pt; margin-bottom: 0.8mm; }
.data-table { border-collapse: collapse; font-size: 8.5pt; width: 100%; max-width: 65mm; }
.data-table th, .data-table td { border: 0.8px solid #555; padding: 0.7mm 2mm; text-align: center; }
.data-table th { background: #f0f0f0; font-weight: 700; }
.function-table { max-width: 80mm; }
.tape-wrap { margin-top: 1.5mm; width: 100%; max-width: 80mm; }
.tape-total { font-size: 8pt; margin-bottom: 0.8mm; }
.tape-bar { display: flex; height: 10mm; border: 1.2px solid #111; }
.tape-part { display: grid; place-items: center; font-size: 8pt; }
.tape-part.known { border-right: 1px solid #111; background: #f2f2f2; }
.tape-part.unknown { background: #fff; }
.area-grid-large { display: grid; grid-template-columns: repeat(var(--cols), 7mm); border: 1px solid #111; margin-top: 1mm; }
.grid-cell { width: 7mm; height: 7mm; border: 0.5px solid #b8c4ce; }
.grid-cell.shaded { background: #e2e8ee; }
.angle-label { font-size: 9px; fill: #111; }
.line-choice, .sym-item { display: flex; flex-direction: column; align-items: center; gap: 1mm; font-size: 8pt; }
.symmetry-choices { gap: 5mm; }
.cylinder, .shape-wrap svg { max-width: 100%; }
.choices { display: flex; flex-wrap: wrap; gap: 2mm 4mm; margin-top: 1mm; font-size: 9pt; }
.choice { white-space: nowrap; }

/* 100マス */
.layout-100 { padding: 15mm 12mm; }
.masu-wrap { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; }
.masu-table { border-collapse: collapse; width: 100%; max-width: 170mm; table-layout: fixed; }
.masu-table th, .masu-table td { border: 0.9px solid #111; text-align: center; height: 17mm; width: 15mm; font-size: 12pt; }
.masu-table th { background: #f0f0f0; font-weight: 700; }
.masu-table .corner { font-size: 10pt; background: #e5e5e5; }
.masu-memo { margin-top: 3mm; font-size: 9pt; letter-spacing: 0.04em; }

@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-preview { max-width: 520px; transform: none; }
  .generator-layout, .content-grid { grid-template-columns: 1fr; }
  .special-grid { grid-template-columns: repeat(2, 1fr); }
  .grade-grid { grid-template-columns: repeat(2, 1fr); }
  .main-nav { display: none; }
  .menu-toggle { display: inline-flex; }
  .mobile-nav.open {
    display: block; border-top: 1px solid var(--line); background: #fff; padding: 8px 20px 16px;
  }
  .mobile-nav a { display: block; padding: 9px 4px; text-decoration: none; color: var(--ink); border-bottom: 1px solid #edf2f7; font-size: 14px; }
  .mobile-nav a:last-child { border-bottom: 0; }
  .section { padding: 40px 0; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .header-inner { padding: 9px 16px; }
  .logo-mark { width: 34px; height: 34px; font-size: 18px; }
  .logo-text { font-size: 15px; }
  .container { padding: 0 16px; }
  .hero { padding: 30px 0 18px; }
  .hero h1 { font-size: 30px; }
  .hero-lead { font-size: 15px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .grade-grid, .unit-grid, .special-grid, .how-grid, .related-units { grid-template-columns: 1fr; }
  .grade-card { padding: 16px; }
  .generator-card, .example-card { padding: 18px; border-radius: 16px; }
  .section-head { display: block; }
  .section-head a { display: inline-block; margin-top: 8px; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .callout-cta { padding: 20px; }
  .count-row { grid-template-columns: repeat(4, 1fr); }
  .segmented label { min-height: 46px; font-size: 13px; }
  .print-toolbar { padding: 8px 10px; gap: 6px; }
  .print-toolbar .toolbar-title { flex: 1 1 100%; margin: 0 0 2px; }
  .print-toolbar .btn { flex: 1 1 auto; font-size: 12px; padding: 7px 9px; }
  .paper-stack { padding: 12px 0 30px; overflow-x: auto; align-items: flex-start; }
  .paper-stack .sheet { zoom: 0.47; margin-left: 0; }
  .print-help { text-align: left; }
}
@media (max-width: 380px) {
  .count-row { grid-template-columns: repeat(2, 1fr); }
  .segmented { grid-template-columns: 1fr; }
}
