/* Fonts are served from this site so no page ever contacts a third party. SIL OFL 1.1, see fonts/OFL-*.txt. */
@font-face {
  font-family: "Cinzel";
  src: url("/fonts/cinzel.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Crimson Pro";
  src: url("/fonts/crimson-pro.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Crimson Pro";
  src: url("/fonts/crimson-pro-italic.woff") format("woff");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --night: #120f24;
  --night-2: #1d1838;
  --parchment: #f4ead3;
  --parchment-edge: #e2d3ad;
  --ink: #2b2118;
  --ink-soft: #5a4a3a;
  --gold: #e8c873;
  --gold-deep: #b8913a;
  --danger: #9b2c22;
  /* Overwritten with the student's house colours once they're sorted. */
  --house: #6b4fa0;
  --house-accent: #e8c873;
  --radius: 16px;
  --tap: 52px;
  --display: "Cinzel", Georgia, serif;
  --body: "Crimson Pro", Georgia, serif;
}

* { box-sizing: border-box; }

/* `hidden` always wins, even over a class that sets display. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--body);
  font-size: 20px;
  line-height: 1.45;
  color: var(--parchment);
  background-color: var(--night);
  touch-action: manipulation;
}

/* The sky sits on a fixed layer: iPad Safari ignores background-attachment: fixed. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 9%, #fff9 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 33% 42%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 36%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 55% 22%, #fffa 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 66%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 94% 74%, #fff7 50%, transparent 51%),
    linear-gradient(180deg, var(--night) 0%, var(--night-2) 60%, #2a1f3d 100%);
}

#app {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.4em;
  letter-spacing: 0.02em;
}
h1 { font-size: clamp(28px, 5vw, 44px); }
h2 { font-size: clamp(22px, 3.6vw, 30px); }
h3 { font-size: 21px; }
p { margin: 0 0 0.8em; }

/* ---------- building blocks ---------- */

.card {
  background: var(--parchment);
  color: var(--ink);
  border-radius: var(--radius);
  border: 2px solid var(--parchment-edge);
  box-shadow: 0 10px 30px #0007, inset 0 0 40px #c9b38433;
  padding: 24px;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 12px 24px;
  border: 0;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--house);
  box-shadow: 0 4px 0 #0005, 0 6px 16px #0004;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #0005; }
.btn:disabled { filter: grayscale(0.7) brightness(0.8); cursor: default; }
.btn.gold { background: linear-gradient(180deg, var(--gold), var(--gold-deep)); color: var(--ink); }
.btn.ghost {
  background: transparent;
  color: var(--parchment);
  box-shadow: inset 0 0 0 2px #f4ead355;
}
.btn.wide { width: 100%; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

label { display: block; font-weight: 600; margin: 14px 0 6px; }

input[type="text"], input[type="password"] {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 16px;
  /* 16px or more stops iPad Safari zooming in on focus. */
  font: 500 20px var(--body);
  color: var(--ink);
  background: #fffaf0;
  border: 2px solid var(--parchment-edge);
  border-radius: 12px;
}
input:focus { border-color: var(--gold-deep); outline: none; }

.error {
  color: var(--danger);
  font-weight: 600;
  min-height: 1.4em;
  margin: 12px 0 0;
}

.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.topbar .crest { width: 44px; height: auto; flex: none; }
.topbar .school {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.1;
  flex: 1;
  min-width: 0;
}
.topbar .school .short { display: none; }
@media (max-width: 560px) {
  .topbar { gap: 8px; }
  .topbar .crest { width: 36px; }
  .topbar .school { font-size: 15px; }
  .topbar .school .full { display: none; }
  .topbar .school .short { display: inline; }
  .topbar nav { gap: 6px; flex-wrap: nowrap; }
  .topbar .btn { padding: 8px 12px; font-size: 14px; }
}
.topbar nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.topbar .btn { min-height: 44px; padding: 8px 16px; font-size: 15px; }

/* ---------- login ---------- */

.login {
  min-height: calc(100dvh - 48px);
  display: grid;
  place-items: center;
}
.login .inner { width: 100%; max-width: 440px; }
.login .crest { display: block; width: 120px; margin: 0 auto 12px; }
.login h1 { text-align: center; }
.login .tagline { text-align: center; color: var(--gold); margin-bottom: 24px; }
.login form .btn { margin-top: 20px; }

/* ---------- sorting ---------- */

.sorting { max-width: 760px; margin: 0 auto; }
.sorting .stone {
  display: block;
  width: min(220px, 50vw);
  margin: 0 auto 8px;
  filter: drop-shadow(0 8px 16px #0008);
}
.sorting .stone.thinking { animation: wobble 0.9s ease-in-out infinite; }
.speech {
  font-style: italic;
  font-size: 22px;
  text-align: center;
  color: var(--gold);
  margin: 0 0 20px;
}
.dots { display: flex; justify-content: center; gap: 8px; margin: 0 0 16px; }
.dots span { width: 12px; height: 12px; border-radius: 50%; background: #f4ead333; }
.dots span.on { background: var(--gold); }

.answers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}
@media (min-width: 640px) {
  .answers { grid-template-columns: 1fr 1fr; }
}
.answer {
  appearance: none;
  min-height: 84px;
  padding: 14px 18px;
  text-align: left;
  font: 600 20px var(--body);
  color: var(--ink);
  background: #fffaf0;
  border: 2px solid var(--parchment-edge);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease;
}
.answer:active { transform: scale(0.98); border-color: var(--gold-deep); }

.reveal {
  text-align: center;
  color: #fff;
  background: var(--house);
  border-color: var(--house-accent);
  animation: rise 0.6s ease-out both;
}
.reveal .house-name {
  font-family: var(--display);
  font-size: clamp(40px, 9vw, 72px);
  font-weight: 700;
  color: var(--house-accent);
  margin: 8px 0;
  text-shadow: 0 3px 12px #0006;
}
.reveal p { color: #fff; }

/* ---------- great hall ---------- */

.banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--house), color-mix(in srgb, var(--house) 60%, #000));
  border: 2px solid var(--house-accent);
  box-shadow: 0 10px 30px #0006;
}
.banner .house-mark {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  color: var(--house);
  background: var(--house-accent);
}
.banner h1 { margin: 0; font-size: clamp(24px, 4.4vw, 36px); }
.banner p { margin: 2px 0 0; color: #ffffffcc; }

.cup {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}
.cup img { width: 84px; height: auto; }
.cup h2 { font-size: 22px; margin-bottom: 4px; }
.cup p { margin: 0 0 10px; }
.bar {
  height: 18px;
  border-radius: 999px;
  background: #2b211822;
  overflow: hidden;
  border: 1px solid #2b211833;
}
.bar > div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  transition: width 0.8s ease;
}
.cup .score { font-weight: 700; margin-top: 6px; }
@media (max-width: 560px) {
  .cup { grid-template-columns: 1fr; gap: 10px; }
  .cup img { width: 64px; }
}

.section-title { color: var(--gold); margin: 6px 0 12px; }

.classes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 640px) {
  .classes { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1000px) {
  .classes { grid-template-columns: 1fr 1fr 1fr; }
}

.door {
  appearance: none;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 150px;
  padding: 18px 18px 16px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--parchment);
  border: 2px solid var(--parchment-edge);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px #0006;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.door:active { transform: scale(0.985); }
.door .subject {
  padding-right: 34px;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.door .title { font-family: var(--display); font-size: 22px; font-weight: 700; line-height: 1.15; }
.door .promise { font-size: 18px; color: var(--ink-soft); margin-top: 2px; }
.door .chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.chip {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font: 700 14px var(--display);
  letter-spacing: 0.04em;
}
.chip.open { background: var(--house); color: #fff; }
.chip.done { background: #2f6b3a; color: #fff; }
.chip.locked { background: #2b211822; color: var(--ink-soft); }
.chip.ai { background: #4b3a6e; color: #fff; }
.door .num {
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  color: #2b211826;
}
.door.locked { background: #d9ccae; opacity: 0.75; }
.door.done { border-color: #2f6b3a; }

.notice {
  margin: 14px 0 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: #00000055;
  color: var(--parchment);
  text-align: center;
}

/* ---------- class + headmaster ---------- */

.classroom { max-width: 720px; margin: 0 auto; }
.classroom .card { text-align: center; }
.classroom .subject { color: var(--ink-soft); font-family: var(--display); letter-spacing: 0.08em; text-transform: uppercase; font-size: 15px; }

.students { display: grid; gap: 14px; }
.student h3 { margin-bottom: 2px; }
.student .row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.student .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- a class ---------- */

.lesson { max-width: 820px; margin: 0 auto; display: grid; gap: 16px; }
.lesson-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.lesson-head h1 { margin: 0; }
.eyebrow {
  margin: 0 0 4px;
  font: 700 14px var(--display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}
.lesson-score {
  flex: none;
  padding: 6px 14px;
  border-radius: 999px;
  font: 700 18px var(--display);
  color: var(--ink);
  background: var(--gold);
  font-variant-numeric: tabular-nums;
}
.lesson-bar { height: 10px; background: #f4ead322; border-color: #f4ead333; }
.leave { margin-top: 8px; }
.leave .btn { min-height: 44px; font-size: 15px; }
.small { font-size: 16px; }

.speaker { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; }
.speaker img { width: 64px; height: auto; filter: drop-shadow(0 4px 8px #0006); }
.bubble {
  position: relative;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--parchment);
  color: var(--ink);
  box-shadow: 0 6px 18px #0005;
}
.bubble .who {
  display: block;
  font: 700 13px var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2f6b3a;
}
.speaker.fib .bubble { background: #efe1f5; }
.speaker.fib .who { color: #8c1c13; }
.bubble p { margin: 2px 0 0; }
.bubble p + p { margin-top: 10px; }

.label {
  display: block;
  font: 700 13px var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.spell-card { display: grid; gap: 12px; align-content: start; }
.spell { margin: 0; font-style: italic; font-size: 21px; }
.spell.big { font-size: clamp(22px, 4vw, 30px); font-weight: 600; }
.spell.mumbled { text-decoration: line-through wavy #8c1c1399; }
.pair { display: grid; gap: 14px; align-items: start; }
@media (min-width: 700px) { .pair { grid-template-columns: 1fr 1fr; } }
.spell-card.vague { border-color: #c9a9a2; }
.spell-card.clear { border-color: #8fb99a; }
.ai-result {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fffaf0;
  border: 2px dashed var(--parchment-edge);
}
.ai-result p { margin: 4px 0 0; }
.actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.flips { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.flip {
  appearance: none;
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 110px;
  padding: 14px;
  text-align: left;
  font: inherit;
  color: #fff;
  background: linear-gradient(160deg, #4b3a6e, #2a2140);
  border: 2px solid var(--gold);
  border-radius: 14px;
  cursor: pointer;
}
.flip .s-name { font: 700 22px var(--display); color: var(--gold); }
.flip .tap { font-size: 15px; color: #ffffffaa; }
.flip[aria-expanded="true"] { background: var(--parchment); color: var(--ink); }
.flip[aria-expanded="true"] .tap { display: none; }
.flip[aria-expanded="true"] .s-name { color: var(--ink); }
.flip .back { display: grid; gap: 2px; }
.flip .means { font-weight: 700; }
.flip .example { font-size: 16px; color: var(--ink-soft); }
.build { margin: 0; padding: 16px 16px 16px 40px; display: grid; gap: 4px; }
.glow {
  margin: 0;
  padding: 14px 18px;
  border: 2px dashed var(--gold);
  border-radius: 14px;
  font-style: italic;
  font-size: 21px;
  background: #e8c87322;
}
.after { display: grid; gap: 14px; justify-items: center; }
.after .speaker { justify-self: stretch; }

.s-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.s-toggle, .tile {
  appearance: none;
  min-height: var(--tap);
  padding: 10px 16px;
  font: 700 18px var(--body);
  color: var(--ink);
  background: #fffaf0;
  border: 2px solid var(--parchment-edge);
  border-radius: 999px;
  cursor: pointer;
}
.s-toggle { font-family: var(--display); font-size: 16px; letter-spacing: 0.03em; }
.s-toggle[aria-pressed="true"], .tile[aria-pressed="true"] {
  color: #fff;
  background: var(--house);
  border-color: var(--house);
}
.s-toggle.answer { box-shadow: 0 0 0 3px var(--gold); }
.s-toggle:disabled, .tile:disabled { cursor: default; opacity: 0.85; }

.tile-row { display: grid; gap: 6px; }
.tile-label { margin: 0; font: 700 15px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.tile { font-weight: 600; font-size: 17px; border-radius: 12px; }
.live-box { display: grid; gap: 8px; border-style: solid; border-color: var(--gold); }
.live { margin: 0; font-size: 21px; font-weight: 600; }
.meter { height: 12px; border-radius: 999px; background: #2b211822; overflow: hidden; }
.meter > div { height: 100%; width: 0; background: linear-gradient(90deg, #6b4fa0, var(--gold)); transition: width 0.4s ease; }
.power { font-size: 16px; color: var(--ink-soft); }

.options { display: grid; gap: 12px; }
.option {
  appearance: none;
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  text-align: left;
  font: 500 19px var(--body);
  font-style: italic;
  color: var(--ink);
  background: var(--parchment);
  border: 3px solid var(--parchment-edge);
  border-radius: 16px;
  cursor: pointer;
}
.option .label { font-style: normal; }
.option.right { border-color: #2f6b3a; }
.option.wrong { border-color: #9b2c22; opacity: 0.75; }

textarea {
  width: 100%;
  padding: 12px 14px;
  font: 500 19px var(--body);
  color: var(--ink);
  background: #fffaf0;
  border: 2px solid var(--parchment-edge);
  border-radius: 12px;
  resize: vertical;
}
textarea:focus { border-color: var(--gold-deep); outline: none; }

.feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 14px;
  color: #fff;
  animation: rise 0.3s ease-out both;
}
.feedback p { margin: 0; }
.feedback.good { background: #2f6b3a; }
.feedback.bad { background: #7a3b2e; }
.points-pop {
  flex: none;
  padding: 4px 12px;
  border-radius: 999px;
  font: 700 16px var(--display);
  color: var(--ink);
  background: var(--gold);
}

.finish { display: grid; justify-items: center; gap: 6px; }
.badge-earned {
  display: grid;
  justify-items: center;
  gap: 2px;
  margin-top: 8px;
  padding: 10px 22px;
  border-radius: 14px;
  background: #00000033;
  border: 2px solid var(--house-accent);
}
.badge-earned .label { color: #ffffffcc; }
.badge-name { font: 700 24px var(--display); color: var(--house-accent); }
.unlocked { color: var(--gold); font-weight: 700; }

.single { display: grid; }
.scene { width: 100%; height: auto; border-radius: 12px; border: 2px solid var(--parchment-edge); }
.option .label + span { font-style: italic; }
.options.plain .option { font-style: normal; font-weight: 600; }

.bowls { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.bowl {
  appearance: none;
  display: grid;
  gap: 4px;
  min-height: 84px;
  padding: 14px;
  text-align: center;
  font: inherit;
  color: #fff;
  background: linear-gradient(160deg, #4b3a6e, #2a2140);
  border: 3px solid var(--gold);
  border-radius: 18px;
  cursor: pointer;
}
.bowl-name { font: 700 19px var(--display); color: var(--gold); }
.bowl-note { font-size: 15px; color: #ffffffcc; }
.bowl.right { border-color: #8fd3a5; box-shadow: 0 0 0 3px #2f6b3a; }
.bowl.wrong { opacity: 0.6; }
.bowl:disabled { cursor: default; }

.shield { display: grid; gap: 10px; border-width: 3px; transition: box-shadow 0.4s ease; }
.shield.glowing { box-shadow: 0 0 0 4px var(--gold), 0 0 40px #e8c873aa; }
.promises { display: grid; gap: 10px; }
.promise {
  appearance: none;
  min-height: var(--tap);
  padding: 12px 16px;
  text-align: left;
  font: 600 19px var(--body);
  color: var(--ink);
  background: #fffaf0;
  border: 2px dashed var(--parchment-edge);
  border-radius: 14px;
  cursor: pointer;
}
.promise[aria-pressed="true"] { color: #fff; background: var(--house); border: 2px solid var(--house); }

.spell-card.postcard { border-style: dashed; transform: rotate(-1deg); }
.spell-card.wishbot { background: #e8f1ff; border-color: #7aa2e3; }
.spell-card.wishbot .spell { font-style: normal; }

/* ---------- the real AI ---------- */

.chat-card { gap: 14px; }
.chat { display: grid; gap: 10px; }
.chat:empty { display: none; }
.chat-line { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: start; }
.chat-line img { width: 44px; height: auto; }
.chat-line.mine { grid-template-columns: 1fr; justify-items: end; }
.chat-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  background: #fffaf0;
  border: 2px solid var(--parchment-edge);
  overflow-wrap: anywhere;
}
.chat-line.mine .chat-bubble { background: var(--house); border-color: var(--house); color: #fff; }
.chat-line.mine .who { color: #ffffffcc; }
.chat-bubble .who {
  display: block;
  font: 700 12px var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4b3a6e;
}
.chat-bubble p { margin: 2px 0 0; white-space: pre-wrap; }
.chat-line.pending .chat-bubble { opacity: 0.7; font-style: italic; }
.composer { display: grid; gap: 10px; }
.composer .error { margin: 0; min-height: 0; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestion {
  appearance: none;
  min-height: 44px;
  padding: 8px 14px;
  font: 600 17px var(--body);
  color: var(--ink);
  background: #efe1f5;
  border: 2px dashed #b9a2d4;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
}

.familiar-form { display: grid; gap: 4px; }
.familiar-form label { margin-top: 8px; }
.field-row { display: grid; gap: 0 12px; }
@media (min-width: 640px) { .field-row { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }
.familiar-card { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; }
.familiar-card img { width: 96px; height: auto; }
.familiar-card p { margin: 0; }
.familiar-name { font: 700 28px var(--display); }
.familiar-kind { font-style: italic; color: var(--ink-soft); }
.familiar-card.big {
  padding: 18px 22px;
  border-radius: var(--radius);
  background: var(--parchment);
  color: var(--ink);
  border: 2px solid var(--house-accent);
}

.prizes h2 { font-size: 22px; margin-bottom: 4px; }
.prizes { margin-bottom: 22px; }
.prize-list { margin: 0 0 10px; padding-left: 1.2em; display: grid; gap: 4px; font-weight: 600; }
.prizes.graduated { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold), 0 10px 30px #0007; }
.graduates { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.graduate { text-align: center; }
.graduate h2 { margin: 4px 0; }

.alert {
  appearance: none;
  display: grid;
  gap: 4px;
  width: 100%;
  margin-bottom: 18px;
  text-align: left;
  font: inherit;
  color: #fff;
  background: #9b2c22;
  border-color: #f3b0a8;
  cursor: pointer;
}
.alert-list { border-color: #9b2c22; margin-bottom: 18px; }
.log { display: grid; gap: 8px; margin: 10px 0 14px; }
.log-line { padding: 8px 12px; border-radius: 10px; background: #fffaf0; border-left: 5px solid #b9a2d4; }
.log-line.kid { border-left-color: var(--house); }
.log-line.flagged { background: #fbe3df; border-left-color: #9b2c22; }
.log-line p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-meta { font-size: 15px; color: var(--ink-soft); }
.log-line .actions { justify-content: flex-start; margin-top: 6px; }
.hidden-note { margin: 0; font-size: 16px; }

/* ---------- the diploma: letter-size paper ---------- */

.diploma-page { display: grid; gap: 18px; justify-items: center; }
.diploma {
  --dip: #6b4fa0;
  --dip-accent: #e8c873;
  width: 100%;
  max-width: 760px;
  aspect-ratio: 11 / 8.5;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  padding: 5% 7%;
  text-align: center;
  color: var(--ink);
  background: #fffaf0;
  border: 14px double var(--dip);
  outline: 4px solid var(--dip-accent);
  outline-offset: -26px;
  border-radius: 6px;
  box-shadow: 0 10px 30px #0007;
}
.diploma p { margin: 0; }
.dip-crest { width: 64px; height: auto; }
.dip-school { font: 700 clamp(18px, 3.4vw, 30px) var(--display); color: var(--dip); letter-spacing: 0.04em; }
.dip-certifies, .dip-body { font-style: italic; font-size: clamp(15px, 2.4vw, 21px); }
.dip-name { font: 700 clamp(30px, 6.4vw, 56px) var(--display); color: var(--dip); line-height: 1.1; }
.dip-house { font: 700 clamp(15px, 2.6vw, 22px) var(--display); letter-spacing: 0.08em; }
.dip-badges {
  list-style: none;
  margin: 6px 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.dip-badges li {
  display: grid;
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid var(--dip-accent);
  background: color-mix(in srgb, var(--dip-accent) 30%, #fff);
  font-size: clamp(11px, 1.6vw, 15px);
  line-height: 1.1;
}
.dip-badges span { font-weight: 700; }
.dip-badges small { color: var(--ink-soft); }
.dip-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 12%; width: 80%; margin-top: 12px; }
.dip-foot div { display: grid; gap: 2px; }
.dip-line { border-bottom: 2px solid var(--ink); font-size: clamp(14px, 2.2vw, 19px); }
.dip-foot small { font: 700 12px var(--display); letter-spacing: 0.1em; text-transform: uppercase; }
.diploma > * { min-width: 0; max-width: 100%; }
@media (max-width: 560px) {
  /* A phone shows it tall instead of landscape; printing uses the page size below. */
  .diploma { aspect-ratio: auto; padding: 32px 18px; border-width: 8px; outline-offset: -18px; }
  .dip-foot { width: 100%; gap: 8%; }
}

@media print {
  @page { size: letter landscape; margin: 0.4in; }
  body { background: #fff; }
  body::before, .topbar, .no-print { display: none !important; }
  #app { max-width: none; padding: 0; }
  .diploma { max-width: none; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- motion ---------- */

@keyframes wobble {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.fade-in { animation: rise 0.35s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
