* { box-sizing: border-box; }
body { margin: 0; color: #222; background: #fff; font: 16px/1.5 system-ui, sans-serif; }
a { color: #12589a; }
.site-header { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 1rem; }
.brand img { display: block; width: 100px; height: auto; }
.school-info h1 { margin: 0 0 .25rem; font-size: 1.3rem; }
.school-info p { margin: .15rem 0; }
.schedule-nav { padding: .5rem 1rem; text-align: center; border-block: 1px solid #ddd; }
.schedule-nav p { margin: .4rem; }
main { max-width: 1440px; margin: 1rem auto; padding: 0 1rem; }
main > h2, .welcome { text-align: center; }
.schedule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr)); gap: 1rem; }
.schedule-tile { display: block; text-align: center; text-decoration: none; color: inherit; }
.schedule-tile img { display: block; width: 95%; max-width: 1200px; height: auto; margin: 0 auto .35rem; }
.notice { text-align: center; }
.sheet-frame { width: 100%; max-width: 780px; height: min(72vh, 760px); margin: 0 auto; }
.sheet-frame iframe { width: 100%; height: 100%; border: 0; }
.print-page { max-width: 1300px; }
.print-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem; margin: 1rem auto; }
.print-controls label { display: flex; align-items: center; gap: .4rem; }
.print-controls input, .print-controls select, .print-controls button { min-height: 2.5rem; padding: .4rem .65rem; }
.print-controls input { width: 6rem; }
#print-summary { flex-basis: 100%; margin: 0; text-align: center; }
.print-output { display: grid; gap: 1rem; }
.print-sheet { display: grid; aspect-ratio: 842 / 595; grid-template-columns: 1fr; gap: .5rem; }
.print-sheet[data-layout="2"] { aspect-ratio: 595 / 842; grid-template-rows: repeat(2, minmax(0, 1fr)); }
.print-sheet[data-layout="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.print-copy { min-width: 0; min-height: 0; }
.print-copy img { display: block; width: 100%; height: auto; object-fit: contain; }
@media (max-width: 600px) {
  .site-header { align-items: flex-start; justify-content: flex-start; }
  .brand img { width: 72px; }
  .school-info h1 { font-size: 1rem; }
}
@page landscape { size: A4 landscape; margin: 8mm; }
@page portrait { size: A4 portrait; margin: 8mm; }
@media print {
  .print-controls { display: none !important; }
  .print-page { max-width: none; margin: 0; padding: 0; }
  .print-output { display: block; }
  .print-sheet { page: landscape; display: grid; width: 100%; height: 180mm; grid-template-columns: 1fr; gap: 3mm; break-inside: avoid-page; page-break-inside: avoid; }
  .print-sheet[data-layout="2"] { page: portrait; height: 265mm; grid-template-columns: 1fr; grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .print-sheet[data-layout="4"] { page: landscape; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .print-sheet + .print-sheet { break-before: page; page-break-before: always; }
  .print-copy { overflow: hidden; }
  .print-copy img { width: 100%; height: 100%; object-fit: contain; }
}
