:root {
  color-scheme: light;
  --ink: #273043;
  --secondary: #4d5d73;
  --action: #344963;
  --focus: #355a88;
  --line: #d8dfea;
  --panel: #fafbfe;
  --pc-scene-background: #f8f9fc;
  color: var(--ink);
  background: #f6f7fa;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 50% 41%, #fff 0%, #f8f9fc 48%, #edf0f5 100%);
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--action); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
ul, ol { padding: 0; margin: 0; }
.skip-link {
  position: absolute;
  z-index: 4;
  top: 8px;
  left: 8px;
  padding: 12px 16px;
  border-radius: 9px;
  background: var(--panel);
  transform: translateY(calc(-100% - 12px));
}
.skip-link:focus { transform: none; }
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 1160px);
  margin-inline: auto;
  padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 4px max(14px, env(safe-area-inset-left));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.045em;
  text-decoration: none;
}
.site-actions { display: flex; align-items: center; gap: 5px; }
.account-link { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #e7ebf0; }
.account-link svg { width: 21px; height: 21px; }
.chip, .site-nav a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: #e7ebf0;
  color: var(--action);
  font-size: .86rem;
  font-weight: 650;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}
.chip:hover, .account-link:hover, .site-nav a:hover { background: #dce4ef; }
.chip.primary { background: var(--action); color: white; }
.site-main { flex: 1; display: grid; min-width: 0; }
.site-main > .view-enter {
  display: grid;
  align-content: center;
  justify-items: center;
  min-width: 0;
  gap: 10px;
  padding-block: clamp(14px, 3vh, 30px) 10px;
}
.page-heading { width: min(calc(100% - 24px), 640px); text-align: center; }
.page-heading h1 { font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 680; letter-spacing: -.03em; }
.page-heading p { margin-top: 3px; color: var(--secondary); font-size: .85rem; line-height: 1.5; }

.pc-paper-flow {
  --card: min(370px, calc(100vw - 78px), clamp(238px, 43vh, 370px));
  --cover-top: 13px;
  width: 100%;
  height: auto;
}
.pc-paper-flow .pc-flow-viewport { height: calc(var(--cover-top) + var(--card) * 1.25); }
.pc-paper-flow .pc-caption { position: static; margin: 0 auto; width: min(calc(100% - 24px), 490px); }
.pc-paper-flow .pc-caption-title { font-size: clamp(1.05rem, 3vw, 1.44rem); }
.pc-paper-flow .pc-caption-subject { margin-top: 2px; color: var(--secondary); font-size: .83rem; }
.pc-paper-flow .pc-cover { cursor: pointer; }
.pc-cover-tab {
  display: none;
  position: absolute;
  z-index: 1;
  top: 11%;
  color: #273043;
  font-size: clamp(12px, calc(var(--card) * .044), 16px);
  font-weight: 700;
  writing-mode: vertical-rl;
  text-orientation: upright;
}
.pc-paper-flow .pc-cover[aria-hidden="true"] .pc-cover-tab { display: block; }
.pc-paper-flow .pc-cover[aria-hidden="true"] :is(.pc-head, .pc-title, .pc-paper-lines, .pc-paper-foot) { opacity: 0; }
.pc-cover[data-flow-side="left"] .pc-cover-tab { left: 7%; }
.pc-cover[data-flow-side="right"] .pc-cover-tab { right: 7%; }
.pc-reflection .pc-cover-tab { display: none !important; }
.pc-paper-flow .pc-head { gap: 7px; }
.pc-paper-flow .pc-head > span:first-child { font-size: clamp(13px, calc(var(--card) * .047), 16px); }
.pc-paper-flow .pc-head > span:last-child { max-width: 53%; font-size: clamp(11px, calc(var(--card) * .039), 14px); }
.pc-paper-flow .pc-title { flex: 0 0 auto; font-size: clamp(18px, calc(var(--card) * .08), 30px); }
.pc-paper-flow .pc-face { gap: calc(var(--card) * .033); contain: layout paint; }
.pc-paper-lines { position: relative; display: grid; min-height: 0; gap: calc(var(--card) * .026); overflow: hidden; }
.pc-paper-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: baseline;
  min-width: 0;
  padding-top: calc(var(--card) * .027);
  border-top: 1px solid #27304326;
  font-size: clamp(12px, calc(var(--card) * .044), 16px);
  line-height: 1.38;
}
.pc-paper-line > span { color: #39485d; font-size: .91em; white-space: nowrap; }
.pc-paper-line b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-weight: 650; }
.pc-paper-line b:only-child { grid-column: 1 / -1; }
.pc-paper-foot { display: flex; justify-content: space-between; gap: 6px; color: #344963; font-size: clamp(12px, calc(var(--card) * .04), 14px); }
.pc-paper-flow .pc-scene:focus-visible { outline: none; }
.pc-paper-flow .pc-scene:focus-visible .pc-cover[data-current="true"] .pc-title { text-decoration: none; }
.pc-paper-flow .pc-flow-viewport::after {
  --pc-edge-fade: clamp(13px, 7%, 80px);
}
.pc-paper-flow .pc-reflection {
  mask-image: linear-gradient(#0003, #0001 12%, transparent 25%);
  -webkit-mask-image: linear-gradient(#0003, #0001 12%, transparent 25%);
}

.date-navigation { display: grid; gap: 5px; width: min(calc(100% - 22px), 460px); }
.week-controls { display: grid; grid-template-columns: 44px 1fr 44px auto; align-items: center; gap: 5px; }
.week-controls p { color: var(--ink); font-size: .84rem; font-weight: 660; text-align: center; }
.week-arrow { font-size: 21px; }
.week-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; list-style: none; }
.week-days a { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0 3px; width: 100%; min-height: 44px; border-radius: 9px; font-size: .82rem; text-decoration: none; }
.week-days a:hover { background: #e7ebf0; }
.week-days a[aria-current="date"] { color: #fff; background: var(--action); }
.flow-tools { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 12px; }
.page-footer {
  padding: 7px max(7px, env(safe-area-inset-right)) max(11px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
}
.site-nav { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px; }
.site-nav a { padding: 5px clamp(3px, 1.1vw, 11px); background: transparent; white-space: nowrap; font-size: clamp(.75rem, 2.9vw, .88rem); }
.site-nav a[aria-current="page"] { background: #e4eaf3; color: var(--ink); }

dialog {
  width: min(calc(100% - 28px), 440px);
  max-height: calc(100% - 28px);
  padding: 21px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #fff;
  border-radius: 20px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 90px #27304330;
}
dialog::backdrop { background: #202a4266; backdrop-filter: blur(8px); }
.school-detail { width: min(calc(100% - 28px), 610px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.dialog-heading h2 { font-size: clamp(1.2rem, 4vw, 1.55rem); }
.dialog-close { flex: 0 0 44px; min-height: 44px; margin-top: -8px; border: 0; border-radius: 50%; color: var(--action); background: transparent; font-size: 25px; }
.dialog-close:hover { background: #e4eaf3; }
.dialog-body { line-height: 1.6; }
.dialog-body [data-retry] { margin-top: 12px; }
.paper-section + .paper-section { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.paper-section h3 { margin-bottom: 4px; font-size: 1rem; }
.paper-rows { list-style: none; }
.paper-rows > li + li { border-top: 1px solid var(--line); }
.paper-note, .paper-rows small, .paper-meals small { color: var(--secondary); font-size: .87rem; }
.paper-copy { white-space: pre-wrap; }
.paper-event { padding-block: 7px; }
.paper-event .paper-copy { margin-top: 5px; }
.paper-link { display: inline-flex; align-items: center; min-height: 44px; gap: 5px; font-size: .88rem; font-weight: 650; text-decoration: none; }
.paper-link:hover { text-decoration: underline; }
.assignment-link { display: flex; justify-content: space-between; gap: 12px; padding-block: 8px; }
.assignment-link strong, .assignment-link small { display: block; overflow-wrap: anywhere; }
.assignment-deadline { flex: none; font-variant-numeric: tabular-nums; }
.paper-meals { padding-left: 1.15em; }
.paper-meals li { padding-block: 3px; }
.paper-meals small { display: block; }
.lesson-rows > li { display: grid; grid-template-columns: 54px 1fr; gap: 8px; padding: 7px 4px; }
.lesson-rows > li > span { color: var(--secondary); }
.current-lesson { background: #edf1f7; }
.class-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 15px; }
.class-fields select { display: block; width: 100%; margin-top: 6px; padding: 7px; min-height: 44px; border: 1px solid #cbd5e4; border-radius: 8px; background: white; }
@media (max-width: 430px) {
  .site-main > .view-enter { gap: 7px; padding-top: 10px; }
  .pc-paper-flow { --cover-top: 8px; }
  .school-detail { padding: 16px; }
}
