:root {
  --paper: #fffdf4;
  --ink: #736ff2;
  --ink-dark: #20204f;
  --yellow: #f3ee2f;
  --cyan: #a7eee2;
  --pink: #f37aa6;
  --line: #7a77e8;
  --soft: #dfe8ff;
  --shadow: 10px 10px 0 rgba(115, 111, 242, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(115, 111, 242, 0.12) 1px, transparent 1px),
    linear-gradient(rgba(115, 111, 242, 0.1) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: "Arial Black", "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
  letter-spacing: 0;
  animation: gridDrift 18s linear infinite;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header,
main,
.footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: relative;
  padding: 24px 0 46px;
}

.side-copy {
  position: relative;
  width: 100%;
  height: 34px;
  margin-bottom: 14px;
  overflow: hidden;
  border-top: 2px solid var(--yellow);
  border-bottom: 2px solid var(--yellow);
  color: var(--ink);
  font-size: 13px;
  line-height: 30px;
  white-space: nowrap;
}

.side-copy span {
  display: inline-block;
  min-width: 100%;
  padding-left: 100%;
  animation: marqueeLine 48s linear infinite;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 3px solid var(--yellow);
  padding-top: 14px;
}

.brand {
  display: inline-grid;
  min-width: 168px;
  min-height: 40px;
  place-items: center;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink);
  padding: 6px 12px;
  box-shadow: 5px 5px 0 var(--yellow);
  font-size: 15px;
  line-height: 1.2;
  text-align: center;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.brand:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--yellow);
}

.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a,
.admin-open,
.section-detail,
.section-top,
.block-head a,
.block-head button,
.footer a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: white;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.nav-links a:hover,
.admin-open:hover,
.section-detail:hover,
.section-top:hover,
.block-head a:hover,
.block-head button:hover,
.footer a:hover {
  background: var(--pink);
  box-shadow: 4px 4px 0 var(--yellow);
  transform: translate(-2px, -2px);
}

.admin-open {
  color: var(--ink-dark);
  background: var(--yellow);
}

.admin-open:hover {
  color: var(--paper);
  background: var(--pink);
  box-shadow: 4px 4px 0 var(--ink);
}

.nav-links a::after,
.block-head a::after,
.footer a::after {
  content: ">";
  margin-left: 8px;
}

.hero .year {
  margin: 22px 0 0;
  border-top: 2px solid var(--yellow);
  padding-top: 10px;
  font-size: 15px;
}

h1 {
  margin: 4px 0 18px;
  color: var(--ink);
  font-size: clamp(42px, 11vw, 132px);
  line-height: 0.82;
  letter-spacing: 0;
  white-space: nowrap;
  animation: titleDrop 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.hero-copy {
  display: grid;
  gap: 10px;
  width: 100%;
  margin: 0 0 20px;
  padding: 16px 18px;
  color: var(--ink-dark);
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid var(--line);
  box-shadow: 8px 8px 0 rgba(115, 111, 242, 0.16);
  font: 800 16px/1.7 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.hero-copy p {
  margin: 0;
}

.hero-subtitle {
  color: var(--pink);
  font-family: "Arial Black", "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
  font-size: clamp(22px, 4vw, 38px);
  line-height: 1.1;
}

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

.panel {
  min-height: 154px;
  border: 2px solid var(--line);
  overflow: hidden;
  position: relative;
  background: white;
  animation: panelPop 650ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.panel:nth-child(2) {
  animation-delay: 110ms;
}

.panel:nth-child(3) {
  animation-delay: 220ms;
}

.panel:nth-child(4) {
  animation-delay: 330ms;
}

.panel-yellow {
  background: var(--yellow);
}

.mountain {
  position: absolute;
  inset: auto 24px 0;
  height: 88%;
  animation: mountainSlide 6s ease-in-out infinite alternate;
}

.mountain::before,
.mountain::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 100%;
  background:
    linear-gradient(132deg, transparent 0 35%, white 36% 39%, transparent 40%),
    linear-gradient(150deg, transparent 0 28%, var(--ink-dark) 29% 33%, transparent 34%),
    var(--ink);
  clip-path: polygon(0 100%, 20% 52%, 31% 73%, 55% 12%, 100% 100%);
}

.mountain::after {
  left: -18%;
  width: 78%;
  height: 76%;
  opacity: 0.82;
  background:
    linear-gradient(132deg, transparent 0 35%, white 36% 39%, transparent 40%),
    var(--ink);
  clip-path: polygon(0 100%, 24% 48%, 42% 68%, 67% 20%, 100% 100%);
}

.panel-lines {
  background:
    linear-gradient(90deg, rgba(243, 238, 47, 0.75) 1px, transparent 1px),
    linear-gradient(rgba(243, 238, 47, 0.75) 1px, transparent 1px),
    white;
  background-size: 20px 20px;
  animation: gridShift 7s linear infinite;
}

.panel-lines span,
.panel-wave::before {
  position: absolute;
  left: -4%;
  right: -4%;
  height: 40px;
  border-top: 3px solid var(--ink);
  border-radius: 50%;
}

.panel-lines span:nth-child(1) { top: 24px; }
.panel-lines span:nth-child(2) { top: 34px; }
.panel-lines span:nth-child(3) { top: 44px; }
.panel-lines span:nth-child(4) { top: 54px; }
.panel-lines span:nth-child(5) { top: 64px; }

.panel-lines span {
  animation: waveLine 4s ease-in-out infinite alternate;
}

.panel-lines span:nth-child(2) { animation-delay: 120ms; }
.panel-lines span:nth-child(3) { animation-delay: 240ms; }
.panel-lines span:nth-child(4) { animation-delay: 360ms; }
.panel-lines span:nth-child(5) { animation-delay: 480ms; }

.panel-wave {
  min-height: 120px;
  background:
    radial-gradient(circle at 14px 14px, var(--ink) 2px, transparent 3px),
    white;
  background-size: 30px 30px;
  animation: dotDrift 9s linear infinite;
}

.panel-wave::before {
  content: "";
  top: 34px;
  height: 62px;
  animation: waveLine 4.5s ease-in-out infinite alternate;
  box-shadow:
    0 10px 0 -2px white,
    0 13px 0 -1px var(--ink),
    0 23px 0 -2px white,
    0 26px 0 -1px var(--ink),
    0 36px 0 -2px white,
    0 39px 0 -1px var(--ink);
}

.panel-noise {
  display: grid;
  align-items: end;
  min-height: 120px;
  color: var(--yellow);
  background:
    radial-gradient(circle at 20% 10%, var(--yellow) 0 3px, transparent 4px),
    radial-gradient(circle at 70% 32%, var(--yellow) 0 5px, transparent 6px),
    radial-gradient(circle at 42% 68%, var(--yellow) 0 4px, transparent 5px),
    var(--ink);
  background-size: 38px 28px, 60px 46px, 44px 36px, auto;
  animation: noiseMove 5s steps(4) infinite;
}

.panel-noise p {
  margin: 0;
  padding: 14px;
  color: white;
  background: rgba(32, 32, 79, 0.7);
}

.tagline {
  margin: 18px 0 0;
  border-top: 3px solid var(--line);
  border-bottom: 3px solid var(--line);
  padding: 12px 0;
  color: var(--ink);
  font-size: clamp(18px, 3vw, 28px);
  overflow: hidden;
  white-space: nowrap;
  animation: taglineReveal 900ms 420ms ease both;
}

.section {
  margin: 0 0 56px;
  padding: 42px 0 0;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 650ms ease, transform 650ms ease;
}

.section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.section-title {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  background: var(--yellow);
  border: 2px solid var(--yellow);
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
}

.section-title::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  transform: translateX(-100%);
}

.section.is-visible .section-title::after {
  animation: shineSweep 1.2s ease both;
}

.section-title span {
  flex: 0 0 auto;
  writing-mode: vertical-rl;
  padding: 8px 4px;
  color: white;
  background: var(--ink);
  font-size: 11px;
}

h2 {
  flex: 1 1 auto;
  margin: 0;
  font-size: clamp(44px, 8vw, 84px);
  line-height: 0.9;
  color: var(--ink);
}

.section-top {
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}

.section-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.section-detail {
  color: var(--ink-dark);
  background: var(--paper);
}

.section-detail::after {
  content: ">";
  margin-left: 8px;
}

.section-top::before {
  content: "^";
  margin-right: 8px;
}

.affairs-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  margin: -6px 0 20px;
  padding: 16px 18px;
  border: 2px solid var(--line);
  background: var(--yellow);
  box-shadow: var(--shadow);
}

.affairs-tags a,
.affairs-tags span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  color: var(--ink);
  font: 900 15px/1.35 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  transition: color 180ms ease, transform 180ms ease;
}

.affairs-tags a:not(:last-child)::after,
.affairs-tags span:not(:last-child)::after {
  content: "｜";
  margin-left: 18px;
  color: var(--ink);
}

.affairs-tags a:hover {
  color: var(--pink);
  transform: translateY(-2px);
}

.home-layout,
.affairs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 20px;
}

.block {
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.links-block {
  grid-column: 1 / -1;
}

.honor-block,
.officers-block {
  display: flex;
  flex-direction: column;
}

.honor-block .collapsible-content,
.officers-block .role-list {
  flex: 1;
}

.honor-block .honor-list,
.officers-block .role-list {
  min-height: var(--pair-content-height, 0);
}

.block:hover {
  transform: translate(-3px, -3px);
  box-shadow: 14px 14px 0 rgba(115, 111, 242, 0.22);
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px;
  border-bottom: 2px solid var(--line);
  background: var(--soft);
}

button.block-head {
  width: 100%;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.collapse-toggle span::after {
  content: " -";
}

.collapse-toggle[aria-expanded="false"] span::after {
  content: " +";
}

.collapsible-closed .role-list {
  display: none;
}

.collapsible-closed .collapsible-content {
  display: none;
}

.collapsible-closed .block-head {
  border-bottom: 0;
}

.block-head p,
.block-head span {
  margin: 0;
  font-size: 14px;
}

.calendar-frame {
  height: 440px;
  background: white;
}

.calendar-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.notes-block {
  min-height: 494px;
}

.note-label {
  display: block;
  padding: 16px 16px 0;
  color: var(--pink);
}

textarea {
  display: block;
  width: calc(100% - 32px);
  min-height: 346px;
  margin: 12px 16px;
  resize: vertical;
  border: 2px solid var(--line);
  padding: 14px;
  color: var(--ink-dark);
  background:
    repeating-linear-gradient(white 0 35px, rgba(115, 111, 242, 0.18) 36px),
    white;
  font: 700 16px/1.7 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

textarea[readonly] {
  cursor: default;
  color: rgba(32, 32, 79, 0.72);
  background:
    repeating-linear-gradient(#fffdf4 0 35px, rgba(115, 111, 242, 0.14) 36px),
    #fffdf4;
}

.admin-note-label {
  display: block;
  margin-bottom: 8px;
  color: var(--pink);
  font: 800 13px/1.4 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.admin-note-editor {
  width: 100%;
  min-height: 260px;
  margin: 0;
}

.note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 16px 16px;
}

.note-status {
  margin: 0;
  font: 700 13px/1.5 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  transition: color 180ms ease, transform 180ms ease;
}

.note-status.is-active {
  color: var(--pink);
  transform: translateX(4px);
}

.note-detail-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  white-space: nowrap;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: white;
  padding: 6px 12px;
  font: 800 13px/1.3 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.note-detail-link::after {
  content: ">";
  margin-left: 8px;
}

.note-detail-link:hover {
  background: var(--pink);
  box-shadow: 4px 4px 0 var(--yellow);
  transform: translate(-2px, -2px);
}

.teacher-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 160px;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
  padding: 18px 20px;
  color: var(--ink-dark);
  background: #f8c9dc;
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 var(--yellow);
}

.teacher-strip p,
.teacher-strip dl,
.teacher-strip dt,
.teacher-strip dd,
.teacher-photo {
  margin: 0;
}

.eyebrow {
  color: var(--ink);
  font-size: 12px;
}

.teacher-info {
  display: grid;
  gap: 10px;
  font: 800 18px/1.45 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.teacher-info div {
  display: grid;
  grid-template-columns: 132px 44px 1fr;
  gap: 0;
  min-height: 44px;
  align-items: center;
  min-width: 0;
}

.teacher-info div::before {
  content: "｜";
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  color: var(--ink);
}

.teacher-info dd {
  grid-column: 3;
  min-width: 0;
  overflow-wrap: anywhere;
}

.teacher-info dt {
  grid-column: 1;
  text-align: right;
  color: var(--ink);
}

.teacher-info dt::after {
  content: none;
}

.teacher-info a {
  color: var(--ink-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.teacher-photo {
  justify-self: end;
  width: 160px;
  aspect-ratio: 1 / 1;
  border: 3px solid var(--ink);
  background: var(--yellow);
  box-shadow: 6px 6px 0 rgba(115, 111, 242, 0.22);
  overflow: hidden;
}

.teacher-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.board {
  width: min(520px, calc(100% - 32px));
  margin: 18px auto;
  padding: 14px;
  text-align: center;
  color: var(--yellow);
  background: var(--ink);
  border: 4px solid var(--yellow);
  animation: boardPulse 2.8s ease-in-out infinite;
}

.seating-block {
  overflow-x: auto;
}

.seating-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  min-width: 720px;
  padding: 0 18px 22px;
}

.seating-chart div {
  display: grid;
  grid-template-rows: auto auto;
  gap: 6px;
  min-height: 72px;
  place-items: center;
  text-align: center;
  color: var(--ink-dark);
  background: white;
  border: 2px solid var(--line);
  font: 800 14px/1.35 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.seat-number {
  font-size: 12px;
  line-height: 1.2;
}

.seat-name {
  font-size: 14px;
  line-height: 1.25;
}

.seating-chart div:hover {
  box-shadow: 5px 5px 0 var(--ink);
  filter: saturate(1.15);
  transform: translate(-2px, -5px) rotate(-1deg);
}

.timetable-block {
  grid-row: span 2;
}

.timetable-block.collapsible-closed {
  grid-row: auto;
}

.covenant-block,
.leave-block {
  grid-column: 1 / -1;
}

.cleaning-block {
  grid-column: 1 / -1;
}

.timetable {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  color: var(--ink-dark);
  font: 800 14px/1.35 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.timetable th:first-child,
.timetable td:first-child {
  width: 68px;
}

.timetable th:nth-child(2),
.timetable td:nth-child(2) {
  width: 132px;
}

.timetable th,
.timetable td {
  border: 2px solid var(--line);
  padding: 14px 10px;
  text-align: center;
}

.timetable thead th {
  background: var(--yellow);
  color: var(--ink);
}

.timetable tbody th {
  background: var(--soft);
  color: var(--pink);
}

.timetable .period-time,
.schedule-editor .period-time {
  color: var(--ink-dark);
  background: var(--soft);
  white-space: nowrap;
}

.timetable td.merged-period {
  text-align: center;
}

.timetable .period-time {
  min-width: 0;
  font-size: 13px;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.quick-links a,
.quick-links .quick-link-card {
  display: grid;
  gap: 6px;
  min-height: 86px;
  align-content: center;
  padding: 14px;
  color: var(--ink-dark);
  background: white;
  border: 2px solid var(--line);
  font: 800 14px/1.35 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.quick-links a:hover,
.quick-links .quick-link-card:hover {
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
  transform: translate(-2px, -4px);
}

.quick-link-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.quick-link-actions a {
  flex: 1;
  min-height: unset;
  padding: 5px 8px;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--ink-dark);
  font-size: 12px;
  text-align: center;
  transition: background-color 150ms ease, color 150ms ease;
}

.quick-link-actions a:hover {
  background: var(--ink);
  color: white;
  box-shadow: none;
  transform: none;
}

.quick-links b {
  color: var(--ink);
  font-size: 18px;
}

.quick-links span {
  color: var(--pink);
}

.role-list {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.role-list p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 10px 12px;
  color: var(--ink-dark);
  border: 2px solid var(--line);
  background: var(--paper);
  font: 800 14px/1.4 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  transition: transform 180ms ease;
}

.role-list p:hover {
  transform: translateX(6px);
}

.role-list p:nth-child(even) {
  background: var(--cyan);
}

.role-list p.officer-item {
  display: grid;
  gap: 8px;
  width: 100%;
  align-items: stretch;
  position: relative;
}

.role-list .officer-main {
  display: block;
  width: 100%;
  min-width: 0;
  padding-right: 180px;
}

.role-list .officer-main > span {
  position: absolute;
  top: 10px;
  right: 12px;
  min-width: 160px;
  text-align: right;
}

.role-list .officer-duty {
  display: block;
  padding-top: 6px;
  border-top: 1px dashed rgba(115, 111, 242, 0.45);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.cleaning-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.cleaning-group {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.cleaning-group-list {
  display: grid;
  gap: 8px;
}

.cleaning-group[data-area="內掃"] .cleaning-group-list p:nth-child(odd),
.cleaning-group[data-area="內掃"] .cleaning-group-list p:nth-child(even) {
  background: #fff9c9;
}

.cleaning-group[data-area="外掃"] .cleaning-group-list p:nth-child(odd),
.cleaning-group[data-area="外掃"] .cleaning-group-list p:nth-child(even) {
  background: #ffe3ef;
}

.cleaning-group-title {
  margin: 4px 0 0;
  padding: 4px 2px;
  color: var(--ink);
  font: 900 16px/1.4 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.cleaning-check-panel {
  margin: 0 16px 16px;
  border: 2px solid var(--line);
  background: var(--yellow);
}

.cleaning-check-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 2px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.cleaning-check-head p,
.cleaning-check-status {
  margin: 0;
}

.cleaning-check-head p {
  font-size: 13px;
}

.cleaning-check-status {
  padding: 12px 14px 0;
  color: var(--ink-dark);
  font: 800 13px/1.45 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.cleaning-check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.cleaning-check-group {
  display: grid;
  gap: 10px;
  align-content: start;
}

.cleaning-check-group[data-check-area="內掃"] {
  grid-column: 1;
}

.cleaning-check-group[data-check-area="外掃"] {
  grid-column: 2;
}

.cleaning-check-group h4 {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  justify-content: space-between;
  margin: 0;
  color: var(--ink);
  font: 900 16px/1.4 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.cleaning-check-group h4 span {
  color: var(--ink);
  font-size: 13px;
}

.cleaning-check-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
  align-items: start;
  padding: 10px 12px;
  color: var(--ink-dark);
  border: 2px solid var(--line);
  background: var(--paper);
  font: 800 13px/1.4 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.cleaning-check-item[data-area="內掃"] {
  background: #fff9c9;
}

.cleaning-check-item[data-area="外掃"] {
  background: #ffe3ef;
}

.cleaning-check-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}

.cleaning-check-item span {
  grid-column: 2;
  color: var(--ink);
}

.flow {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 16px;
  list-style: none;
  color: var(--ink-dark);
  font: 800 15px/1.55 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.leave-manual-wrap {
  padding: 16px 16px 0;
}

.leave-manual-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: white;
  padding: 7px 14px;
  font: 800 13px/1.3 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.leave-manual-link::after {
  content: ">";
  margin-left: 8px;
}

.leave-manual-link:hover {
  background: var(--pink);
  box-shadow: 4px 4px 0 var(--yellow);
  transform: translate(-2px, -2px);
}

.leave-notes {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 8px 16px 0 38px;
  color: var(--ink-dark);
  font: 900 14px/1.55 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.section-manual-wrap {
  margin: -4px 0 20px;
}

.section-manual-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: white;
  padding: 7px 14px;
  font: 800 13px/1.3 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.section-manual-link::after {
  content: ">";
  margin-left: 8px;
}

.section-manual-link:hover {
  background: var(--pink);
  box-shadow: 4px 4px 0 var(--yellow);
  transform: translate(-2px, -2px);
}

.makeup-block {
  margin-top: 20px;
}

.requirement-note {
  margin: 0;
  padding: 16px 16px 0;
  color: var(--pink);
  font: 900 15px/1.45 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.flow > li {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: start;
  transition: transform 180ms ease;
}

.flow > li:hover {
  transform: translateX(6px);
}

.flow > li > span {
  display: inline-grid;
  height: 34px;
  place-items: center;
  color: var(--paper);
  background: var(--pink);
  border: 2px solid var(--line);
}

.compact-flow {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.covenant-flow {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.covenant-flow > li {
  grid-template-columns: 58px 1fr;
  gap: 14px;
}

.covenant-item {
  display: grid;
  gap: 6px;
}

.covenant-title,
.covenant-summary,
.covenant-detail {
  margin: 0;
}

.covenant-title {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.covenant-detail {
  color: var(--pink);
  font-size: 14px;
  line-height: 1.4;
}

.covenant-sublist {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 4px;
}

.covenant-signature {
  margin: 0 16px 16px;
  border: 2px solid var(--line);
  background: var(--yellow);
}

.signature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 2px solid var(--line);
  color: var(--ink);
}

.signature-head p,
.signature-head span,
.signature-status {
  margin: 0;
}

.signature-head p {
  font-size: 13px;
}

.signature-form {
  display: grid;
  grid-template-columns: 120px minmax(180px, 1fr) auto;
  gap: 10px;
  padding: 14px;
}

.signature-form label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font: 900 13px/1.3 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.signature-form input {
  min-height: 42px;
  width: 100%;
  border: 2px solid var(--line);
  background: var(--paper);
  color: var(--ink-dark);
  padding: 8px 10px;
  font: 800 16px/1.2 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.signature-form button {
  align-self: end;
  min-height: 42px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.signature-form button:hover {
  background: var(--pink);
  box-shadow: 4px 4px 0 var(--paper);
  transform: translate(-2px, -2px);
}

.signature-status {
  padding: 0 14px 12px;
  color: var(--ink-dark);
  font: 800 13px/1.45 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.signature-missing {
  display: grid;
  gap: 6px;
  margin: 0 14px 12px;
  padding: 10px 12px;
  color: var(--ink-dark);
  border: 2px solid var(--line);
  background: #fffdf4;
  font: 800 13px/1.5 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.signature-missing b {
  color: var(--pink);
}

.signature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}

.signature-list p {
  margin: 0;
  padding: 8px 10px;
  color: var(--ink-dark);
  border: 2px solid var(--line);
  background: var(--paper);
  font: 800 13px/1.3 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.honor-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px;
  color: var(--ink-dark);
  font: 800 14px/1.45 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.honor-list li {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 12px;
  border: 2px solid var(--line);
  background: var(--paper);
}

.honor-list li:nth-child(odd) {
  background: var(--yellow);
}

.honor-list b {
  color: var(--ink);
  font-size: 16px;
}

.honor-list span {
  color: var(--ink-dark);
}

.honor-list {
  list-style: none;
}

.list-height-collapsed {
  overflow: hidden;
}

.list-fold-actions {
  display: flex;
  justify-content: center;
  padding: 0 16px 16px;
}

.list-fold-toggle {
  min-height: 34px;
  border: 2px solid var(--ink);
  background: white;
  color: var(--ink);
  padding: 6px 14px;
  font: 800 13px/1.3 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.list-fold-toggle:hover {
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
  transform: translate(-2px, -2px);
}

.collapsible-closed .list-fold-actions {
  display: none;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding: 20px 0;
  border-top: 3px solid var(--line);
}

.footer p {
  margin: 0;
}

.footer-copy {
  display: grid;
  gap: 6px;
}

.footer-credit {
  color: var(--ink-dark);
  font: 700 13px/1.4 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.admin-panel {
  position: fixed;
  inset: 0;
  display: grid;
  align-items: end;
  justify-items: end;
  padding: 18px;
  background: rgba(32, 32, 79, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 20;
}

.admin-panel.is-open {
  opacity: 1;
  pointer-events: auto;
}

.admin-card {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  color: var(--ink-dark);
  background:
    linear-gradient(90deg, rgba(115, 111, 242, 0.1) 1px, transparent 1px),
    linear-gradient(rgba(115, 111, 242, 0.1) 1px, transparent 1px),
    var(--paper);
  background-size: 22px 22px;
  border: 3px solid var(--line);
  box-shadow: 12px 12px 0 rgba(32, 32, 79, 0.25);
  transform: translateY(20px);
  transition: transform 180ms ease;
}

.admin-panel.is-open .admin-card {
  transform: translateY(0);
}

.admin-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px 16px;
  color: white;
  background: var(--ink);
  border-bottom: 3px solid var(--yellow);
}

.admin-head p,
.admin-head h3,
.admin-message {
  margin: 0;
}

.admin-head p {
  color: var(--yellow);
  font-size: 12px;
}

.admin-head h3 {
  font-size: 24px;
}

.admin-close,
.login-row button,
.admin-actions button,
.logout-button,
.admin-tabs button {
  min-height: 36px;
  border: 2px solid var(--ink);
  color: white;
  background: var(--ink);
  padding: 7px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.admin-close:hover,
.login-row button:hover,
.admin-actions button:hover,
.logout-button:hover,
.admin-tabs button:hover,
.admin-tabs button.is-active {
  background: var(--pink);
  box-shadow: 4px 4px 0 var(--yellow);
  transform: translate(-2px, -2px);
}

.login-form,
.admin-tools {
  padding: 16px;
}

.login-form label,
.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--pink);
  font: 800 13px/1.4 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.login-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.login-row input,
.field input {
  width: 100%;
  min-height: 40px;
  border: 2px solid var(--line);
  padding: 8px 10px;
  color: var(--ink-dark);
  background: white;
  font: 800 14px/1.4 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.admin-message {
  margin-top: 10px;
  color: var(--ink);
  font: 800 13px/1.45 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.admin-message.is-error {
  color: #c22d68;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.admin-section {
  display: none;
}

.admin-section.is-active {
  display: block;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  min-width: 720px;
}

.field {
  padding: 10px;
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.field small {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.pair-editor {
  display: grid;
  gap: 10px;
}

.pair-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.42fr) minmax(160px, 0.58fr);
  gap: 10px;
  padding: 10px;
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.pair-row-with-delete {
  grid-template-columns: minmax(120px, 0.42fr) minmax(160px, 0.58fr) auto;
}

.pair-row label {
  display: block;
  margin-bottom: 6px;
  color: var(--pink);
  font: 800 13px/1.4 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.pair-row input {
  width: 100%;
  min-height: 40px;
  border: 2px solid var(--line);
  padding: 8px 10px;
  color: var(--ink-dark);
  background: white;
  font: 800 14px/1.4 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.pair-row select {
  width: 100%;
  min-height: 40px;
  border: 2px solid var(--line);
  padding: 8px 10px;
  color: var(--ink-dark);
  background: white;
  font: 800 14px/1.4 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.cleaning-editor-row {
  grid-template-columns: minmax(0, 1fr) 84px minmax(0, 0.72fr) auto;
  justify-content: stretch;
  width: 100%;
  max-width: 100%;
}

.cleaning-editor-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.cleaning-editor-column {
  border: 2px solid var(--line);
  padding: 10px;
  background: rgba(255, 255, 255, 0.72);
  min-width: 0;
}

.cleaning-editor-column h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font: 900 15px/1.35 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.cleaning-editor-list {
  display: grid;
  gap: 10px;
  justify-items: stretch;
}

.cleaning-editor-row > div {
  min-width: 0;
}

.cleaning-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.officer-editor-row {
  grid-template-columns: minmax(120px, 0.24fr) minmax(120px, 0.24fr) minmax(220px, 0.42fr) auto;
}

.officer-row-actions {
  display: flex;
  align-items: end;
}

.pair-row-actions {
  display: flex;
  align-items: end;
}

.row-delete-button {
  min-height: 40px;
  border: 2px solid var(--ink);
  background: var(--ink-dark);
  color: white;
  padding: 8px 12px;
  font: 800 13px/1.3 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.row-delete-button:hover {
  background: var(--pink);
  box-shadow: 4px 4px 0 var(--yellow);
  transform: translate(-2px, -2px);
}

.row-delete-icon {
  min-width: 44px;
  padding: 8px 10px;
  font-size: 18px;
  line-height: 1;
}

.schedule-editor {
  overflow-x: auto;
  border: 2px solid var(--line);
  background: white;
}

.schedule-editor table {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
}

.schedule-editor th,
.schedule-editor td {
  border: 2px solid var(--line);
  padding: 8px;
}

.schedule-editor th {
  color: var(--ink);
  background: var(--yellow);
}

.schedule-editor input {
  width: 100%;
  min-height: 36px;
  border: 2px solid rgba(115, 111, 242, 0.55);
  padding: 6px 8px;
  color: var(--ink-dark);
  font: 800 13px/1.35 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.roster-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 10px;
}

.roster-row input[type="file"] {
  width: 100%;
  min-height: 40px;
  border: 2px solid var(--line);
  padding: 6px 8px;
  background: white;
}

.roster-textarea {
  min-height: 120px;
}

.honor-title-list li {
  gap: 0;
}

.honor-title-list li b {
  font-size: 18px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.admin-signature-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 12px;
  border: 2px solid var(--line);
  background: var(--paper);
}

.admin-signature-list p {
  margin: 0;
  padding: 8px 10px;
  color: var(--ink-dark);
  border: 2px solid var(--line);
  background: white;
  font: 800 13px/1.35 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.logout-button {
  width: 100%;
  margin-top: 16px;
  background: var(--ink-dark);
}

@keyframes gridDrift {
  from { background-position: 0 0, 0 0, 0 0; }
  to { background-position: 28px 28px, 28px 28px, 0 0; }
}

@keyframes marqueeLine {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@keyframes titleDrop {
  from { opacity: 0; transform: translateY(-22px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes panelPop {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mountainSlide {
  from { transform: translateX(-10px); }
  to { transform: translateX(10px); }
}

@keyframes gridShift {
  from { background-position: 0 0, 0 0, 0 0; }
  to { background-position: 20px 0, 0 20px, 0 0; }
}

@keyframes waveLine {
  from { transform: translateX(-12px) translateY(0); }
  to { transform: translateX(12px) translateY(4px); }
}

@keyframes dotDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 30px 30px, 0 0; }
}

@keyframes noiseMove {
  0% { background-position: 0 0, 0 0, 0 0, 0 0; }
  100% { background-position: 38px 28px, -60px 46px, 44px -36px, 0 0; }
}

@keyframes taglineReveal {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes shineSweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@keyframes boardPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(243, 238, 47, 0); }
  50% { box-shadow: 0 0 0 6px rgba(243, 238, 47, 0.28); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .section {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 820px) {
  .site-header,
  main,
  .footer {
    width: min(100% - 24px, 680px);
  }

  .nav-bar,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .teacher-strip {
    grid-template-columns: 1fr;
  }

  .teacher-photo {
    justify-self: start;
    width: min(220px, 100%);
  }

  .teacher-info div {
    grid-template-columns: 112px 40px 1fr;
  }

  .hero-grid,
  .home-layout,
  .affairs-grid,
  .compact-flow,
  .covenant-flow,
  .signature-form,
  .cleaning-check-list {
    grid-template-columns: 1fr;
  }

  .role-list .officer-main {
    padding-right: 120px;
  }

  .role-list .officer-main > span {
    min-width: 110px;
  }

  .cleaning-check-group[data-check-area="內掃"],
  .cleaning-check-group[data-check-area="外掃"] {
    grid-column: auto;
  }

  .panel {
    min-height: 128px;
  }

  .calendar-frame {
    height: 360px;
  }

}

@media (max-width: 520px) {
  .nav-links {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .brand {
    width: 100%;
  }

  .nav-links a {
    justify-content: space-between;
  }

  .admin-open {
    justify-content: space-between;
    width: 100%;
  }

  .note-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .note-detail-link {
    justify-content: center;
    width: 100%;
  }

  h1 {
    font-size: 46px;
  }

  .section-title {
    padding: 12px;
    flex-wrap: wrap;
  }

  h2 {
    font-size: 42px;
  }

  .section-top {
    justify-content: center;
    width: 100%;
  }

  .section-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .section-detail {
    justify-content: center;
  }

  .timetable {
    min-width: 620px;
  }

  .timetable-block {
    overflow-x: auto;
  }

  .quick-links {
    grid-template-columns: 1fr;
  }

  .cleaning-columns {
    grid-template-columns: 1fr;
  }

  .admin-panel {
    padding: 10px;
  }

  .honor-block .honor-list,
  .officers-block .role-list {
    min-height: 0;
  }

  .admin-card {
    max-height: calc(100vh - 20px);
  }

  .login-row {
    grid-template-columns: 1fr;
  }

  .pair-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 40px;
  }
}
