/* St. Maria College shared shell styles, paired with shell.js and loaded by every page (college, campus, mail,
   affairs): the top bar and account menu, toasts, the offline bar, read-failure cards and motion states.
   Colour, type and motion tokens come from tokens.css. */

/* ---------- top bar: felt pennant, paper tags on a twine, HELLO name badge ----------
   One set of nodes for every width. ≥700px: one flex row (pennant · tags hanging from pins · badge) that never
   overlaps. <700px: pennant and badge at the top (sticky, shrinking after 24px of scroll), the tags on a clothesline
   fixed to the bottom of the screen. Stop-motion only: every move is 2–3 held frames of 160 ms (steps(1, end)). */
#college-nav { position: relative; z-index: 30; }
.college-top { position: relative; display: flex; align-items: flex-start; gap: clamp(8px, 2.2vw, 32px); min-height: clamp(132px, 15vw, 196px);
  padding: 0 clamp(14px, 2vw, 28px); color: var(--cp-bark); }
.college-top[data-compact="always"] { min-height: 104px; }
.college-top a { text-decoration: none; }

/* pennant */
.cp-pennant { position: relative; z-index: 3; display: block; flex: 0 0 clamp(250px, 36%, 480px); margin-top: 8px; transform: rotate(-5deg); transform-origin: 12px 20px;
  filter: drop-shadow(0 7px 5px color-mix(in srgb, var(--d-bark-black-10) 38%, transparent)); --cp-run: running; }
.college-top[data-compact="always"] .cp-pennant { flex-basis: 250px; }
.cp-pennant svg { display: block; width: 100%; height: auto; overflow: visible; }
.cp-pennant:focus-visible { outline: 2px dashed var(--cp-gold); outline-offset: 4px; }

/* the line the tags hang from */
.cp-line { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; }
.cp-twine { position: absolute; left: 0; top: 0; width: 100%; height: 120px; pointer-events: none; overflow: visible; }
.cp-twine path, .cp-rope path { fill: none; stroke: var(--twine); stroke-opacity: .72; stroke-width: 2.2; }
.cp-rope { display: none; }
.cp-row { position: relative; z-index: 4; display: flex; justify-content: center; align-items: flex-start; gap: clamp(16px, 1.8vw, 24px); min-width: 0; }
/* Desktop: the pennant and the badge line up with the page column (--page-max) rather than the window edges, so on
   wide screens the bar sits over the content; and the pins hang a little lower so their heads are not cut off. */
@media (min-width: 700px) {
  .college-top { padding-inline: max(clamp(14px, 2vw, 28px), calc((100% - var(--page-max, 1180px)) / 2)); }
  .cp-row { padding-top: 10px; }
}
/* narrow desktops: tighter lettering so four tags, the pennant and the badge always fit one row */
@media (min-width: 700px) and (max-width: 919.98px) {
  .college-top .cp-en { letter-spacing: .06em; }
  .college-top .cp-card { padding-inline: 7px; }
  .college-top .cp-me { flex-basis: 80px; }
}

/* one tag: pin (peg on phones), string, paper card */
.cp-tag { --r: var(--r0, 0deg); position: relative; display: block; flex: 0 0 auto; min-width: 0; color: var(--tag-ink); transform-origin: 50% 0; transform: rotate(var(--r, 0deg));
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.cp-tag:nth-child(1) { --h: 46px; } .cp-tag:nth-child(2) { --h: 60px; } .cp-tag:nth-child(3) { --h: 62px; } .cp-tag:nth-child(4) { --h: 48px; }
.college-top[data-compact="always"] .cp-tag { --h: 18px; }
.cp-str { display: block; width: 1px; height: var(--h, 40px); margin: 0 auto; background: var(--twine); opacity: .75; }
.cp-peg { position: absolute; left: 50%; top: -5px; z-index: 2; width: 16px; height: 12px; margin-left: -8px; border-radius: 2px; background: var(--pin);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--p-bark) 40%, transparent), 0 2px 2px color-mix(in srgb, var(--d-bark-black-10) 35%, transparent); }
.cp-peg::after { content: ""; position: absolute; left: 3px; right: 3px; top: 5px; height: 2px; background: color-mix(in srgb, var(--p-bark) 40%, transparent); }
.cp-card { position: relative; display: block; padding: 10px clamp(8px, 1.2vw, 14px) 9px; text-align: center; }
/* the paper itself: shape and colour on <i>, cut by hand (a slow, fixed wobble) on .cp-paper; the words stay crisp */
.cp-paper { position: absolute; inset: 0; z-index: 0; filter: url(#cut) drop-shadow(0 6px 6px color-mix(in srgb, var(--d-bark-black-10) 32%, transparent)); }
.cp-paper i { position: absolute; inset: 0; display: block; background: var(--tag-college-bg); }
.cp-t-news .cp-paper i { background: var(--tag-news-bg); }
.cp-t-air .cp-paper i { background: var(--tag-mail-bg); }
.cp-en, .cp-cn { position: relative; z-index: 1; display: block; white-space: nowrap; }
.cp-en { font-family: var(--cp-en); font-size: clamp(8px, .85vw, 10px); letter-spacing: .16em; line-height: 1.2; opacity: .8; }
.cp-cn { font-family: var(--cp-zh); font-weight: 900; font-size: clamp(15px, 1.7vw, 19px); line-height: 1.3; }
/* 学院 · luggage tag: paper, cut corners, green eyelet */
.cp-t-lug .cp-card { padding-top: 20px; }
.cp-t-lug .cp-paper i { clip-path: polygon(18% 0, 82% 0, 100% 18%, 100% 100%, 0 100%, 0 18%); }
.cp-t-lug .cp-card::before { content: ""; position: absolute; left: 50%; top: 6px; z-index: 1; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%;
  background: var(--tag-college-eyelet); box-shadow: 0 0 0 2px var(--tag-college-ring); }
/* 校园 · gold cinema ticket stub with a notch on each side */
.cp-t-tix .cp-paper i { background: var(--tag-campus-bg); border-top: 2px dashed color-mix(in srgb, var(--p-bark) 35%, transparent);
  -webkit-mask: radial-gradient(circle 7px at 0 50%, transparent 98%, var(--d-bark-black-10)) left / 51% 100% no-repeat, radial-gradient(circle 7px at 100% 50%, transparent 98%, var(--d-bark-black-10)) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 7px at 0 50%, transparent 98%, var(--d-bark-black-10)) left / 51% 100% no-repeat, radial-gradient(circle 7px at 100% 50%, transparent 98%, var(--d-bark-black-10)) right / 51% 100% no-repeat; }
/* 邮箱 · airmail envelope */
.cp-t-air .cp-paper i { border: 5px solid transparent;
  border-image: repeating-linear-gradient(45deg, var(--tag-mail-stripe-a) 0 8px, var(--tag-mail-bg) 8px 14px, var(--tag-mail-stripe-b) 14px 22px, var(--tag-mail-bg) 22px 28px) 6; }
/* 新闻 · newsprint with a red double rule */
.cp-t-news .cp-paper i { border-left: 6px double var(--tag-news-rule); }
/* 作品展 · pine mount with a paper frame */
.cp-t-show { color: var(--tag-show-ink); }
.cp-t-show .cp-paper i { background: var(--tag-show-bg); box-shadow: inset 0 0 0 3px var(--tag-show-frame); }
/* 入学 · wine card, gold stitched hem */
.cp-t-adm { color: var(--tag-adm-ink); }
.cp-t-adm .cp-paper i { background: var(--tag-adm-bg); border-bottom: 3px dashed var(--tag-adm-hem); }
.cp-t-adm .cp-en { color: var(--tag-adm-en); opacity: 1; }
.cp-tag:focus-visible { outline: none; }
.cp-tag:focus-visible .cp-card { outline: 2px dashed var(--cp-gold); outline-offset: 4px; }
/* the mailbox postmark: inbox unread count */
.cp-stamp { position: absolute; right: -8px; top: -7px; z-index: 3; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 12px; background: var(--stamp-bg); color: var(--cp-paper);
  font-family: var(--cp-en); font-size: 12px; line-height: 24px; text-align: center; box-shadow: 0 0 0 2px var(--stamp-ink), 0 0 0 3px var(--stamp-bg); transform: rotate(12deg); }
/* the hand-drawn red ring around the current page's tag */
.cp-ring { position: absolute; left: -12px; top: -10px; z-index: 2; width: calc(100% + 24px); height: calc(100% + 22px); overflow: visible; pointer-events: none; filter: drop-shadow(0 0 1px color-mix(in srgb, var(--p-paper) 85%, transparent)); }
.cp-ring path { fill: none; stroke: var(--ring); stroke-width: 2.6; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 190; stroke-dashoffset: 0; }

/* HELLO name badge */
.cp-me { position: relative; z-index: 5; flex: 0 0 clamp(84px, 9.5vw, 114px); margin-top: clamp(18px, 3vw, 34px); }
.college-top[data-compact="always"] .cp-me { margin-top: 16px; flex-basis: 88px; }
.college-top .cp-badge { position: relative; display: block; width: 100%; margin: 0; padding: 0 0 2px; border: 0; border-radius: 9px; background: none; box-shadow: none;
  color: var(--cp-bark); font: inherit; text-align: center; text-decoration: none; cursor: pointer; transform: rotate(5deg); transform-origin: 100% 0; }
.college-top .cp-badge:hover, .college-top .cp-badge:active { background: none; transform: rotate(5deg); box-shadow: none; }
.cp-badge .cp-paper i { border-radius: var(--radius-badge); background: var(--badge-paper); }
.cp-hello { position: relative; z-index: 1; display: block; padding: 5px 0 3px; border-radius: 9px 9px 0 0; background: var(--badge-top-bg); color: var(--badge-top-ink);
  font-family: var(--cp-en); font-size: 9px; letter-spacing: .14em; line-height: 1.25; }
.cp-hello b { display: block; font-size: clamp(11px, 1.15vw, 13px); font-weight: 400; letter-spacing: .06em; }
.cp-name { position: relative; z-index: 1; display: block; padding: 6px 6px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--cp-zh); font-weight: 900; font-size: clamp(17px, 1.9vw, 22px); line-height: 1.2; }
.cp-name.long { font-size: clamp(13px, 1.3vw, 15px); padding-block: 9px 9px; }
.cp-badge.blank .cp-name { height: 18px; margin: 6px 10px 0; padding: 0; border-bottom: 1.5px solid color-mix(in srgb, var(--p-bark) 32%, transparent); }
.cp-hint { position: relative; z-index: 1; display: block; padding: 4px 0 6px; color: var(--badge-hint); font-family: var(--cp-zh); font-weight: 700; font-size: 12px; letter-spacing: .08em; }
.college-top .cp-badge:focus-visible { outline: 2px dashed var(--cp-gold); outline-offset: 3px; }
.cp-menu { position: absolute; right: 0; top: calc(100% + 14px); z-index: 40; width: 252px; display: grid; padding: 6px 0; background: var(--cp-paper); color: var(--cp-bark);
  box-shadow: 0 12px 22px color-mix(in srgb, var(--d-bark-black-10) 45%, transparent); transform: rotate(.5deg); }
.cp-menu[hidden] { display: none; }
.cp-menu a, .college-top .cp-menu button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 48px; margin: 0; padding: 0 16px;
  border: 0; border-radius: 0; background: none; box-shadow: none; color: inherit; font: inherit; font-family: var(--cp-zh); font-size: 15px; font-weight: 700; line-height: 1.3;
  text-align: left; text-decoration: none; cursor: pointer; transform: none; }
.cp-menu a:hover, .cp-menu a:focus-visible, .college-top .cp-menu button:hover, .college-top .cp-menu button:focus-visible { background: color-mix(in srgb, var(--p-gold) 20%, transparent); outline: none; transform: none; }
/* the staff key: a frost-blue lined library card */
.cp-menu .cp-key { margin: 4px 0; color: var(--library-card-ink); border-top: 4px solid var(--library-card-ink);
  background: var(--library-card-bg) repeating-linear-gradient(transparent 0 15px, color-mix(in srgb, var(--p-navy) 22%, transparent) 15px 16px); }
.cp-menu .cp-key span { white-space: nowrap; }
.cp-menu .cp-key small { font-family: var(--cp-en); font-size: 9px; font-weight: 400; letter-spacing: .14em; opacity: .75; }
.cp-menu .cp-key:hover, .cp-menu .cp-key:focus-visible { background-color: var(--d-pine-frost-10); }
.college-top .cp-menu .cp-out { color: var(--cp-wine); border-top: 1px dashed color-mix(in srgb, var(--p-bark) 30%, transparent); }

/* ---------- phones: badge and pennant on top, tags on a clothesline at the bottom ---------- */
@media (max-width: 699.98px) {
  /* The bar is fixed over a constant 118px of page space, so shrinking it never changes the layout (no scroll-anchoring
     jump between the two sizes); the page simply scrolls under the smaller bar. */
  #college-nav { height: 118px; }
  body[data-compact-nav] #college-nav { height: 66px; }
  .college-top, .college-top[data-compact="always"] { position: fixed; left: 0; right: 0; top: 0; z-index: 30; display: block; height: 118px; min-height: 0; padding: 0; box-shadow: 0 0 0 color-mix(in srgb, var(--d-bark-black-10) 0%, transparent);
    background-color: var(--green-deep, var(--d-pine-black-70));
    background-image: repeating-linear-gradient(90deg, transparent 0 46px, color-mix(in srgb, var(--p-wine) 35%, transparent) 46px 58px, transparent 58px 70px, color-mix(in srgb, var(--tartan-thread) 18%, transparent) 70px 72px, transparent 72px 104px),
      repeating-linear-gradient(0deg, transparent 0 46px, color-mix(in srgb, var(--p-wine) 35%, transparent) 46px 58px, transparent 58px 70px, color-mix(in srgb, var(--tartan-thread) 18%, transparent) 70px 72px, transparent 72px 104px);
    transition: height calc(var(--cp-f) * 2) steps(2, end); }
  .college-top[data-compact] { height: 66px; box-shadow: 0 8px 12px color-mix(in srgb, var(--d-bark-black-10) 35%, transparent); }
  .cp-pennant, .college-top[data-compact="always"] .cp-pennant { position: absolute; left: 2px; top: 8px; width: min(252px, calc(100vw - 122px)); margin: 0;
    transition: width calc(var(--cp-f) * 2) steps(2, end), top calc(var(--cp-f) * 2) steps(2, end); }
  .college-top[data-compact] .cp-pennant { width: 168px; top: 2px; }
  .cp-me, .college-top[data-compact="always"] .cp-me { position: absolute; right: 12px; top: 14px; width: 86px; margin: 0; }
  .college-top .cp-badge { transition: scale calc(var(--cp-f) * 2) steps(2, end); }
  .college-top[data-compact] .cp-badge { scale: .72; }
  .cp-hello b { font-size: 11px; }
  .cp-name { font-size: 18px; padding: 4px 4px 5px; }
  .cp-name.long { font-size: 13px; padding-block: 7px 6px; }
  .cp-menu { position: absolute; right: 0; top: calc(100% + 12px); width: min(252px, calc(100vw - 24px)); }
  .college-top[data-compact] .cp-menu { top: 52px; }

  /* the clothesline */
  .cp-line { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; display: block; height: calc(108px + env(safe-area-inset-bottom, 0px)); isolation: isolate; }
  .cp-line::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--green-deep, var(--d-pine-black-70));
    -webkit-mask: linear-gradient(transparent, var(--d-bark-black-10) 22%); mask: linear-gradient(transparent, var(--d-bark-black-10) 22%); }
  .cp-twine { display: none; }
  .cp-rope { position: absolute; left: 0; top: 14px; display: block; width: 100%; height: 30px; overflow: hidden; pointer-events: none; } /* the rope runs past both edges; clipped so phones never scroll sideways */
  .cp-row { position: absolute; left: 8px; right: 8px; top: 22px; justify-content: space-between; flex-wrap: nowrap; gap: 5px; }
  /* gentler tilts on the line so neighbouring tags never touch, even at 320px */
  .cp-tag, .college-top[data-compact="always"] .cp-tag { --r: calc(var(--r0, 0deg) * .55); flex: 1 1 0; max-width: 92px; min-height: 64px; }
  .cp-tag:nth-child(1) { --h: 4px; } .cp-tag:nth-child(2) { --h: 9px; } .cp-tag:nth-child(3) { --h: 8px; } .cp-tag:nth-child(4) { --h: 3px; }
  .cp-row:has(> :nth-child(3):last-child) > :nth-child(2) { --h: 10px; }
  .cp-row:has(> :nth-child(3):last-child) > :nth-child(3) { --h: 5px; }
  /* a wooden clothes peg instead of a pin, clipped over the rope */
  .cp-peg { top: -12px; width: 9px; height: 24px; margin-left: -4.5px; border-radius: 2px; background: linear-gradient(90deg, var(--peg-wood), var(--peg-wood-hi) 45%, var(--peg-wood));
    box-shadow: 0 2px 2px color-mix(in srgb, var(--d-bark-black-10) 40%, transparent); }
  .cp-peg::after { left: -1px; right: -1px; top: 9px; height: 3px; border-radius: 2px; background: var(--peg-spring); opacity: .8; }
  .cp-card { padding: 9px 4px 8px; }
  .cp-t-lug .cp-card { padding-top: 17px; }
  .cp-cn { font-size: clamp(14px, 4.4vw, 17px); }
  .cp-en { font-size: clamp(7px, 2.2vw, 8.5px); letter-spacing: .1em; }
  .cp-ring { top: -6px; left: -7px; width: calc(100% + 14px); height: calc(100% + 14px); }
  .cp-stamp { right: -3px; top: -9px; }
  /* room for the clothesline under the page, and the toast above it */
  html.has-college-line body { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
  html.has-college-line .college-toast { bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 339.98px) {
  .cp-row { left: 4px; right: 4px; gap: 3px; }
  .cp-card { padding-inline: 2px; }
  .cp-en { letter-spacing: .04em; }
}

/* ---------- stop-motion ---------- */
/* idle, pennant only: the felt edge re-cut each exposure, the hand puts it back a hair off, the tail lifts every 5 s */
.felt-art { filter: url(#felt1); animation: cp-boil calc(var(--cp-idle) * 3) steps(1, end) infinite; animation-play-state: var(--cp-run, running); }
@keyframes cp-boil { 0% { filter: url(#felt1); } 33.33% { filter: url(#felt2); } 66.66% { filter: url(#felt3); } }
.flutter { transform-origin: 60px 90px; animation: cp-flutter 5s steps(1, end) infinite; animation-play-state: var(--cp-run, running); }
@keyframes cp-flutter { 0%, 84% { transform: none; } 84.01% { transform: skewY(-1.8deg) scaleX(.99); } 87.2%, 100% { transform: none; } }
.cp-pennant { animation: cp-hand calc(var(--cp-idle) * 3) steps(1, end) infinite; animation-play-state: var(--cp-run, running); }
@keyframes cp-hand { 0% { translate: var(--ax) var(--ay); rotate: var(--ar); } 33.33% { translate: var(--bx) var(--by); rotate: var(--br); } 66.66% { translate: var(--cx) var(--cy); rotate: var(--cr); } }
html[data-page-hidden] .cp-pennant { --cp-run: paused; }
/* entrance (once per page load, .cp-play): pennant swung in (3), tags swung down from their pegs (3 each), badge stuck on (2), ring drawn (3) */
.cp-play .cp-pennant { animation: cp-pennant-in calc(var(--cp-f) * 3) steps(1, end) both, cp-hand calc(var(--cp-idle) * 3) steps(1, end) infinite; }
@keyframes cp-pennant-in { 0% { transform: translate(-40%, -4px) rotate(-11deg); } 33.33% { transform: translate(2%, 1px) rotate(-2deg); } 66.66%, 100% { transform: rotate(-5deg); } }
.cp-play .cp-twine path { stroke-dasharray: 1100; animation: cp-twine calc(var(--cp-f) * 2) steps(2, end) calc(var(--cp-f) * 2) both; }
@keyframes cp-twine { from { stroke-dashoffset: 1100; } to { stroke-dashoffset: 0; } }
@keyframes cp-hide { 0%, 100% { visibility: hidden; } }
@keyframes cp-tag-in { 0% { transform: rotate(calc(var(--r) * 4)); } 33.33% { transform: rotate(calc(var(--r) * -1.5)); } 66.66%, 100% { transform: rotate(var(--r)); } }
.cp-play .cp-tag { animation: cp-hide calc(var(--cp-f) * (3 + var(--i))) steps(1, end), cp-tag-in calc(var(--cp-f) * 3) steps(1, end) calc(var(--cp-f) * (3 + var(--i))) forwards; }
.cp-tag.cp-drop { animation: cp-hide calc(var(--cp-f) * var(--i) + 1ms) steps(1, end), cp-tag-in calc(var(--cp-f) * 3) steps(1, end) calc(var(--cp-f) * var(--i)) forwards; }
@keyframes cp-stick { 0% { transform: rotate(11deg) scale(1.12); } 50%, 100% { transform: rotate(5deg); } }
.cp-play .cp-badge { animation: cp-hide calc(var(--cp-f) * 8) steps(1, end), cp-stick calc(var(--cp-f) * 2) steps(1, end) calc(var(--cp-f) * 8) forwards; }
@keyframes cp-draw { from { stroke-dashoffset: 190; } to { stroke-dashoffset: 0; } }
.cp-play .cp-ring path { animation: cp-draw calc(var(--cp-f) * 3) steps(3, end) calc(var(--cp-f) * 9) both; }
.cp-ring.cp-redraw path { animation: cp-draw calc(var(--cp-f) * 3) steps(3, end) both; }
/* pressing a tag flicks it (+6°, −3°, back); hover only where there is a real pointer */
@keyframes cp-swing { 0% { transform: rotate(calc(var(--r) + 6deg)); } 33.33% { transform: rotate(calc(var(--r) - 3deg)); } 66.66%, 100% { transform: rotate(var(--r)); } }
@media (hover: hover) { .cp-tag:hover { animation: cp-swing calc(var(--cp-f) * 3) steps(1, end); } }
.cp-tag.cp-flick { animation: cp-swing calc(var(--cp-f) * 3) steps(1, end); }
/* a new page's first card drops into place; the badge menu is slapped down the same way */
@keyframes cp-slap { 0% { translate: 0 14px; rotate: 1.5deg; } 50%, 100% { translate: none; rotate: none; } }
.cp-slap, .cp-menu.cp-pop { animation: cp-slap calc(var(--cp-f) * 2) steps(1, end); }
/* reduced motion: the last frame of everything, nothing idles */
@media (prefers-reduced-motion: reduce) {
  .cp-pennant, .felt-art, .flutter, .cp-tag, .cp-badge, .cp-ring path, .cp-twine path, .cp-slap, .cp-menu { animation: none !important; transition: none !important; }
  .college-top, .college-top .cp-badge { transition: none !important; }
}
html[data-reduced-motion] :is(.cp-pennant, .cp-tag, .cp-badge, .cp-ring path, .cp-twine path, .cp-slap, .cp-menu, .college-top) { animation: none !important; transition: none !important; }
html[data-reduced-motion] .cp-pennant { --cp-run: paused; }

/* ---------- empty lists: one sentence and a small paper slip ---------- */
.paper-bit { position: relative; display: block; width: 46px; height: 34px; margin: 0 auto 10px; transform: rotate(-4deg);
  background: var(--paper-bit) repeating-linear-gradient(transparent 0 7px, color-mix(in srgb, var(--p-navy) 18%, transparent) 7px 8px); border-top: 4px solid var(--paper-bit-rule);
  box-shadow: 0 4px 6px color-mix(in srgb, var(--d-bark-black-10) 25%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--p-bark) 12%, transparent); }
.paper-bit::before { content: ""; position: absolute; left: 12px; top: -10px; width: 24px; height: 10px; background: var(--tape); transform: rotate(6deg); }

/* ---------- toast, offline bar, failure card ---------- */
/* 4 飞翔: the goose crosses the screen once after a letter is confirmed sent (elements.js gooseFlyby). */
.goose-flyby { position: fixed; left: 0; bottom: 22vh; width: clamp(120px, 26vw, 210px); z-index: 61; pointer-events: none; }
.goose-flyby img { display: block; width: 100%; height: auto; }
.college-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) rotate(-1deg); z-index: 60; max-width: calc(100% - 32px);
  background: var(--gold-soft); color: var(--brown); padding: 10px 18px; box-shadow: 2px 4px 0 color-mix(in srgb, var(--d-bark-black-10) 25%, transparent); font-weight: 700; }
.college-toast[data-kind="error"] { background: var(--red); color: var(--cream); }
.college-offline { position: sticky; top: 0; z-index: 35; padding: 7px 14px; text-align: center; font-size: 13px; font-weight: 700; background: var(--brown, var(--p-bark)); color: var(--cream); }
.college-failure { display: grid; justify-items: start; gap: 6px; padding: 18px 20px; background: var(--paper, var(--d-paper-white-50)); color: var(--ink); border-left: 4px solid var(--red);
  box-shadow: 3px 4px 0 color-mix(in srgb, var(--d-bark-black-10) 20%, transparent); }
.college-failure b { font-family: var(--zh); color: var(--red-deep); }
.college-failure span { font-size: 13.5px; color: var(--brown); }
.college-failure.compact { padding: 10px 12px; box-shadow: none; background: transparent; }

/* ---------- motion states (driven by College.motion / mount / list) ---------- */
[data-motion], .motion-overlay { transition: opacity var(--dur) var(--ease), translate var(--dur) var(--ease); }
/* Snapshot of replaced content: never interactive, never in the accessibility tree (see College.mount). */
.motion-overlay[data-snapshot] * { pointer-events: none !important; }
[data-motion-state="entering"] { opacity: 0; translate: 0 8px; }
[data-motion-state="entered-pending"], [data-motion-state="entered"] { opacity: 1; translate: 0 0; }
[data-motion-state="leaving"] { opacity: 1; }
[data-motion-state="leaving-active"], [data-motion-state="left"] { opacity: 0; translate: 0 -4px; }
/* The previous view fades out on top of the new one without taking layout space or input. */
.motion-overlay { position: absolute; inset: 0 0 auto 0; pointer-events: none; z-index: 1; }
:has(> .motion-overlay) { position: relative; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
  [data-motion-state="entering"] { opacity: 1; translate: none; }
}
html[data-reduced-motion] [data-motion-state] { transition: none !important; }
html[data-reduced-motion] .motion-overlay { display: none; }

/* ---------- back/forward cache: private content stays hidden until the account is confirmed ---------- */
html[data-verifying] body > :not(#college-nav):not(#college-verify):not(#college-offline),
html[data-verifying] .cp-me { visibility: hidden; }
#college-verify .small-btn { margin-left: 10px; padding: 3px 10px; border: 1px solid color-mix(in srgb, var(--p-paper) 60%, transparent); border-radius: 4px; background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
#college-verify .small-btn:hover, #college-verify .small-btn:focus-visible { background: color-mix(in srgb, var(--d-bark-black-10) 25%, transparent); }

/* 添加到主屏幕: a one-time paper slip for members on touch screens (shell.js homeScreen). Above the phone clothesline. */
.home-hint { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 45; transform: translateX(-50%) rotate(-.4deg);
  width: min(380px, calc(100% - 24px)); display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 14px 40px 14px 14px;
  background: var(--card-paper, var(--p-paper)); color: var(--card-text, var(--p-bark)); border-top: 4px solid var(--p-wine);
  box-shadow: 3px 4px 0 color-mix(in srgb, var(--d-bark-black-10) 25%, transparent), 0 16px 30px -12px color-mix(in srgb, var(--d-bark-black-10) 60%, transparent); }
html.has-college-line .home-hint { bottom: calc(116px + env(safe-area-inset-bottom, 0px)); }
.home-hint img { width: 44px; height: 44px; border-radius: 10px; }
.home-hint b { display: block; font-family: var(--zh); font-weight: 900; font-size: 16px; color: var(--p-pine); }
.home-hint p { margin: 4px 0 10px; font-size: 14px; line-height: 1.6; }
.home-hint-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.home-hint-actions button { min-height: 40px; padding: 0 14px; border: 1px solid var(--p-pine); border-radius: 4px; background: var(--p-pine); color: var(--p-paper); box-shadow: none; font: inherit; font-size: 14px; cursor: pointer; }
.home-hint-actions button.secondary { background: transparent; color: var(--p-pine); }
.home-hint-x { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; box-shadow: none; background: none; color: var(--p-bark); font-size: 22px; line-height: 1; cursor: pointer; }
.home-hint button:focus-visible { outline: 2px dashed var(--p-gold); outline-offset: 2px; }

/* 跳到正文: hidden until a keyboard focuses it, then a paper tab at the top-left corner. */
.skip-link { position: fixed; left: 12px; top: calc(8px + env(safe-area-inset-top, 0px)); z-index: 100; padding: 10px 16px; background: var(--p-paper); color: var(--p-wine);
  font-weight: 700; text-decoration: none; border-top: 4px solid var(--p-wine); box-shadow: 2px 3px 0 color-mix(in srgb, var(--d-bark-black-10) 30%, transparent);
  transform: translateY(-200%); }
.skip-link:focus { transform: none; outline: 2px dashed var(--p-gold); outline-offset: 2px; }

/* 切换账号: 我的账号 in the badge menu (shell.js) */
.cp-menu-h { margin: 6px 16px 2px; font-family: var(--cp-en); font-size: 10px; letter-spacing: .18em; color: var(--cp-wine); }
.cp-accounts { display: grid; padding-bottom: 4px; border-bottom: 1px dashed color-mix(in srgb, var(--p-bark) 30%, transparent); }
.cp-menu .cp-acct, .college-top .cp-menu .cp-acct { justify-content: flex-start; gap: 10px; min-height: 52px; }
.cp-menu .cp-acct.current { display: flex; align-items: center; gap: 10px; padding: 0 16px; min-height: 52px; background: color-mix(in srgb, var(--p-gold) 14%, transparent); cursor: default; }
.cp-avatar { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; color: var(--cp-paper); font-family: var(--cp-zh); font-size: 15px; font-weight: 900; }
.cp-acct-text { display: grid; min-width: 0; line-height: 1.25; }
.cp-acct-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.cp-acct-text small { font-family: var(--cp-en); font-size: 11px; font-weight: 400; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-acct-mark { margin-left: auto; padding: 1px 7px; font-size: 11px; color: var(--cp-paper); background: var(--cp-wine); border-radius: 2px; }
.college-top .cp-menu .cp-add { color: var(--cp-bark); font-size: 14px; }
.college-top .cp-menu .cp-add small { font-size: 11px; font-weight: 400; opacity: .65; }
.college-top .cp-menu .cp-out-all { border-top: 0; font-size: 14px; font-weight: 400; }
.cp-add-dialog { width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; background: transparent; overflow: visible; }
.cp-add-dialog::backdrop { background: color-mix(in srgb, var(--d-pine-black-70) 70%, transparent); }
.cp-add-dialog .login-wrap { padding: 12px 0; }
.cp-add-dialog .login-back, .cp-add-dialog .login-goose { display: none; }
.cp-add-close { position: absolute; z-index: 2; left: 8px; top: 18px; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: var(--cp-paper); color: var(--cp-bark); font-size: 22px; cursor: pointer; box-shadow: 0 2px 6px color-mix(in srgb, var(--d-bark-black-10) 40%, transparent); }

/* 防呆: in-page confirmation, field checks, counters, toast action (shell.js) */
.cp-confirm { width: min(420px, calc(100vw - 24px)); padding: 0; border: 0; background: transparent; overflow: visible; }
.cp-confirm::backdrop { background: color-mix(in srgb, var(--d-pine-black-70) 70%, transparent); }
.cp-confirm form { display: grid; gap: 12px; padding: 22px 22px 18px; background: var(--cp-paper); color: var(--cp-bark); border-top: 6px solid var(--cp-wine);
  box-shadow: 0 14px 30px color-mix(in srgb, var(--d-bark-black-10) 50%, transparent); transform: rotate(-.4deg); }
.cp-confirm h2 { margin: 0; font-family: var(--cp-zh); font-size: 20px; line-height: 1.35; }
.cp-confirm-body { margin: 0; font-size: 15px; line-height: 1.65; white-space: pre-line; }
.cp-confirm-field { display: grid; gap: 6px; font-size: 14px; }
.cp-confirm-input { min-height: 46px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 4px; background: var(--cream); color: var(--ink); font: inherit; font-size: 16px; }
.cp-confirm-hint { margin: 0; min-height: 1em; font-size: 13px; color: var(--red); }
.cp-confirm-hint:empty { display: none; }
.cp-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.cp-confirm-actions button { min-height: 46px; min-width: 96px; padding: 0 18px; border-radius: 4px; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.cp-confirm-no { border: 1.5px solid var(--line); background: transparent; color: var(--cp-bark); }
.cp-confirm-yes { border: 0; background: var(--cp-pine); color: var(--cp-paper); }
.cp-confirm-yes.danger { background: var(--cp-wine); }
.cp-confirm-yes:disabled { opacity: .45; cursor: not-allowed; }
.field-error { display: block; margin-top: 4px; font-size: 13px; line-height: 1.5; color: var(--red); }
.field-error:empty { display: none; }
[aria-invalid] { border-color: var(--red) !important; }
.field-count { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); text-align: right; }
.field-count[data-over] { color: var(--red); font-weight: 700; }
.college-toast .toast-action { margin-left: 12px; min-height: 36px; padding: 0 12px; border: 1.5px solid currentColor; border-radius: 3px; background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
