:root {
  color-scheme: light;
  --paper: #fff;
  --bg: #edf3fa;
  --ink: #19334d;
  --muted: #577188;
  --accent: #155ab5;
  --line: #cad9e8;
  --tint: #e5eefb;
  --warn: #854308;
  font-family: "BIZ UDPGothic", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
}
.script-controls {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: var(--accent);
  text-underline-offset: 0.22em;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button,
input,
select,
textarea,
a {
  touch-action: manipulation;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid #d16b13;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 1rem max(1rem, calc((100vw - 1160px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  font-weight: 800;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.tool-links {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
}
main {
  max-width: 1160px;
  margin: auto;
  padding: 2rem 1.2rem 4rem;
}
.page-intro {
  margin-bottom: 1.7rem;
  max-width: 52rem;
}
.page-intro h1 {
  font-size: clamp(1.65rem, 3.6vw, 2.55rem);
  letter-spacing: 0.025em;
  line-height: 1.4;
  margin: 0 0 0.6rem;
}
.page-intro p {
  margin: 0.3rem 0;
}
.privacy-note {
  font-size: 0.85rem;
  color: var(--muted);
}
.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 0.85fr) minmax(0, 1.35fr);
  gap: 1.6rem;
  align-items: start;
}
.controls {
  padding: 1.5rem;
  background: var(--paper);
  border-radius: 14px;
  border: 1px solid var(--line);
}
h2 {
  font-size: 1.2rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}
h3 {
  font-size: 1rem;
  margin: 1.2rem 0 0.35rem;
}
.field {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 1rem;
}
.field > label,
.field > span {
  font-weight: 700;
}
.field small,
.field-help {
  font-size: 0.82rem;
  color: var(--muted);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid #8fa8bf;
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 0.65rem 0.7rem;
  line-height: 1.45;
  min-height: 46px;
}
textarea {
  resize: vertical;
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
  width: 1.1rem;
  height: 1.1rem;
  vertical-align: middle;
  margin-right: 0.4rem;
}
.check-label {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  font-size: 0.9rem;
  padding: 0.35rem 0;
}
fieldset {
  margin: 0 0 1rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-width: 0;
}
legend {
  font-weight: 700;
  padding: 0 0.3rem;
  font-size: 0.92rem;
}
.primary,
.secondary,
.actions button {
  border-radius: 6px;
  min-height: 44px;
  padding: 0.6rem 0.9rem;
  font-weight: 700;
  line-height: 1.4;
}
.primary {
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
  width: 100%;
}
.primary:hover {
  background: #11498f;
}
.secondary,
.actions button {
  color: var(--accent);
  background: var(--paper);
  border: 1px solid #9ab5d4;
}
.secondary:hover,
.actions button:hover {
  background: var(--tint);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0;
}
.actions button:disabled {
  opacity: 0.5;
  cursor: default;
}
.notice {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.7rem 0;
}
.error {
  color: #9c2222;
  background: #fff0ed;
  border-left: 4px solid #b32922;
  padding: 0.75rem;
  font-size: 0.9rem;
}
.result-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 6px solid var(--accent);
  border-radius: 3px 3px 12px 12px;
  padding: 1.6rem;
  min-width: 0;
  min-height: 380px;
  box-shadow: 0 8px 24px #19334d0a;
}
.result-heading {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}
.result-value {
  font-size: clamp(1.55rem, 3.1vw, 2.4rem);
  font-weight: 800;
  margin: 0.45rem 0 1rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.result-summary {
  margin: 0.7rem 0;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.result-empty {
  display: grid;
  place-items: center;
  min-height: 230px;
  color: var(--muted);
  text-align: center;
}
.calendar-mark {
  width: 104px;
  height: 102px;
  border: 2px solid #99b7d6;
  border-radius: 7px;
  margin: 0 auto 1rem;
  position: relative;
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: #497aa8;
}
.calendar-mark::before {
  content: "";
  position: absolute;
  top: 23px;
  left: 0;
  right: 0;
  border-top: 2px solid #99b7d6;
}
.calendar-mark span {
  padding-top: 15px;
}
.table-wrap {
  overflow: auto;
  max-height: 450px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.87rem;
}
th,
td {
  text-align: left;
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid #dce5ef;
  vertical-align: top;
}
th {
  background: #eff4fa;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}
tr:last-child td {
  border-bottom: 0;
}
tr.holiday td {
  color: #6c6a70;
  background: #f8f9fb;
}
td:first-child {
  white-space: nowrap;
}
caption {
  text-align: left;
  padding: 0.65rem;
  font-weight: 700;
}
.guide {
  margin-top: 2.5rem;
  max-width: 100%;
}
.guide > h2 {
  font-size: 1.4rem;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}
.guide p,
.guide li {
  max-width: 70ch;
  font-size: 0.93rem;
}
.guide-grid h3 {
  margin-top: 0;
}
.guide ul,
.guide ol {
  padding-left: 1.25rem;
}
.guide details {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}
summary {
  cursor: pointer;
  font-weight: 700;
}
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 1rem 2rem;
  text-align: center;
  background: #e3ecf6;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer p {
  margin: 0.7rem 0 0;
}
.details-list {
  font-size: 0.88rem;
}
.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.8rem 0;
}
.example-btn {
  font-size: 0.82rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f7faff;
  color: var(--accent);
  padding: 0.4rem 0.7rem;
  min-height: 38px;
}
.weekdays {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.weekdays label {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
  min-width: 35px;
  font-size: 0.9rem;
}
.weekdays input {
  margin: 0 0 0.2rem;
}
.small {
  font-size: 0.82rem;
  color: var(--muted);
}
.year-badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.15rem 0.55rem;
  font-size: 0.8rem;
  background: white;
  margin-right: 0.4rem;
}
@media (max-width: 800px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .site-header {
    align-items: start;
  }
  .tool-links {
    justify-content: flex-end;
    gap: 0.5rem;
    font-size: 0.8rem;
  }
  main {
    padding: 1.4rem 1rem 3rem;
  }
  .result-panel {
    min-height: 250px;
  }
  .controls,
  .result-panel {
    padding: 1.2rem;
  }
}
@media (max-width: 380px) {
  .field-row {
    grid-template-columns: 1fr;
  }
  .site-header {
    flex-direction: column;
  }
  .tool-links {
    justify-content: flex-start;
  }
  .controls,
  .result-panel {
    padding: 1rem;
  }
  .weekdays {
    gap: 0.2rem;
  }
  .weekdays label {
    min-width: 31px;
    padding: 0.3rem;
  }
  .actions button {
    flex: 1 1 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
@media print {
  body {
    background: white;
    color: black;
    font-size: 11pt;
  }
  .site-header,
  .controls,
  .guide,
  .site-footer,
  .no-print,
  .actions,
  .privacy-note,
  .examples {
    display: none !important;
  }
  main {
    padding: 0;
    max-width: none;
  }
  .workspace {
    display: block;
  }
  .page-intro {
    margin: 0 0 1rem;
  }
  .page-intro h1 {
    font-size: 18pt;
  }
  .result-panel {
    border: 0;
    padding: 0;
    box-shadow: none;
    min-height: 0;
  }
  .table-wrap {
    overflow: visible;
    max-height: none;
    border: 0;
  }
  th {
    position: static;
  }
  tr {
    break-inside: avoid;
  }
  .result-value {
    font-size: 20pt;
  }
  .print-note {
    display: block !important;
  }
}
:where(input, select, textarea) {
  min-width: 0;
  max-width: 100%;
}
.error:empty {
  display: none;
}
#result-body td,
#resume-body td {
  white-space: nowrap;
}
.details-list .field-row {
  grid-template-columns: 1.1fr 1fr 1fr;
  margin-bottom: 12px;
}
.details-list .field-row label {
  font-size: 0.85rem;
}
.details-list .field-row input {
  display: block;
  width: 100%;
}
#rows td:nth-child(2),
.table-wrap th:nth-child(2) {
  white-space: nowrap;
}
