* { box-sizing: border-box; }
html { font: 16px/1.55 "Segoe UI", Meiryo, sans-serif; color: #183531; background: #f1f5f1; }
body { margin: 0; }
main { max-width: 56rem; margin: auto; padding: clamp(12px,4vw,36px); }
a { color: #16665c; }
h1 { margin: .45em 0 .15em; font-size: clamp(1.65rem,5vw,2.55rem); }
header p { margin: .4em 0 1em; }
form, nav section { border: 1px solid #bdcfc7; background: white; border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
nav h2, nav p { margin: .25em 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,13rem),1fr)); gap: .75rem; }
label { font-weight: 600; display: flex; flex-direction: column; justify-content: end; gap: .3rem; }
.wide { grid-column: 1/-1; }
input, select, textarea, button { font: inherit; border: 1px solid #748c82; border-radius: 5px; padding: .5rem; color: inherit; background: white; }
textarea { resize: vertical; }
.actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }
button { cursor: pointer; }
button[type=submit] { background: #17655b; color: white; }
button:disabled { opacity: .55; }
:focus-visible { outline: 3px solid #ae570e; outline-offset: 2px; }
#status { margin: .65rem 0 0; }
.sheet { background: #fff; color: #172622; margin-bottom: 1rem; box-shadow: 0 2px 8px #173a3225; }
.roster { padding: 1rem; }
.roster h2, .roster h3 { margin: 0; }
.roster-row { border-top: 1px solid #9caca4; padding: .5em 0; }
.roster-row ul { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: .25rem 0; padding: 0; }
.roster-row li { overflow-wrap: anywhere; max-width: 100%; }
.paper, .labels { width: 100%; aspect-ratio: 210/297; padding: 5.714286%; }
.landscape .paper { aspect-ratio: 297/210; padding: 4.040404%; }
.paper svg { display: block; width: 100%; height: 100%; overflow: visible; }
.labels { display: grid; grid-template-columns: repeat(var(--cols),minmax(0,1fr)); grid-template-rows: repeat(var(--rows), minmax(0,1fr)); container-type: inline-size; }
.label { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1px dashed #777; padding: .3em; overflow-wrap: anywhere; font-size: min(2.4cqw,calc(6cqw / var(--cols)),calc(18cqw / var(--rows))); line-height: 1.15; }
.label strong { font-size: 1.8em; }
@page { size: A4 portrait; margin: 12mm; }
@page wide-paper { size: A4 landscape; margin: 12mm; }
@media print {
  html, body { background: white; color: black; }
  main { max-width: none; margin: 0; padding: 0; }
  .no-print { display: none !important; }
  .sheet { margin: 0; padding: 0; box-shadow: none; }
  .sheet + .sheet { break-before: page; }
  .paper, .labels { width: 186mm; height: 273mm; aspect-ratio: auto; }
  .landscape .paper { page: wide-paper; width: 273mm; height: 186mm; padding: 0; }
  .roster-row, .roster-row li { break-inside: avoid; }
  .roster h2, .roster h3 { break-after: avoid; }
}
