:root {
  --bg: #faf8f3;
  --surface: #ffffff;
  --ink: #1f1d1a;
  --sub: #5c5850;
  --line: #e4dfd4;
  --accent: #0b6e4f;
  --accent-soft: #e3f1eb;
  --warn: #b3261e;
  --warn-soft: #fbedeb;
  --field: #cfc8ba;
  --chip: #f0ece3;
  --r: 12px;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.num, time, input, td, .chip b { font-variant-numeric: tabular-nums; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  overflow-wrap: anywhere;
}

a:visited { color: var(--accent); }

a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -64px;
  padding: 12px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  z-index: 9;
  text-decoration: none;
}

.skip:focus { top: 16px; color: #fff; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.hd {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.logo i {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
}

nav[aria-label="メイン"] {
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}

nav[aria-label="メイン"] ul {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

nav[aria-label="メイン"] a {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--sub);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  flex: 0 0 auto;
}

nav[aria-label="メイン"] a:hover { background: var(--chip); color: var(--ink); }

nav[aria-label="メイン"] a[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: 0;
}

.notice {
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 14px;
  font-weight: 600;
}

.notice .wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.notice .wrap span:last-child { min-width: 0; }

.intro { padding-top: 48px; padding-bottom: 32px; }

h1, h2, h3 { font-weight: 700; letter-spacing: 0.02em; }

h1 { margin: 0; font-size: 32px; line-height: 1.35; }

h2 { margin: 0; font-size: 24px; line-height: 1.4; }

.lead {
  margin: 12px 0 0;
  color: var(--sub);
  max-width: 40em;
  word-break: auto-phrase;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 32px;
  align-items: start;
  padding-bottom: 96px;
}

.card, .result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 32px;
}

.result { border-top: 4px solid var(--accent); }

.res { position: sticky; top: 24px; }

.field + .field,
.field + .row,
.row + .hint { margin-top: 24px; }

.lbl, legend {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

fieldset {
  border: 0;
  margin: 24px 0 0;
  padding: 0;
  min-width: 0;
}

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  background: var(--chip);
  border-radius: 10px;
  gap: 4px;
}

.seg.two { grid-template-columns: 1fr 1fr; }

.seg button, .seg label {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--sub);
  cursor: pointer;
  text-align: center;
}

.seg button[aria-pressed="true"],
.seg label:has(input:checked) {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(31, 29, 26, 0.12);
}

.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.row > * { min-width: 0; }

.in {
  display: flex;
  align-items: center;
  height: 48px;
  border: 1px solid var(--field);
  border-radius: 8px;
  background: #fff;
  padding: 0 16px;
  font-size: 16px;
}

.in input, .in span.share-text {
  border: 0;
  font: inherit;
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  height: 100%;
}

.in span.suffix { color: var(--sub); font-size: 14px; white-space: nowrap; margin-left: 8px; }

.hint, .field-help, .footer-meta {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--sub);
  line-height: 1.7;
}

#closed-field { margin-top: 24px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.tg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--field);
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--sub);
  cursor: pointer;
}

.tg[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tg[aria-pressed="true"]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.sub {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 14px;
}

.sub button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.btn {
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: 8px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.btn.ghost {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn:hover { filter: brightness(1.05); }

.submit { margin-top: 32px; width: 100%; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.kicker {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.big {
  margin: 8px 0 0;
  font-size: 48px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.big small { font-size: 24px; font-weight: 700; margin-left: 4px; }

.big[data-tone="negative"] { color: var(--warn); }

.wareki { margin: 8px 0 0; color: var(--sub); font-size: 15px; }

.cond { margin: 16px 0 0; font-size: 14px; color: var(--sub); }

.bd { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  background: var(--chip);
  white-space: nowrap;
}

.chip-note {
  margin: 8px 0 0;
  color: #5e5a53;
  font-size: 13px;
  line-height: 1.7;
}

#out-chip-note span { white-space: nowrap; }

.chip-note.row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.chip-note.row span { white-space: nowrap; }

.chip.a { background: var(--accent-soft); color: var(--accent); }

.chip.w { background: var(--warn-soft); color: var(--warn); }

.cal { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 24px; }

.cal h3 { font-size: 14px; margin: 0 0 8px; }

.cal table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  font-size: 13px;
  text-align: center;
}

.cal th { font-weight: 600; color: var(--sub); height: 24px; }

.cal td {
  height: 36px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.cal td.off { background: var(--chip); color: #6b665c; font-weight: 400; }

.cal td.hol { background: var(--warn-soft); color: var(--warn); }

.cal td.e { background: none; }

.cal td.st { box-shadow: inset 0 0 0 2px var(--ink); color: var(--ink); }

.cal td.goal { background: var(--accent); color: #fff; font-weight: 800; }

.legend {
  display: flex;
  flex-wrap: wrap;
  row-gap: 4px;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--sub);
}

.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: -1px;
}

.share {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 24px;
  align-items: center;
}

.share .in {
  font-size: 13px;
  color: var(--sub);
  overflow: hidden;
}

.share .in input { color: var(--sub); }

.month { padding: 96px 0; border-top: 1px solid var(--line); background: #f5f2eb; }

.mhd {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 24px;
}

.mtab, table.data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
  font-size: 15px;
}

.mtab th, .mtab td, table.data th, table.data td {
  height: 48px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  background: none;
  color: var(--ink);
  border-radius: 0;
  font-weight: 400;
  vertical-align: middle;
}

.mtab th, table.data th { background: #fbfaf6; font-size: 13px; font-weight: 700; }

.mtab th:first-child, .mtab td:first-child,
table.data th:first-child, table.data td:first-child { text-align: left; }

.mtab td b, table.data td b { color: var(--accent); font-weight: 700; }

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

.prose { padding: 48px 0 96px; }

.prose article, article.prose { max-width: 680px; }

.prose h2, article.prose h2 { margin: 48px 0 24px; }

.prose h3, article.prose h3 { font-size: 18px; margin: 48px 0 12px; }

.prose p, .prose li, article.prose p, article.prose li {
  font-size: 17px;
  line-height: 1.9;
  margin-top: 16px;
}

.prose ol, .prose ul, article.prose ol, article.prose ul {
  margin-top: 16px;
  padding-left: 24px;
}

article.prose > h1 { margin-bottom: 8px; }

blockquote.law {
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
}

blockquote.law p { margin: 8px 0; }

.cite { color: var(--sub); font-size: 16px; }

pre.code, .formula {
  margin: 16px 0;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

details { border-bottom: 1px solid var(--line); }

details:first-of-type { border-top: 1px solid var(--line); margin-top: 24px; }

summary {
  min-height: 56px;
  display: flex;
  align-items: center;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  justify-content: space-between;
  gap: 16px;
}

summary::-webkit-details-marker { display: none; }

summary::after { content: "+"; font-size: 20px; color: var(--accent); }

details[open] summary::after { content: "−"; }

details p { margin: 0 0 24px; }

.page { padding-bottom: 96px; }

.warnings, .notices, .noscript {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn);
}

.notices { background: var(--accent-soft); color: var(--accent); }

.warnings p, .notices p, .noscript { margin: 8px 0; }

.error-list { margin: 8px 0 0; padding-left: 24px; color: var(--warn); }

.added-list { list-style: none; margin: 8px 0 0; padding: 0; }

.added-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
}

.added-list .btn {
  height: 36px;
  padding: 0 12px;
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.page form.card { max-width: 720px; }

details.holiday-meta {
  margin-top: 24px;
  border-top: 1px solid #e7e2d8;
  border-bottom: 1px solid #e7e2d8;
}

details.holiday-meta summary,
.result summary {
  width: 100%;
  height: 48px;
  min-height: 48px;
  justify-content: space-between;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

details.holiday-meta summary::after,
.result summary::after {
  content: "+";
  color: #0b6e4f;
  font-size: 20px;
  line-height: 1;
}

details.holiday-meta[open] summary::after,
.result details[open] summary::after { content: "−"; }

.result details { border-bottom-color: #e7e2d8; }

.result details:first-of-type { border-top-color: #e7e2d8; }

details.holiday-meta p {
  margin: 0 0 16px;
  color: #5e5a53;
  font-size: 13px;
  line-height: 1.7;
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.grid.month-grid { row-gap: 0; padding-bottom: 0; }

#month-result { margin-top: 32px; }

@media (min-width: 961px) {
  #month-result { margin-top: 0; }
}

#result-empty p:last-child { margin: 8px 0 0; color: var(--sub); }

.breakdown { margin: 8px 0 0; padding-left: 24px; }

.breakdown li { margin: 4px 0; font-size: 14px; }

.ye-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 48px;
  font-size: 13px;
  color: var(--sub);
}

.foot { display: flex; flex-direction: column; gap: 16px; }

.footer-caution { margin: 0; font-weight: 700; color: var(--ink); }

footer nav { display: flex; flex-wrap: wrap; gap: 8px 16px; }

footer nav a { min-height: 44px; display: inline-flex; align-items: center; }

@media (max-width: 960px) {
  .grid { grid-template-columns: 1fr; }
  .res { position: static; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .hd {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: 12px;
  }
  .logo { height: 44px; }
  nav[aria-label="メイン"] {
    margin: 0 -16px;
    padding: 0 12px;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 24px), transparent 100%);
  }
  .notice { font-size: 13px; }
  .intro { padding-top: 32px; padding-bottom: 24px; }
  .row { grid-template-columns: 3fr 2fr; gap: 12px; }
  h1 { font-size: 24px; }
  .lead { font-size: 15px; }
  .card, .result { padding: 24px 16px; }
  .seg button, .seg label { font-size: 13px; }
  .big { font-size: 40px; }
  .grid { gap: 24px; padding-bottom: 64px; }
  .month, .prose, .page { padding-top: 64px; padding-bottom: 64px; }
  .month { padding-top: 64px; }
  .mtab th, .mtab td, table.data th, table.data td { padding: 8px; font-size: 14px; }
  .prose p, .prose li, article.prose p, article.prose li { font-size: 16px; }
  .share { grid-template-columns: 1fr; }
  .mhd, .ye-grid { flex-direction: column; align-items: stretch; }
  .ye-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
