:root {
  --blue: #1463ff;
  --blue-deep: #0a2f7f;
  --blue-soft: #dbe9ff;
  --sky: #75c9ff;
  --ink: #101828;
  --paper: #f7f5ed;
  --white: #fffef8;
  --yellow: #ffd84d;
  --red: #ff5d5d;
  --mint: #7ee6cf;
  --muted: #5b6576;
  --border: 3px solid var(--ink);
  --shadow: 7px 7px 0 var(--ink);
  --shadow-small: 4px 4px 0 var(--ink);
  --radius: 14px;
  --font-display: 'Bangers', Impact, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: rgba(0,0,0,0); }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 20%, rgba(20,99,255,.08) 0 2px, transparent 3px) 0 0/28px 28px,
    var(--paper);
  font-family: var(--font-body);
  line-height: 1.55;
  overflow-x: hidden;
}
body::selection { background: var(--yellow); color: var(--ink); }
button, input, textarea, select { font: inherit; }
a { color: inherit; }
img { max-width: 100%; display: block; }

.paper-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: .13;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.comic-section { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 88px 0; }
.comic-panel { background: var(--white); border: var(--border); box-shadow: var(--shadow); border-radius: var(--radius); }
.eyebrow { margin: 0 0 8px; font-weight: 900; letter-spacing: .13em; font-size: .78rem; color: var(--blue-deep); }
.issue-tag { display: inline-block; padding: 7px 13px; background: var(--yellow); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font-size: .72rem; font-weight: 900; letter-spacing: .08em; transform: rotate(-1.5deg); }

.comic-button {
  appearance: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 20px;
  border: var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow-small);
  font-weight: 900;
  letter-spacing: .035em;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.comic-button:hover { transform: translate(-2px,-2px) rotate(-.4deg); box-shadow: 6px 6px 0 var(--ink); }
.comic-button:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--ink); }
.comic-button--primary { background: var(--blue); color: white; }
.comic-button--light { background: var(--white); }
.comic-button--small { min-height: 42px; font-size: .82rem; padding: 0 14px; }
.comic-button--wide { width: 100%; }
.comic-button:disabled { cursor: wait; opacity: .65; }

/* Login */
.login-page { min-height: 100vh; background: var(--blue); }
.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,.24) 0 2px, transparent 2.7px) 0 0/22px 22px;
  mask-image: linear-gradient(90deg, #000 0 55%, transparent 85%);
}
.speed-lines { position: fixed; width: 45vw; height: 45vw; opacity: .11; pointer-events: none; background: repeating-conic-gradient(from 0deg, white 0 1deg, transparent 1.5deg 8deg); border-radius: 50%; }
.speed-lines--left { left: -25vw; top: -10vw; }
.speed-lines--right { right: -28vw; bottom: -15vw; }
.login-shell { position: relative; z-index: 1; width: min(1120px, calc(100% - 32px)); min-height: 100vh; margin: auto; display: grid; grid-template-columns: 1.2fr .8fr; align-items: center; gap: 80px; padding: 54px 0; }
.login-story { color: white; position: relative; }
.login-story h1 { font: 400 clamp(4.7rem, 9vw, 8.4rem)/.78 var(--font-display); letter-spacing: .02em; margin: 28px 0 22px; -webkit-text-stroke: 2px var(--ink); text-shadow: 7px 7px 0 var(--ink); transform: rotate(-1deg); }
.login-story h1 span { color: var(--yellow); }
.login-lead { max-width: 610px; font-size: 1.18rem; font-weight: 800; text-shadow: 2px 2px 0 rgba(0,0,0,.2); }
.story-panels { display: grid; grid-template-columns: repeat(3,1fr); gap: 13px; margin-top: 42px; }
.mini-panel { min-height: 124px; padding: 15px; background: var(--white); color: var(--ink); border: var(--border); box-shadow: var(--shadow-small); display: flex; flex-direction: column; justify-content: flex-end; }
.mini-panel b { font: 2rem/1 var(--font-display); letter-spacing: .04em; }
.mini-panel span { font-size: .76rem; font-weight: 800; }
.mini-panel--one { transform: rotate(-2deg); background: var(--yellow); }
.mini-panel--two { transform: translateY(10px) rotate(1.5deg); }
.mini-panel--three { transform: rotate(-1deg); background: var(--mint); }
.login-card { position: relative; padding: 42px 38px 34px; transform: rotate(.7deg); }
.login-card h2 { font: 3.3rem/1 var(--font-display); letter-spacing: .035em; margin: 8px 0 10px; }
.login-card > p { color: var(--muted); font-weight: 700; }
.panel-kicker { color: var(--blue)!important; font-size: .7rem; letter-spacing: .12em; font-weight: 900!important; }
.login-card form { margin-top: 26px; }
.login-card label { display: block; font-weight: 900; margin-bottom: 7px; }
.pin-input-wrap { position: relative; }
.pin-input-wrap input { width: 100%; height: 64px; border: var(--border); border-radius: 8px; background: var(--blue-soft); padding: 0 58px 0 18px; font-size: 1.55rem; font-weight: 900; letter-spacing: .28em; outline: none; }
.pin-input-wrap input:focus { background: white; box-shadow: 0 0 0 4px rgba(20,99,255,.22); }
.peek-button { position: absolute; right: 8px; top: 8px; width: 48px; height: 48px; border: 0; background: transparent; cursor: pointer; font-size: 1.15rem; }
.form-message { min-height: 24px; margin: 8px 0 10px; color: #b42318!important; font-size: .82rem; font-weight: 800!important; }
.login-note { margin-top: 24px; display: flex; align-items: flex-start; gap: 10px; padding: 12px; background: var(--yellow); border: 2px dashed var(--ink); transform: rotate(-.4deg); }
.login-note > span { flex: 0 0 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: white; font-weight: 900; }
.login-note p { margin: 0; font-size: .76rem; font-weight: 800; }
.admin-link { display: block; margin-top: 22px; text-align: center; color: var(--muted); font-size: .78rem; font-weight: 800; }
.tape { position: absolute; width: 112px; height: 28px; background: rgba(255,216,77,.8); border-left: 1px solid rgba(0,0,0,.13); border-right: 1px solid rgba(0,0,0,.13); }
.tape--top { top: -15px; left: 50%; transform: translateX(-50%) rotate(-3deg); }
.comic-burst { position: absolute; z-index: 4; display: grid; place-items: center; width: 118px; aspect-ratio: 1; background: var(--yellow); border: 3px solid var(--ink); clip-path: polygon(50% 0,61% 25%,83% 9%,77% 34%,100% 35%,79% 52%,96% 68%,72% 67%,75% 94%,56% 73%,44% 100%,37% 73%,12% 91%,22% 65%,0 56%,25% 45%,4% 25%,30% 29%); font: 2.4rem/1 var(--font-display); transform: rotate(8deg); filter: drop-shadow(5px 5px 0 var(--ink)); }
.comic-burst--small { width: 92px; right: 5%; top: 1%; font-size: 1.9rem; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; height: 76px; padding: 0 max(18px, calc((100vw - 1180px)/2)); display: flex; align-items: center; gap: 30px; background: rgba(247,245,237,.94); border-bottom: 3px solid var(--ink); backdrop-filter: blur(8px); transition: transform .25s ease; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; margin-right: auto; }
.brand-mark { width: 48px; height: 48px; border: 3px solid var(--ink); background: var(--blue); color: white; display: grid; place-items: center; font: 2rem/1 var(--font-display); box-shadow: 4px 4px 0 var(--ink); transform: rotate(-4deg); }
.brand b { display: block; font: 1.35rem/1 var(--font-display); letter-spacing: .06em; }
.brand small { display: block; font-size: .57rem; font-weight: 900; letter-spacing: .12em; color: var(--muted); }
.main-nav { display: flex; align-items: center; gap: 3px; }
.main-nav a { text-decoration: none; padding: 10px 11px; border-bottom: 3px solid transparent; font-weight: 900; font-size: .78rem; }
.main-nav a:hover { color: var(--blue); border-bottom-color: var(--blue); }
.header-lock { border: 2px solid var(--ink); border-radius: 7px; background: var(--yellow); padding: 9px 12px; font-weight: 900; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); }
.nav-toggle { display: none; width: 42px; height: 42px; border: 2px solid var(--ink); background: white; box-shadow: 3px 3px 0 var(--ink); font-size: 1.2rem; }

/* Loader */
.page-loader { position: fixed; inset: 0; z-index: 1000; display: grid; place-content: center; gap: 20px; text-align: center; background: var(--blue); color: white; transition: opacity .35s ease, visibility .35s ease; }
.loader-burst { width: 130px; height: 130px; display: grid; place-items: center; margin: auto; background: var(--yellow); color: var(--ink); border: 4px solid var(--ink); border-radius: 44% 56% 60% 40%/48% 42% 58% 52%; font: 4.2rem var(--font-display); box-shadow: 9px 9px 0 var(--ink); animation: loaderWobble .8s infinite alternate ease-in-out; }
.page-loader p { font-weight: 900; letter-spacing: .08em; }
.site-page:not(.is-loading) .page-loader { opacity: 0; visibility: hidden; }
@keyframes loaderWobble { to { transform: rotate(5deg) scale(1.04); } }

/* Hero */
.hero { min-height: calc(100vh - 76px); display: grid; grid-template-columns: .95fr 1.05fr; align-items: center; gap: 54px; position: relative; padding-top: 76px; padding-bottom: 120px; }
.hero::before { content: ''; position: absolute; left: -18vw; top: 2%; width: 45vw; height: 45vw; background: repeating-conic-gradient(from -20deg, rgba(20,99,255,.09) 0 2deg, transparent 2deg 8deg); border-radius: 50%; z-index: -1; }
.hero-copy h1 { margin: 18px 0 8px; font: clamp(5.8rem, 11vw, 9.7rem)/.75 var(--font-display); letter-spacing: .02em; text-shadow: 7px 7px 0 white, 10px 10px 0 var(--ink); -webkit-text-stroke: 2px var(--ink); transform: rotate(-1.2deg); }
.hero-copy h1 span { color: var(--blue); }
.hero-tagline { font-size: clamp(1.15rem,2vw,1.45rem); font-weight: 900; max-width: 560px; margin: 25px 0 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 15px; }
.speech-note { position: relative; width: fit-content; max-width: 390px; margin-top: 38px; background: white; border: var(--border); border-radius: 50%; padding: 20px 28px; font-weight: 900; transform: rotate(-2deg); box-shadow: var(--shadow-small); }
.speech-note::after { content: ''; position: absolute; bottom: -18px; right: 28%; width: 24px; height: 24px; background: white; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg); }
.hero-art { position: relative; min-height: 560px; display: grid; place-items: center; }
.halftone-disc { position: absolute; width: 520px; max-width: 90%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--blue) 0 3px, transparent 3.5px) 0 0/15px 15px; opacity: .75; }
.class-photo-frame { position: relative; width: min(520px, 90%); aspect-ratio: 4/3; border: 5px solid var(--ink); background: white; box-shadow: 13px 13px 0 var(--ink); transform: rotate(2.2deg); overflow: hidden; }
.class-photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.photo-placeholder { width: 100%; height: 100%; display: grid; place-content: center; text-align: center; background: linear-gradient(135deg, var(--blue-soft), white 60%); }
.photo-placeholder span { font: 8rem/.8 var(--font-display); color: var(--blue); -webkit-text-stroke: 3px var(--ink); text-shadow: 5px 5px 0 var(--yellow); }
.photo-placeholder small { font-weight: 900; letter-spacing: .2em; }
.photo-caption { position: absolute; left: 16px; bottom: 13px; padding: 8px 13px; background: var(--yellow); border: 2px solid var(--ink); font-weight: 900; box-shadow: 3px 3px 0 var(--ink); transform: rotate(-2deg); }
.hero-art .comic-burst { right: -10px; top: 20px; }
.scribble-arrow { position: absolute; left: 0; bottom: 65px; font: 5rem var(--font-display); transform: rotate(18deg); }
.sticker { position: absolute; padding: 9px 15px; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); font: 1.55rem var(--font-display); }
.sticker--blue { right: 35px; bottom: 28px; background: var(--sky); transform: rotate(-8deg); }
.hero-strip { position: absolute; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4,1fr); background: var(--ink); color: white; border: 3px solid var(--ink); box-shadow: 8px 8px 0 var(--blue); transform: rotate(-.35deg); }
.hero-strip div { display: flex; align-items: baseline; justify-content: center; gap: 8px; min-height: 82px; padding: 14px; border-right: 2px solid white; }
.hero-strip div:last-child { border-right: 0; }
.hero-strip strong { font: 3.2rem/1 var(--font-display); color: var(--yellow); }
.hero-strip span { font-size: .76rem; font-weight: 900; text-transform: uppercase; }

/* Chapters */
.chapter-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 34px; }
.chapter-heading > div > span { display: inline-block; color: var(--blue); font-size: .72rem; font-weight: 900; letter-spacing: .12em; }
.chapter-heading h2 { margin: 2px 0 0; font: clamp(3rem,6vw,5.4rem)/.9 var(--font-display); letter-spacing: .025em; }
.chapter-heading p { max-width: 360px; margin: 0 0 4px; color: var(--muted); font-weight: 800; }

/* Announcements */
.announcement-section { width: 100%; max-width: none; background: var(--blue); color: white; border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink); padding-left: max(16px, calc((100vw - 1180px)/2)); padding-right: max(16px, calc((100vw - 1180px)/2)); }
.announcement-section .chapter-heading span { color: var(--yellow); }
.announcement-section .chapter-heading p { color: rgba(255,255,255,.82); }
.announcement-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 22px; }
.announcement-card { position: relative; min-height: 210px; padding: 24px; color: var(--ink); background: var(--white); border: var(--border); box-shadow: 8px 8px 0 var(--ink); transform: rotate(var(--tilt,0deg)); }
.announcement-card:nth-child(2n) { --tilt: 1deg; background: var(--yellow); }
.announcement-card:nth-child(3n) { --tilt: -1deg; background: var(--blue-soft); }
.announcement-card .pin { position: absolute; right: 15px; top: 12px; font-size: 1.4rem; }
.announcement-card time { font-size: .7rem; font-weight: 900; letter-spacing: .08em; color: var(--blue-deep); }
.announcement-card h3 { margin: 11px 0 8px; font: 2rem/1 var(--font-display); letter-spacing: .03em; }
.announcement-card p { margin: 0; font-weight: 700; font-size: .9rem; white-space: pre-line; }
.empty-panel { grid-column: 1/-1; padding: 32px; border: 3px dashed currentColor; text-align: center; font-weight: 900; }

/* Schedule */
.day-tabs, .album-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.day-tab, .album-tab { border: 2px solid var(--ink); background: white; padding: 10px 15px; font-weight: 900; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); transition: .15s; }
.day-tab:hover, .album-tab:hover { transform: translateY(-2px); }
.day-tab.is-active, .album-tab.is-active { background: var(--blue); color: white; transform: rotate(-1deg); }
.schedule-board { padding: 28px; min-height: 300px; background: linear-gradient(90deg, transparent 0 44px, rgba(255,93,93,.32) 45px 47px, transparent 48px), repeating-linear-gradient(0deg, white 0 35px, rgba(20,99,255,.16) 36px 37px); }
.lesson-row { display: grid; grid-template-columns: 112px 58px 1fr auto; align-items: center; gap: 16px; min-height: 82px; padding: 12px 8px 12px 58px; border-bottom: 2px solid rgba(16,24,40,.12); }
.lesson-row:last-child { border-bottom: 0; }
.lesson-time { font-weight: 900; font-size: .78rem; }
.lesson-icon { width: 48px; height: 48px; display: grid; place-items: center; border: 2px solid var(--ink); background: var(--subject-accent,var(--blue-soft)); box-shadow: 3px 3px 0 var(--ink); font-size: 1.35rem; transform: rotate(-2deg); }
.lesson-info h3 { margin: 0; font-size: 1.05rem; }
.lesson-info p { margin: 2px 0 0; font-size: .75rem; color: var(--muted); font-weight: 700; }
.lesson-room { padding: 6px 9px; border: 2px solid var(--ink); background: var(--yellow); font-size: .7rem; font-weight: 900; }

/* Uniforms */
.uniform-section { background: transparent; }
.uniform-strip { display: grid; grid-template-columns: repeat(5,1fr); gap: 16px; }
.uniform-card { min-height: 260px; border: var(--border); background: white; box-shadow: var(--shadow-small); position: relative; overflow: hidden; transform: rotate(var(--tilt)); transition: transform .2s ease; }
.uniform-card:nth-child(odd) { --tilt: -1deg; }
.uniform-card:nth-child(even) { --tilt: 1deg; }
.uniform-card:hover { transform: rotate(0) translateY(-5px); }
.uniform-visual { height: 145px; background: var(--blue-soft); border-bottom: 3px solid var(--ink); display: grid; place-items: center; overflow: hidden; }
.uniform-visual img { width: 100%; height: 100%; object-fit: cover; }
.uniform-visual span { font-size: 3.5rem; }
.uniform-copy { padding: 16px; }
.uniform-copy b { color: var(--blue); font-size: .68rem; letter-spacing: .12em; }
.uniform-copy h3 { margin: 5px 0 7px; font: 1.55rem/1 var(--font-display); }
.uniform-copy p { margin: 0; font-size: .75rem; font-weight: 700; color: var(--muted); }

/* Duty */
.duty-section { width: 100%; max-width: none; background: var(--yellow); border-block: 4px solid var(--ink); padding-left: max(16px, calc((100vw - 1180px)/2)); padding-right: max(16px, calc((100vw - 1180px)/2)); }
.duty-board { display: grid; grid-template-columns: repeat(5,1fr); gap: 16px; }
.duty-card { background: var(--white); border: var(--border); box-shadow: var(--shadow-small); min-height: 260px; padding: 18px; transform: rotate(var(--tilt)); }
.duty-card:nth-child(odd) { --tilt: 1deg; }
.duty-card:nth-child(even) { --tilt: -1deg; }
.duty-card h3 { margin: -32px 0 18px; width: fit-content; padding: 7px 12px; background: var(--blue); color: white; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font: 1.6rem var(--font-display); }
.duty-card ul { list-style: none; margin: 0; padding: 0; }
.duty-card li { display: flex; gap: 9px; align-items: flex-start; padding: 10px 0; border-bottom: 2px dashed rgba(16,24,40,.25); font-size: .78rem; font-weight: 800; }
.duty-card li:last-child { border-bottom: 0; }
.duty-card li span { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 50%; background: var(--blue-soft); border: 2px solid var(--ink); font-size: .68rem; }

/* Students */
.student-tools { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.search-box { flex: 1; max-width: 520px; display: flex; align-items: center; background: white; border: var(--border); box-shadow: var(--shadow-small); }
.search-box span { padding-left: 15px; font: 1.8rem var(--font-display); }
.search-box input { width: 100%; height: 48px; border: 0; outline: 0; background: transparent; padding: 0 15px; font-weight: 800; }
.student-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 23px; }
.student-card { position: relative; background: white; border: var(--border); box-shadow: var(--shadow-small); overflow: hidden; transform: rotate(var(--tilt)); cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; }
.student-card:nth-child(4n+1) { --tilt: -1.2deg; }
.student-card:nth-child(4n+2) { --tilt: .8deg; }
.student-card:nth-child(4n+3) { --tilt: -.4deg; }
.student-card:nth-child(4n) { --tilt: 1.3deg; }
.student-card:hover { transform: translateY(-7px) rotate(0); box-shadow: 8px 8px 0 var(--ink); }
.student-photo { aspect-ratio: 4/4.4; background: var(--blue-soft); border-bottom: 3px solid var(--ink); overflow: hidden; position: relative; }
.student-photo img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.9) contrast(1.02); }
.student-avatar { width: 100%; height: 100%; display: grid; place-items: center; background: radial-gradient(circle at 70% 20%, var(--yellow) 0 13%, transparent 13.5%), radial-gradient(circle, rgba(20,99,255,.28) 0 2px, transparent 2.5px) 0 0/16px 16px, var(--blue-soft); font: 5rem var(--font-display); color: var(--blue); -webkit-text-stroke: 2px var(--ink); }
.student-number { position: absolute; top: 10px; left: 10px; min-width: 39px; height: 39px; padding: 0 7px; display: grid; place-items: center; background: var(--yellow); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font-weight: 900; }
.student-copy { padding: 16px; }
.student-copy h3 { margin: 0; font: 1.8rem/1 var(--font-display); letter-spacing: .025em; }
.student-copy .role { display: inline-block; margin: 7px 0 9px; padding: 3px 7px; background: var(--blue); color: white; font-size: .64rem; font-weight: 900; transform: rotate(-1deg); }
.student-copy p { margin: 0; color: var(--muted); font-size: .75rem; font-weight: 700; }

/* Gallery */
.gallery-section { width: 100%; max-width: none; padding-left: max(16px, calc((100vw - 1180px)/2)); padding-right: max(16px, calc((100vw - 1180px)/2)); background: var(--blue-deep); color: white; border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink); }
.gallery-section .chapter-heading span { color: var(--sky); }
.gallery-section .chapter-heading p { color: rgba(255,255,255,.75); }
.gallery-section .album-tab { color: var(--ink); }
.gallery-section .album-tab.is-active { background: var(--yellow); color: var(--ink); }
.gallery-grid { columns: 3 280px; column-gap: 20px; }
.gallery-item { break-inside: avoid; margin: 0 0 20px; padding: 9px 9px 36px; background: white; color: var(--ink); border: var(--border); box-shadow: 6px 6px 0 rgba(0,0,0,.7); transform: rotate(var(--tilt)); cursor: zoom-in; }
.gallery-item:nth-child(3n+1) { --tilt: -1deg; }
.gallery-item:nth-child(3n+2) { --tilt: .8deg; }
.gallery-item:nth-child(3n) { --tilt: -.3deg; }
.gallery-item img { width: 100%; height: auto; border: 2px solid var(--ink); background: var(--blue-soft); }
.gallery-item figcaption { padding: 9px 5px 0; font-weight: 900; font-size: .78rem; }
.album-cover-card { min-height: 270px; display: grid; place-items: center; background: var(--blue-soft); border: var(--border); color: var(--ink); text-align: center; padding: 22px; }
.album-cover-card h3 { font: 2.2rem var(--font-display); margin: 0; }

/* Final + footer */
.final-panel { display: grid; grid-template-columns: 220px 1fr auto; align-items: center; gap: 35px; background: var(--blue); color: white; border: 4px solid var(--ink); box-shadow: 11px 11px 0 var(--ink); padding: 38px; margin-top: 90px; margin-bottom: 90px; transform: rotate(-.4deg); }
.final-burst { width: 185px; aspect-ratio: 1; display: grid; place-items: center; text-align: center; background: var(--yellow); color: var(--ink); clip-path: polygon(50% 0,60% 22%,80% 4%,77% 31%,100% 28%,82% 49%,100% 61%,76% 67%,83% 95%,58% 77%,48% 100%,38% 76%,11% 94%,23% 66%,0 56%,24% 44%,5% 20%,31% 27%); border: 0; font: 2.2rem/.88 var(--font-display); filter: drop-shadow(6px 6px 0 var(--ink)); }
.final-panel h2 { margin: 0 0 8px; font: 3.2rem/1 var(--font-display); }
.final-panel p { margin: 0; font-weight: 700; }
.site-footer { min-height: 170px; padding: 35px max(18px, calc((100vw - 1180px)/2)); display: flex; align-items: center; gap: 28px; background: var(--ink); color: white; border-top: 4px solid var(--blue); }
.site-footer p { margin-left: auto; color: rgba(255,255,255,.65); font-size: .76rem; }
.site-footer > a { color: var(--yellow); font-size: .76rem; font-weight: 900; }
.brand--footer .brand-mark { background: var(--yellow); color: var(--ink); }
.brand--footer small { color: rgba(255,255,255,.6); }

/* Music player */
.music-player { position: fixed; right: 22px; bottom: 22px; z-index: 80; width: 360px; border: 3px solid var(--ink); background: var(--white); box-shadow: 8px 8px 0 var(--ink); border-radius: 13px; transition: transform .28s ease; }
.music-player.is-collapsed { transform: translateX(calc(100% - 54px)); }
.player-toggle { position: absolute; left: -22px; top: -22px; width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--ink); background: var(--yellow); box-shadow: 4px 4px 0 var(--ink); font-size: 1.35rem; cursor: pointer; z-index: 2; }
.player-body { padding: 15px 16px 12px 64px; position: relative; min-height: 100px; }
.vinyl-wrap { position: absolute; left: 10px; top: 16px; width: 48px; height: 48px; }
.vinyl { width: 48px; height: 48px; border-radius: 50%; background: repeating-radial-gradient(circle, #151515 0 3px, #313131 4px 5px); border: 2px solid var(--ink); display: grid; place-items: center; overflow: hidden; }
.vinyl img { width: 21px; height: 21px; object-fit: cover; border-radius: 50%; }
.vinyl span { position: absolute; font: .7rem var(--font-display); color: white; }
.music-player.is-playing .vinyl { animation: vinylSpin 4s linear infinite; }
@keyframes vinylSpin { to { transform: rotate(360deg); } }
.track-copy { display: grid; min-width: 0; padding-right: 32px; }
.track-copy strong, .track-copy span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-copy strong { font-size: .84rem; }
.track-copy span { font-size: .68rem; color: var(--muted); font-weight: 700; }
.player-controls { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.player-controls button, .player-extra button { border: 0; background: transparent; cursor: pointer; font-size: .95rem; }
.player-controls .play-main { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink); background: var(--blue); color: white; box-shadow: 2px 2px 0 var(--ink); }
.player-progress { display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; gap: 6px; margin-top: 7px; font-size: .58rem; font-weight: 900; }
.player-progress input, .player-extra input { accent-color: var(--blue); height: 4px; min-width: 0; }
.player-extra { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 4px; }
.player-extra label { display: flex; align-items: center; gap: 3px; font-size: .65rem; }
.player-extra label input { width: 60px; }
.player-extra button.is-active { background: var(--yellow); border-radius: 4px; }
.playlist { display: none; max-height: 180px; overflow: auto; margin-top: 8px; border-top: 2px dashed var(--ink); padding-top: 7px; }
.playlist.is-open { display: block; }
.playlist-item { width: 100%; display: grid; grid-template-columns: 24px 1fr; gap: 7px; text-align: left; padding: 7px; border: 0; background: transparent; cursor: pointer; font-size: .68rem; font-weight: 800; }
.playlist-item:hover, .playlist-item.is-active { background: var(--blue-soft); }

/* Dialogs */
dialog { border: var(--border); box-shadow: 12px 12px 0 var(--ink); background: var(--white); color: var(--ink); padding: 0; max-width: min(720px, calc(100% - 28px)); }
dialog::backdrop { background: rgba(5,16,40,.76); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; right: 10px; top: 10px; z-index: 3; width: 40px; height: 40px; border: 2px solid var(--ink); background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); font: 1.6rem/1 var(--font-display); cursor: pointer; }
.student-dialog { width: 720px; }
.student-profile { display: grid; grid-template-columns: 270px 1fr; min-height: 400px; }
.student-profile-image { background: var(--blue-soft); border-right: 3px solid var(--ink); min-height: 400px; }
.student-profile-image img { width: 100%; height: 100%; object-fit: cover; }
.student-profile-image .student-avatar { min-height: 400px; }
.student-profile-copy { padding: 48px 35px 30px; }
.student-profile-copy .number-label { color: var(--blue); font-weight: 900; font-size: .72rem; letter-spacing: .12em; }
.student-profile-copy h2 { margin: 7px 0; font: 3.4rem/.9 var(--font-display); }
.profile-role { display: inline-block; background: var(--yellow); border: 2px solid var(--ink); padding: 5px 9px; font-size: .7rem; font-weight: 900; transform: rotate(-1deg); }
.profile-facts { display: grid; gap: 12px; margin-top: 25px; }
.profile-fact { border-left: 5px solid var(--blue); padding-left: 12px; }
.profile-fact small { display: block; color: var(--muted); font-size: .65rem; font-weight: 900; text-transform: uppercase; }
.profile-fact b { font-size: .9rem; }
.profile-quote { margin-top: 25px; padding: 16px; border: 2px dashed var(--ink); background: var(--blue-soft); font-weight: 800; font-style: italic; }
.photo-dialog { width: fit-content; max-width: min(960px, calc(100% - 28px)); background: var(--ink); color: white; }
.photo-dialog img { max-height: 75vh; width: auto; max-width: 100%; object-fit: contain; }
.photo-dialog p { margin: 0; padding: 12px 15px; font-weight: 800; }

/* Toast + reveal */
.comic-toast { position: fixed; left: 50%; bottom: 28px; z-index: 999; transform: translate(-50%,120px) rotate(-1deg); opacity: 0; padding: 12px 18px; background: var(--yellow); border: var(--border); box-shadow: var(--shadow-small); font-weight: 900; transition: .25s ease; pointer-events: none; }
.comic-toast.is-visible { transform: translate(-50%,0) rotate(-1deg); opacity: 1; }
.reveal { opacity: 0; transform: translateY(34px) rotate(.3deg); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
.reveal--left { transform: translateX(-45px) rotate(-.4deg); }
.reveal--right { transform: translateX(45px) rotate(.4deg); }
.reveal.is-visible { opacity: 1; transform: translate(0) rotate(0); }
.random-highlight { animation: randomPop .65s ease 2; z-index: 2; }
@keyframes randomPop { 50% { transform: translateY(-12px) rotate(-2deg) scale(1.06); box-shadow: 12px 12px 0 var(--yellow); } }

/* Responsive */
@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; gap: 42px; padding: 45px 0 70px; }
  .login-story { text-align: center; }
  .login-lead { margin-inline: auto; }
  .login-story h1 { font-size: clamp(4.3rem,15vw,7rem); }
  .comic-burst--small { right: 2%; }
  .login-card { width: min(520px,100%); margin: auto; }
  .main-nav { position: fixed; left: 16px; right: 16px; top: 86px; display: none; flex-direction: column; align-items: stretch; background: white; border: var(--border); box-shadow: var(--shadow); padding: 12px; }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 13px; }
  .nav-toggle { display: block; }
  .header-lock { font-size: 0; width: 42px; height: 42px; padding: 0; }
  .header-lock span { font-size: 1rem; }
  .hero { grid-template-columns: 1fr; padding-top: 70px; }
  .hero-copy { text-align: center; }
  .hero-tagline, .speech-note { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
  .hero-art { min-height: 480px; }
  .hero-strip { position: relative; grid-column: 1; margin-top: 20px; }
  .announcement-grid { grid-template-columns: 1fr 1fr; }
  .uniform-strip, .duty-board { grid-template-columns: repeat(3,1fr); }
  .student-grid { grid-template-columns: repeat(3,1fr); }
  .final-panel { grid-template-columns: 170px 1fr; }
  .final-panel > a { grid-column: 1/-1; justify-self: center; }
}

@media (max-width: 700px) {
  html { scroll-padding-top: 72px; }
  .comic-section { width: min(100% - 24px,1180px); padding: 62px 0; }
  .site-header { height: 68px; padding-inline: 12px; gap: 10px; }
  .brand-mark { width: 42px; height: 42px; font-size: 1.7rem; }
  .brand b { font-size: 1.1rem; }
  .brand small { font-size: .48rem; }
  .login-shell { width: min(100% - 24px,1120px); }
  .story-panels { grid-template-columns: 1fr; max-width: 430px; margin-inline: auto; }
  .mini-panel { min-height: 95px; }
  .mini-panel--two { transform: rotate(1deg); }
  .login-card { padding: 35px 24px 26px; }
  .login-story h1 { text-shadow: 5px 5px 0 var(--ink); }
  .hero { min-height: auto; width: min(100% - 24px,1180px); padding-bottom: 60px; }
  .hero-copy h1 { font-size: clamp(5.2rem,26vw,7rem); text-shadow: 5px 5px 0 white,8px 8px 0 var(--ink); }
  .hero-art { min-height: 360px; }
  .class-photo-frame { width: 92%; box-shadow: 8px 8px 0 var(--ink); }
  .halftone-disc { width: 350px; }
  .hero-art .comic-burst { width: 84px; font-size: 1.8rem; right: 0; }
  .scribble-arrow { display: none; }
  .sticker--blue { right: 10px; bottom: 15px; }
  .hero-strip { grid-template-columns: repeat(2,1fr); transform: none; }
  .hero-strip div:nth-child(2) { border-right: 0; }
  .hero-strip div:nth-child(-n+2) { border-bottom: 2px solid white; }
  .chapter-heading { display: block; }
  .chapter-heading p { margin-top: 12px; }
  .announcement-section, .duty-section, .gallery-section { padding-left: 12px; padding-right: 12px; }
  .announcement-grid { grid-template-columns: 1fr; }
  .schedule-board { padding: 12px 8px; }
  .lesson-row { grid-template-columns: 78px 43px 1fr; gap: 8px; padding-left: 47px; }
  .lesson-icon { width: 38px; height: 38px; }
  .lesson-room { grid-column: 3; width: fit-content; }
  .uniform-strip, .duty-board { display: flex; overflow-x: auto; padding: 12px 6px 18px; scroll-snap-type: x mandatory; }
  .uniform-card, .duty-card { flex: 0 0 78%; scroll-snap-align: center; }
  .student-tools { display: grid; }
  .student-grid { grid-template-columns: repeat(2,1fr); gap: 14px; }
  .student-copy { padding: 12px; }
  .student-copy h3 { font-size: 1.4rem; }
  .gallery-grid { columns: 2 150px; column-gap: 12px; }
  .gallery-item { margin-bottom: 12px; padding: 6px 6px 26px; }
  .final-panel { width: calc(100% - 24px); grid-template-columns: 1fr; text-align: center; padding: 26px; }
  .final-burst { margin: auto; }
  .site-footer { flex-wrap: wrap; padding: 35px 18px; }
  .site-footer p { width: 100%; order: 3; margin: 0; }
  .music-player { right: 12px; bottom: 12px; width: min(350px,calc(100% - 24px)); }
  .music-player.is-collapsed { transform: translateX(calc(100% - 48px)); }
  .student-profile { grid-template-columns: 1fr; }
  .student-profile-image { min-height: 280px; max-height: 330px; border-right: 0; border-bottom: 3px solid var(--ink); }
  .student-profile-copy { padding: 28px 22px; }
  .student-profile-copy h2 { font-size: 2.7rem; }
}

@media (max-width: 420px) {
  .student-grid { grid-template-columns: 1fr 1fr; }
  .student-photo { aspect-ratio: 1/1.12; }
  .student-avatar { font-size: 3.7rem; }
  .student-copy p { display: none; }
  .gallery-grid { columns: 1; }
  .music-player { width: calc(100% - 24px); }
}

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

/* =========================================================
   APP PAGES — multi-page student experience
   ========================================================= */
.route-page { min-height: 100vh; background: var(--blue); }
.app-page {
  --app-top-space: 96px;
  min-height: 100vh;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
}
.app-page.page-ready { opacity: 1; }
.app-page.is-leaving { opacity: 0; transform: translateY(8px) scale(.995); }
.app-page main { position: relative; z-index: 1; }
.inner-page-main { padding-top: 18px; }

.app-header {
  width: min(1180px, calc(100% - 32px));
  height: 80px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 30;
}
.app-header .brand { width: fit-content; }

.app-nav {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 200;
  display: grid;
  justify-items: end;
}
.app-nav-toggle {
  min-width: 112px;
  height: 48px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: var(--border);
  border-radius: 11px;
  background: var(--yellow);
  box-shadow: var(--shadow-small);
  color: var(--ink);
  font-weight: 900;
  letter-spacing: .07em;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.app-nav-toggle:hover { transform: translate(-2px,-2px) rotate(-1deg); box-shadow: 6px 6px 0 var(--ink); }
.app-nav-toggle-icon { font-size: 1.15rem; transition: transform .25s ease; }
.app-nav.is-open .app-nav-toggle-icon { transform: rotate(90deg); }
.app-nav-panel {
  width: 230px;
  margin-top: 12px;
  padding: 10px;
  display: grid;
  gap: 7px;
  border: var(--border);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 9px 9px 0 var(--ink);
  transform-origin: top right;
  transform: translateY(-12px) scale(.9) rotate(2deg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease, transform .25s cubic-bezier(.2,.9,.2,1.2), visibility .2s;
}
.app-nav.is-open .app-nav-panel { transform: translateY(0) scale(1) rotate(0); opacity: 1; visibility: visible; pointer-events: auto; }
.app-nav-panel a,
.app-nav-panel button {
  min-height: 44px;
  padding: 9px 11px;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 7px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  font-weight: 900;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.app-nav-panel a span,
.app-nav-panel button span { width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 7px; background: var(--blue-soft); }
.app-nav-panel a:hover,
.app-nav-panel button:hover { transform: translateX(-3px); background: var(--blue-soft); border-color: var(--ink); }
.app-nav-panel a.is-active { background: var(--blue); color: white; border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.app-nav-panel a.is-active span { background: var(--yellow); color: var(--ink); }
.app-nav-panel button { border-top: 2px dashed var(--ink); border-radius: 0 0 8px 8px; margin-top: 3px; color: #a61b1b; }

.app-hero { min-height: calc(100vh - 80px); padding-top: 36px; }
.hero-art { --motion-x: 0px; --motion-y: 0px; }
.hero-art .class-photo-frame { transform: translate(var(--motion-x), var(--motion-y)) rotate(2deg); transition: transform .18s ease-out; }
.hero-art .halftone-disc { transform: translate(calc(var(--motion-x) * -.65), calc(var(--motion-y) * -.65)); transition: transform .2s ease-out; }

.comic-marquee {
  width: 100%;
  overflow: hidden;
  border-top: var(--border);
  border-bottom: var(--border);
  background: var(--yellow);
  transform: rotate(-.5deg) scale(1.01);
}
.comic-marquee div {
  width: max-content;
  padding: 12px 0;
  font: 1.65rem/1 var(--font-display);
  letter-spacing: .08em;
  white-space: nowrap;
  animation: comicTicker 24s linear infinite;
}
@keyframes comicTicker { to { transform: translateX(-50%); } }

.portal-section { padding-top: 72px; }
.portal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.portal-card {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  min-height: 160px;
  padding: 24px;
  display: grid;
  grid-template-columns: 58px 1fr 34px;
  align-items: center;
  gap: 18px;
  border: var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transform: perspective(800px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: transform .18s ease, box-shadow .18s ease;
}
.portal-card:hover { box-shadow: 11px 11px 0 var(--ink); transform: perspective(800px) translate(-3px,-3px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)); }
.portal-card > span { width: 54px; height: 54px; display: grid; place-items: center; border: var(--border); border-radius: 50%; background: var(--white); font: 1.5rem var(--font-display); }
.portal-card h3 { margin: 0 0 4px; font: 2.2rem/1 var(--font-display); letter-spacing: .04em; }
.portal-card p { margin: 0; font-size: .82rem; font-weight: 800; }
.portal-card > b { font-size: 1.7rem; transition: transform .2s ease; }
.portal-card:hover > b { transform: translateX(7px); }
.portal-card--yellow { background: var(--yellow); transform: rotate(-.8deg); }
.portal-card--blue { background: var(--blue); color: white; transform: rotate(.7deg); }
.portal-card--mint { background: var(--mint); transform: rotate(.5deg); }
.portal-card--paper { background: var(--white); transform: rotate(-.5deg); }
.text-link { color: var(--blue); font-weight: 900; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.home-news { padding-top: 55px; }

.page-banner {
  min-height: 470px;
  margin-top: 10px;
  padding: 48px 58px;
  display: grid;
  grid-template-columns: 1fr .72fr;
  align-items: center;
  gap: 50px;
  position: relative;
  overflow: hidden;
  border: var(--border);
  border-radius: 18px;
  box-shadow: 10px 10px 0 var(--ink);
}
.page-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .16;
  background: radial-gradient(circle, currentColor 0 2px, transparent 2.6px) 0 0/22px 22px;
}
.page-banner-copy,
.page-banner-art { position: relative; z-index: 1; }
.page-banner h1 { margin: 15px 0 16px; font: clamp(5rem,10vw,8.7rem)/.75 var(--font-display); letter-spacing: .025em; -webkit-text-stroke: 2px var(--ink); text-shadow: 7px 7px 0 var(--ink); }
.page-banner-copy > p:last-child { max-width: 580px; font-size: 1.05rem; font-weight: 800; }
.page-banner--yellow { background: var(--yellow); }
.page-banner--blue { background: var(--blue); color: white; }
.page-banner--blue .eyebrow { color: var(--yellow); }
.page-banner--blue h1 { color: white; text-shadow: 7px 7px 0 var(--ink); }
.page-banner--mint { background: var(--mint); }
.page-banner--paper { background: var(--white); }
.page-banner-art { min-height: 280px; display: grid; place-items: center; }
.banner-symbol {
  width: 210px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 5px solid var(--ink);
  border-radius: 48% 52% 42% 58%/53% 39% 61% 47%;
  background: var(--white);
  color: var(--blue);
  box-shadow: 12px 12px 0 var(--ink);
  font: 7rem/1 var(--font-display);
  transform: rotate(7deg);
}
.banner-symbol--clock { font-size: 5.6rem; }
.banner-symbol--camera { font-size: 5rem; }
.speech-cloud {
  position: absolute;
  right: -14px;
  bottom: -2px;
  max-width: 210px;
  padding: 15px 18px;
  border: var(--border);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow-small);
  text-align: center;
  font-weight: 900;
  transform: rotate(-4deg);
}
.speech-cloud::after { content: ''; position: absolute; left: 20px; bottom: -22px; border: 14px solid transparent; border-top-color: var(--ink); transform: rotate(18deg); }

.alphabet-ribbon {
  margin: 22px 0 28px;
  padding: 10px 16px;
  overflow: hidden;
  border: 2px dashed var(--ink);
  background: var(--yellow);
  white-space: nowrap;
  text-align: center;
  font: 1.2rem var(--font-display);
  letter-spacing: .08em;
  transform: rotate(-.3deg);
}
.student-card,
.uniform-card,
.duty-card,
.announcement-card,
.gallery-item {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  transform-style: preserve-3d;
}
.student-card.is-visible,
.uniform-card.is-visible,
.duty-card.is-visible,
.announcement-card.is-visible,
.gallery-item.is-visible {
  transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
}
.student-letter {
  position: absolute;
  left: 9px;
  bottom: 9px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
  font: 1.3rem var(--font-display);
}
.student-number { display: none !important; }

.lesson-row--animated { animation: lessonRowIn .42s both cubic-bezier(.2,.8,.2,1); animation-delay: calc(var(--row-order) * 55ms); }
@keyframes lessonRowIn { from { opacity: 0; transform: translateX(-24px) rotate(-.6deg); } to { opacity: 1; transform: translateX(0) rotate(0); } }

.motion-float { animation: comicFloat 3.4s ease-in-out infinite; }
.motion-delay { animation-delay: -1.4s; }
@keyframes comicFloat { 0%,100% { translate: 0 0; rotate: 0deg; } 50% { translate: 0 -10px; rotate: 2deg; } }
.page-banner .issue-tag { animation: tagPop 2.6s ease-in-out infinite; }
@keyframes tagPop { 0%,86%,100% { transform: rotate(-1.5deg) scale(1); } 91% { transform: rotate(1.5deg) scale(1.08); } }

.reveal { transition-delay: 0ms; }
.app-page .reveal.is-visible { animation: revealSettle .55s .15s both ease-out; }
@keyframes revealSettle { 0% { filter: saturate(.75); } 55% { filter: saturate(1.15); } 100% { filter: saturate(1); } }

@media (max-width: 980px) {
  .app-header { width: min(100% - 28px,1180px); padding-right: 128px; }
  .page-banner { grid-template-columns: 1fr .55fr; padding: 40px; }
  .page-banner-art { min-height: 240px; }
  .banner-symbol { width: 165px; font-size: 5rem; }
}

@media (max-width: 700px) {
  .app-page { --app-top-space: 76px; }
  .app-header { height: 70px; width: calc(100% - 24px); padding-right: 58px; }
  .app-header .brand small { max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-nav { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
  .app-nav-toggle { min-width: 48px; width: 48px; height: 48px; padding: 0; }
  .app-nav-toggle > span:last-child { display: none; }
  .app-nav-panel { width: min(245px,calc(100vw - 24px)); }
  .app-hero { padding-top: 45px; }
  .comic-marquee div { font-size: 1.35rem; }
  .portal-grid { grid-template-columns: 1fr; gap: 17px; }
  .portal-card { min-height: 132px; grid-template-columns: 48px 1fr 24px; padding: 19px; }
  .portal-card > span { width: 44px; height: 44px; font-size: 1.2rem; }
  .portal-card h3 { font-size: 1.75rem; }
  .page-banner { width: calc(100% - 24px); min-height: 500px; margin-top: 8px; padding: 34px 25px 40px; grid-template-columns: 1fr; gap: 18px; text-align: center; }
  .page-banner h1 { font-size: clamp(5rem,22vw,7rem); text-shadow: 5px 5px 0 var(--ink); }
  .page-banner-copy > p:last-child { margin-inline: auto; }
  .page-banner-art { min-height: 200px; }
  .banner-symbol { width: 145px; font-size: 4.7rem; box-shadow: 8px 8px 0 var(--ink); }
  .speech-cloud { right: 3%; bottom: -4px; max-width: 165px; padding: 11px 13px; font-size: .72rem; }
  .alphabet-ribbon { overflow-x: auto; text-align: left; }
  .home-news .chapter-heading a { display: inline-block; margin-top: 13px; }
}

@media (max-width: 420px) {
  .portal-card p { font-size: .72rem; }
  .page-banner h1 { font-size: 5.2rem; }
  .banner-symbol { width: 125px; font-size: 4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .comic-marquee div,
  .motion-float,
  .page-banner .issue-tag,
  .lesson-row--animated,
  .app-page .reveal.is-visible { animation: none !important; }
  .app-page { opacity: 1; }
}

/* Keep the access-check loader visible while page content enters. */
.app-page { opacity: 1; transform: none; }
.app-page > .app-header,
.app-page > main,
.app-page > .site-footer,
.app-page > .app-nav,
.app-page > .music-player {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease;
}
.app-page.page-ready > .app-header,
.app-page.page-ready > main,
.app-page.page-ready > .site-footer,
.app-page.page-ready > .app-nav,
.app-page.page-ready > .music-player { opacity: 1; transform: translateY(0); }
.app-page.is-leaving > .app-header,
.app-page.is-leaving > main,
.app-page.is-leaving > .site-footer,
.app-page.is-leaving > .app-nav,
.app-page.is-leaving > .music-player { opacity: 0; transform: translateY(8px); }
.app-page.page-ready > .music-player.is-collapsed { transform: translateX(calc(100% - 54px)); }
@media (max-width:700px) {
  .app-page.page-ready > .music-player.is-collapsed { transform: translateX(calc(100% - 48px)); }
}


/* =========================================================
   V3 — page-turn navigation, persistent player, light motion
   ========================================================= */
.page-turn-overlay {
  position: fixed;
  inset: 0;
  z-index: 10020;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  perspective: 1500px;
  overflow: hidden;
}
.page-turn-overlay.is-closing,
.page-turn-overlay.is-opening {
  visibility: visible;
  opacity: 1;
}
.page-turn-leaf {
  position: absolute;
  top: 0;
  width: 50.2%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(16,24,40,.08) 1px, transparent 1px) 0 0/34px 100%,
    radial-gradient(circle, rgba(20,99,255,.16) 0 2px, transparent 2.7px) 0 0/22px 22px,
    var(--white);
  border-block: 4px solid var(--ink);
  backface-visibility: hidden;
  will-change: transform;
}
.page-turn-leaf::before {
  content: '';
  position: absolute;
  inset: 18px;
  border: 3px dashed var(--blue);
  opacity: .55;
}
.page-turn-leaf::after {
  content: '';
  position: absolute;
  width: 44%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: repeating-conic-gradient(from -8deg, rgba(20,99,255,.14) 0 3deg, transparent 3deg 10deg);
}
.page-turn-leaf > span {
  position: relative;
  z-index: 2;
  padding: 10px 18px;
  border: 3px solid var(--ink);
  background: var(--yellow);
  box-shadow: 6px 6px 0 var(--ink);
  color: var(--ink);
  font: clamp(2.8rem,8vw,6.5rem)/1 var(--font-display);
  letter-spacing: .06em;
  transform: rotate(-3deg);
}
.page-turn-leaf--left {
  left: 0;
  border-right: 2px solid var(--ink);
  transform: translateX(-104%) rotateY(-12deg);
  transform-origin: left center;
}
.page-turn-leaf--right {
  right: 0;
  border-left: 2px solid var(--ink);
  transform: translateX(104%) rotateY(12deg);
  transform-origin: right center;
}
.page-turn-leaf--right > span {
  background: var(--blue);
  color: white;
  transform: rotate(3deg);
}
.page-turn-spine {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 0;
  width: 8px;
  height: 100%;
  opacity: 0;
  transform: translateX(-50%);
  background: var(--ink);
  box-shadow: 0 0 18px rgba(16,24,40,.55);
}
.page-turn-overlay.is-closing .page-turn-leaf--left {
  animation: pageCloseLeft .36s cubic-bezier(.2,.78,.2,1) forwards;
}
.page-turn-overlay.is-closing .page-turn-leaf--right {
  animation: pageCloseRight .36s cubic-bezier(.2,.78,.2,1) forwards;
}
.page-turn-overlay.is-closing .page-turn-spine {
  animation: pageSpineIn .2s .18s ease forwards;
}
.page-turn-overlay.is-opening .page-turn-leaf--left {
  animation: pageOpenLeft .5s cubic-bezier(.7,0,.2,1) forwards;
}
.page-turn-overlay.is-opening .page-turn-leaf--right {
  animation: pageOpenRight .5s cubic-bezier(.7,0,.2,1) forwards;
}
.page-turn-overlay.is-opening .page-turn-spine {
  animation: pageSpineOut .28s ease forwards;
}
@keyframes pageCloseLeft {
  from { transform: translateX(-104%) rotateY(-12deg); }
  to { transform: translateX(0) rotateY(0); }
}
@keyframes pageCloseRight {
  from { transform: translateX(104%) rotateY(12deg); }
  to { transform: translateX(0) rotateY(0); }
}
@keyframes pageOpenLeft {
  from { transform: translateX(0) rotateY(0); }
  to { transform: translateX(-106%) rotateY(-14deg); }
}
@keyframes pageOpenRight {
  from { transform: translateX(0) rotateY(0); }
  to { transform: translateX(106%) rotateY(14deg); }
}
@keyframes pageSpineIn { to { opacity: 1; } }
@keyframes pageSpineOut { from { opacity: 1; } to { opacity: 0; } }

/* Subtle, low-cost motion for the student area. */
.app-page.page-ready .app-header .brand-mark {
  animation: brandComicNod 5.2s 1.2s ease-in-out infinite;
}
.app-page.page-ready .app-nav-toggle {
  animation: menuAttention 6.5s 2.4s ease-in-out infinite;
}
.page-banner::before {
  animation: bannerDotsDrift 14s linear infinite;
}
.page-banner .speech-cloud {
  animation: speechCloudBob 4.4s ease-in-out infinite;
}
.chapter-heading h2 {
  position: relative;
  width: fit-content;
}
.chapter-heading h2::after {
  content: '';
  position: absolute;
  left: 2%;
  bottom: -9px;
  width: 96%;
  height: 5px;
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
  transform: scaleX(0) rotate(-1deg);
  transform-origin: left;
}
.chapter-heading.is-visible h2::after {
  animation: comicUnderline .62s .22s cubic-bezier(.2,.8,.2,1) forwards;
}
.hero-strip div:nth-child(1) strong { animation-delay: .1s; }
.hero-strip div:nth-child(2) strong { animation-delay: .35s; }
.hero-strip div:nth-child(3) strong { animation-delay: .6s; }
.hero-strip div:nth-child(4) strong { animation-delay: .85s; }
.app-page.page-ready .hero-strip strong {
  animation-name: statPop;
  animation-duration: 4.8s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
.announcement-card .pin {
  animation: pinBounce 3.8s ease-in-out infinite;
}
.lesson-row--animated .lesson-icon {
  animation: lessonIconPop .5s both cubic-bezier(.2,.85,.2,1);
  animation-delay: calc(var(--row-order) * 55ms + 100ms);
}
.day-tab.is-active,
.album-tab.is-active {
  animation: activeTabPop .28s ease-out both;
}
.student-card:hover .student-photo img,
.gallery-item:hover img,
.uniform-card:hover .uniform-visual img {
  transform: scale(1.045) rotate(.25deg);
}
.student-photo img,
.gallery-item img,
.uniform-visual img {
  transition: transform .45s cubic-bezier(.2,.8,.2,1);
}
.portal-card { position: relative; overflow: hidden; }
.portal-card::before {
  content: '';
  position: absolute;
  inset: 7px;
  pointer-events: none;
  border: 2px dashed currentColor;
  border-radius: 7px;
  opacity: .18;
}
.music-player.is-playing {
  animation: playerBeat 3.2s ease-in-out infinite;
}

@keyframes brandComicNod {
  0%, 86%, 100% { transform: rotate(-4deg) translateY(0); }
  90% { transform: rotate(1deg) translateY(-3px); }
  94% { transform: rotate(-6deg) translateY(0); }
}
@keyframes menuAttention {
  0%, 88%, 100% { box-shadow: 4px 4px 0 var(--ink); }
  92% { box-shadow: 4px 4px 0 var(--ink), 0 0 0 6px rgba(255,216,77,.34); }
}
@keyframes bannerDotsDrift {
  to { background-position: 88px 44px; }
}
@keyframes speechCloudBob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}
@keyframes comicUnderline {
  to { transform: scaleX(1) rotate(-1deg); }
}
@keyframes statPop {
  0%, 78%, 100% { transform: translateY(0) scale(1); }
  84% { transform: translateY(-4px) scale(1.08); }
  90% { transform: translateY(0) scale(1); }
}
@keyframes pinBounce {
  0%, 82%, 100% { transform: translateY(0) rotate(0); }
  88% { transform: translateY(-5px) rotate(-8deg); }
  94% { transform: translateY(0) rotate(5deg); }
}
@keyframes lessonIconPop {
  from { transform: scale(.72) rotate(-10deg); opacity: .2; }
  to { transform: scale(1) rotate(-2deg); opacity: 1; }
}
@keyframes activeTabPop {
  from { transform: scale(.92) rotate(0); }
  to { transform: scale(1) rotate(-1deg); }
}
@keyframes playerBeat {
  0%, 90%, 100% { box-shadow: 8px 8px 0 var(--ink); }
  94% { box-shadow: 8px 8px 0 var(--ink), 0 0 0 5px rgba(20,99,255,.18); }
}

@media (max-width: 700px) {
  .page-turn-leaf > span { padding: 8px 12px; font-size: clamp(2.2rem,13vw,4.2rem); }
  .page-turn-leaf::before { inset: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .page-turn-overlay.is-closing .page-turn-leaf--left,
  .page-turn-overlay.is-closing .page-turn-leaf--right,
  .page-turn-overlay.is-opening .page-turn-leaf--left,
  .page-turn-overlay.is-opening .page-turn-leaf--right,
  .page-turn-overlay .page-turn-spine,
  .app-page.page-ready .app-header .brand-mark,
  .app-page.page-ready .app-nav-toggle,
  .page-banner::before,
  .page-banner .speech-cloud,
  .chapter-heading.is-visible h2::after,
  .app-page.page-ready .hero-strip strong,
  .announcement-card .pin,
  .lesson-row--animated .lesson-icon,
  .day-tab.is-active,
  .album-tab.is-active,
  .music-player.is-playing {
    animation: none !important;
  }
  .page-turn-overlay.is-closing .page-turn-leaf--left,
  .page-turn-overlay.is-closing .page-turn-leaf--right {
    transform: translateX(0);
  }
  .page-turn-overlay.is-opening {
    visibility: hidden;
    opacity: 0;
  }
  .chapter-heading.is-visible h2::after { transform: scaleX(1); }
}

/* =========================================================
   V4 — improved readability and more visible lightweight motion
   ========================================================= */
html,
body,
a,
button,
input,
textarea,
select,
label,
[role='button'],
[tabindex] {
  -webkit-tap-highlight-color: transparent !important;
}

/* Light buttons must stay readable inside dark/blue sections. */
.comic-button--light,
.final-panel .comic-button--light {
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
}

/* Page titles keep the black comic outline, but no longer have a full-black fill. */
.page-banner--yellow h1,
.page-banner--mint h1,
.page-banner--paper h1 {
  color: var(--blue);
  -webkit-text-fill-color: var(--blue);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 7px 7px 0 var(--ink), 10px 10px 0 rgba(20,99,255,.16);
}
.page-banner--paper h1 { color: var(--blue-deep); -webkit-text-fill-color: var(--blue-deep); }
.page-banner--blue h1 {
  color: var(--white);
  -webkit-text-fill-color: var(--white);
}

/* A clearer entrance animation for every section as it enters the viewport. */
.app-page .reveal {
  opacity: 0;
  translate: 0 34px;
  scale: .955;
  filter: blur(1.5px) saturate(.78);
  transition-property: opacity, transform, translate, scale, filter;
  transition-duration: .66s, .72s, .72s, .72s, .58s;
  transition-timing-function: ease, cubic-bezier(.16,.84,.24,1), cubic-bezier(.16,.84,.24,1), cubic-bezier(.16,.84,.24,1), ease;
}
.app-page .reveal--left { translate: -42px 8px; }
.app-page .reveal--right { translate: 42px 8px; }
.app-page .reveal.is-visible {
  opacity: 1;
  translate: 0 0;
  scale: 1;
  filter: none;
}

/* The title plays again whenever the app swaps in a new page. */
.app-page.page-ready .page-banner h1 {
  animation: pageTitleComicIn .78s .08s both cubic-bezier(.16,.86,.2,1);
}
.app-page.page-ready .page-banner-copy > p:last-child {
  animation: pageCopyIn .62s .28s both ease-out;
}
@keyframes pageTitleComicIn {
  0% { opacity: 0; translate: -30px 20px; scale: .86; clip-path: inset(0 100% 0 0); }
  62% { opacity: 1; translate: 5px -2px; scale: 1.035; clip-path: inset(0 0 0 0); }
  100% { opacity: 1; translate: 0 0; scale: 1; clip-path: inset(0 0 0 0); }
}
@keyframes pageCopyIn {
  from { opacity: 0; translate: 0 14px; }
  to { opacity: 1; translate: 0 0; }
}

/* A slowly moving comic halo behind the banner symbol. */
.page-banner-art::before {
  content: '';
  position: absolute;
  width: min(310px, 88%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(20,99,255,.18) 0 5deg, transparent 5deg 13deg);
  animation: bannerHaloSpin 18s linear infinite;
  pointer-events: none;
}
.page-banner--blue .page-banner-art::before { background: repeating-conic-gradient(from 0deg, rgba(255,216,77,.22) 0 5deg, transparent 5deg 13deg); }
@keyframes bannerHaloSpin { to { rotate: 1turn; } }

/* Interactive cards use one shared transform so hover no longer gets overridden. */
.app-page .student-card.is-visible,
.app-page .uniform-card.is-visible,
.app-page .duty-card.is-visible,
.app-page .announcement-card.is-visible,
.app-page .gallery-item.is-visible {
  --card-lift: 0px;
  --card-scale: 1;
  --card-rotation: var(--tilt, 0deg);
  transform: perspective(900px)
    translateY(var(--card-lift))
    scale(var(--card-scale))
    rotateX(var(--tilt-x, 0deg))
    rotateY(var(--tilt-y, 0deg))
    rotate(var(--card-rotation));
  transition: transform .24s cubic-bezier(.2,.8,.2,1), box-shadow .24s ease, filter .24s ease;
  will-change: transform;
}
.app-page .portal-card.is-visible {
  --card-lift: 0px;
  --card-scale: 1;
  --card-rotation: 0deg;
  transform: perspective(850px)
    translateY(var(--card-lift))
    scale(var(--card-scale))
    rotateX(var(--tilt-x, 0deg))
    rotateY(var(--tilt-y, 0deg))
    rotate(var(--card-rotation));
  transition: transform .24s cubic-bezier(.2,.8,.2,1), box-shadow .24s ease, filter .24s ease;
  will-change: transform;
}
.app-page .portal-card--yellow.is-visible { --card-rotation: -.8deg; }
.app-page .portal-card--blue.is-visible { --card-rotation: .7deg; }
.app-page .portal-card--mint.is-visible { --card-rotation: .5deg; }
.app-page .portal-card--paper.is-visible { --card-rotation: -.5deg; }

/* Extra interactive polish without adding a heavy animation library. */
.announcement-card,
.duty-card,
.student-card,
.uniform-card,
.gallery-item,
.portal-card {
  position: relative;
}
.announcement-card,
.duty-card { overflow: hidden; }
.announcement-card::after,
.duty-card::after,
.student-card::after,
.uniform-card::after,
.gallery-item::after,
.portal-card::after {
  content: '';
  position: absolute;
  z-index: 5;
  top: -55%;
  left: -75%;
  width: 36%;
  height: 210%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.42), transparent);
  transform: rotate(19deg);
  transition: left .48s ease;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .app-page .student-card.is-visible:hover,
  .app-page .uniform-card.is-visible:hover,
  .app-page .duty-card.is-visible:hover,
  .app-page .announcement-card.is-visible:hover,
  .app-page .gallery-item.is-visible:hover {
    --card-lift: -8px;
    --card-scale: 1.035;
    --card-rotation: 0deg;
    box-shadow: 10px 10px 0 var(--ink);
    filter: saturate(1.06) contrast(1.015);
  }
  .app-page .portal-card.is-visible:hover {
    --card-lift: -7px;
    --card-scale: 1.035;
    --card-rotation: 0deg;
    box-shadow: 12px 12px 0 var(--ink);
    filter: saturate(1.07);
  }
  .announcement-card:hover::after,
  .duty-card:hover::after,
  .student-card:hover::after,
  .uniform-card:hover::after,
  .gallery-item:hover::after,
  .portal-card:hover::after { left: 145%; }

  .lesson-row {
    transition: translate .2s ease, scale .2s ease, background .2s ease;
  }
  .lesson-row:hover {
    translate: 7px 0;
    scale: 1.012;
    background: rgba(255,216,77,.22);
  }
  .day-tab:hover,
  .album-tab:hover {
    transform: translateY(-3px) scale(1.035) rotate(-.5deg);
    box-shadow: 5px 5px 0 var(--ink);
  }
  .page-banner-art:hover .banner-symbol {
    scale: 1.045;
    filter: saturate(1.1);
  }
}

/* Tap feedback for phones and tablets. */
.app-page .tilt-card.is-pressed {
  --card-lift: 2px !important;
  --card-scale: .975 !important;
  --card-rotation: 0deg !important;
  box-shadow: 2px 2px 0 var(--ink) !important;
  transition-duration: .08s !important;
}
.comic-button:active,
.app-nav-toggle:active,
.day-tab:active,
.album-tab:active {
  scale: .97;
}

/* More visible but still calm ambient movement. */
.alphabet-ribbon {
  background-image: linear-gradient(110deg, var(--yellow) 0 38%, #ffe98e 48%, var(--yellow) 58% 100%);
  background-size: 240% 100%;
  animation: ribbonShimmer 7s ease-in-out infinite;
}
@keyframes ribbonShimmer {
  0%, 72%, 100% { background-position: 100% 0; }
  84% { background-position: 0 0; }
}
.empty-panel {
  animation: emptyPanelBreathe 4.8s ease-in-out infinite;
}
@keyframes emptyPanelBreathe {
  0%, 100% { opacity: .88; }
  50% { opacity: 1; }
}
.final-panel {
  transition: transform .28s ease, box-shadow .28s ease;
}
@media (hover: hover) and (pointer: fine) {
  .final-panel:hover { transform: translateY(-5px) rotate(0); box-shadow: 14px 14px 0 var(--ink); }
}

@media (max-width: 700px) {
  .page-banner--yellow h1,
  .page-banner--mint h1,
  .page-banner--paper h1 {
    text-shadow: 5px 5px 0 var(--ink), 8px 8px 0 rgba(20,99,255,.15);
  }
  .page-banner-art::before { width: min(235px, 82%); }
}

@media (prefers-reduced-motion: reduce) {
  .app-page.page-ready .page-banner h1,
  .app-page.page-ready .page-banner-copy > p:last-child,
  .page-banner-art::before,
  .alphabet-ribbon,
  .empty-panel {
    animation: none !important;
  }
  .app-page .reveal {
    opacity: 1;
    translate: 0 0;
    scale: 1;
    filter: none;
  }
  .app-page .student-card.is-visible,
  .app-page .uniform-card.is-visible,
  .app-page .duty-card.is-visible,
  .app-page .announcement-card.is-visible,
  .app-page .gallery-item.is-visible,
  .app-page .portal-card.is-visible {
    transition: none !important;
  }
}
.gallery-item { overflow: hidden; }
