:root {
  color-scheme: light;
  --ink: #122639;
  --muted: #485e71;
  --navy: #10334c;
  --teal: #09695e;
  --line: #d6e0e7;
  --paper: #fff;
  --bg: #edf3f6;
  --holiday: #fff5d9;
  --holiday-ink: #744509;
  --exam: #f7e6e8;
  --exam-ink: #7b3545;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
button, input { font: inherit; }
a { color: #0e6259; text-underline-offset: .16em; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid #05756a;
  outline-offset: 4px;
}
.frame { width: min(94%, 94rem); margin-inline: auto; }
.hero {
  padding: clamp(2rem, 4.8vw, 4.2rem) 0 clamp(1.6rem, 3.7vw, 3.2rem);
  color: #fff;
  background: linear-gradient(115deg, #102f49 8%, #17465c 73%, #15584f);
  border-bottom: 5px solid #e6be65;
}
.hero-inner { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.year { margin: 0 0 .45rem; color: #d4e9ef; font-size: .95rem; font-weight: 700; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); line-height: 1.13; letter-spacing: .01em; }
.range { margin: .65rem 0 0; color: #d4e9ef; font-size: clamp(1rem, 1.5vw, 1.18rem); }
.exam-start {
  display: grid;
  gap: .12rem;
  width: min(100%, 17.4rem);
  padding: .9rem 1rem;
  border: 1px solid #93b7c4;
  border-radius: .5rem;
  color: #fff;
  background: #143b4d;
  text-decoration: none;
}
.exam-start:hover { background: #1d4c5e; }
.exam-start:focus-visible { outline-color: #f9d784; }
.exam-start time { color: #ffe096; font-size: 1.25rem; font-weight: 750; }
.exam-start span { color: #f0f8fc; font-size: .9rem; }

.controls { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .65rem 1rem; align-items: center; justify-content: space-between; }
.jumps, .actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.jumps a, .print {
  min-height: 2.55rem;
  padding: .5rem .78rem;
  border: 1px solid #afc4d0;
  border-radius: .4rem;
  color: var(--navy);
  background: var(--paper);
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
}
.jumps a:hover, .print:hover { background: #ddeaf0; }
.print { cursor: pointer; }
.progress { margin: 0 .35rem 0 0; font-size: .875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .2rem .95rem; margin: .8rem 0 0; color: var(--muted); font-size: .875rem; }
.legend li { display: flex; align-items: center; gap: .38rem; }
.swatch { width: .8rem; height: .8rem; border: 1px solid currentColor; border-radius: .15rem; }
.swatch.holiday { color: var(--holiday-ink); background: var(--holiday); }
.swatch.exam { color: var(--exam-ink); background: var(--exam); }
.swatch.off { color: var(--teal); background: #e2f1ed; }

.phase { margin-top: clamp(1.8rem, 3.6vw, 3.25rem); scroll-margin-top: 1.2rem; }
.phase-header { border-top: 2px solid var(--navy); padding: .8rem 0 .9rem; }
.phase-header h2 { margin: 0; font-size: clamp(1.35rem, 2vw, 2.1rem); line-height: 1.25; }
.phase-header p { margin: .35rem 0 0; color: var(--muted); max-width: 65ch; }
.week { margin-top: 1rem; }
.week:first-of-type { margin-top: 0; }
.week h3 { margin: 0 0 .4rem; color: var(--navy); font-size: 1rem; }
.weekdays, .calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays {
  text-align: center;
  color: var(--navy);
  background: #dbe8ef;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: .4rem .4rem 0 0;
  padding: .28rem 0;
  font-size: .875rem;
  font-weight: 700;
}
.calendar {
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 0 0 .4rem .4rem;
  background: var(--line);
}
.day { min-width: 0; background: var(--paper); }
.day.empty { background: #e8eff3; }
.day.weekend { background: #f6fafe; }
.day.holiday { background: #fffaf0; }
.day.travel { background: #fff5df; }
.day.off { background: #f3faf8; }
.day-head {
  display: flex;
  min-height: 2.65rem;
  gap: .22rem .42rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: .42rem .6rem;
  border-bottom: 1px solid var(--line);
}
.day.holiday .day-head, .day.travel .day-head { color: var(--holiday-ink); background: var(--holiday); }
.day.exam .day-head { color: var(--exam-ink); background: var(--exam); }
.day.off .day-head { color: #126354; background: #e2f1ed; }
.day.is-today .day-head { box-shadow: inset 0 3px var(--teal); }
.day-head time { white-space: nowrap; font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.day-weekday { display: none; }
.day-label { font-size: .875rem; font-weight: 750; }
.slots, .papers { list-style: none; margin: 0; padding: 0; }
.papers { padding: .48rem .61rem; background: #fcf2f3; color: var(--exam-ink); border-bottom: 1px solid #e5cfd3; }
.paper { margin-bottom: .3rem; font-size: .875rem; line-height: 1.3; }
.paper:last-child { margin-bottom: 0; }
.paper strong { display: block; }
.paper time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.slot { padding: .66rem .6rem; }
.slot + .slot { border-top: 1px solid var(--line); }
.slot label { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .5rem; color: #0f5e53; font-size: .895rem; font-weight: 750; cursor: pointer; }
.slot label time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.slot input { width: 1.08rem; height: 1.08rem; margin: 0; accent-color: var(--teal); cursor: pointer; }
.slot h4 { margin: .25rem 0 .2rem; font-size: 1rem; line-height: 1.36; }
.slot p, .day-note { font-size: 1rem; margin: 0; color: #354e60; line-height: 1.55; overflow-wrap: break-word; }
.slot.is-done { background: #e6f2ed; }
.day-note { padding: .55rem .6rem; }
.sources { border-top: 1px solid var(--line); margin: 2.4rem 0 0; padding: 1rem 0 1.5rem; color: var(--muted); font-size: .875rem; }
.sources p { margin: .18rem 0; }

@media (max-width: 76rem) {
  .weekdays, .day.empty { display: none; }
  .calendar { grid-template-columns: repeat(3, minmax(0, 1fr)); border-radius: .4rem; }
  .day-weekday { display: inline; margin-left: .36rem; color: inherit; font-size: .875rem; font-weight: 650; }
  .day-head { padding-inline: .8rem; }
  .slot, .papers, .day-note { padding-inline: .8rem; }
}
@media (max-width: 52rem) { .calendar { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 34rem) {
  .frame { width: min(92%, 94rem); }
  .hero-inner, .calendar { grid-template-columns: minmax(0, 1fr); }
  .hero-inner { gap: 1rem; }
  .exam-start { width: 100%; }
  .controls { align-items: start; }
}
@media print {
  :root, body { background: white; }
  .frame { width: 100%; }
  .hero { background: white; color: var(--ink); padding-block: 0 1rem; }
  .year, .range { color: var(--ink); }
  .controls, .exam-start { display: none; }
  .phase { margin-top: 1.4rem; }
  .calendar { grid-template-columns: repeat(7, minmax(0, 1fr)); print-color-adjust: exact; }
  .weekdays { display: grid; }
  .day.empty { display: block; }
  .day-weekday { display: none; }
  .week { break-inside: avoid; }
  .slot p, .day-note { font-size: .8rem; }
  .day-head, .slot, .papers, .day-note { padding-inline: .3rem; }
  .slot h4, .slot label, .paper { font-size: .78rem; }
}
