/* Dhruv's Quest. Rich, soft pixel world: deep sage, sea and terracotta under plum-chrome UI with cream text. Never pure black, never neon. */
:root {
  color-scheme: dark;
  --ink: #f6ecd6;
  --ink-2: #b9b2d9;
  --on-light: #2a1a10;
  --paper: #1d1840;
  --lilac: #2a2350;
  --lilac-line: #4a4080;
  --sage: #3fa36b;
  --ground: #0e0c24;
  --ground-2: #161236;
  --coral: #e8604f;
  --coral-ink: #ff8f7a;
  --yellow: #f2c14e;
  --sea: #4a78c9;
  --wood: #a8743f;
  --parch: #efe0bd;
  --parch-ink: #3b2a1a;
  --wax: #b3262d;

  --f-title: 'Almendra', 'Jersey 10', serif;
  --f-display: 'Almendra', 'Jersey 10', serif;
  --f-dialog: 'Almendra', 'Jersey 10', serif;
  --f-body: 'Literata', Georgia, 'Times New Roman', serif;

  /* 9-slice pixel frames: outline, gold bevel, corner studs, fill. */
  --fr-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cpath fill='%2307061a' d='M1 0h7v1H1zM0 1h1v7H0zM8 1h1v7H8zM1 8h7v1H1z'/%3E%3Cpath fill='%23a8862e' d='M1 1h7v1H1zM1 2h1v5H1zM7 2h1v5H7zM1 7h7v1H1z'/%3E%3Cpath fill='%23f2c14e' d='M1 1h2v1H1zM1 2h1v1H1zM6 1h2v1H6zM7 2h1v1H7zM1 7h2v1H1zM1 6h1v1H1zM6 7h2v1H6zM7 6h1v1H7z'/%3E%3Cpath fill='%231d1840' d='M2 2h5v5H2z'/%3E%3C/svg%3E");
  --fr-hot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cpath fill='%2307061a' d='M1 0h7v1H1zM0 1h1v7H0zM8 1h1v7H8zM1 8h7v1H1z'/%3E%3Cpath fill='%23f2c14e' d='M1 1h7v1H1zM1 2h1v5H1zM7 2h1v5H7zM1 7h7v1H1z'/%3E%3Cpath fill='%23fff0b8' d='M1 1h2v1H1zM1 2h1v1H1zM6 1h2v1H6zM7 2h1v1H7zM1 7h2v1H1zM1 6h1v1H1zM6 7h2v1H6zM7 6h1v1H7z'/%3E%3Cpath fill='%23262052' d='M2 2h5v5H2z'/%3E%3C/svg%3E");
  --fr-lilac: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cpath fill='%2307061a' d='M1 0h7v1H1zM0 1h1v7H0zM8 1h1v7H8zM1 8h7v1H1z'/%3E%3Cpath fill='%233a3170' d='M1 1h7v1H1zM1 2h1v5H1zM7 2h1v5H7zM1 7h7v1H1z'/%3E%3Cpath fill='%235a4e9a' d='M1 1h2v1H1zM1 2h1v1H1zM6 1h2v1H6zM7 2h1v1H7zM1 7h2v1H1zM1 6h1v1H1zM6 7h2v1H6zM7 6h1v1H7z'/%3E%3Cpath fill='%232a2350' d='M2 2h5v5H2z'/%3E%3C/svg%3E");
  --fr-yellow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cpath fill='%2307061a' d='M1 0h7v1H1zM0 1h1v7H0zM8 1h1v7H8zM1 8h7v1H1z'/%3E%3Cpath fill='%23fff0b8' d='M1 1h7v1H1zM1 2h1v5H1zM7 2h1v5H7zM1 7h7v1H1z'/%3E%3Cpath fill='%23ffffff' d='M1 1h2v1H1zM1 2h1v1H1zM6 1h2v1H6zM7 2h1v1H7zM1 7h2v1H1zM1 6h1v1H1zM6 7h2v1H6zM7 6h1v1H7z'/%3E%3Cpath fill='%23f2c14e' d='M2 2h5v5H2z'/%3E%3C/svg%3E");
  --fr-yellow-hot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cpath fill='%2307061a' d='M1 0h7v1H1zM0 1h1v7H0zM8 1h1v7H8zM1 8h7v1H1z'/%3E%3Cpath fill='%23ff8f7a' d='M1 1h7v1H1zM1 2h1v5H1zM7 2h1v5H7zM1 7h7v1H1z'/%3E%3Cpath fill='%23fff0b8' d='M1 1h2v1H1zM1 2h1v1H1zM6 1h2v1H6zM7 2h1v1H7zM1 7h2v1H1zM1 6h1v1H1zM6 7h2v1H6zM7 6h1v1H7z'/%3E%3Cpath fill='%23f7d06a' d='M2 2h5v5H2z'/%3E%3C/svg%3E");
  --fr-key: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cpath fill='%2307061a' d='M1 0h7v1H1zM0 1h1v7H0zM8 1h1v7H8zM1 8h7v1H1z'/%3E%3Cpath fill='%23fff8e6' d='M1 1h7v1H1zM1 2h1v5H1zM7 2h1v5H7z'/%3E%3Cpath fill='%23c9b48a' d='M1 7h7v1H1z'/%3E%3Cpath fill='%23efe0bd' d='M2 2h5v5H2z'/%3E%3C/svg%3E");
  --fr-parch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cpath fill='%233b2a1a' d='M1 0h7v1H1zM0 1h1v7H0zM8 1h1v7H8zM1 8h7v1H1z'/%3E%3Cpath fill='%23b39d74' d='M1 1h7v1H1zM1 2h1v5H1zM7 2h1v5H7zM1 7h7v1H1z'/%3E%3Cpath fill='%238a6a48' d='M1 1h2v1H1zM1 2h1v1H1zM6 1h2v1H6zM7 2h1v1H7zM1 7h2v1H1zM1 6h1v1H1zM6 7h2v1H6zM7 6h1v1H7z'/%3E%3Cpath fill='%23efe0bd' d='M2 2h5v5H2z'/%3E%3C/svg%3E");
  --fr-wax: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cpath fill='%233a0c10' d='M1 0h7v1H1zM0 1h1v7H0zM8 1h1v7H8zM1 8h7v1H1z'/%3E%3Cpath fill='%23d43a40' d='M1 1h7v1H1zM1 2h1v5H1zM7 2h1v5H7zM1 7h7v1H1z'/%3E%3Cpath fill='%23ff8f7a' d='M1 1h2v1H1zM1 2h1v1H1zM6 1h2v1H6zM7 2h1v1H7zM1 7h2v1H1zM1 6h1v1H1zM6 7h2v1H6zM7 6h1v1H7z'/%3E%3Cpath fill='%23b3262d' d='M2 2h5v5H2z'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; }
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--f-body);
  -webkit-font-smoothing: antialiased;
  font-variant-ligatures: none;
  scrollbar-color: var(--lilac-line) var(--ground);
}
body.is-inside { overflow: hidden; }
::selection { background: var(--yellow); color: var(--on-light); }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 2px; text-decoration-color: var(--coral); }
img, canvas, svg { display: block; }
button { font: inherit; color: inherit; }
p { margin: 0 0 1em; }
h2, h3, h4 { margin: 0; text-wrap: balance; }
kbd { font: inherit; }

.ico { width: auto; height: 1em; flex: none; }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 50;
  padding: 8px 14px; background: var(--paper); border: 3px solid var(--ink);
  font: 400 1rem var(--f-dialog); text-decoration: none; font-size-adjust: 0.56; font-weight: 700;}
.skip:focus { top: 16px; }

/* ---------- Frames & buttons ---------- */
.frame {
  background: var(--paper) padding-box;
  border: 12px solid transparent;
  border-image: var(--fr-paper) 3 fill / 12px stretch;
  filter: drop-shadow(0 10px 18px rgba(8, 5, 16, 0.42));
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  padding: 4px 8px;
  border: 9px solid transparent;
  border-image: var(--fr-paper) 3 fill / 9px stretch;
  background: none;
  font: 400 1rem/1.2 var(--f-dialog);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: transform 120ms cubic-bezier(0.16, 1, 0.3, 1); font-size-adjust: 0.56; font-weight: 700;}
.btn .ico { height: 0.9em; }
.btn:hover { border-image-source: var(--fr-hot); }
.btn:active { transform: translateY(2px); }
.btn-primary { border-image-source: var(--fr-yellow); color: var(--on-light); }
.btn-primary:hover { border-image-source: var(--fr-yellow-hot); }
.btn-soon { cursor: default; color: var(--ink-2); border-image-source: var(--fr-lilac); }
.btn-soon:hover { border-image-source: var(--fr-lilac); }
.btn-soon:active { transform: none; }
.btn-icon { padding: 4px; min-width: 44px; justify-content: center; }

.kbd {
  display: inline-grid; place-items: center;
  min-width: 26px; height: 26px;
  padding: 0 4px;
  border: 6px solid transparent;
  border-image: var(--fr-key) 3 fill / 6px stretch;
  background: #f6e8c4 padding-box;
  font: 400 0.75rem/1 var(--f-dialog);
  color: var(--on-light); font-size-adjust: 0.56; font-weight: 700;}

/* ---------- The world ---------- */
.world {
  --px: 3px;
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 400px;
  overflow: hidden;
  background: var(--sage);
  outline: none;
  touch-action: manipulation;
}
#map {
  position: absolute; inset: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.labels { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; }
.plate {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 0 6px;
  border: 6px solid transparent;
  border-image: var(--fr-paper) 3 fill / 6px stretch;
  font: 400 max(13px, calc(var(--px) * 5))/1.2 var(--f-dialog);
  letter-spacing: 0.05em;
  white-space: nowrap;
  color: var(--ink);
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1); font-size-adjust: 0.56; font-weight: 700;}
.plate-facade { border: 0; border-image: none; padding: 0; background: none; color: #5a3a14; }
.plate.is-hot { border-image-source: var(--fr-hot); transform: translate(-50%, calc(-100% - 4px)); }
.board-text {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid; justify-items: center;
  line-height: 1.05;
  color: var(--on-light);
  white-space: nowrap;
}
.board-text span:first-child { font: 600 max(10px, calc(var(--px) * 3.8)) / 1.1 'Tiro Devanagari Marathi', serif; opacity: 0.85; }
.board-text span:last-child { font: 400 max(12px, calc(var(--px) * 5.6)) / 1 var(--f-dialog); letter-spacing: 0.08em; font-size-adjust: 0.56; font-weight: 700;}

.bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 8px 0 2px;
  border: 8px solid transparent;
  border-image: var(--fr-paper) 3 fill / 8px stretch;
  background: none;
  font: 400 0.9375rem/1.2 var(--f-dialog);
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  animation: bob 1.2s steps(2, jump-none) infinite; font-size-adjust: 0.56; font-weight: 700;}
.bubble .kbd { height: 24px; }
@keyframes bob { 50% { translate: 0 -3px; } }

/* HUD */
.hud {
  position: absolute; inset: max(14px, env(safe-area-inset-top)) 16px auto 16px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px;
  pointer-events: none;
  z-index: 5;
}
.hud > * { pointer-events: auto; }
.hud-btn { filter: drop-shadow(0 8px 14px rgba(8, 5, 16, 0.38)); }
.hud-btn .kbd { height: 22px; min-width: 22px; border-width: 5px; border-image-width: 5px; margin-right: -2px; }
.hud-btn[aria-pressed='true'] { border-image-source: var(--fr-yellow); color: var(--on-light); }


.hint {
  position: absolute; left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 3;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  max-width: calc(100% - 300px);
  padding: 2px 8px;
  border: 9px solid transparent;
  border-image: var(--fr-lilac) 3 fill / 9px stretch;
  background: var(--lilac) padding-box;
  font: 400 0.875rem/1.3 var(--f-dialog);
  color: var(--ink-2);
  transition: opacity 600ms ease; font-size-adjust: 0.56; font-weight: 700;}
.hint span { display: inline-flex; align-items: center; gap: 4px; }
.hint .kbd { min-width: 24px; height: 24px; }
.hint.is-quiet { opacity: 0.6; }
.is-dialog .hint { opacity: 0; visibility: hidden; }

.to-guide {
  position: absolute; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 3;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 10px;
  border: 9px solid transparent;
  border-image: var(--fr-paper) 3 fill / 9px stretch;
  font: 400 1rem/1.2 var(--f-dialog);
  text-decoration: none;
  filter: drop-shadow(0 8px 14px rgba(8, 5, 16, 0.38)); font-size-adjust: 0.56; font-weight: 700;}
.to-guide:hover { border-image-source: var(--fr-hot); }
.to-guide .ico { height: 0.85em; }
.to-guide span:last-child .ico { animation: nudge 1.4s steps(2, jump-none) infinite; color: var(--coral-ink); }
@keyframes nudge { 50% { translate: 0 3px; } }

/* Dialogue */
.dialog {
  position: absolute; left: 50%; bottom: 84px; z-index: 6;
  width: min(800px, calc(100% - 32px));
  transform: translate(-50%, 14px);
  opacity: 0;
  transition: opacity 200ms ease, transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
.dialog.is-open { opacity: 1; transform: translate(-50%, 0); }
.dialog-box {
  position: relative;
  padding: 18px 22px 14px;
  border-width: 16px;
  border-image-width: 16px;
  cursor: pointer;
}
.dialog-who {
  position: absolute; left: 6px; top: -38px;
  padding: 0 12px 2px;
  border: 9px solid transparent;
  border-image: var(--fr-yellow) 3 fill / 9px stretch;
  color: var(--on-light);
  font: 400 1.375rem/1.2 var(--f-display);
  letter-spacing: 0.04em; font-size-adjust: cap-height 0.536; font-weight: 700;}
.dialog-text { margin: 0; min-height: 3.3em; max-width: 62ch; font: 400 1.25rem/1.65 var(--f-dialog); font-size-adjust: 0.56; font-weight: 700;}
.dialog-more { position: absolute; right: 4px; bottom: -2px; color: var(--coral-ink); animation: nudge 0.9s steps(2, jump-none) infinite; }
.dialog-more .ico { height: 10px; }
.dialog-choices { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; }
.choice {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  padding: 4px 12px 4px 6px;
  border: 0; background: none;
  font: 400 1.125rem/1.2 var(--f-dialog);
  cursor: pointer; font-size-adjust: 0.56; font-weight: 700;}
.choice .cur { width: 10px; color: var(--coral-ink); visibility: hidden; }
.choice .cur .ico { height: 14px; }
.choice:focus, .choice:hover { outline: none; background: var(--lilac); }
.choice:focus .cur, .choice:hover .cur { visibility: visible; }
.choice:focus-visible { box-shadow: inset 0 -3px 0 var(--coral); }

/* Town map */
.menu {
  position: absolute; top: 88px; right: 16px; z-index: 12;
  width: min(440px, calc(100% - 32px));
  max-height: calc(100% - 104px);
  display: flex;
  transform: translateX(16px);
  opacity: 0;
  transition: opacity 180ms ease, transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}
.menu.is-open { transform: none; opacity: 1; }
.menu-box { width: 100%; overflow: auto; padding: 8px 10px 10px; scrollbar-width: thin; }
.menu-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.menu-title { font: 400 2rem/1.1 var(--f-display); font-size-adjust: cap-height 0.536; font-weight: 700;}
.menu-list { list-style: none; margin: 0; padding: 0; }
.m-item {
  display: grid; grid-template-columns: 14px 1fr auto; column-gap: 8px; align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 6px 10px 6px 6px;
  border: 0; background: none;
  text-align: left;
  cursor: pointer;
}
.m-item .cur { grid-row: span 2; color: var(--coral-ink); visibility: hidden; }
.m-item .cur .ico { height: 14px; }
.m-name { font: 400 1.5rem/1.1 var(--f-display); font-size-adjust: cap-height 0.536; font-weight: 700;}
.m-where { grid-column: 2; font: 400 0.875rem/1.3 var(--f-dialog); color: var(--ink-2); font-size-adjust: 0.56; font-weight: 700;}
.m-seen { grid-column: 3; grid-row: 1 / span 2; width: 10px; height: 10px; border: 2px solid var(--lilac-line); }
.m-item.is-seen .m-seen { background: var(--coral); border-color: var(--coral); }
.m-item:hover, .m-item:focus { outline: none; background: var(--lilac); }
.m-item:hover .cur, .m-item:focus .cur { visibility: visible; }
.m-item:focus-visible { box-shadow: inset 0 -3px 0 var(--coral); }

/* Interior window */
.window {
  position: absolute; inset: 0; z-index: 10;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(10, 7, 20, 0.62);
  opacity: 0;
  transition: opacity 200ms ease;
}
.window.is-open { opacity: 1; }
.window-box {
  width: min(1060px, 100%);
  max-height: 100%;
  display: grid; grid-template-rows: auto 1fr;
  overflow: hidden;
  border-width: 16px;
  border-image-width: 16px;
  transform: translateY(14px) scale(0.985);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}
.window.is-open .window-box { transform: none; }
.window-head {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 2px 4px 14px;
  background: linear-gradient(90deg, var(--lilac-line) 50%, transparent 0) 0 100% / 12px 3px repeat-x;
}
.window-title { font: 400 2.125rem/1.1 var(--f-display); font-size-adjust: cap-height 0.536; font-weight: 700;}
.window-body {
  display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 36px;
  overflow: auto;
  padding: 22px 6px 12px 4px;
  scrollbar-width: thin;
}
.window-body .content { padding-right: 8px; }

.scene {
  align-self: start;
  position: sticky; top: 0;
  display: grid; justify-items: center; gap: 14px;
  padding: 18px 14px 16px;
  border: 12px solid transparent;
  border-image: var(--fr-lilac) 3 fill / 12px stretch;
  text-align: center;
}
.portrait { width: 112px; height: auto; image-rendering: pixelated; padding-bottom: 6px; background: linear-gradient(transparent 82%, rgba(8, 5, 16, 0.32) 82%, rgba(8, 5, 16, 0.32) 92%, transparent 92%); }
.scene-line { margin: 0; font: 400 1rem/1.6 var(--f-dialog); font-size-adjust: 0.56; font-weight: 700;}
.scene-line b { display: block; margin-bottom: 4px; font: 400 1.375rem/1.1 var(--f-display); color: var(--coral-ink); font-size-adjust: cap-height 0.536; font-weight: 700;}

/* ---------- Shared content ---------- */
.c-title { font: 400 clamp(2.5rem, 1.8rem + 2.2vw, 3.5rem)/1 var(--f-display); letter-spacing: 0.01em; margin-bottom: 8px; font-size-adjust: cap-height 0.536; font-weight: 700;}
.c-title:has(.c-logo) { display: flex; align-items: center; gap: 14px; }
.c-logo { width: 0.95em; height: 0.95em; flex: none; }
.c-tagline { font: 400 1.1875rem/1.45 var(--f-dialog); color: var(--coral-ink); margin-bottom: 14px; font-size-adjust: 0.56; font-weight: 700;}
.c-lede { font-size: 1.1875rem; line-height: 1.6; max-width: 62ch; }
.content p, .entry-body p { max-width: 66ch; }
.c-sub { margin: 32px 0 12px; font: 400 1.375rem/1.1 var(--f-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--yellow); font-size-adjust: cap-height 0.536; font-weight: 700;}

.feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 68ch; }
.feats li { display: grid; grid-template-columns: 12px 1fr; gap: 12px; align-items: start; }
.feats .ico { height: 10px; margin-top: 0.55em; color: var(--coral); }

.items { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.items li {
  padding: 0 6px;
  border: 7px solid transparent;
  border-image: var(--fr-lilac) 3 fill / 7px stretch;
  font: 400 0.9375rem/1.5 var(--f-dialog); font-size-adjust: 0.56; font-weight: 700;}

.brand { width: 1em; height: 1em; flex: none; }
.items li.has-brand { display: inline-flex; align-items: center; gap: 7px; }
.items li .brand { width: 15px; height: 15px; }
.rank-logo { position: absolute; right: 14px; top: 14px; }
.rank-logo .brand { width: 30px; height: 30px; }
.social-name { display: inline-flex; align-items: center; gap: 10px; }
.social-name .brand { width: 20px; height: 20px; }
.heat-tab .brand { width: 16px; height: 16px; }
.heat-tab[aria-selected='true'] .brand path { fill: var(--on-light); }
.heat-name .brand { width: 0.8em; height: 0.8em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 24px; margin: 22px 0 24px; padding: 16px 0; background: linear-gradient(90deg, var(--lilac-line) 50%, transparent 0) 0 0 / 12px 3px repeat-x, linear-gradient(90deg, var(--lilac-line) 50%, transparent 0) 0 100% / 12px 3px repeat-x; }
.facts dt { font: 400 0.8125rem/1.3 var(--f-dialog); color: var(--ink-2); font-size-adjust: 0.56; font-weight: 700;}
.facts dd { margin: 2px 0 0; font: 400 1.5rem/1.15 var(--f-display); font-size-adjust: cap-height 0.536; font-weight: 700;}


.ranks { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.rank {
  --belt: #5a9ad6;
  position: relative;
  display: grid; gap: 2px;
  padding: 18px 12px 12px;
  border: 12px solid transparent;
  border-image: var(--fr-paper) 3 fill / 12px stretch;
}
.rank .belt { height: 0.42em; margin: 0 0 0.1em; color: var(--belt); }
.belt-violet { --belt: #a07fe0; }
.belt-gold { --belt: #f2c24a; }
.rank-name { display: flex; flex-direction: column; align-items: flex-start; font: 400 2.75rem/1 var(--f-display); font-size-adjust: cap-height 0.536; font-weight: 700;}
.rank-detail { font-size: 0.9375rem; color: var(--ink-2); }
.rank-detail b { color: var(--ink); font-weight: 700; }
.rank-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font: 400 0.9375rem/1.3 var(--f-dialog); font-size-adjust: 0.56; font-weight: 700;}
.rank-link .ico { height: 0.75em; }

.practice { display: grid; gap: 16px; width: min(100%, 1120px); margin: 4px auto 0; }
.heat-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.heat-tab[aria-selected='true'] { border-image-source: var(--fr-yellow); color: var(--on-light); }
.heat-tab[aria-selected='true']:hover { border-image-source: var(--fr-yellow-hot); }
.heat-swatch { width: 10px; height: 10px; flex: none; box-shadow: 0 0 0 2px #0c0b24; }
.heat-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 8px; }
.heat-name { display: inline-flex; align-items: center; gap: 6px; font: 400 1.375rem/1.1 var(--f-display); text-decoration: none; font-size-adjust: cap-height 0.536; font-weight: 700;}
.heat-name .ico { height: 0.55em; color: var(--coral-ink); }
.heat-name:hover { text-decoration: underline; }
.heat-sum { font: 400 0.875rem/1.3 var(--f-dialog); color: var(--ink-2); font-size-adjust: 0.56; font-weight: 700;}
.heat-wrap { position: relative; padding-top: 18px; max-width: 100%; }
.heat-wrap canvas { image-rendering: pixelated; cursor: crosshair; touch-action: pan-y; }
.heat-months { position: absolute; left: 0; right: 0; top: 0; height: 16px; }
.heat-months span { position: absolute; top: 0; font: 400 0.75rem/1 var(--f-dialog); color: var(--ink-2); font-size-adjust: 0.56; font-weight: 700;}
.heat-tip {
  position: absolute; z-index: 2;
  transform: translate(-50%, -100%);
  padding: 0 6px;
  border: 6px solid transparent;
  border-image: var(--fr-paper) 3 fill / 6px stretch;
  background: var(--paper) padding-box;
  font: 400 0.8125rem/1.4 var(--f-dialog);
  white-space: nowrap;
  pointer-events: none; font-size-adjust: 0.56; font-weight: 700;}
.practice-note { margin: 0; font: 400 0.8125rem/1.5 var(--f-dialog); color: var(--ink-2); font-size-adjust: 0.56; font-weight: 700;}

.shelf {
  list-style: none; margin: 24px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr);
  align-items: stretch; row-gap: 34px;
}
.trophy {
  display: grid; grid-template-rows: 58px auto auto; justify-items: center; align-content: start; gap: 4px;
  padding: 0 10px 14px;
  text-align: center;
  background:
    linear-gradient(var(--wood), var(--wood)) 0 calc(100% - 3px) / 100% 6px no-repeat,
    linear-gradient(#5e3d27, #5e3d27) 0 100% / 100% 3px no-repeat;
}
.cup { align-self: end; color: var(--yellow); margin-bottom: 6px; }
.cup .ico { height: 52px; }
.tier-2 .cup .ico { height: 42px; }
.tier-3 .cup .ico { height: 34px; }
.tier-4 .cup .ico { height: 28px; }
.tier-2 .cup { color: #cfc8de; }
.tier-3 .cup { color: #e08f5a; }
.tier-4 .cup { color: #7fb3e0; }
.t-place { font: 400 1.5rem/1.1 var(--f-display); font-size-adjust: cap-height 0.536; font-weight: 700;}
.t-event { font-size: 0.9375rem; line-height: 1.4; color: var(--ink-2); max-width: 22ch; }

.shelves { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 32px; }
.rack { padding-bottom: 18px; background: linear-gradient(var(--wood), var(--wood)) 0 100% / 100% 5px no-repeat; }
.rack .c-sub { margin-top: 22px; }

.mail-card {
  margin: 20px 0 6px;
  padding: 18px 16px 6px;
  border: 12px solid transparent;
  border-image: var(--fr-lilac) 3 fill / 12px stretch;
}
.mail-label { font: 400 0.875rem/1 var(--f-dialog); color: var(--ink-2); font-size-adjust: 0.56; font-weight: 700;}
.mail-addr { display: block; margin-top: 6px; font: 400 clamp(1.6rem, 1.3rem + 1.4vw, 2.25rem)/1.15 var(--f-display); overflow-wrap: anywhere; letter-spacing: 0.02em; font-size-adjust: cap-height 0.536; font-weight: 700;}
.mail-card .actions { margin-top: 16px; margin-bottom: 10px; }
.socials { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 28px; }
.socials a {
  display: grid; grid-template-columns: 1fr auto 12px; align-items: center; gap: 10px;
  min-height: 48px;
  padding: 6px 2px;
  text-decoration: none;
  background: linear-gradient(90deg, var(--lilac-line) 50%, transparent 0) 0 100% / 8px 2px repeat-x;
  font: 400 1.375rem/1.1 var(--f-display); font-size-adjust: cap-height 0.536; font-weight: 700;}
.socials .handle { font: 400 0.9375rem/1.2 var(--f-dialog); color: var(--ink-2); font-size-adjust: 0.56; font-weight: 700;}
.socials .ico { height: 0.7em; color: var(--coral-ink); }
.socials a:hover { background-color: var(--lilac); }

.fade { position: absolute; inset: 0; z-index: 20; background: var(--ground); opacity: 0; pointer-events: none; transition: opacity 220ms ease; }
.fade.is-on { opacity: 1; }

/* ---------- Guidebook ---------- */
.guide {
  position: relative;
  background:
    radial-gradient(circle at 1px 1px, rgba(245, 236, 217, 0.06) 1px, transparent 1.5px) 0 0 / 18px 18px,
    var(--ground);
  padding: 112px clamp(20px, 3vw, 48px) 0;
}
.guide::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 12px;
  background: linear-gradient(90deg, var(--sea) 50%, #285f89 0) 0 0 / 24px 12px repeat-x;
  box-shadow: 0 6px 0 #4c8cba;
}
.guide-wrap {
  max-width: 1480px; margin: 0 auto;
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: clamp(32px, 4vw, 64px);
  align-items: start;
}

.guide-body { display: grid; gap: 96px; padding-bottom: 32px; }
.entry { scroll-margin-top: 40px; }
.sec-title { display: flex; align-items: center; gap: 16px; }
.projects-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.projects-head .c-title { margin: 0; }
.project-toggle { margin-left: auto; }
.project-toggle .ico, .projects-all .ico { height: 0.7em; }
.project-more { animation: more-in 260ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes more-in { from { opacity: 0; transform: translateY(-6px); } }
.project-list { display: grid; gap: 48px; }
.project { scroll-margin-top: 40px; }
.project .entry-body {
  padding: 26px 30px 30px;
  border: 16px solid transparent;
  border-image: var(--fr-paper) 3 fill / 16px stretch;
  filter: drop-shadow(0 12px 22px rgba(8, 5, 16, 0.32));
}
.guide-foot {
  position: relative;
  display: grid; justify-items: center; gap: 14px;
  margin: 96px calc(-1 * clamp(20px, 3vw, 48px)) 0;
  padding: 64px 24px 72px;
  text-align: center;
  background: var(--ground-2);
}
.guide-foot::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 10px;
  background: linear-gradient(90deg, #efe3c4 50%, transparent 0) 0 0 / 28px 4px repeat-x, #5b5470;
}
.foot-flag .spr { width: 40px; height: 45px; }
.foot-line { font: 400 clamp(2rem, 1.6rem + 1.4vw, 3rem)/1.1 var(--f-display); margin: 0; color: var(--yellow); text-shadow: 0 3px 0 #c94a2c, 0 6px 0 #1d1b45; font-size-adjust: cap-height 0.536; font-weight: 700;}

.noscript { max-width: 60ch; margin: 40px auto; padding: 0 24px; }

/* ---------- Narrow screens ---------- */
@media (max-width: 860px) {
  .guide-wrap { grid-template-columns: 1fr; gap: 40px; }
  .window-body { grid-template-columns: 1fr; gap: 20px; }
  .scene { position: static; grid-template-columns: 72px 1fr; justify-items: start; text-align: left; align-items: center; padding: 10px; }
  .portrait { width: 64px; }
  .hint { max-width: calc(100% - 32px); bottom: 76px; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .hud { inset: max(10px, env(safe-area-inset-top)) 10px auto 10px; }
  .hud-btn .btn-label, .hud-btn .kbd { display: none; }
  #btn-map .btn-label { display: inline; }
  .hud-btn { padding: 4px; min-width: 44px; justify-content: center; }
  .dialog { bottom: 72px; width: calc(100% - 20px); }
  .dialog-box { padding: 14px 12px 10px; border-width: 12px; border-image-width: 12px; }
  .dialog-text { font-size: 1.0625rem; }
  .choice { font-size: 1rem; }
  .hint { left: 10px; bottom: 70px; font-size: 0.8125rem; }
  .is-dialog .hint { display: none; }
  .to-guide { left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); justify-content: center; }
  .menu { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; max-height: calc(100% - 90px); transform: translateY(16px); }
  .window { padding: 0; place-items: stretch; }
  .window-box { width: 100%; height: 100%; max-height: none; border-width: 12px; border-image-width: 12px; }
  .window-title { font-size: 1.625rem; }
  .window-close-label { display: none; }
  .guide { padding: 80px 16px 0; }
  .project-list { gap: 36px; }
  .project .entry-body { padding: 14px 10px 18px; border-width: 12px; border-image-width: 12px; }
  .guide-body { gap: 72px; }
  .sec-title { gap: 12px; }
  .shelf { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Platformer: HUD ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hud-player, .hud-stat {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border: 9px solid transparent;
  border-image: var(--fr-paper) 3 fill / 9px stretch;
  background: var(--paper) padding-box;
  filter: drop-shadow(0 8px 14px rgba(8, 5, 16, 0.38));
}
.hud-lv { font: 400 1.5rem/1 var(--f-display); color: var(--yellow); letter-spacing: 0.04em; font-size-adjust: cap-height 0.536; font-weight: 700;}
.hud-xpbar { position: relative; width: 120px; height: 12px; background: #15153a; box-shadow: inset 0 0 0 2px #0c0b24; }
.hud-xpbar span { position: absolute; left: 2px; right: 2px; top: 2px; bottom: 2px; transform: scaleX(0); transform-origin: left; background: linear-gradient(#7ff0a8, #26a641); transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1); }
.hud-xp-text { font: 400 0.75rem/1 var(--f-dialog); color: var(--ink-2); white-space: nowrap; font-size-adjust: 0.56; font-weight: 700;}
.hud-right { display: flex; align-items: center; gap: 8px; }
.hud-stat { gap: 6px; font: 400 1.25rem/1 var(--f-display); font-size-adjust: cap-height 0.536; font-weight: 700;}
.hud-stat .ico { height: 0.8em; color: #ff7a59; }
.coin-ico { width: 12px; height: 16px; background: #ffc94a; box-shadow: inset 2px 0 0 #ffe39a, inset -2px 0 0 #d99a20, 0 0 0 2px #a8601a; animation: coin-spin 0.9s steps(4) infinite; }
@keyframes coin-spin { 25% { transform: scaleX(0.6); } 50% { transform: scaleX(0.15); } 75% { transform: scaleX(0.6); } }

.hud-track { position: relative; height: 38px; margin: 0 8px; }
.track { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; }
.track::before { content: ''; position: absolute; left: 0; right: 0; top: 17px; height: 4px; background: rgba(12, 11, 36, 0.55); box-shadow: 0 0 0 2px rgba(255, 243, 220, 0.25); }
.track li { position: absolute; top: 0; transform: translateX(-50%); }
.track-dot {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 6px solid transparent; border-image: var(--fr-paper) 3 fill / 6px stretch; background: none;
  color: var(--ink-2); cursor: pointer; transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1);
}
.track-dot .ico { height: 12px; }
.track-dot:hover, .track-dot:focus-visible { transform: translateY(-3px) scale(1.12); border-image-source: var(--fr-hot); outline: none; }
.track-dot.is-seen { border-image-source: var(--fr-yellow); color: var(--on-light); }
.track-flag { top: 6px !important; color: var(--yellow); }
.track-flag .ico { height: 18px; }
.track-pip { position: absolute; top: 30px; width: 10px; height: 10px; margin-left: -5px; background: #ff7a59; box-shadow: 0 0 0 2px #0c0b24; transition: left 120ms linear; }

/* Floating score text */
.pop {
  position: absolute; transform: translate(-50%, -100%);
  font: 400 max(13px, calc(var(--px) * 5)) / 1 var(--f-display); color: var(--yellow); letter-spacing: 0.04em; white-space: nowrap;
  text-shadow: 0 2px 0 #0c0b24, 2px 0 0 #0c0b24, -2px 0 0 #0c0b24, 0 -2px 0 #0c0b24;
  pointer-events: none; animation: pop-up 1s cubic-bezier(0.16, 1, 0.3, 1) forwards; font-size-adjust: cap-height 0.536; font-weight: 700;}
.pop-xp { color: #7ff0a8; font-size: max(16px, calc(var(--px) * 6.5)); }
.pop-bug { color: #ffb0c6; }
.pop-ouch { color: #ff9a7e; }
@keyframes pop-up { 0% { opacity: 0; transform: translate(-50%, -60%) scale(0.6); } 15% { opacity: 1; transform: translate(-50%, -110%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }

/* Section unlocked / level up banner */
.banner {
  position: absolute; left: 50%; top: 22%; z-index: 8;
  display: grid; justify-items: center; gap: 4px;
  padding: 10px 26px 12px;
  border: 12px solid transparent; border-image: var(--fr-yellow) 3 fill / 12px stretch; background: var(--yellow) padding-box;
  color: var(--on-light); text-align: center;
  width: max-content; max-width: calc(100% - 32px);
  transform: translate(-50%, -20px) scale(0.8); opacity: 0;
  filter: drop-shadow(0 14px 24px rgba(8, 5, 16, 0.5));
  pointer-events: none;
}
.banner.is-on { animation: banner-in 1.9s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes banner-in { 0% { opacity: 0; transform: translate(-50%, -20px) scale(0.6); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 20% { transform: translate(-50%, 0) scale(1); } 85% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -12px) scale(0.96); } }
.banner-ico { color: #c65840; }
.banner-ico .ico { height: 26px; }
.banner-title { font: 400 clamp(1.75rem, 1.2rem + 2vw, 2.75rem)/1 var(--f-display); letter-spacing: 0.03em; font-size-adjust: cap-height 0.536; font-weight: 700;}
.banner-sub { font: 400 0.9375rem/1.3 var(--f-dialog); color: #4a3a1a; font-size-adjust: 0.56; font-weight: 700;}

/* ---------- Title screen ---------- */
.title {
  position: absolute; inset: 0; z-index: 9;
  display: grid; place-items: center;
  padding: 90px 20px 80px;
  background: radial-gradient(ellipse at 50% 45%, rgba(21, 21, 58, 0.15), rgba(21, 21, 58, 0.62) 75%);
  opacity: 0; transition: opacity 300ms ease;
}
.title.is-on { opacity: 1; }
.title-inner { display: grid; justify-items: center; gap: 18px; text-align: center; }
.logo { margin: 0; display: grid; justify-items: center; line-height: 0.82; }
.logo span {
  display: block;
  font: 400 clamp(4.5rem, 2.5rem + 9vw, 10rem)/0.85 var(--f-display);
  letter-spacing: 0.04em;
  color: #ffc94a;
  text-shadow: 0 4px 0 #ff7a59, 0 8px 0 #c94a2c, 0 12px 0 #6c2a3a, 0 16px 0 #1d1b45, 0 24px 30px rgba(8, 5, 16, 0.55);
  animation: logo-float 3.2s ease-in-out infinite; font-size-adjust: cap-height 0.536; font-weight: 700;}
.logo .logo-b { color: #fff3dc; animation-delay: -1.6s; text-shadow: 0 4px 0 #5fb4ea, 0 8px 0 #2f6e9c, 0 12px 0 #1d3d6a, 0 16px 0 #1d1b45, 0 24px 30px rgba(8, 5, 16, 0.55); }
@keyframes logo-float { 50% { transform: translateY(-8px); } }
.title-sub {
  margin: 10px 0 0; padding: 8px 16px;
  border: 9px solid transparent; border-image: var(--fr-paper) 3 fill / 9px stretch; background: var(--paper) padding-box;
  font: 400 1.0625rem/1.4 var(--f-dialog); font-size-adjust: 0.56; font-weight: 700;}
.title-menu { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.title-menu .btn { font-size: 1.125rem; min-height: 52px; padding: 6px 14px; }
.title-menu .btn .ico { height: 0.8em; }
.title-start { animation: start-pulse 1.4s ease-in-out infinite; }
@keyframes start-pulse { 50% { transform: scale(1.06); } }
.title-hint { margin: 0; font: 400 0.9375rem/1 var(--f-dialog); color: #fff3dc; text-shadow: 0 2px 0 #0c0b24; font-size-adjust: 0.56; font-weight: 700;}
.blink { animation: blink 1s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.is-title .hud, .is-title .hint, .is-title .to-guide, .is-title .pad, .is-title #labels { opacity: 0; pointer-events: none; }
.hud, .hint, .to-guide, .pad, #labels { transition: opacity 300ms ease; }

/* ---------- Course clear ---------- */
.clear { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; padding: 20px; background: rgba(10, 7, 20, 0.45); opacity: 0; transition: opacity 250ms ease; }
.clear.is-on { opacity: 1; }
.clear-box { width: min(560px, 100%); padding: 20px 24px 22px; text-align: center; border-width: 16px; border-image-width: 16px; animation: clear-in 600ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes clear-in { from { transform: translateY(30px) scale(0.9); } }
.clear-title { font: 400 clamp(2.75rem, 2rem + 3vw, 4rem)/1 var(--f-display); color: var(--yellow); text-shadow: 0 4px 0 #c94a2c, 0 8px 0 #1d1b45; margin-bottom: 14px; font-size-adjust: cap-height 0.536; font-weight: 700;}
.clear-lede { margin-bottom: 14px; }
.clear-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 6px; }
.clear-stats dt { font: 400 0.75rem/1.3 var(--f-dialog); color: var(--ink-2); font-size-adjust: 0.56; font-weight: 700;}
.clear-stats dd { margin: 0; font: 400 1.75rem/1.1 var(--f-display); font-size-adjust: cap-height 0.536; font-weight: 700;}
.clear-box .actions { justify-content: center; }

/* ---------- Touch pad ---------- */
.pad { display: none; }
.is-touch .pad {
  position: absolute; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 4;
  display: flex; justify-content: space-between; align-items: flex-end; padding: 0 14px;
  pointer-events: none;
}
.pad-dir, .pad-act { display: flex; gap: 12px; align-items: flex-end; pointer-events: auto; }
.pad-btn {
  display: grid; place-items: center; width: 64px; height: 64px; padding: 0;
  border: 10px solid transparent; border-image: var(--fr-paper) 3 fill / 10px stretch; background: none;
  font: 400 1.5rem/1 var(--f-display); color: var(--ink);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  opacity: 0.88; font-size-adjust: cap-height 0.536; font-weight: 700;}
.pad-btn .ico { height: 18px; }
.pad-btn.is-down { transform: translateY(3px); border-image-source: var(--fr-hot); }
.pad-jump { width: 76px; height: 76px; border-image-source: var(--fr-yellow); color: var(--on-light); font-size: 2rem; }
.pad-enter { width: auto; padding: 0 10px; font: 400 1rem/1 var(--f-dialog); font-size-adjust: 0.56; font-weight: 700;}
.is-touch .hint { display: none; }
.is-touch .to-guide { left: 50%; right: auto; bottom: max(30px, calc(env(safe-area-inset-bottom) + 16px)); transform: translateX(-50%); padding: 2px 6px; font-size: 0; gap: 6px; }
.is-touch .to-guide .ico { height: 14px; }

/* ---------- Level select icons ---------- */
.m-item { grid-template-columns: 14px 26px 1fr auto; }
.m-item .cur { grid-row: span 2; }
.m-ico { grid-row: span 2; color: var(--yellow); }
.m-ico .ico { height: 16px; }
.m-name, .m-where { grid-column: 3; }
.m-seen { grid-column: 4; }

/* ---------- Gallery ---------- */
.gallery-grid { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.photo {
  display: grid; width: 100%; padding: 6px 6px 8px; gap: 6px;
  border: 9px solid transparent; border-image: var(--fr-key) 3 fill / 9px stretch; background: none;
  color: var(--on-light); cursor: zoom-in; text-align: left;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.gallery-grid li:nth-child(3n + 1) .photo { transform: rotate(-1.5deg); }
.gallery-grid li:nth-child(3n + 2) .photo { transform: rotate(1deg); }
.photo:hover, .photo:focus-visible { transform: translateY(-4px) rotate(0) scale(1.03); }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #d9c8a8; }
.photo-cap { font: 400 0.875rem/1.3 var(--f-dialog); font-size-adjust: 0.56; font-weight: 700;}
.gallery-empty { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.gallery-empty .practice-note { grid-column: 1 / -1; }
.frame-empty {
  display: grid; place-items: center; aspect-ratio: 4 / 3;
  border: 9px solid transparent; border-image: var(--fr-lilac) 3 fill / 9px stretch; background: var(--lilac) padding-box;
  color: var(--ink-2);
}
.frame-empty .ico { height: 28px; opacity: 0.7; }
.lightbox { max-width: min(1100px, 96vw); width: auto; padding: 0; border: 0; background: transparent; color: var(--ink); }
.lightbox::backdrop { background: rgba(10, 7, 20, 0.94); }
.lightbox figure { margin: 0; padding: 10px; border: 12px solid transparent; border-image: var(--fr-paper) 3 fill / 12px stretch; background: var(--paper) padding-box; }
.lightbox img { display: block; max-width: 100%; max-height: 74vh; margin: 0 auto; }
.lightbox figcaption { padding: 10px 4px 0; font: 400 1rem/1.4 var(--f-dialog); font-size-adjust: 0.56; font-weight: 700;}
.lb-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; padding: 10px; border: 12px solid transparent; border-image: var(--fr-paper) 3 fill / 12px stretch; background: var(--paper) padding-box; }
.lb-count { font: 400 1rem/1 var(--f-dialog); color: var(--ink-2); font-size-adjust: 0.56; font-weight: 700;}

.c-org { display: flex; align-items: flex-start; gap: 10px; margin-top: 4px; }
.c-org b { font-weight: 400; color: #ff5a6e; }
.org-logo { width: auto; height: 1.1em; flex: none; margin-top: 0.15em; }
/* Achievement story links */
.t-post { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font: 400 0.875rem/1.3 var(--f-dialog); color: var(--coral-ink); font-size-adjust: 0.56; font-weight: 700;}
.t-post .ico { height: 0.7em; }

@media (max-width: 1180px) {
  .hud { grid-template-columns: auto auto; grid-template-areas: 'player right' 'track track'; gap: 10px; }
  .hud-player { grid-area: player; }
  .hud-right { grid-area: right; justify-content: flex-end; }
  .hud-track { grid-area: track; margin: 0 6px; }
  .hud-xp-text { display: none; }
}
@media (max-width: 640px) {
  .hud { inset: max(10px, env(safe-area-inset-top)) 10px auto 10px; }
  .hud-xpbar { width: 64px; }
  .hud-player, .hud-stat { border-width: 7px; border-image-width: 7px; padding: 6px 9px; }
  .hud-lv { font-size: 1.25rem; }
  .hud-stat { font-size: 1.0625rem; }
  .hud-right .hud-stat:nth-child(2) { display: none; }
  #btn-map .btn-label { display: none; }
  .track-dot { width: 24px; height: 24px; border-width: 5px; border-image-width: 5px; }
  .track-dot .ico { height: 9px; }
  .track::before { top: 14px; }
  .track-pip { top: 25px; }
  .logo span { font-size: clamp(3.75rem, 20vw, 6rem); }
  .title-sub { font-size: 0.9375rem; }
  .clear-stats { grid-template-columns: repeat(2, 1fr); }
  .gallery-empty { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Section sprites ---------- */
.spr { display: block; width: 32px; height: 36px; overflow: visible; }
.sec-badge {
  --glow: #ffc94a;
  position: relative;
  display: inline-grid; place-items: center; flex: none;
  width: 64px; height: 64px;
  border: 9px solid transparent;
  border-image: var(--fr-lilac) 3 fill / 9px stretch;
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--glow) 28%, transparent), transparent 70%) padding-box, var(--lilac) padding-box;
  filter: drop-shadow(0 6px 12px color-mix(in srgb, var(--glow) 30%, transparent));
  transform: scale(0.4) rotate(-12deg); opacity: 0;
}
.sec-badge.is-in { animation: badge-pop 700ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards, badge-bob 2.8s ease-in-out 700ms infinite; }
@keyframes badge-pop { 0% { opacity: 0; transform: scale(0.4) rotate(-12deg); } 60% { opacity: 1; transform: scale(1.15) rotate(4deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
.sec-badge.is-done { opacity: 1; transform: none; animation: badge-bob 2.8s ease-in-out infinite; }
@keyframes badge-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
/* Shine sweep */
.sec-badge::before { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.32) 50%, transparent 58%) 0 0 / 300% 100% no-repeat; background-position: 100% 0; pointer-events: none; }
.sec-badge.is-in::before { animation: shine 4.5s ease-in-out 1.2s infinite; }
@keyframes shine { 0%, 70% { background-position: 100% 0; } 85%, 100% { background-position: 0% 0; } }
/* Hover: bump it like a ? block and pop a coin */
.sec-coin { position: absolute; left: 50%; top: 4px; width: 8px; height: 10px; margin-left: -4px; background: #ffc94a; box-shadow: inset 2px 0 0 #ffe39a, inset -2px 0 0 #d99a20, 0 0 0 1px #a8601a; opacity: 0; pointer-events: none; }
.sec-title:hover .sec-badge, .sec-badge:hover { animation: badge-bump 380ms cubic-bezier(0.34, 1.56, 0.64, 1); opacity: 1; transform: none; }
.sec-title:hover .sec-coin { animation: coin-pop 700ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes badge-bump { 0% { transform: translateY(0); } 35% { transform: translateY(-9px) scale(1.06); } 100% { transform: translateY(0); } }
@keyframes coin-pop { 0% { opacity: 1; transform: translateY(0) scaleX(1); } 50% { transform: translateY(-26px) scaleX(0.2); } 100% { opacity: 0; transform: translateY(-34px) scaleX(1); } }

/* Per-sprite life */
.spr path { transform-box: fill-box; transform-origin: center; }
.is-live .px-smoke { animation: smoke 2.4s ease-out infinite; }
.is-live .px-s2 { animation-delay: 1.2s; }
@keyframes smoke { 0% { opacity: 0; transform: translateY(2px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(1px, -4px); } }
.is-live .px-glow { animation: window-glow 3s steps(2, jump-none) infinite; }
@keyframes window-glow { 0%, 60% { fill: #ffd27a; } 70% { fill: #fff2b3; } 80%, 100% { fill: #ffd27a; } }
.is-live .px-spark { animation: twinkle 1.6s ease-in-out infinite; }
.is-live .px-spark.px-s2 { animation-delay: 0.8s; }
@keyframes twinkle { 0%, 100% { opacity: 0.15; transform: scale(0.4); } 50% { opacity: 1; transform: scale(1.2); } }
.is-live .px-shine { animation: shimmer 2.2s steps(2, jump-none) infinite; }
@keyframes shimmer { 50% { opacity: 0.3; } }
.is-live .px-clasp { animation: shimmer 1.8s steps(2, jump-none) infinite; }
.is-live .px-tag { animation: tag-swing 2.4s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes tag-swing { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(12deg); } }
.is-live .px-cursor { animation: blink 0.9s steps(2, jump-none) infinite; }
.is-live .px-type { animation: type-in 3.2s steps(4, jump-end) infinite; transform-origin: 0 50%; }
.is-live .px-t2 { animation-delay: 0.3s; }
.is-live .px-t3 { animation-delay: 0.6s; }
@keyframes type-in { 0% { transform: scaleX(0); } 40%, 100% { transform: scaleX(1); } }
.is-live .px-core { animation: core 1.8s ease-in-out infinite; }
@keyframes core { 50% { fill: #9ef5c0; filter: brightness(1.2); } }
.is-live .px-pin { animation: pin 1.8s steps(2, jump-none) infinite; }
.is-live .px-p1 { animation-delay: 0.3s; }
.is-live .px-p2 { animation-delay: 0.6s; }
@keyframes pin { 50% { fill: #4fd18b; } }
.is-live.spr-rocket { animation: rocket-float 1.6s ease-in-out infinite; }
@keyframes rocket-float { 50% { transform: translateY(-3px) rotate(-3deg); } }
.is-live .px-flame { animation: flame 0.24s steps(2, jump-none) infinite; transform-origin: 50% 0; }
.is-live .px-f2 { animation-duration: 0.18s; }
@keyframes flame { 50% { transform: scaleY(1.45); } }
.is-live .px-flash { animation: flash 3s steps(1, jump-none) infinite; }
.is-live .px-burst { opacity: 0; animation: burst 3s steps(1, jump-none) infinite; }
@keyframes flash { 0%, 85%, 100% { fill: #ffe08a; } 88%, 94% { fill: #ffffff; } }
@keyframes burst { 0%, 85%, 100% { opacity: 0; } 88%, 94% { opacity: 1; } }
.is-live .px-lens { animation: shimmer 3s steps(2, jump-none) infinite; }
.is-live .px-heart { animation: heart 1.1s ease-in-out infinite; }
@keyframes heart { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.35); } 30% { transform: scale(1); } 45% { transform: scale(1.2); } }
.is-live.spr-mail { animation: mail-wiggle 2.6s ease-in-out infinite; }
@keyframes mail-wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-6deg); } 90% { transform: rotate(5deg); } 95% { transform: rotate(-3deg); } }

.sec-badge .spr { width: 42px; height: 47px; margin-top: -3px; }
/* Sprites in the HUD track, level select and banner */
.track-dot .spr { width: 16px; height: 18px; }
.track-dot:hover .spr, .track-dot:focus-visible .spr { animation: badge-bump 380ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.m-ico .spr { width: 22px; height: 25px; }
.m-item:hover .m-ico .spr, .m-item:focus .m-ico .spr { animation: badge-bump 380ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.banner-ico .spr { width: 40px; height: 45px; }
.track-dot { width: 32px; height: 32px; }
.track-dot.is-seen { border-image-source: var(--fr-yellow); }

@media (max-width: 640px) {
  .sec-badge { width: 50px; height: 50px; border-width: 7px; border-image-width: 7px; }
  .sec-badge .spr { width: 32px; height: 36px; }
  .sec-title { gap: 12px; }
  .track-dot { width: 24px; height: 24px; }
  .track-dot .spr { width: 12px; height: 14px; }
}
@media (prefers-reduced-motion: reduce) { .sec-badge { opacity: 1; transform: none; } }

/* ---------- Guidebook quest log ---------- */
.guide-head { position: sticky; top: 28px; }
.guide-card { display: grid; gap: 18px; padding: 16px 14px 16px; border-width: 14px; border-image-width: 14px; }
.guide-top { display: flex; align-items: center; gap: 12px; }
.guide-book .spr { width: 44px; height: 50px; }
.guide-title { font: 400 2.5rem/0.95 var(--f-display); letter-spacing: 0.02em; color: var(--yellow); text-shadow: 0 3px 0 #c94a2c, 0 6px 0 #1d1b45; margin: 0 0 6px; font-size-adjust: cap-height 0.536; font-weight: 700;}
.guide-sub { margin: 0; font: 400 0.9375rem/1.4 var(--f-body); color: var(--ink-2); }
.guide-player {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px;
  border: 9px solid transparent; border-image: var(--fr-lilac) 3 fill / 9px stretch; background: var(--lilac) padding-box;
}
.guide-avatar { display: grid; place-items: center; width: 48px; height: 48px; flex: none; background: radial-gradient(circle at 50% 70%, rgba(95, 180, 234, 0.35), transparent 70%), #15153a; box-shadow: 0 0 0 2px #0c0b24; overflow: hidden; }
.guide-avatar canvas { width: 32px; height: 36px; image-rendering: pixelated; animation: avatar-idle 1.4s steps(2, jump-none) infinite; }
@keyframes avatar-idle { 50% { transform: translateY(-2px); } }
.guide-who { display: grid; gap: 2px; min-width: 0; }
.guide-who b { font: 400 1.375rem/1 var(--f-display); font-weight: 400; font-size-adjust: cap-height 0.536; font-weight: 700;}
.guide-who span { font: 400 0.8125rem/1.3 var(--f-dialog); color: var(--yellow); font-size-adjust: 0.56; font-weight: 700;}

.guide-index { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.guide-index a {
  display: grid; grid-template-columns: 12px 28px 1fr 16px; align-items: center; gap: 8px;
  min-height: 42px; padding: 4px 8px 4px 4px;
  border: 6px solid transparent;
  font: 400 1rem/1.2 var(--f-dialog); color: var(--ink-2); text-decoration: none;
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1), color 160ms ease; font-size-adjust: 0.56; font-weight: 700;}
.gi-cur { color: var(--coral); visibility: hidden; }
.gi-cur .ico { height: 12px; }
.gi-ico .spr { width: 24px; height: 27px; filter: grayscale(0.65) brightness(0.85); transition: filter 200ms ease; }
.gi-state { width: 12px; height: 12px; box-shadow: inset 0 0 0 2px var(--lilac-line); }
.guide-index a:hover { color: var(--ink); transform: translateX(4px); }
.guide-index a:hover .gi-ico .spr { filter: none; }
.guide-index a.is-read .gi-state { background: #4fd18b; box-shadow: inset 0 0 0 2px #2f7f63; clip-path: polygon(0 50%, 35% 85%, 100% 10%, 100% 35%, 35% 100%, 0 70%); }
.guide-index a.is-active {
  color: var(--on-light);
  border-image: var(--fr-yellow) 3 fill / 6px stretch;
  transform: translateX(6px);
}
.guide-index a.is-active .gi-cur { visibility: visible; color: #c94a2c; animation: nudge-x 0.8s steps(2, jump-none) infinite; }
.guide-index a.is-active .gi-ico .spr { filter: none; }
.guide-index a.is-active .gi-state { box-shadow: inset 0 0 0 2px #a8601a; }
@keyframes nudge-x { 50% { transform: translateX(3px); } }

.guide-progress { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; font: 400 0.8125rem/1 var(--f-dialog); color: var(--ink-2); font-size-adjust: 0.56; font-weight: 700;}
.gp-bar { position: relative; height: 12px; background: #15153a; box-shadow: inset 0 0 0 2px #0c0b24; }
.gp-bar i { position: absolute; left: 2px; right: 2px; top: 2px; bottom: 2px; transform: scaleX(0); transform-origin: left; background: repeating-linear-gradient(90deg, #ffc94a 0 6px, #ffe39a 6px 8px); transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1); }
.gp-count { font: 400 1.125rem/1 var(--f-display); color: var(--yellow); font-size-adjust: cap-height 0.536; font-weight: 700;}
.guide-play { justify-content: center; }
.guide-play .ico { height: 0.8em; }

@media (max-width: 860px) {
  .guide-head { position: static; }
  .guide-index { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

/* =====================================================================
   Wizarding world layer: midnight, gold foil, parchment, wax and candlelight.
   ===================================================================== */
body {
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 248, 224, 0.5), transparent 60%),
    radial-gradient(1px 1px at 68% 42%, rgba(201, 214, 255, 0.45), transparent 60%),
    radial-gradient(1px 1px at 38% 76%, rgba(255, 248, 224, 0.35), transparent 60%),
    var(--ground);
  scrollbar-color: #4a4080 var(--ground);
}
::selection { background: var(--yellow); color: var(--on-light); }
:focus-visible { outline-color: var(--yellow); }

/* Big titles get the pixel display face */
.logo span, .c-title, .guide-title, .window-title, .menu-title, .clear-title, .banner-title, .foot-line, .letter-title { font-family: var(--f-title); font-weight: 700; }
.c-title { font-size: clamp(2.5rem, 1.9rem + 2vw, 3.4rem); letter-spacing: 0.01em; line-height: 1; }
.c-tagline, .c-org b { color: var(--coral-ink); }
.c-sub { color: var(--yellow); }
.feats .ico { color: var(--yellow); }

/* World signage */
.plate { color: var(--ink); letter-spacing: 0.08em; }
.board-text { color: var(--yellow); }
.board-text span:first-child { font: 400 max(12px, calc(var(--px) * 6.4)) / 1 var(--f-title); opacity: 1; letter-spacing: 0.04em; text-shadow: 0 1px 0 #3a0c10; }

/* HUD */
.hud-lv { font-family: var(--f-title); font-size: 1.75rem; color: var(--yellow); letter-spacing: 0.02em; }
.hud-xpbar { background: #120e2a; }
.hud-xpbar span { background: repeating-linear-gradient(90deg, #e04450 0 5px, #a8262c 5px 7px); }
.stat-spr .spr, .btn-spr .spr { width: 18px; height: 20px; }
.btn-spr { display: inline-grid; }
.track::before { background: rgba(7, 6, 26, 0.6); box-shadow: 0 0 0 2px rgba(242, 193, 78, 0.35); }
.track-pip { background: var(--yellow); }
.track-flag .spr { width: 26px; height: 29px; }
.track-flag { top: 2px !important; }

/* Title screen: gold pixel lettering over the living night scene */
.title { background: radial-gradient(ellipse at 50% 42%, rgba(8, 7, 28, 0.05), rgba(8, 7, 28, 0.68) 78%); }
.title-orb .spr { width: 64px; height: 72px; animation: orb-hover 3s ease-in-out infinite; }
@keyframes orb-hover { 0%, 100% { transform: translate(-14px, 0); } 25% { transform: translate(10px, -8px); } 50% { transform: translate(16px, 2px); } 75% { transform: translate(-6px, -6px); } }
.logo span {
  font-size: clamp(5rem, 3rem + 9vw, 11rem);
  line-height: 0.82;
  letter-spacing: 0.02em;
  color: var(--yellow);
  text-shadow: 0 0 18px rgba(242, 193, 78, 0.45), 0 4px 0 #a8762e, 0 8px 0 #5a3a12, 0 12px 0 #120e2a, 0 26px 34px rgba(4, 3, 14, 0.7);
}
.logo .logo-b { color: var(--ink); text-shadow: 0 0 18px rgba(201, 214, 255, 0.35), 0 4px 0 #8a83b8, 0 8px 0 #3a3170, 0 12px 0 #120e2a, 0 26px 34px rgba(4, 3, 14, 0.7); }
.title-sub { border-image-source: var(--fr-parch); background: var(--parch) padding-box; color: var(--parch-ink); font-family: var(--f-dialog); font-size-adjust: 0.56; font-weight: 700;}
.title-hint { color: var(--yellow); }

/* Invitation letter */
.letter { position: absolute; inset: 0; z-index: 14; display: grid; place-items: center; padding: 20px; background: rgba(6, 5, 18, 0.62); opacity: 0; transition: opacity 300ms ease; }
.letter.is-on { opacity: 1; }
.letter-owl { position: absolute; right: 8%; top: 6%; opacity: 0; }
.letter-owl canvas { width: 170px; height: auto; image-rendering: pixelated; }
.letter.is-on .letter-owl { animation: owl-deliver 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes owl-deliver { 0% { opacity: 1; transform: translate(120%, -120%) rotate(-10deg); } 55% { opacity: 1; transform: translate(-40%, 30%) rotate(6deg); } 100% { opacity: 0.95; transform: translate(10%, -10%) rotate(0); } }
.letter-paper {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100% - 20px); overflow: auto;
  padding: 34px 30px 26px;
  border: 14px solid transparent; border-image: var(--fr-parch) 3 fill / 14px stretch;
  background: var(--parch) padding-box;
  color: var(--parch-ink);
  font: 400 1.0625rem/1.6 var(--f-body);
  filter: drop-shadow(0 24px 40px rgba(4, 3, 14, 0.6));
  transform: translateY(40px) scaleY(0.2) rotate(-3deg); opacity: 0; transform-origin: 50% 0;
}
.letter.is-on .letter-paper { animation: letter-unfold 900ms cubic-bezier(0.16, 1, 0.3, 1) 650ms forwards; }
.letter.is-off .letter-paper { animation: letter-away 420ms ease-in forwards; }
@keyframes letter-unfold { 0% { opacity: 1; transform: translateY(40px) scaleY(0.12) rotate(-3deg); } 60% { transform: translateY(-4px) scaleY(1.03) rotate(0.6deg); } 100% { opacity: 1; transform: none; } }
@keyframes letter-away { to { opacity: 0; transform: translateY(-60px) rotate(4deg) scale(0.9); } }
.letter-seal { position: absolute; left: 50%; top: -30px; margin-left: -30px; }
.letter-seal .spr { width: 60px; height: 68px; }
.letter-title { margin: 6px 0 12px; font-size: clamp(2.4rem, 2rem + 2vw, 3.2rem); line-height: 1; text-align: center; color: #7a1620; }
.letter-to { font-weight: 700; margin-bottom: 8px; }
.letter-keys { display: flex; flex-wrap: wrap; gap: 8px 16px; font: 400 0.875rem/1.3 var(--f-dialog); font-size-adjust: 0.56; font-weight: 700;}
.letter-keys span { display: inline-flex; align-items: center; gap: 4px; }
.letter-sign { font-style: italic; margin-top: 4px; }
.letter-sign span { font-family: var(--f-title); font-style: normal; font-size: 1.75rem; color: #7a1620; }
.letter-go { margin-top: 6px; }
.letter-paper .kbd { color: var(--on-light); }

/* The Map: parchment with walking footprints */
.menu-box { border-image-source: var(--fr-parch); background: var(--parch) padding-box; color: var(--parch-ink); position: relative; }
.menu-title { font-size: 2.6rem; color: #7a1620; line-height: 1; }
.menu-head .btn { color: var(--parch-ink); border-image-source: var(--fr-parch); }
.m-name { color: var(--parch-ink); font-family: var(--f-display); font-size-adjust: cap-height 0.536; font-weight: 700;}
.m-where { color: #6e5a40; }
.m-ico { color: var(--parch-ink); }
.m-item .cur { color: var(--wax); }
.m-item:hover, .m-item:focus { background: rgba(179, 38, 45, 0.12); }
.m-item:focus-visible { box-shadow: inset 0 -3px 0 var(--wax); }
.m-seen { border-color: #b39d74; }
.m-item.is-seen .m-seen { background: var(--wax); border-color: #7a1620; }

/* Chapter banner: a parchment scroll that unrolls */
.banner { border-image-source: var(--fr-parch); background: var(--parch) padding-box; color: var(--parch-ink); }
.banner::before, .banner::after { content: ''; position: absolute; top: -10px; bottom: -10px; width: 10px; background: linear-gradient(90deg, #8a6a48, #c9a882 40%, #8a6a48); box-shadow: 0 0 0 2px #3b2a1a; }
.banner::before { left: -18px; } .banner::after { right: -18px; }
.banner-title { font-size: clamp(2rem, 1.4rem + 2vw, 3rem); color: #7a1620; }
.banner-sub { color: #5a4630; }
.banner-ico .spr { width: 46px; height: 52px; }

/* Rooms (interiors) */
.window { background: rgba(6, 5, 18, 0.66); }
.window-title { font-size: 2.6rem; color: var(--yellow); line-height: 1; }
.scene { border-image-source: var(--fr-paper); background: radial-gradient(circle at 50% 30%, rgba(242, 193, 78, 0.18), transparent 70%) padding-box, #15112e padding-box; }
.scene-line b { color: var(--yellow); font-family: var(--f-title); font-size: 1.6rem; }
.portrait { animation: portrait-breathe 3s ease-in-out infinite; }
@keyframes portrait-breathe { 50% { transform: translateY(-3px); } }

/* Course clear */
.clear-title { color: var(--yellow); font-size: clamp(3rem, 2.4rem + 3vw, 4.6rem); text-shadow: 0 0 18px rgba(242, 193, 78, 0.45), 0 4px 0 #5a3a12, 0 8px 0 #120e2a; }

/* Section badges and the quest log */
.sec-badge { border-image-source: var(--fr-paper); background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--glow) 32%, transparent), transparent 70%) padding-box, #15112e padding-box; }
.guide { background: radial-gradient(1px 1px at 20% 30%, rgba(255, 248, 224, 0.4), transparent 60%) 0 0 / 160px 160px, radial-gradient(1px 1px at 70% 80%, rgba(201, 214, 255, 0.35), transparent 60%) 0 0 / 210px 210px, var(--ground); }
.guide::before { background: linear-gradient(90deg, #4a4080 50%, #3a3170 0) 0 0 / 24px 12px repeat-x; box-shadow: 0 6px 0 #2a2350; }
.guide-title { font-size: 3rem; color: var(--yellow); text-shadow: 0 0 14px rgba(242, 193, 78, 0.35), 0 3px 0 #5a3a12, 0 6px 0 #120e2a; }
.guide-who b { font-family: var(--f-title); font-size: 1.6rem; }
.guide-index a.is-active { color: var(--on-light); }
.gp-bar i { background: repeating-linear-gradient(90deg, #e04450 0 6px, #a8262c 6px 8px); }
.foot-line { color: var(--yellow); font-size: clamp(2.4rem, 2rem + 1.6vw, 3.4rem); text-shadow: 0 0 14px rgba(242, 193, 78, 0.35), 0 3px 0 #5a3a12, 0 6px 0 #120e2a; }

/* Trophy shelf: goblets by tier */
.cup .spr { width: 46px; height: 52px; }
.tier-2 .cup .spr { filter: grayscale(1) brightness(1.25); }
.tier-3 .cup .spr { filter: sepia(1) saturate(2.2) hue-rotate(-18deg) brightness(0.85); }
.tier-4 .cup .spr { filter: grayscale(0.6) brightness(0.75); }
.tier-2 .cup .spr, .tier-3 .cup .spr, .tier-4 .cup .spr { width: 38px; height: 43px; }

/* Gallery as moving portraits in gold frames */
.photo { border-image-source: var(--fr-hot); color: var(--ink); }
.photo img { background: #2a2350; }
.photo-cap { font-family: var(--f-display); font-size: 1.1rem; color: var(--yellow); letter-spacing: 0.04em; font-size-adjust: cap-height 0.536; font-weight: 700;}

/* Sprite life for the magical icons */
.is-live.spr-hat { animation: hat-sway 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes hat-sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.is-live .px-mouth { animation: talk 0.9s steps(2, jump-none) infinite; transform-origin: 50% 0; }
@keyframes talk { 50% { transform: scaleY(2.5); } }
.is-live .px-quill { animation: quill-write 1.2s ease-in-out infinite; transform-origin: 0% 100%; transform-box: view-box; }
@keyframes quill-write { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(1px, -1px); } 50% { transform: translate(2px, 0); } 75% { transform: translate(1px, 1px); } }
.is-live .px-liquid { animation: liquid 2s ease-in-out infinite; }
@keyframes liquid { 50% { fill: #7ff0b0; } }
.is-live .px-bubble { animation: bubble 1.6s ease-in infinite; }
.is-live .px-b2 { animation-delay: 0.5s; } .is-live .px-b3 { animation-delay: 1s; }
@keyframes bubble { 0% { opacity: 0; transform: translateY(2px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }
.is-live.spr-spellbook { animation: book-float 2.4s ease-in-out infinite; }
@keyframes book-float { 50% { transform: translateY(-3px) rotate(-2deg); } }
.is-live .px-rune { animation: rune-glow 1.8s ease-in-out infinite; }
@keyframes rune-glow { 50% { fill: #fff8e0; } }
.is-live .px-face { animation: portrait-move 4s ease-in-out infinite; }
@keyframes portrait-move { 0%, 40%, 100% { transform: translateX(0); } 50%, 80% { transform: translateX(1px); } }
.is-live .px-eyes { animation: eyes-blink 3.4s steps(1, jump-none) infinite; transform-origin: 50% 50%; }
@keyframes eyes-blink { 0%, 92%, 100% { opacity: 1; } 94%, 98% { opacity: 0; } }
.is-live.spr-letter { animation: letter-bob 2.2s ease-in-out infinite; }
@keyframes letter-bob { 50% { transform: translateY(-2px) rotate(2deg); } }
.is-live .px-seal { animation: seal-glow 2s ease-in-out infinite; }
@keyframes seal-glow { 50% { fill: #ff5a60; } }
.is-live .px-wing { animation: wing-flap 0.18s steps(2, jump-none) infinite; transform-origin: 50% 70%; }
@keyframes wing-flap { 50% { transform: scaleY(-1); } }
.is-live .px-steps { animation: blink 1.2s steps(2, jump-none) infinite; }
.is-live .px-s2 { animation-delay: 0.3s; } .is-live .px-s3 { animation-delay: 0.6s; } .is-live .px-s4 { animation-delay: 0.9s; }

/* Wand-sparkle cursor trail */
.wand-spark { position: fixed; z-index: 60; width: 3px; height: 3px; pointer-events: none; background: var(--yellow); box-shadow: 0 0 6px rgba(242, 193, 78, 0.8); animation: wand-spark 700ms ease-out forwards; }
.wand-spark.s2 { background: #fff8e0; box-shadow: 0 0 6px rgba(255, 248, 224, 0.8); }
.wand-spark.s3 { background: #7fe0ff; box-shadow: 0 0 6px rgba(127, 224, 255, 0.8); }
@keyframes wand-spark { to { opacity: 0; transform: translate(var(--dx), 16px) scale(0.3); } }

@media (max-width: 640px) {
  .logo span { font-size: clamp(4rem, 22vw, 6.5rem); }
  .letter-owl canvas { width: 110px; }
  .letter-paper { padding: 30px 16px 18px; border-width: 10px; border-image-width: 10px; }
  .menu-title, .window-title { font-size: 2rem; }
  .guide-title { font-size: 2.4rem; }
}

/* Pixel display face only where words are decorative; names use Jersey 10. */
.c-title, .window-title, .banner-title, .scene-line b, .guide-who b { font-family: var(--f-display); font-weight: 400; letter-spacing: 0.02em; font-size-adjust: cap-height 0.536; font-weight: 700;}
.c-title { font-size: clamp(2.4rem, 1.9rem + 1.6vw, 3.2rem); color: var(--ink); text-shadow: 0 3px 0 #120e2a; }
.sec-title { color: var(--yellow); }
.window-title { font-size: 2.2rem; }
.banner-title { font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem); }
.scene-line b { font-size: 1.5rem; }
.guide-who b { font-size: 1.5rem; }
.hud-lv { white-space: nowrap; }
@media (max-width: 640px) { .hud-lv { font-size: 1.35rem; } }
.logo span { font-size: clamp(3.4rem, min(3rem + 9vw, 17vh), 11rem); }
.title-orb .spr { width: clamp(40px, 7vh, 64px); height: auto; }
.title-inner { gap: clamp(10px, 2vh, 18px); }
@media (max-width: 640px) { .logo span { font-size: clamp(3.4rem, min(22vw, 13vh), 6.5rem); } }
@media (max-height: 560px) {
  .letter { padding: 10px; }
  .letter-paper { padding: 22px 24px 16px; font-size: 0.95rem; line-height: 1.45; }
  .letter-title { font-size: 2.1rem; margin: 2px 0 6px; }
  .letter-paper p { margin: 0 0 8px; }
  .letter-owl canvas { width: 110px; }
}
.hud-lv, .letter-sign span { font-weight: 700; }
.board-text span:first-child { font-weight: 500; letter-spacing: 0.02em; }
@media (prefers-reduced-motion: reduce) {
  .letter.is-on .letter-paper, .letter.is-on .letter-owl { opacity: 1; transform: none; }
  .banner.is-on { opacity: 1; transform: translate(-50%, 0); }
  .sec-badge.is-in { opacity: 1; transform: none; }
}
/* Gallery: three across on wide screens (6 photos = two even rows), two on tablets, one on phones. */
.gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .gallery-grid { grid-template-columns: 1fr; } }
/* ---------- Viewport fit ---------- */
/* The footer bleeds to the guide's edges with negative margins; never let that become a sideways scroll. */
.guide { overflow-x: clip; }
html, body { overflow-x: clip; }
.hud { grid-template-columns: minmax(0, 1fr) auto; }
@media (min-width: 1181px) { .hud { grid-template-columns: auto minmax(0, 1fr) auto; } }
/* Small phones: tighter HUD so the score, gold, map and sound fit on one row. */
@media (max-width: 380px) {
  .hud { inset: max(8px, env(safe-area-inset-top)) 8px auto 8px; gap: 8px; }
  .hud-right { gap: 6px; }
  .hud-xpbar { display: none; }
  .hud-lv { font-size: 1.125rem; }
  .hud-stat { font-size: 0.9375rem; padding: 5px 7px; }
  .hud-btn { min-height: 40px; padding: 4px 6px; }
  .track-dot { width: 21px; height: 21px; }
}
/* Touch screens have no Enter key to press. */
@media (pointer: coarse) { .title-hint { display: none; } }
/* Short screens (phones in landscape, small laptop windows): compact the title and HUD. */
@media (max-height: 600px) {
  .title-menu .btn { min-height: 44px; font-size: 1rem; }
  .title-sub { padding-block: 6px; }
}
@media (max-height: 500px) {
  .hud { inset: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) auto max(10px, env(safe-area-inset-left)); gap: 6px 10px; }
  .hud-player, .hud-stat, .hud-btn { border-width: 7px; border-image-width: 7px; padding: 4px 9px; min-height: 36px; }
  .hud-lv { font-size: 1.2rem; }
  .hud-stat, .hud-btn { font-size: 0.9375rem; }
  .hud-track { height: 30px; }
  .track-dot { width: 22px; height: 22px; border-width: 5px; border-image-width: 5px; }
  .track::before { top: 13px; }
  .track-pip { top: 23px; }
  .title-inner { gap: 8px; }
  .title-orb { display: none; }
}
/* Big monitors: scale the interface chrome with the screen so it does not shrink to a strip. */
@media (min-width: 1800px) and (min-height: 950px) { .hud, .hint, .to-guide { zoom: 1.2; } }
@media (min-width: 2300px) and (min-height: 1250px) { .hud, .hint, .to-guide { zoom: 1.45; } }
/* Very small phones: slimmer pad so the quest-log button fits between the arrows and jump. */
@media (max-width: 380px) {
  .is-touch .pad { padding: 0 8px; }
  .pad-dir, .pad-act { gap: 8px; }
  .pad-btn { width: 54px; height: 54px; border-width: 8px; border-image-width: 8px; }
  .is-touch .to-guide { left: 50%; right: auto; transform: translateX(-50%); padding: 4px 8px; }
}
/* Room close button: full label on wide screens, "Back" on phones; touch screens have no Esc key. */
.wc-short { display: none; }
#window-close { white-space: nowrap; flex: none; }
@media (max-width: 560px) { .wc-long { display: none; } .wc-short { display: inline; } }
@media (pointer: coarse) { #window-close .kbd { display: none; } }

/* ---------- Spellbook quest log ---------- */
:root { --seal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' shape-rendering='crispEdges'%3E%3Crect x='3' y='1' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='4' y='1' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='5' y='1' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='6' y='1' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='7' y='1' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='8' y='1' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='9' y='1' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='10' y='1' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='11' y='1' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='12' y='1' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='2' y='2' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='3' y='2' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='4' y='2' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='5' y='2' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='6' y='2' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='7' y='2' width='1' height='1' fill='%23c43a36'/%3E%3Crect x='8' y='2' width='1' height='1' fill='%23c43a36'/%3E%3Crect x='9' y='2' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='10' y='2' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='11' y='2' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='12' y='2' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='13' y='2' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='2' y='3' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='3' y='3' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='4' y='3' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='5' y='3' width='1' height='1' fill='%23c43a36'/%3E%3Crect x='6' y='3' width='1' height='1' fill='%23c43a36'/%3E%3Crect x='7' y='3' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='8' y='3' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='9' y='3' width='1' height='1' fill='%23c43a36'/%3E%3Crect x='10' y='3' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='11' y='3' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='12' y='3' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='13' y='3' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='2' y='4' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='3' y='4' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='4' y='4' width='1' height='1' fill='%23c43a36'/%3E%3Crect x='5' y='4' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='6' y='4' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='7' y='4' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='8' y='4' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='9' y='4' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='10' y='4' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='11' y='4' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='12' y='4' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='13' y='4' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='1' y='5' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='2' y='5' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='3' y='5' width='1' height='1' fill='%23c43a36'/%3E%3Crect x='4' y='5' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='5' y='5' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='6' y='5' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='7' y='5' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='8' y='5' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='9' y='5' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='10' y='5' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='11' y='5' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='12' y='5' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='13' y='5' width='1' height='1' fill='%237a1620'/%3E%3Crect x='14' y='5' width='1' height='1' fill='%237a1620'/%3E%3Crect x='1' y='6' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='2' y='6' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='3' y='6' width='1' height='1' fill='%23c43a36'/%3E%3Crect x='4' y='6' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='5' y='6' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='6' y='6' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='7' y='6' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='8' y='6' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='9' y='6' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='10' y='6' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='11' y='6' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='12' y='6' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='13' y='6' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='14' y='6' width='1' height='1' fill='%237a1620'/%3E%3Crect x='1' y='7' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='2' y='7' width='1' height='1' fill='%23c43a36'/%3E%3Crect x='3' y='7' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='4' y='7' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='5' y='7' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='6' y='7' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='7' y='7' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='8' y='7' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='9' y='7' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='10' y='7' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='11' y='7' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='12' y='7' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='13' y='7' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='14' y='7' width='1' height='1' fill='%237a1620'/%3E%3Crect x='0' y='8' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='1' y='8' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='2' y='8' width='1' height='1' fill='%23c43a36'/%3E%3Crect x='3' y='8' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='4' y='8' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='5' y='8' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='6' y='8' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='7' y='8' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='8' y='8' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='9' y='8' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='10' y='8' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='11' y='8' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='12' y='8' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='13' y='8' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='14' y='8' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='15' y='8' width='1' height='1' fill='%237a1620'/%3E%3Crect x='0' y='9' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='1' y='9' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='2' y='9' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='3' y='9' width='1' height='1' fill='%23c43a36'/%3E%3Crect x='4' y='9' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='5' y='9' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='6' y='9' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='7' y='9' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='8' y='9' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='9' y='9' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='10' y='9' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='11' y='9' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='12' y='9' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='13' y='9' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='14' y='9' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='15' y='9' width='1' height='1' fill='%237a1620'/%3E%3Crect x='0' y='10' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='1' y='10' width='1' height='1' fill='%23d4483c'/%3E%3Crect x='2' y='10' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='3' y='10' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='4' y='10' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='5' y='10' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='6' y='10' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='7' y='10' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='8' y='10' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='9' y='10' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='10' y='10' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='11' y='10' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='12' y='10' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='13' y='10' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='14' y='10' width='1' height='1' fill='%237a1620'/%3E%3Crect x='15' y='10' width='1' height='1' fill='%237a1620'/%3E%3Crect x='1' y='11' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='2' y='11' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='3' y='11' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='4' y='11' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='5' y='11' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='6' y='11' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='7' y='11' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='8' y='11' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='9' y='11' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='10' y='11' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='11' y='11' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='12' y='11' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='13' y='11' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='14' y='11' width='1' height='1' fill='%237a1620'/%3E%3Crect x='2' y='12' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='3' y='12' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='4' y='12' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='5' y='12' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='6' y='12' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='7' y='12' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='8' y='12' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='9' y='12' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='10' y='12' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='11' y='12' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='12' y='12' width='1' height='1' fill='%237a1620'/%3E%3Crect x='13' y='12' width='1' height='1' fill='%237a1620'/%3E%3Crect x='4' y='13' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='5' y='13' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='6' y='13' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='7' y='13' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='8' y='13' width='1' height='1' fill='%238e1c24'/%3E%3Crect x='9' y='13' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='10' y='13' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='11' y='13' width='1' height='1' fill='%237a1620'/%3E%3Crect x='5' y='14' width='1' height='1' fill='%237a1620'/%3E%3Crect x='6' y='14' width='1' height='1' fill='%237a1620'/%3E%3Crect x='7' y='14' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='8' y='14' width='1' height='1' fill='%23b3262d'/%3E%3Crect x='9' y='14' width='1' height='1' fill='%237a1620'/%3E%3Crect x='10' y='14' width='1' height='1' fill='%237a1620'/%3E%3Crect x='6' y='15' width='1' height='1' fill='%237a1620'/%3E%3Crect x='7' y='15' width='1' height='1' fill='%237a1620'/%3E%3Crect x='8' y='15' width='1' height='1' fill='%237a1620'/%3E%3Crect x='9' y='15' width='1' height='1' fill='%237a1620'/%3E%3C/svg%3E"); --candle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 12' shape-rendering='crispEdges'%3E%3Crect x='0' y='2' width='5' height='10' fill='%23efe0bd'/%3E%3Crect x='0' y='2' width='1' height='10' fill='%23fff8e6'/%3E%3Crect x='4' y='2' width='1' height='10' fill='%23c9b48a'/%3E%3Crect x='3' y='3' width='1' height='3' fill='%23fff8e6'/%3E%3Crect x='2' y='0' width='1' height='2' fill='%232a1a10'/%3E%3C/svg%3E"); }
/* Chapter badges are wax seals pressed into the page. */
.sec-badge {
  border: 0; border-image: none;
  width: 64px; height: 64px;
  background: var(--seal) center / 100% 100% no-repeat;
  filter: drop-shadow(0 4px 0 rgba(8, 5, 16, 0.45)) drop-shadow(0 0 14px color-mix(in srgb, var(--glow) 22%, transparent));
  image-rendering: pixelated;
}
.sec-badge::before { display: none; }
.sec-badge .spr { width: 32px; height: 36px; margin-top: 0; filter: drop-shadow(0 1px 0 #4a0c12); }
@media (max-width: 640px) { .sec-badge { width: 50px; height: 50px; } .sec-badge .spr { width: 26px; height: 29px; } }
/* A bookmark ribbon hangs from the quest log card. */
.guide-card { position: relative; }
.guide-card::after {
  content: ''; position: absolute; top: -14px; right: 18px; width: 16px; height: 84px; pointer-events: none;
  background: linear-gradient(90deg, #7a1620 0 3px, #b3262d 3px 12px, #8e1c24 12px);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%);
  filter: drop-shadow(0 3px 0 rgba(8, 5, 16, 0.5));
}
.guide-top { padding-right: 28px; }
/* Projects: loose pages peek out behind each card. */
.project { position: relative; }
.project::before, .project::after {
  content: ''; position: absolute; z-index: -1; top: 14px; bottom: 14px; width: 12px;
  /* Stepped pixel edge on the outer side, like a page torn on the grid. */
  background: linear-gradient(90deg, transparent 0 3px, var(--parch) 3px) 0 0 / 100% 100% no-repeat, repeating-linear-gradient(180deg, var(--parch) 0 6px, transparent 6px 12px) 0 0 / 3px 100% no-repeat;
  box-shadow: inset -3px 0 0 #c9b48a;
}
.project::before { left: -9px; transform: rotate(-1.2deg); }
.project::after { left: -15px; top: 26px; bottom: 26px; opacity: 0.7; transform: rotate(-2.4deg); }
.project .entry-body { position: relative; z-index: 1; }
/* Contact is a letter on parchment, sealed in the corner. */
.mail-card { position: relative; border-image-source: var(--fr-parch); background: var(--parch) padding-box; color: var(--parch-ink); padding: 22px 22px 8px; }
.mail-card::after { content: ''; position: absolute; top: -26px; right: 14px; width: 52px; height: 52px; background: var(--seal) center / 100% 100% no-repeat; image-rendering: pixelated; transform: rotate(-10deg); filter: drop-shadow(0 3px 0 rgba(8, 5, 16, 0.4)); }
.mail-label { color: #6e5a40; }
.mail-addr { color: #7a1620; text-decoration-color: #b3262d; }
.mail-card .btn:not(.btn-primary) { color: var(--parch-ink); border-image-source: var(--fr-parch); }
/* Floating candles drift down the margins on wide screens. */
.g-candle { display: none; }
@media (min-width: 1240px) {
  .g-candle {
    display: block; position: absolute; left: 14px; width: 10px; height: 24px; z-index: 0; pointer-events: none;
    background: var(--candle) center bottom / 10px 24px no-repeat; image-rendering: pixelated;
    animation: candle-float 5s ease-in-out infinite; opacity: 0.85;
  }
  .g-candle.is-right { left: auto; right: 14px; }
  .g-candle::before { content: ''; position: absolute; left: 3px; top: -6px; width: 4px; height: 6px; background: #ffd27a; box-shadow: 0 -2px 0 #fff0b8, 0 0 18px 6px rgba(255, 207, 110, 0.35); animation: flame 0.5s steps(2, jump-none) infinite; }
}
@keyframes candle-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes flame { 50% { transform: translateX(1px) scaleY(1.2); background: #ffb347; } }
/* Room speaker stands in front of a pixel backdrop of their room. */
.stage { position: relative; display: grid; place-items: end center; width: 100%; min-height: 150px; overflow: hidden; box-shadow: 0 0 0 2px #0c0b24; }
.backdrop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.stage .portrait { position: relative; z-index: 1; background: none; padding-bottom: 4px; filter: drop-shadow(0 3px 0 rgba(8, 5, 16, 0.55)); }
@media (max-width: 860px) { .stage { min-height: 0; width: 72px; height: 84px; } .stage .portrait { width: 52px; } }
@media (prefers-reduced-motion: reduce) {
  .g-candle, .g-candle::before { animation: none; }
}
.project-list { position: relative; z-index: 0; }
/* Seal icons get a thin cream outline so they read on the red wax. */
.sec-badge .spr { filter: drop-shadow(1px 0 0 #f6ecd6) drop-shadow(-1px 0 0 #f6ecd6) drop-shadow(0 1px 0 #f6ecd6) drop-shadow(0 -1px 0 #f6ecd6) drop-shadow(0 2px 0 #4a0c12); }
/* ---------- Chapter crests (replace the wax seals) ---------- */
.sec-badge {
  display: inline-block; position: relative;
  width: 72px; height: 75px;
  background: none center / 100% 100% no-repeat;
  filter: drop-shadow(0 4px 0 rgba(8, 5, 16, 0.5));
}
.sec-badge .spr {
  position: absolute; left: 48%; top: 33px; width: 26px; height: 29px; margin: 0 0 0 -13px;
  filter: drop-shadow(1px 0 0 #f6ecd6) drop-shadow(-1px 0 0 #f6ecd6) drop-shadow(0 1px 0 #f6ecd6) drop-shadow(0 -1px 0 #f6ecd6) drop-shadow(0 2px 0 rgba(8, 5, 16, 0.6));
}
.sec-coin { top: -6px; }
@media (max-width: 640px) {
  .sec-badge { width: 54px; height: 56px; }
  .sec-badge .spr { top: 25px; width: 20px; height: 22px; margin-left: -10px; }
}
@media (max-width: 640px) { .project::before, .project::after { display: none; } }
/* ---------- Trophies ---------- */
.trophy { --tier: #f2c14e; grid-template-rows: 86px auto auto; }
.tier-2 { --tier: #c3cbef; }
.tier-3 { --tier: #e0915a; }
.tier-4 { --tier: #5a8af0; }
.cup { position: relative; display: grid; place-items: end center; width: 80px; height: 86px; margin-bottom: 8px; }
.cup::before {
  content: ''; position: absolute; left: 50%; top: 46%; width: 96px; height: 96px; margin: -48px 0 0 -48px; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--tier) 34%, transparent) 0%, transparent 62%);
  animation: tier-glow 3.2s ease-in-out infinite;
}
.trophy-art { position: relative; width: 70px; height: 77px; image-rendering: pixelated; filter: drop-shadow(0 4px 0 rgba(8, 5, 16, 0.45)); transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.tier-1 .trophy-art { width: 80px; height: 88px; }
.trophy:hover .trophy-art { transform: translateY(-4px) rotate(-3deg); }
.cup-spark { position: absolute; top: 8px; right: 10px; width: 4px; height: 4px; background: #ffffff; box-shadow: 0 -4px 0 #ffffff, 0 4px 0 #ffffff, -4px 0 0 #ffffff, 4px 0 0 #ffffff; transform: scale(0.5); opacity: 0; animation: cup-spark 2.6s steps(4) infinite; }
.tier-2 .cup-spark { animation-delay: 0.7s; } .tier-3 .cup-spark { animation-delay: 1.3s; } .tier-4 .cup-spark { animation-delay: 1.9s; }
@keyframes cup-spark { 0%, 70% { opacity: 0; transform: scale(0.4); } 80% { opacity: 1; transform: scale(0.8); } 100% { opacity: 0; transform: scale(0.4); } }
@keyframes tier-glow { 50% { opacity: 0.6; transform: scale(0.92); } }
.t-place { color: var(--tier); text-shadow: 0 2px 0 #0c0b24; }
.tier-2 .t-place { color: #e8ebfa; }
@media (max-width: 640px) { .trophy { grid-template-rows: 70px auto auto; } .cup { width: 64px; height: 70px; } .trophy-art, .tier-1 .trophy-art { width: 56px; height: 62px; } }
@media (prefers-reduced-motion: reduce) { .cup::before, .cup-spark { animation: none; } .cup-spark { display: none; } }
.logo, .title-sub { user-select: none; -webkit-user-select: none; }
/* Title lettering: Harry P (drop the font file at assets/fonts/HarryP.ttf). Falls back to the pixel face until it exists. */
@font-face { font-family: 'Harry P'; src: url('../assets/fonts/HarryP.ttf') format('truetype'); font-display: swap; }
.logo span { font-family: 'Harry P', var(--f-title); font-weight: 400; letter-spacing: 0.01em; }
/* Harry P is narrow, so the title runs a size larger to hold the same presence. */
.logo span { font-size: clamp(4rem, min(3.6rem + 10.5vw, 20vh), 13rem); line-height: 0.95; }
@media (max-width: 640px) { .logo span { font-size: clamp(4rem, min(26vw, 15vh), 7.5rem); } }
/* Pixelated title: the canvas paints the letters; the h1 text stays for screen readers. */
.logo { position: relative; }
.logo.is-pixel span { color: transparent; text-shadow: none; }
.logo-pixels { position: absolute; image-rendering: pixelated; pointer-events: none; filter: drop-shadow(0 0 18px rgba(242, 193, 78, 0.28)) drop-shadow(0 18px 24px rgba(4, 3, 14, 0.6)); animation: logo-float 4s ease-in-out infinite; }
@keyframes logo-float { 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .logo-pixels { animation: none; } }
.logo span { letter-spacing: 0.04em; }
/* Buttons and the title subtitle use Jersey 10. It sets small for its size, so it runs about a third larger. */
.btn { font-family: var(--f-display); font-size: 1.3rem; letter-spacing: 0.03em; line-height: 1; font-size-adjust: cap-height 0.536; font-weight: 700;}
.title-menu .btn { font-size: 1.5rem; }
.title-sub { font-family: var(--f-display); font-size: 1.5rem; letter-spacing: 0.04em; font-size-adjust: cap-height 0.536; font-weight: 700;}
.hud-btn, .heat-tab, .projects-all, .project-toggle { font-size: 1.2rem; }
.btn .kbd { font-family: var(--f-dialog); font-size-adjust: 0.56; font-weight: 700;}
@media (max-height: 600px) { .title-menu .btn { font-size: 1.3rem; } }
@media (max-width: 640px) { .title-sub { font-size: 1.25rem; } .title-menu .btn { font-size: 1.35rem; } }
/* Footer: a quiet sign-off line, not a second hero. */
.guide-foot {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 72px; padding: 22px 24px 26px;
  background: var(--ground);
  border-top: 2px solid #2e2a52;
}
.guide-foot::before { display: none; }
.foot-flag .spr { width: 22px; height: 25px; }
.foot-line { font: 400 1.25rem/1 var(--f-display); letter-spacing: 0.04em; color: var(--ink-2); text-shadow: none; font-size-adjust: cap-height 0.536; font-weight: 700;}

/* ---------- Quest log card: inventory slots, star marks, a potion vial for progress ---------- */
.guide-sub { font-style: italic; font-size: 0.9375rem; }
.guide-who span { font: 400 1.0625rem/1.25 var(--f-display); letter-spacing: 0.03em; font-size-adjust: cap-height 0.536; font-weight: 700;}
.guide-index { gap: 6px; }
.guide-index a {
  grid-template-columns: 12px 36px 1fr 16px; min-height: 46px;
  font: 400 1.375rem/1.05 var(--f-display); letter-spacing: 0.03em; color: var(--ink); font-size-adjust: cap-height 0.536; font-weight: 700;}
.gi-ico { display: grid; place-items: center; width: 36px; height: 36px; background: #15112e; box-shadow: inset 0 0 0 2px #0c0b24, inset 0 0 0 4px #3d3770; }
.gi-ico .spr, .guide-index a:hover .gi-ico .spr { width: 24px; height: 27px; filter: none; }
.guide-index a.is-active .gi-ico { box-shadow: inset 0 0 0 2px #0c0b24, inset 0 0 0 4px #c9952e; background: #1d1840; }
.guide-index a .gi-state, .guide-index a.is-active .gi-state { width: 14px; height: 14px; background: #3d3770; box-shadow: none; clip-path: none; -webkit-mask: var(--px-star) center / 100% 100% no-repeat; mask: var(--px-star) center / 100% 100% no-repeat; }
.guide-index a.is-read .gi-state { background: #f2c14e; box-shadow: none; clip-path: none; -webkit-mask: var(--px-star) center / 100% 100% no-repeat; mask: var(--px-star) center / 100% 100% no-repeat; filter: drop-shadow(0 0 4px rgba(242, 193, 78, 0.6)); }
.guide-index a.is-active.is-read .gi-state { background: #a8262c; filter: none; }
.guide-progress { font: 400 1.125rem/1 var(--f-display); letter-spacing: 0.03em; font-size-adjust: cap-height 0.536; font-weight: 700;}
.gp-bar { height: 18px; background: #15112e; box-shadow: inset 0 0 0 2px #0c0b24, inset 0 0 0 4px #8a83b8, inset 0 6px 0 4px rgba(255, 255, 255, 0.06); }
.gp-bar::after { content: ''; position: absolute; right: -6px; top: 3px; width: 6px; height: 12px; background: #8a5a34; box-shadow: inset 0 0 0 2px #5a3a24; }
.gp-bar i { left: 4px; right: 4px; top: 4px; bottom: 4px; background: radial-gradient(circle at 30% 40%, #fff0b8 0 1px, transparent 1.5px) 0 0 / 9px 10px, linear-gradient(#ffe39a 0 35%, #f2c14e 35% 75%, #c9952e 75%); }

/* ---------- Skills: cabinet shelves with an object for each ---------- */
.shelves { gap: 30px 26px; }
.rack {
  position: relative; padding: 16px 16px 20px; margin-bottom: 10px;
  border: 12px solid transparent; border-image: var(--fr-paper) 3 fill / 12px stretch;
  background: #15112e padding-box;
}
.rack::after { content: ''; position: absolute; left: -16px; right: -16px; bottom: -22px; height: 10px; background: linear-gradient(#c08a52 0 3px, #8a5a34 3px 7px, #5e3d27 7px); box-shadow: 0 4px 0 rgba(8, 5, 16, 0.4); }
.rack .c-sub.rack-head { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font: 400 1.625rem/1 var(--f-display); letter-spacing: 0.04em; text-transform: none; font-size-adjust: cap-height 0.536; font-weight: 700;}
.rack-ico { display: grid; place-items: center; width: 40px; height: 40px; flex: none; background: #0e0c24; box-shadow: inset 0 0 0 2px #0c0b24, inset 0 0 0 4px #c9952e; }
.rack-ico .spr { width: 28px; height: 31px; }
.items { gap: 10px; }
.items li {
  padding: 3px 8px; border: 0; border-image: none;
  background: #241f4e; box-shadow: inset 0 0 0 2px #0c0b24, inset 0 -3px 0 2px #1a1640, inset 0 2px 0 2px #3d3770;
  font: 400 1.25rem/1.3 var(--f-display); letter-spacing: 0.03em;
  transition: transform 160ms cubic-bezier(0.34, 1.56, 0.64, 1); font-size-adjust: cap-height 0.536; font-weight: 700;}
.items li:hover { transform: translateY(-2px); }
.items li .brand { width: 16px; height: 16px; }

/* ---------- Find me elsewhere: owl-post letters ---------- */
.socials { gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.socials li { position: relative; }
.socials a {
  grid-template-columns: 44px 1fr 14px; gap: 12px; min-height: 0; padding: 12px 14px 12px 12px;
  border: 10px solid transparent; border-image: var(--fr-parch) 3 fill / 10px stretch;
  background: var(--parch) padding-box; color: var(--parch-ink);
  transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.socials a:hover { background-color: var(--parch); transform: translateY(-3px) rotate(-0.6deg); }
.socials li::after { content: ''; position: absolute; top: -12px; right: 14px; width: 32px; height: 32px; background: var(--seal) center / 100% 100% no-repeat; image-rendering: pixelated; transform: rotate(-12deg); filter: drop-shadow(0 2px 0 rgba(8, 5, 16, 0.4)); pointer-events: none; }
.social-mark { display: grid; place-items: center; width: 44px; height: 44px; background: #1d1840; box-shadow: inset 0 0 0 2px #0c0b24, inset 0 0 0 4px #c9952e; }
.social-mark .brand { width: 22px; height: 22px; }
.social-text { display: grid; gap: 3px; min-width: 0; }
.socials .social-name { font: 400 1.5rem/1 var(--f-display); letter-spacing: 0.03em; color: #2a1d10; font-size-adjust: cap-height 0.536; font-weight: 700;}
.socials .handle { font: 400 1.0625rem/1.1 var(--f-display); color: #6e5a40; letter-spacing: 0.03em; overflow-wrap: anywhere; font-size-adjust: cap-height 0.536; font-weight: 700;}
.socials .ico { color: #b3262d; }
/* Sub-headings: title case in the pixel face, led by a small gold diamond. */
.c-sub:not(.rack-head) { display: flex; align-items: center; gap: 10px; text-transform: none; font-size: 1.625rem; letter-spacing: 0.04em; }
.c-sub:not(.rack-head)::before { content: ''; width: 10px; height: 10px; flex: none; background: var(--yellow); transform: rotate(45deg); box-shadow: 0 0 0 2px #0c0b24, 0 0 8px rgba(242, 193, 78, 0.5); }

:root { --px-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Crect x='3' y='0' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='0' y='2' width='1' height='1'/%3E%3Crect x='1' y='2' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='4' y='2' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='6' y='2' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='3' y='3' width='1' height='1'/%3E%3Crect x='4' y='3' width='1' height='1'/%3E%3Crect x='5' y='3' width='1' height='1'/%3E%3Crect x='2' y='4' width='1' height='1'/%3E%3Crect x='3' y='4' width='1' height='1'/%3E%3Crect x='4' y='4' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='4' y='5' width='1' height='1'/%3E%3Crect x='5' y='5' width='1' height='1'/%3E%3Crect x='0' y='6' width='1' height='1'/%3E%3Crect x='1' y='6' width='1' height='1'/%3E%3Crect x='5' y='6' width='1' height='1'/%3E%3Crect x='6' y='6' width='1' height='1'/%3E%3C/svg%3E"); }

/* ---------- Quest map: the quest log index as a parchment map ---------- */
@media (min-width: 861px) {
  .guide-head { top: 20px; }
  .guide-card {
    gap: 12px; padding: 14px 14px 14px; max-height: calc(100vh - 40px); overflow-y: auto; scrollbar-width: none;
    border-image-source: var(--fr-parch); background: var(--parch) padding-box; color: var(--parch-ink);
    background-image: radial-gradient(circle at 20% 15%, rgba(201, 180, 138, 0.35) 0 2px, transparent 3px), radial-gradient(circle at 80% 70%, rgba(201, 180, 138, 0.3) 0 2px, transparent 3px);
    background-size: 46px 52px, 61px 47px;
  }
  .guide-card::-webkit-scrollbar { display: none; }
  .guide-top { gap: 10px; }
  .guide-book .spr { width: 34px; height: 38px; }
  .guide-title { font-size: 2rem; line-height: 1; color: #7a1620; text-shadow: 0 2px 0 #d9c49a, 0 3px 0 rgba(59, 42, 26, 0.25); margin: 0; }
  .guide-sub { font-size: 0.8125rem; color: #6e5a40; margin-top: 2px; }
  .guide-player { display: none; }

  .qmap { position: relative; }
  .qmap-path { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
  .qmap-path path { fill: none; stroke: #6e5a40; stroke-width: 3; stroke-dasharray: 2 7; stroke-linecap: square; opacity: 0.85; }
  .qmap-walker { position: absolute; left: 0; top: 0; z-index: 2; image-rendering: pixelated; pointer-events: none; transition: transform 700ms cubic-bezier(0.45, 0, 0.25, 1); filter: drop-shadow(0 2px 0 rgba(59, 42, 26, 0.35)); }

  .guide-index { position: relative; z-index: 1; gap: 2px; padding-left: 30px; }
  .guide-index li:nth-child(even) { padding-left: 20px; }
  .guide-index a, .guide-index a.is-active {
    grid-template-columns: 34px 1fr 14px; gap: 10px; min-height: 40px; padding: 2px 6px 2px 0;
    border: 0; border-image: none; background: none; transform: none;
    font: 400 1.25rem/1.05 var(--f-display); letter-spacing: 0.03em; color: #4a3622; font-size-adjust: cap-height 0.536; font-weight: 700;}
  .guide-index .gi-cur { display: none; }
  .gi-ico { width: 34px; height: 34px; background: #efe0bd; box-shadow: inset 0 0 0 2px #3b2a1a, inset 0 0 0 4px #c9b48a; }
  .gi-ico .spr, .guide-index a:hover .gi-ico .spr { width: 22px; height: 25px; }
  .guide-index a:hover { color: #7a1620; transform: translateX(3px); }
  .guide-index a:is(:hover, :focus-visible) { color: #7a1620; }
  .guide-index a:is(:hover, :focus-visible) .gi-name { text-decoration: underline wavy #b3262d 2px; text-underline-offset: 5px; }
  .guide-index a:is(:hover, :focus-visible) .gi-ico { background: #fff3d6; box-shadow: inset 0 0 0 2px #7a1620, inset 0 0 0 4px #e0b048, 0 0 12px rgba(224, 176, 72, 0.6); }
  .guide-index a .gi-state, .guide-index a.is-active .gi-state { width: 13px; height: 13px; background: #c9b48a; filter: none; }
  .guide-index a.is-read .gi-state { background: #c9952e; filter: drop-shadow(0 1px 0 #7a4a12); }
  .guide-index a.is-active.is-read .gi-state { background: #b3262d; filter: none; }

  .guide-progress { color: #4a3622; font-size: 1.0625rem; gap: 8px; }
  .gp-count { color: #7a1620; }
  .gp-bar { background: #e8d6ad; box-shadow: inset 0 0 0 2px #3b2a1a, inset 0 0 0 4px #b39d74; }
  .guide-play { min-height: 40px; font-size: 1.2rem; }
}
/* The map runs the full height of the screen; stops spread evenly along the path. */
@media (min-width: 861px) {
  .guide-card { min-height: calc(100vh - 40px); grid-template-rows: auto 1fr auto auto; align-content: stretch; }
  .qmap { display: flex; }
  .qmap .guide-index { flex: 1; display: flex; flex-direction: column; justify-content: space-evenly; gap: 4px; }
  .guide-index a, .guide-index a.is-active { min-height: 46px; font-size: 1.375rem; }
  .gi-ico { width: 40px; height: 40px; }
  .gi-ico .spr, .guide-index a:hover .gi-ico .spr { width: 28px; height: 31px; }
  .guide-index a, .guide-index a.is-active { grid-template-columns: 40px 1fr 14px; }
  .guide-title { font-size: 2rem; white-space: nowrap; }
}

/* Jersey 10 has one weight; never let the browser fake a bold. */
body { font-synthesis: none; }
.btn, .title-sub { font-size-adjust: none; }
/* Chapter headings: pixelated Almendra Bold painted by canvas over the transparent heading text. */
.px-text { position: relative; display: inline-block; font-family: 'Almendra', var(--f-title); font-weight: 700; letter-spacing: 0; color: transparent !important; text-shadow: none !important; }
.px-text canvas { position: absolute; image-rendering: pixelated; pointer-events: none; filter: drop-shadow(0 0 10px rgba(242, 193, 78, 0.2)); }
.px-text::selection { color: transparent; }
/* Almendra replaces the old pixel face: bold for titles and signs, regular for small decorative lines. */
.guide-title, .window-title, .menu-title, .clear-title, .banner-title, .letter-title, .hud-lv, .letter-sign span, .board-text span:first-child { font-family: var(--f-title); font-weight: 700; letter-spacing: 0.01em; }
.px-text[data-look="cream"] { font-weight: 400; }
.px-text[data-look="cream"] { font-family: 'Almendra SC', 'Almendra', serif; font-weight: 400; }

/* Almendra Bold stands in for Jersey 10, scaled to Jersey's cap height so every control keeps its width.
   Painted headings and titles keep their own sizes. */
.btn, .title-sub { font-size-adjust: cap-height 0.536; font-weight: 700; }
.c-title, .guide-title, .window-title, .menu-title, .clear-title, .banner-title, .letter-title, .hud-lv, .letter-sign span, .board-text span, .px-text, .logo, .logo span, .rank-name, .project .c-title { font-size-adjust: none; }
/* Pixel edges: hard aliased edges (no anti-aliasing) on all interface text. */
.btn, .gi-name, .c-sub, .t-place, .items li, .heat-tab, .m-name, .social-name, .hud-stat, .title-sub, .scene-line b, .gp-count { filter: url(#pxe); }
.hud-btn { filter: url(#pxe) drop-shadow(0 8px 14px rgba(8, 5, 16, 0.38)); }
.rank-link, .t-post, .heat-name, .heat-sum, .heat-months, .m-where, .handle, .photo-cap, .scene-line, .dialog-text, .hint, .hud-xp-text, .gp-label, .mail-label, .lb-count, .c-tagline, .fact dt, .fact dd, .kbd { filter: url(#pxe); }

/* ---------- Rank cards: the whole card opens the profile ---------- */
.rank { padding: 0; border: 0; border-image: none; transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.rank-card {
  position: relative; display: grid; gap: 2px; height: 100%; overflow: hidden;
  padding: 18px 12px 14px;
  border: 12px solid transparent; border-image: var(--fr-paper) 3 fill / 12px stretch;
  color: inherit; text-decoration: none; cursor: pointer;
  filter: drop-shadow(0 6px 0 rgba(8, 5, 16, 0.45));
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), filter 220ms ease;
}
.rank-card:hover, .rank-card:focus-visible {
  transform: translateY(-6px) rotate(-0.6deg);
  filter: drop-shadow(0 12px 0 rgba(8, 5, 16, 0.4)) drop-shadow(0 0 16px rgba(242, 193, 78, 0.35));
  outline: none;
}
.rank-card:active { transform: translateY(-2px) scale(0.98); transition-duration: 80ms; }
.rank-logo { transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.rank-card:hover .rank-logo, .rank-card:focus-visible .rank-logo { transform: translateY(-3px) rotate(8deg) scale(1.15); }
.rank-go { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font: 700 0.9375rem/1.3 var(--f-dialog); font-size-adjust: 0.56; color: var(--coral-ink); opacity: 0.75; transform: translateX(-4px); transition: opacity 200ms ease, transform 200ms ease; filter: url(#pxe); }
.rank-go .ico { height: 0.75em; transition: transform 200ms ease; }
.rank-card:hover .rank-go, .rank-card:focus-visible .rank-go { opacity: 1; transform: none; }
.rank-card:hover .rank-go .ico, .rank-card:focus-visible .rank-go .ico { transform: translate(3px, -3px); }
.rank-shine { position: absolute; inset: -20%; pointer-events: none; background: linear-gradient(115deg, transparent 42%, rgba(255, 240, 184, 0.22) 50%, transparent 58%); transform: translateX(-120%); }
.rank-card:hover .rank-shine, .rank-card:focus-visible .rank-shine { transform: translateX(120%); transition: transform 700ms ease; }
@media (prefers-reduced-motion: reduce) { .rank-card, .rank-card:hover, .rank-card:focus-visible, .rank-card:hover .rank-logo { transform: none; } .rank-shine { display: none; } }
.rank-card::after { content: ''; position: absolute; inset: -12px; pointer-events: none; box-shadow: inset 0 0 0 3px #ffe39a, inset 0 0 0 6px rgba(242, 193, 78, 0.35), inset 0 0 28px rgba(242, 193, 78, 0.25); opacity: 0; transition: opacity 200ms ease; }
.rank-card:hover::after, .rank-card:focus-visible::after { opacity: 1; }

/* ---------- Skills: the wand shop ---------- */
.rack {
  padding: 16px 18px 6px; margin-bottom: 14px;
  border: 10px solid #2a1a10; border-image: none;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 23px),
    linear-gradient(#4a2f1c, #3d2616);
  box-shadow: inset 0 0 0 2px #6e4a2c, inset 0 10px 18px rgba(0, 0, 0, 0.35), 0 8px 0 rgba(8, 5, 16, 0.45);
}
.rack::before { content: ''; position: absolute; left: -16px; right: -16px; top: -18px; height: 10px; background: linear-gradient(#c08a52 0 3px, #8a5a34 3px 7px, #5e3d27 7px); box-shadow: 0 3px 0 rgba(8, 5, 16, 0.35); }
.rack::after { bottom: -20px; }
.rack .c-sub.rack-head { margin: 0 0 16px; gap: 10px; text-shadow: none; filter: none; }
.rack-ico { box-shadow: inset 0 0 0 2px #0c0b24, inset 0 0 0 4px #c9952e; background: #1a1006; }
.rack-plaque {
  padding: 4px 14px 5px; font: 700 1.25rem/1 var(--f-display); font-size-adjust: cap-height 0.536; letter-spacing: 0.02em;
  color: #3a1e08; text-shadow: 0 1px 0 rgba(255, 240, 184, 0.6);
  background: linear-gradient(#ffe39a, #e0b048 45%, #a8761e);
  box-shadow: 0 0 0 2px #3a1e08, inset 0 -2px 0 rgba(58, 30, 8, 0.3), 0 3px 0 rgba(8, 5, 16, 0.4);
  filter: url(#pxe);
}
.rack-plaque::before, .rack-plaque::after { content: '•'; margin: 0 6px 0 0; color: #7a4a12; }
.rack-plaque::after { margin: 0 0 0 6px; }

/* Each skill is a wand box resting on a shelf plank. */
.wands {
  --row: 54px;
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 14px 8px;
  background: linear-gradient(transparent 40px, #2a1a10 40px, #8a5a34 41px, #6e4a2c 45px, #2a1a10 46px, transparent 47px) 0 0 / 100% var(--row) repeat-y;
}
.wand-box {
  position: relative; height: 40px;
  display: inline-flex; align-items: center; gap: 6px; padding: 0 8px 0 6px;
  background: var(--box);
  box-shadow: 0 0 0 2px #120a06, inset 0 4px 0 rgba(255, 255, 255, 0.14), inset 0 -3px 0 rgba(0, 0, 0, 0.3), inset 5px 0 0 rgba(0, 0, 0, 0.28);
  cursor: default;
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 220ms ease;
}
.wand-box::before { content: ''; position: absolute; top: 5px; right: 4px; width: 3px; height: 3px; background: #e0b048; box-shadow: 0 25px 0 #e0b048, -100cqw 0 0 transparent; }
.wb-logo { display: grid; place-items: center; width: 22px; height: 22px; flex: none; }
.wb-logo .brand { width: 16px; height: 16px; }
.wb-label {
  padding: 2px 8px 3px; background: #efe0bd; color: #3b2a1a;
  font: 700 1.0625rem/1.15 var(--f-display); font-size-adjust: cap-height 0.536;
  box-shadow: inset 0 0 0 1px #b39d74, 0 1px 0 rgba(0, 0, 0, 0.35);
  filter: url(#pxe);
}
.wand-box::after {
  content: ''; position: absolute; right: -6px; top: -8px; width: 9px; height: 9px; opacity: 0; pointer-events: none;
  background: #fff8e0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.wand-box:hover { transform: translateY(-9px) rotate(-2deg); box-shadow: 0 0 0 2px #120a06, inset 0 4px 0 rgba(255, 255, 255, 0.2), inset 0 -3px 0 rgba(0, 0, 0, 0.3), inset 5px 0 0 rgba(0, 0, 0, 0.28), 0 10px 0 rgba(8, 5, 16, 0.45), 0 0 14px rgba(242, 193, 78, 0.35); }
.wand-box:hover::after { animation: wand-spark 700ms ease-out; }
@keyframes wand-spark { 0% { opacity: 0; transform: scale(0.3) rotate(0); } 30% { opacity: 1; transform: scale(1.2) rotate(45deg); } 100% { opacity: 0; transform: scale(0.6) rotate(90deg) translate(4px, -6px); } }
@media (prefers-reduced-motion: reduce) { .wand-box:hover { transform: none; } .wand-box:hover::after { animation: none; } }
@media (max-width: 860px) { .qmap-path, .qmap-walker { display: none; } }
.px-text { white-space: nowrap; }
.sec-title, .rank-card, .project .c-title { min-width: 0; }
/* The quest log column never grows to fit a long painted heading; headings shrink to the column instead. */
.guide-wrap > * { min-width: 0; }
@media (max-width: 860px) { .guide-wrap { grid-template-columns: minmax(0, 1fr); } }
.entry, .entry-body, .project, .content { min-width: 0; }
/* Skills: no wooden cabinet or shelf planks; groups sit on the midnight panel with the gold pixel frame. */
.rack {
  padding: 16px 16px 18px; margin-bottom: 0;
  border: 12px solid transparent; border-image: var(--fr-paper) 3 fill / 12px stretch;
  background: #15112e padding-box; box-shadow: none;
}
.rack::before, .rack::after { display: none; }
.wands { background: none; gap: 10px 8px; }
/* Shelves without the wood: a slim gold-trimmed ledge under each row of wand boxes. */
.wands {
  gap: 16px 8px; padding-bottom: 2px;
  background:
    linear-gradient(transparent 40px, #0c0b24 40px, #e0b048 41px, #c9952e 43px, #6e4a12 45px, rgba(8, 5, 16, 0.55) 46px, transparent 50px) -16px 0 / calc(100% + 32px) 56px repeat-y;
}
.wand-box { box-shadow: 0 0 0 2px #120a06, inset 0 4px 0 rgba(255, 255, 255, 0.14), inset 0 -3px 0 rgba(0, 0, 0, 0.3), inset 5px 0 0 rgba(0, 0, 0, 0.28), 0 3px 0 rgba(8, 5, 16, 0.5); }
.wands { margin: 0 -16px; padding: 0 16px 8px; background-position: 0 0; background-size: 100% 56px; }
/* ---------- Skills: arched stone display niches (painted by canvas) ---------- */
.shelves { gap: 26px 22px; }
.rack {
  position: relative; isolation: isolate;
  padding: 70px 28px 34px; margin: 0;
  border: 0; border-image: none; background: none; box-shadow: none;
  filter: drop-shadow(0 8px 0 rgba(8, 5, 16, 0.5));
}
.niche { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; image-rendering: pixelated; }
.rack .c-sub.rack-head { justify-content: center; margin: 0 0 18px; }
.wands { margin: 0 -14px; padding: 0 14px 6px; justify-content: center; }
/* Shelves of light: a faint hairline with drifting pixel sparkles; the wand boxes float above it. */
.wands { position: relative; background: none; isolation: isolate; }
.wands::before, .wands::after { content: ''; position: absolute; inset: 0 14px; z-index: -1; pointer-events: none; }
.wands::before {
  background:
    radial-gradient(circle at 50% 47px, #fff0b8 0 1px, transparent 1.6px) 0 0 / 17px 56px repeat,
    linear-gradient(90deg, transparent, rgba(242, 193, 78, 0.28) 15%, rgba(242, 193, 78, 0.28) 85%, transparent) 0 46px / 100% 1px no-repeat,
    repeating-linear-gradient(transparent 0 46px, rgba(242, 193, 78, 0.22) 46px 47px, transparent 47px 56px);
  -webkit-mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  animation: stardust-r 9s linear infinite;
}
.wands::after {
  background: radial-gradient(circle at 50% 45px, #bfe0ff 0 0.9px, transparent 1.5px) 0 0 / 29px 56px repeat;
  -webkit-mask: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); mask: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
  opacity: 0.85; animation: stardust-l 13s linear infinite;
}
@keyframes stardust-r { to { background-position: 170px 0, 0 46px, 0 0; } }
@keyframes stardust-l { to { background-position: -290px 0; } }
.wand-box { animation: levitate 4.2s ease-in-out infinite; }
.wand-box:nth-child(3n + 2) { animation-delay: -1.4s; }
.wand-box:nth-child(3n + 3) { animation-delay: -2.8s; }
@keyframes levitate { 50% { translate: 0 -2px; } }
@media (prefers-reduced-motion: reduce) { .wands::before, .wands::after, .wand-box { animation: none; } }
.wands { padding-bottom: 12px; }
/* Quiet shelves: stone ledges carved from the niche itself; no sparkles, no idle motion. */
.wands::after { display: none; }
.wands::before {
  inset: 0; animation: none; -webkit-mask: none; mask: none;
  background: repeating-linear-gradient(transparent 0 40px, #6a63a6 40px 41px, #4d4780 41px 45px, #0c0b24 45px 46px, rgba(8, 5, 16, 0.4) 46px 49px, transparent 49px 56px);
}
.wand-box { animation: none; }
.wand-box:hover::after { animation: none; }
.wands::before { opacity: 0.2; }
/* Stone ledges with a warm golden tint: gilded top edge, gold-washed face. */
.wands::before { background: repeating-linear-gradient(transparent 0 40px, #e0c27a 40px 41px, #8a7560 41px 45px, #0c0b24 45px 46px, rgba(8, 5, 16, 0.4) 46px 49px, transparent 49px 56px); }

/* ---------- Quest log as a slim sticky top bar; content takes the full width ---------- */
@media (min-width: 861px) {
  .guide { padding-top: 0; }
  .guide-wrap { grid-template-columns: minmax(0, 1fr); gap: 56px; max-width: 1280px; }
  .guide-head { position: sticky; top: 0; z-index: 20; margin: 0 -8px; padding-top: 10px; background: linear-gradient(var(--ground) 70%, transparent); }
  .guide-card {
    display: flex; align-items: center; gap: 16px;
    min-height: 0; max-height: none; overflow: visible;
    padding: 6px 14px; border-width: 10px; border-image-width: 10px;
  }
  .guide-card::after { display: none; }
  .guide-top { flex: none; padding-right: 0; gap: 8px; }
  .guide-book .spr { width: 26px; height: 29px; }
  .guide-title { font-size: 1.5rem; }
  .guide-sub, .guide-progress, .qmap-path, .qmap-walker { display: none; }
  .qmap { flex: 1; min-width: 0; }
  .qmap .guide-index {
    flex-direction: row; justify-content: space-between; align-items: center; gap: 4px; padding: 0;
    background: repeating-linear-gradient(90deg, #8a6a4a 0 3px, transparent 3px 9px) 0 50% / 100% 2px no-repeat;
  }
  .guide-index li, .guide-index li:nth-child(even) { padding-left: 0; }
  .guide-index a, .guide-index a.is-active {
    grid-template-columns: 30px auto; gap: 6px; min-height: 0; padding: 3px 7px 3px 3px;
    background: var(--parch); font-size: 1rem; white-space: nowrap;
  }
  .guide-index .gi-state { display: none; }
  .gi-ico { width: 30px; height: 30px; }
  .gi-ico .spr, .guide-index a:hover .gi-ico .spr { width: 20px; height: 22px; }
  .guide-index a:is(:hover, :focus-visible) .gi-name { text-underline-offset: 4px; }
  .guide-play { flex: none; min-height: 34px; padding: 4px 12px; font-size: 0.95rem; }
  .entry { scroll-margin-top: 90px; }
}
@media (min-width: 861px) and (max-width: 1240px) {
  .guide-index .gi-name { display: none; }
  .guide-index a, .guide-index a.is-active { grid-template-columns: 30px; padding: 3px; }
  .guide-index a.is-active .gi-name { display: inline; }
  .guide-index a.is-active { grid-template-columns: 30px auto; padding-right: 7px; }
}
@media (min-width: 861px) {
  .guide-play { border-width: 6px; border-image-width: 6px; min-height: 30px; padding: 2px 10px; }
  .guide-index a, .guide-index a.is-active { font-size: 1.1rem; }
  .shelves { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 861px) {
  .guide-play { white-space: nowrap; flex-shrink: 0; }
  .guide-card { gap: 12px; }
  .guide-index a, .guide-index a.is-active { font-size: 1rem; padding-right: 5px; }
}
@media (min-width: 861px) and (max-width: 1500px) { .guide-top { display: none; } }

/* ---------- The Daily Prophet: one compact broadsheet (1400 wide, ~1.25x tall) ---------- */
@font-face { font-family: 'Muggle News'; src: url('../assets/fonts/MuggleNews.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Headline One'; src: url('../assets/fonts/Headline-One.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Headline Two'; src: url('../assets/fonts/Headline-Two.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Ziggurat'; src: url('../assets/fonts/Ziggurat-Black.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'Champion Heavy'; src: url('../assets/fonts/ChampionGothic-Heavyweight.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Champion Light'; src: url('../assets/fonts/ChampionGothic-Lightweight.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Champion Bantam'; src: url('../assets/fonts/ChampionGothic-Bantamweight.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Champion Feather'; src: url('../assets/fonts/ChampionGothic-Featherweight.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Champion Middle'; src: url('../assets/fonts/ChampionGothic-Middleweight.ttf') format('truetype'); font-display: swap; }

.dp-book {
  --dp-ink: #17130d; --dp-ink2: #3a3226; --dp-paper: #e9dfc4; --dp-gold: #e2b33c;
  --dp-light: 'Champion Light', sans-serif; --dp-bantam: 'Champion Bantam', sans-serif; --dp-feather: 'Champion Feather', sans-serif;
  --dp-heavy: 'Champion Heavy', sans-serif; --dp-mid: 'Champion Middle', sans-serif;
  --dp-slab: 'Ziggurat', 'Ultra', serif; --dp-outline: 'Headline One', serif; --dp-label: 'Headline Two', sans-serif;
  --dp-west: 'Rye', serif; --dp-script: 'Pinyon Script', cursive; --dp-frak: 'UnifrakturMaguntia', serif;
  --dp-body: 'IM Fell English', Georgia, serif; --dp-sc: 'IM Fell English SC', Georgia, serif;
  margin: 18px auto 0;
}
.dp-book * { text-shadow: none; filter: none; font-size-adjust: none; letter-spacing: normal; box-sizing: border-box; }
.dp-book p, .dp-book h4, .dp-book h5, .dp-book figure { margin: 0; max-width: none; color: var(--dp-ink); }
.dp-sheet {
  position: relative; display: flex; flex-direction: column; gap: 6px; margin: 0 auto;
  padding: 12px 16px 8px; color: var(--dp-ink); font: 400 13px/1.28 var(--dp-body);
  background:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%236f5124' opacity='.12' filter='url(%23grain)' d='M0 0h180v180H0z'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 8% 12%, rgba(120, 85, 35, 0.13), transparent 38%),
    radial-gradient(ellipse at 50% 45%, transparent 60%, rgba(120, 85, 35, 0.24)),
    var(--dp-paper);
  box-shadow: 0 1px 0 #c8b88f, 0 12px 0 -4px rgba(8, 5, 16, 0.45), 0 18px 40px rgba(4, 3, 14, 0.5);
}
.dp-book.is-fixed .dp-sheet { width: 1400px; height: 1740px; }

/* Masthead */
.dp-mast { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; align-items: center; padding-bottom: 6px; border-bottom: 4px double var(--dp-ink); }
.dp-mast .dp-title { grid-column: 1 / -1; grid-row: 1; }
.dp-title { text-align: center; min-width: 0; }
.dp-ears { display: flex; justify-content: space-between; font: italic 400 10px/1 var(--dp-body); color: var(--dp-ink2); }
.dp-titlerow { display: grid; grid-template-columns: 94px minmax(0, 1fr) 70px; align-items: center; gap: 12px; }
.dp-crest-svg { width: 84px; height: auto; display: block; }
.dp-name { position: relative; padding-top: 14px; font: 400 112px/0.8 'Muggle News', serif; text-transform: uppercase; white-space: nowrap; }
.dp-the { position: absolute; top: -11px; left: 50%; transform: translateX(-30%); font: 400 37px/1 var(--dp-script); text-transform: none; }
.dp-book .dp-p { color: var(--dp-gold); text-shadow: 1px 0 0 #6e4a10, -1px 0 0 #6e4a10, 0 1px 0 #6e4a10, 0 -1px 0 #6e4a10, 2px 2px 0 #4a3008; }
.dp-no { display: grid; place-content: center; width: 64px; height: 64px; border: 4px double var(--dp-ink); border-radius: 50%; outline: 1px solid var(--dp-ink); outline-offset: 3px; transform: rotate(-10deg); }
.dp-no b { font: 400 34px/0.9 var(--dp-slab); }
.dp-no span { font: 400 13px/1 var(--dp-label); text-transform: uppercase; }
.dp-motto { margin-top: 7px !important; padding: 2px 0; border-top: 1.5px solid var(--dp-ink); border-bottom: 1.5px solid var(--dp-ink); font: 400 11px/1.2 var(--dp-mid); text-transform: uppercase; word-spacing: 0.3em; }
.dp-book .dp-motto { letter-spacing: 0.16em; }

/* Body: lead + second on top, the coffee story and three small stories below */
.dp-body {
  flex: 1; min-height: 0; overflow: hidden;
  border: 2px solid var(--dp-ink); box-shadow: inset 0 0 0 3px var(--dp-paper), inset 0 0 0 4px var(--dp-ink);
  padding: 9px 11px;
  display: grid; gap: 8px 14px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1.75fr) minmax(0, 1fr);
}
.dp-lead { grid-column: 1 / 9; grid-row: 1; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.dp-second { grid-column: 9 / 13; grid-row: 1; display: flex; flex-direction: column; gap: 5px; min-height: 0; border-left: 1.5px solid var(--dp-ink); padding-left: 14px; }
.dp-third { grid-column: 1 / 6; grid-row: 2; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; min-height: 0; border-top: 3px solid var(--dp-ink); padding-top: 6px; }
.dp-third-in { display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.dp-small { grid-row: 2; display: flex; flex-direction: column; gap: 3px; min-height: 0; border-top: 3px solid var(--dp-ink); border-left: 1.5px solid var(--dp-ink); padding: 6px 0 0 12px; }
.dp-small:nth-of-type(1) { grid-column: 6 / 8; }
.dp-small:nth-of-type(2) { grid-column: 8 / 10; }
.dp-small:nth-of-type(3) { grid-column: 10 / 13; }
.dp-body > .dp-small:nth-of-type(n) { }
.dp-body > section.dp-small:nth-child(4) { grid-column: 6 / 9; }
.dp-body > section.dp-small:nth-child(5) { grid-column: 9 / 11; }
.dp-body > section.dp-small:nth-child(6) { grid-column: 11 / 13; }

/* Type */
.dp-fill { font: 400 9.5px/1.18 var(--dp-frak); color: var(--dp-ink2) !important; text-align: justify; hyphens: auto; word-break: break-word; overflow: hidden; }
.dp-c3 { columns: 3; column-gap: 9px; }
.dp-text { font: 400 13px/1.27 var(--dp-frak); text-align: justify; hyphens: auto; }
.dp-cols { columns: 3; column-gap: 12px; column-rule: 1px solid rgba(23, 19, 13, 0.4); font: 400 13.5px/1.3 var(--dp-frak); text-align: justify; hyphens: auto; }
.dp-more { font: 400 11.5px/1.2 var(--dp-sc); color: var(--dp-ink); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.dp-more:hover, .dp-more:focus-visible { background: var(--dp-ink); color: var(--dp-paper); text-decoration: none; }
.dp-tagrow { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; }
.dp-excl { display: inline-flex; align-items: center; border: 2.5px solid var(--dp-ink); background: var(--dp-ink); }
.dp-hand { display: grid; place-items: center; padding: 0 8px; background: var(--dp-ink); }
.dp-book .dp-hand { color: var(--dp-paper); }
.dp-excl-w { padding: 3px 10px 1px 0; font: 400 31px/1 var(--dp-outline); text-transform: uppercase; color: var(--dp-paper); }
.dp-book .dp-excl-w { letter-spacing: 0.05em; color: transparent; -webkit-text-stroke: 0.65px var(--dp-paper); background: repeating-linear-gradient(120deg, var(--dp-paper) 0 0.7px, transparent 0.7px 2.5px); background-clip: text; -webkit-background-clip: text; }
.dp-h1 { font: 400 92px/0.9 var(--dp-light); text-transform: uppercase; text-align: center; white-space: nowrap; }
.dp-h1b { font: 400 52px/0.9 var(--dp-light); text-transform: uppercase; }
.dp-h2 { font: 400 50px/1 var(--dp-light); text-transform: uppercase; white-space: nowrap; }
.dp-won-word { display: inline-block; padding: 1px 7px 0; background: var(--dp-ink); color: var(--dp-paper); }
.dp-h3 { font: 400 46px/0.9 var(--dp-bantam); text-transform: uppercase; }
.dp-hs { font: 400 28px/0.92 var(--dp-bantam); text-transform: uppercase; }
.dp-kick { font: 400 11px/1 var(--dp-sc); text-transform: uppercase; border-bottom: 1px solid var(--dp-ink); padding-bottom: 2px; }
.dp-book .dp-kick { letter-spacing: 0.12em; }
.dp-special { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.dp-special::before { content: ''; flex: 1; height: 8px; background: var(--dp-ink); }
.dp-special span { font: 400 25px/1 var(--dp-outline); text-transform: uppercase; color: var(--dp-paper); -webkit-text-stroke: 0.65px var(--dp-ink); }
.dp-drop { break-inside: avoid; position: relative; isolation: isolate; float: left; display: grid; place-items: center; width: 62px; height: 66px; margin: 3px 10px 5px 0; border: 5px double var(--dp-ink); outline: 1px solid var(--dp-ink); outline-offset: 2px; box-shadow: 5px 5px 0 var(--dp-ink); background: repeating-linear-gradient(115deg, transparent 0 3px, rgba(23, 19, 13, 0.45) 3px 4px); font: 400 47px/1 var(--dp-slab); color: var(--dp-ink); transform: rotate(-2deg); }
.dp-drop::before { content: ''; position: absolute; inset: 4px; border: 1px solid var(--dp-ink); background: var(--dp-paper); z-index: -1; }
.dp-drop > span { -webkit-text-stroke: 0.5px var(--dp-ink); }
.dp-cols .dp-drop { width: 38px; height: 42px; margin: 2px 8px 4px 0; border-width: 3px; font-size: 28px; box-shadow: 3px 3px 0 var(--dp-ink); }
.dp-dc::after { content: ''; display: block; clear: both; }
.dp-vert { writing-mode: vertical-rl; white-space: nowrap; font: 400 60px/0.9 var(--dp-bantam); text-transform: uppercase; }
.dp-vert-up { transform: rotate(180deg); font-size: 44px; }
.dp-bar { display: block; height: 8px; background: var(--dp-ink); }
.dp-won { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.dp-ad { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 8px; border: 4px double var(--dp-ink); padding: 5px 8px; text-align: center; margin-top: 3px; }
.dp-ad-owl { display: block; }
.dp-owl-art { display: block; width: 100%; height: auto; }
.dp-classified { font: 400 13px/1 var(--dp-label); text-transform: uppercase; border-bottom: 1px solid var(--dp-ink); padding-bottom: 2px; }
.dp-ad-h { font: 400 32px/1.1 var(--dp-slab); text-transform: uppercase; }
.dp-ad-b { font: 400 12px/1.25 var(--dp-frak); }

/* Lead layout */
.dp-lead-row { flex: 1; min-height: 0; display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 12px; }
.dp-lead-l { display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow: hidden; }
.dp-vrow { flex: 1; min-height: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px; overflow: hidden; }

/* Photos: newsprint black and white, colour on hover; they stretch to take up the slack */
.dp-fig { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dp-fig figcaption { margin-top: 2px; font: italic 400 10.5px/1.1 var(--dp-body); text-align: center; }
.dp-photo { position: relative; display: block; width: 100%; flex: 1; min-height: 60px; padding: 0; border: 2px solid var(--dp-ink); background: #2a251c; overflow: hidden; cursor: zoom-in; }
.dp-book .dp-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1) contrast(1.22) sepia(0.12); transition: filter 400ms ease, transform 600ms ease; }
.dp-photo::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle, rgba(20, 16, 10, 0.14) 0 0.55px, transparent 0.9px) 0 0 / 2px 2px; transition: opacity 400ms ease; }
.dp-book .dp-photo:hover img, .dp-book .dp-photo:focus-visible img { filter: none; transform: scale(1.03); }
.dp-photo:hover::after, .dp-photo:focus-visible::after { opacity: 0; }
.dp-photo:focus-visible { outline: 3px solid var(--dp-ink); outline-offset: 2px; }

/* Narrow screens (not scaled): a simple flowing column */
.dp-book:not(.is-fixed) .dp-mast, .dp-book:not(.is-fixed) .dp-body { display: flex; flex-direction: column; }
.dp-book:not(.is-fixed) .dp-lead-l, .dp-book:not(.is-fixed) .dp-vert, .dp-book:not(.is-fixed) .dp-tagrow .dp-fill { display: none; }
.dp-book:not(.is-fixed) .dp-lead-row, .dp-book:not(.is-fixed) .dp-third { display: block; }
.dp-book:not(.is-fixed) .dp-name { font-size: 9vw; }
.dp-book:not(.is-fixed) .dp-h1, .dp-book:not(.is-fixed) .dp-h2 { font-size: 11vw; white-space: normal; }
.dp-book:not(.is-fixed) .dp-cols { columns: 1; }
.dp-book:not(.is-fixed) .dp-photo { aspect-ratio: 4 / 3; flex: none; }
.dp-book:not(.is-fixed) .dp-second, .dp-book:not(.is-fixed) .dp-small, .dp-book:not(.is-fixed) .dp-third { border-left: 0; padding-left: 0; }
.dp-book.is-fixed .dp-sheet { height: 1171px; }
.dp-body { grid-template-rows: minmax(0, 2.1fr) minmax(0, 1fr); }
.dp-h1 { font: 400 86px/0.98 var(--dp-slab); text-transform: uppercase; }
.dp-headline-ink { display: block; width: 135%; margin-left: -17.5%; transform: scaleX(0.74); }
.dp-lead-row { grid-template-columns: 250px minmax(0, 1fr); }
.dp-third { grid-template-columns: auto minmax(0, 1fr); }
.dp-hs { font-size: 24px; }
.dp-h3 { font-size: 40px; }
.dp-vert-up { font-size: 36px; }
.dp-small .dp-text, .dp-third .dp-text { font-size: 12px; line-height: 1.22; }
/* Small stories: Retrack gets the widest slot so its landscape photo is not cropped. */
.dp-body > section.dp-small:nth-child(4) { grid-column: 6 / 8; }
.dp-body > section.dp-small:nth-child(5) { grid-column: 8 / 10; }
.dp-body > section.dp-small:nth-child(6) { grid-column: 10 / 13; }
.dp-vrow .dp-fill { height: 100%; }
/* Two small stories now (Retrack removed): split the slot evenly. */
.dp-body > section.dp-small:nth-child(4) { grid-column: 6 / 9; }
.dp-body > section.dp-small:nth-child(5) { grid-column: 9 / 13; }
/* Engraved ornaments, letterpress rules and editorial furniture. */
.dp-hand-art { display: block; width: 48px; height: 28px; }
.dp-wire { font: 400 12px/1 var(--dp-label); text-transform: uppercase; border-block: 1px solid var(--dp-ink); padding: 3px 0; text-align: center; }
.dp-column-print { min-height: 0; overflow: hidden; }
.dp-column-print .dp-fill { height: auto; }
.dp-pull { font: 400 24px/0.95 var(--dp-slab); text-align: center; text-transform: uppercase; border-block: 3px double var(--dp-ink); padding: 7px 0; margin: 7px 0 !important; }
.dp-mini-banner { font: 400 19px/1 var(--dp-label); text-transform: uppercase; text-align: center; border-block: 3px double var(--dp-ink); padding: 4px 0; }
.dp-printer-mark { text-align: center; font: italic 400 11px/1 var(--dp-body); }
.dp-lead-l .dp-drop { width: 84px; height: 90px; font-size: 67px; }
.dp-lead-l .dp-vert { font: 400 44px/0.9 var(--dp-light); }
.dp-third .dp-kick { display: flex; justify-content: space-between; font-family: var(--dp-label); font-size: 14px; }
.dp-small .dp-kick { font-family: var(--dp-label); font-size: 14px; }
.dp-small:nth-child(4) .dp-hs { font-family: var(--dp-slab); font-size: 24px; line-height: 1.08; }
.dp-small:nth-child(5) .dp-hs { font-family: var(--dp-light); font-size: 30px; line-height: 0.92; }
.dp-photo { outline: 1px solid var(--dp-ink); outline-offset: 2px; }
.dp-fig figcaption { border-bottom: 1px solid var(--dp-ink); padding: 2px 0; }
.dp-book:not(.is-fixed) .dp-mast { gap: 10px; }
.dp-book:not(.is-fixed) .dp-title { width: 100%; }
.dp-book:not(.is-fixed) .dp-titlerow { grid-template-columns: 42px minmax(0, 1fr) 30px; gap: 5px; }
.dp-book:not(.is-fixed) .dp-crest-svg { width: 40px; }
.dp-book:not(.is-fixed) .dp-no { width: 27px; height: 27px; outline-offset: 1px; border-width: 2px; }
.dp-book:not(.is-fixed) .dp-no b { font-size: 14px; }
.dp-book:not(.is-fixed) .dp-no span { font-size: 6px; }
.dp-book:not(.is-fixed) .dp-the { font-size: 22px; top: -4px; }
.dp-book:not(.is-fixed) .dp-motto { font-size: 9px; letter-spacing: 0.02em; }
.dp-book:not(.is-fixed) .dp-name { font-size: clamp(22px, 7vw, 54px); }
.dp-book:not(.is-fixed) .dp-headline-ink { width: auto; margin: 0; transform: none; }
.dp-book:not(.is-fixed) .dp-h1 { font: 400 clamp(25px, 6.7vw, 48px)/1.05 var(--dp-slab); white-space: normal; }
.dp-book:not(.is-fixed) .dp-h2 { font-size: clamp(24px, 6.7vw, 40px); white-space: nowrap; }
.dp-book:not(.is-fixed) .dp-body { gap: 22px; }
.dp-book:not(.is-fixed) .dp-h1b { font-size: 42px; }
.dp-book:not(.is-fixed) .dp-tagrow { display: block; }
.dp-book:not(.is-fixed) .dp-second, .dp-book:not(.is-fixed) .dp-small { border-top: 3px double var(--dp-ink); padding-top: 10px; }
.dp-book:not(.is-fixed) .dp-small:nth-child(4) .dp-hs { font-size: 28px; }

/* ---------- Photo viewer: a clipping from the Daily Prophet ---------- */
.lightbox {
  --dp-ink: #17130d; --dp-paper: #e9dfc4;
  max-width: min(1000px, 94vw); padding: 14px 18px 12px; border: 0; color: var(--dp-ink);
  background:
    radial-gradient(circle at 18% 22%, rgba(110, 80, 30, 0.08) 0 1px, transparent 1.6px) 0 0 / 7px 9px,
    radial-gradient(ellipse at 50% 45%, transparent 60%, rgba(120, 85, 35, 0.28)),
    var(--dp-paper);
  box-shadow: 0 0 0 1px #c8b88f, 0 24px 60px rgba(4, 3, 14, 0.7);
}
.lightbox * { text-shadow: none; font-size-adjust: none; }
.lb-mast { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; margin: 0 0 8px; padding-bottom: 4px; border-bottom: 3px double var(--dp-ink); }
.lb-mast span { font: italic 400 11px/1 'IM Fell English', serif; color: #3a3226; }
.lb-mast span:last-child { text-align: right; font: 400 11px/1 'IM Fell English SC', serif; letter-spacing: 0.12em; text-transform: uppercase; }
.lb-mast b { font: 400 34px/1 'Muggle News', serif; text-transform: uppercase; color: var(--dp-ink); }
.lb-mast i { font-style: normal; color: #e2b33c; text-shadow: 1px 0 0 #6e4a10, -1px 0 0 #6e4a10, 0 1px 0 #6e4a10, 0 -1px 0 #6e4a10; }
.lightbox figure { margin: 0; padding: 0; border: 0; border-image: none; background: none; }
.lightbox img { display: block; max-width: 100%; max-height: 68vh; margin: 0 auto; border: 3px solid var(--dp-ink); box-shadow: 4px 4px 0 var(--dp-ink); }
.lightbox figcaption { display: grid; gap: 2px; padding: 10px 0 0; text-align: center; }
.lb-head { font: 400 34px/0.95 'Champion Light', sans-serif; text-transform: uppercase; color: var(--dp-ink); }
.lb-cap { font: italic 400 13px/1.2 'IM Fell English', serif; color: #3a3226; }
.lb-bar { margin-top: 10px; padding: 8px 0 0; border: 0; border-image: none; border-top: 1.5px solid var(--dp-ink); background: none; }
.lb-bar .btn { border: 2.5px solid var(--dp-ink); border-image: none; background: var(--dp-paper); box-shadow: 3px 3px 0 var(--dp-ink); color: var(--dp-ink); font: 400 17px/1 'Rye', serif; text-transform: uppercase; padding: 6px 12px; min-height: 0; filter: none; }
.lb-bar .btn:hover, .lb-bar .btn:focus-visible { background: var(--dp-ink); color: var(--dp-paper); }
.lb-bar .btn .ico { color: inherit; }
.lb-count { font: 400 22px/1 'Rye', serif; color: var(--dp-ink); filter: none; }
.lightbox { background-color: #e9dfc4; outline: 3px double #17130d; outline-offset: -8px; }
.lightbox figcaption, .lb-mast, .lb-bar { background-color: #e9dfc4; }
.lb-mast i { color: #9a6a12; }

/* Keep quest navigation in the page flow instead of covering chapters on scroll. */
.guide-head {
  position: static;
  z-index: auto;
  margin: 0;
  background: none;
}
/* The return link belongs to the navigation; only dock it after that row scrolls away. */
.guide-card { filter: none; }
.guide-return { display: flex; justify-content: center; flex: none; }
.guide-play { margin: 0; white-space: nowrap; }
.guide-return.is-docked .guide-play {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  left: auto;
  z-index: 40;
}
@media (min-width: 861px) {
  .guide-return { margin-left: auto; }
}
@media (max-width: 860px) {
  .guide-play { min-height: 40px; padding: 3px 10px; font-size: 1rem; }
}
/* ---------- Rank cards: the Sorting Hat announces each rank ---------- */
.ranks { overflow: visible; }
.hat-card { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: center; overflow: visible; padding: 16px 14px 12px;
  background: radial-gradient(circle at 16% 62%, color-mix(in srgb, var(--tint) 30%, transparent), transparent 62%), #1d1840 padding-box; }
.hat-card .rank-shine { display: none; }
.hat-sprite { align-self: end; transform-origin: 50% 100%; }
.hat-sprite .spr { width: 76px; height: 85px; image-rendering: pixelated; filter: drop-shadow(0 3px 0 rgba(8, 5, 16, 0.6)); }
.hat-card:hover .hat-sprite, .hat-card:focus-visible .hat-sprite, .hat-card.is-sorting .hat-sprite { animation: hat-wobble 0.9s ease-in-out 2; }
@keyframes hat-wobble { 25% { transform: rotate(-8deg); } 75% { transform: rotate(7deg); } }
.hat-info { display: grid; gap: 2px; min-width: 0; }
.hat-plat { display: flex; align-items: center; gap: 7px; font: 400 0.95rem/1 var(--f-dialog); color: var(--ink); }
.hat-plat .brand { width: 20px; height: 20px; }
.hat-card .rank-name { font-size: 2.4rem; transition: color 300ms ease; }
.hat-card .rank-detail { font-size: 0.95rem; }
.hat-ladder { position: relative; height: 6px; margin: 8px 0 2px; background: #0e0c24; box-shadow: inset 0 0 0 1px #3d3770; }
.hat-ladder i { position: absolute; left: 0; top: 0; bottom: 0; min-width: 3px; background: linear-gradient(90deg, #a8761e, #f2c14e); }
.hat-ladder em { position: absolute; top: -4px; width: 3px; height: 14px; margin-left: -1px; background: #fff3c4; box-shadow: 0 0 6px #f2c14e; }
.hat-lad { display: flex; justify-content: space-between; gap: 8px; font: 400 0.8rem/1 var(--f-dialog); color: var(--ink-2); }
.hat-card .rank-go { margin-top: 6px; }
.hat-say {
  position: absolute; z-index: 5; left: 6px; bottom: calc(100% + 12px); width: min(270px, 92%);
  padding: 7px 10px; background: var(--parch); color: var(--parch-ink); text-align: left;
  font: italic 400 0.875rem/1.3 'IM Fell English', Georgia, serif; text-shadow: none;
  box-shadow: 0 0 0 2px #3b2a1a, 4px 4px 0 #3b2a1a; opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}
.hat-say::after { content: ''; position: absolute; left: 30px; top: 100%; border: 8px solid transparent; border-top-color: #3b2a1a; }
.hat-say b { font-style: normal; color: #7a1620; text-transform: uppercase; }
.hat-card:hover .hat-say, .hat-card:focus-visible .hat-say, .hat-card.is-sorting .hat-say { opacity: 1; transform: none; }
.hat-card:hover .rank-name, .hat-card:focus-visible .rank-name, .hat-card.is-sorting .rank-name { animation: rank-announce 1.4s ease 0.9s both; }
@keyframes rank-announce { 40% { filter: drop-shadow(0 0 10px #f2c14e) brightness(1.3); } }
@media (prefers-reduced-motion: reduce) { .hat-card .hat-sprite, .hat-card .rank-name { animation: none !important; } .hat-say { transition: none; } }
.hat-plat { font-size: 1.15rem; gap: 8px; }
.hat-plat .brand { width: 24px; height: 24px; }
.hat-card { padding-left: 10px; gap: 10px; }
/* Rank cards: big platform logo left, small Sorting Hat right; no ladder line. */
.hat-card { grid-template-columns: 72px minmax(0, 1fr) 44px; gap: 14px; padding: 16px 14px 14px; }
.hat-logo { display: grid; place-items: center; width: 72px; height: 72px; background: color-mix(in srgb, var(--tint) 16%, #0e0c24); box-shadow: inset 0 0 0 2px #0c0b24, inset 0 0 0 4px color-mix(in srgb, var(--tint) 60%, #3d3770); }
.hat-logo .brand { width: 44px; height: 44px; }
.hat-plat { font-size: 1rem; color: var(--ink-2); }
.hat-sprite { align-self: start; justify-self: end; }
.hat-sprite .spr { width: 44px; height: 49px; }
.hat-say { left: auto; right: 0; }
.hat-say::after { left: auto; right: 14px; }
.hat-ladder, .hat-lad { display: none; }
.hat-logo img { width: 56px; height: 56px; object-fit: contain; display: block; }
.hat-logo:has(img[src*="codechef"]) img { width: 62px; height: 62px; }
.hat-logo:has(img[src*="codechef"]) { background: #efe0bd; box-shadow: inset 0 0 0 2px #0c0b24, inset 0 0 0 4px #c08a52; }
/* Logos sit straight on the card; invert the monochrome CodeChef mark for the dark background. */
.hat-logo, .hat-logo:has(img[src*="codechef"]) { background: none; box-shadow: none; }
.hat-logo img { width: 64px; height: 64px; }
.hat-logo:has(img[src*="codechef"]) img { width: 70px; height: 70px; filter: invert(1); mix-blend-mode: screen; }
/* Narrow game cards give the hat its own row instead of squeezing rank text. */
.rank { container-type: inline-size; }
@container (max-width: 320px) {
  .hat-card { grid-template-columns: 72px minmax(0, 1fr); }
  .hat-logo { grid-column: 1; grid-row: 1; }
  .hat-sprite { grid-column: 2; grid-row: 1; align-self: center; }
  .hat-info { grid-column: 1 / -1; grid-row: 2; }
}

/* About: reading copy beside a compact owl-post directory. */
.entry-about { margin-bottom: -40px; }
.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(260px, 1fr);
  gap: clamp(36px, 6vw, 96px);
  align-items: start;
  margin-top: 24px;
}
.about-copy { min-width: 0; }
.about-copy p:first-child { margin-top: 0; }
.about-copy p:last-child { margin-bottom: 0; }
.about-post {
  width: 100%;
  max-width: 360px;
  justify-self: end;
  margin-top: -56px;
  padding: 20px;
  border: 12px solid transparent;
  border-image: var(--fr-lilac) 3 fill / 12px stretch;
}
.about-post-head { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 22px; }
.about-owl .spr { display: block; width: 48px; height: 48px; }
.about-post h4 { margin: 0; color: var(--yellow); font: 700 2rem/1.1 var(--f-display); }
.about-post .about-links { display: grid; gap: 12px; margin-top: 0; }
.about-links .btn { display: flex; justify-content: space-between; width: 100%; }
.about-links .btn:first-child { justify-content: center; }
@media (max-width: 860px) {
  .entry-about { margin-bottom: -24px; }
  .about-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .about-post { justify-self: start; max-width: 400px; margin-top: 0; }
}

/* CodeCell experience: the original logo balances the story column. */
.experience-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
  margin-top: 24px;
}
.experience-copy { min-width: 0; }
.experience-copy .c-org { margin-top: 0; margin-bottom: 22px; }
.experience-copy .feats { max-width: none; gap: 18px; }
.experience-emblem { width: 100%; max-width: 400px; margin: 0 auto; padding: 20px; }
.experience-logo { display: block; width: 100%; height: auto; image-rendering: pixelated; }
@media (max-width: 860px) {
  .experience-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .experience-emblem { max-width: 330px; }
}

/* Soft snowfall and tapered fairy-light stars behind the quest log. */
.guide { isolation: isolate; }
.guide-sparkles { position: absolute; inset: 12px 0 0; z-index: -1; pointer-events: none;
  background: url('../assets/backgrounds/enchanted-snow.svg') 0 0 / 900px 720px repeat;
  animation: enchanted-snowfall 36s linear infinite;
}
.guide-sparkles.is-distant {
  background-position: 370px 180px; background-size: 630px 504px;
  opacity: .55; animation-name: enchanted-distant; animation-duration: 58s;
}
.guide-fairy-lights { position: absolute; inset: 12px 0 0; z-index: -1; pointer-events: none;
  background: url('../assets/backgrounds/enchanted-stars.svg') 0 0 / 1100px 860px repeat;
  animation: fairy-light-shimmer 8s ease-in-out infinite alternate;
}
@keyframes enchanted-snowfall { to { background-position: 90px 720px; } }
@keyframes enchanted-distant { to { background-position: 430px 684px; } }
@keyframes fairy-light-shimmer { from { opacity: .35; } to { opacity: .8; } }
@media (prefers-reduced-motion: reduce) { .guide-sparkles, .guide-fairy-lights { animation: none; } }

/* ---------- Say hello: the Owlery ---------- */
.owlery { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; margin-top: 18px; align-items: stretch; }
.ow-letter {
  position: relative; overflow: visible; padding: 104px 28px 26px;
  background: var(--parch); color: var(--parch-ink);
  border: 10px solid transparent; border-image: var(--fr-parch) 3 fill / 10px stretch;
  filter: drop-shadow(0 8px 0 rgba(8, 5, 16, 0.45));
}
.ow-flap { position: absolute; left: 0; right: 0; top: 0; height: 96px; pointer-events: none;
  background: linear-gradient(to bottom right, transparent calc(50% - 1px), #b39d74 50%, transparent calc(50% + 1px)) left / 50% 100% no-repeat,
              linear-gradient(to bottom left, transparent calc(50% - 1px), #b39d74 50%, transparent calc(50% + 1px)) right / 50% 100% no-repeat; }
.ow-seal { position: absolute; left: 50%; top: 70px; width: 58px; height: 58px; margin-left: -29px; display: grid; place-items: center;
  background: var(--seal) center / 100% 100% no-repeat; image-rendering: pixelated; font: 700 1rem/1 var(--f-title); color: #f2c14e; text-shadow: 0 1px 0 #4a0c12;
  filter: drop-shadow(0 3px 0 rgba(59, 42, 26, 0.45)); transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.ow-letter:hover .ow-seal { transform: rotate(-10deg) scale(1.06); }
.ow-stamp { position: absolute; right: 16px; top: 14px; padding: 6px 8px; text-align: center; font: 400 0.8rem/1.1 var(--f-dialog); color: #7a1620;
  border: 2px dashed #7a1620; transform: rotate(6deg); background: rgba(255, 248, 230, 0.5); }
.ow-stamp b { font-family: var(--f-title); font-size: 1rem; }
.ow-to { margin: 0; font: 400 1.9rem/1 'Pinyon Script', cursive; color: #1f4a33; }
.ow-where { margin: 4px 0 10px; font: italic 400 1rem/1.3 var(--f-body); color: #6e5a40; }
.ow-addr { display: inline-block; font: 700 clamp(1.3rem, 1rem + 1.2vw, 1.9rem)/1.15 var(--f-title); color: #7a1620; text-decoration: underline wavy #b3262d 1.5px; text-underline-offset: 6px; overflow-wrap: anywhere; }
.ow-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.ow-actions .btn:not(.btn-primary) { color: var(--parch-ink); border-image-source: var(--fr-parch); }
/* A white owl carries the letter off when you send it. */
.ow-flyer { position: absolute; right: 30px; bottom: 30px; opacity: 0; pointer-events: none; }
.ow-flyer canvas { display: block; width: 60px; height: auto; image-rendering: pixelated; }
.ow-letter.is-sent .ow-flyer { animation: owl-fly 1.6s cubic-bezier(0.4, 0, 0.6, 1) forwards; }
@keyframes owl-fly { 0% { opacity: 0; transform: translate(-60px, 40px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(240px, -260px) rotate(-10deg); } }

/* The perches: one owl per social account, with the platform's tag on its leg. */
.ow-perches { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 10px; background: #15112e; box-shadow: inset 0 0 0 2px #0c0b24, inset 0 0 0 4px #3d3770; }
.ow-perch-h { margin: 0; font: 400 1.05rem/1 var(--f-dialog); color: var(--ink-2); }
.ow-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; flex: 1; align-content: space-evenly; }
.ow-perch { position: relative; display: grid; grid-template-columns: 54px 32px minmax(0, 1fr) 14px; align-items: end; gap: 12px; padding: 8px 6px 9px; color: var(--ink); text-decoration: none;
  background: linear-gradient(transparent calc(100% - 7px), #8a5a34 calc(100% - 7px), #5a3a24 calc(100% - 3px), #2a1a10 calc(100% - 1px)) ; }
.ow-bird { display: block; transform-origin: 50% 100%; }
.ow-bird canvas { display: block; width: 54px; height: auto; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(8, 5, 16, 0.6)); }
.ow-perch:hover .ow-bird, .ow-perch:focus-visible .ow-bird { animation: owl-ruffle 0.6s ease-in-out 2; }
@keyframes owl-ruffle { 25% { transform: translateY(-4px) rotate(-6deg); } 75% { transform: translateY(-2px) rotate(5deg); } }
.ow-tag { align-self: center; display: grid; place-items: center; width: 32px; height: 32px; background: #efe0bd; box-shadow: inset 0 0 0 2px #3b2a1a; transform: rotate(-6deg); }
.ow-tag .brand { width: 18px; height: 18px; }
.ow-tag .brand path { fill: #1d1840; }
.ow-txt { display: grid; gap: 2px; align-self: center; min-width: 0; }
.ow-name { font: 700 1.25rem/1 var(--f-title); }
.ow-handle { font: 400 1rem/1.1 var(--f-dialog); color: var(--ink-2); overflow-wrap: anywhere; }
.ow-perch > .ico { align-self: center; height: 0.8em; color: var(--coral-ink); }
.ow-perch:hover .ow-name, .ow-perch:focus-visible .ow-name { color: var(--yellow); }
.ow-perch:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
@media (max-width: 860px) { .owlery { grid-template-columns: 1fr; } .ow-letter { padding: 96px 18px 20px; } }
@media (prefers-reduced-motion: reduce) { .ow-letter.is-sent .ow-flyer, .ow-perch .ow-bird { animation: none !important; } }
.ow-letter { padding-top: 112px; }
.ow-flap { height: 84px; }
.ow-seal { top: 52px; }
.ow-perch { grid-template-columns: 64px 34px minmax(0, 1fr) 14px; }
.ow-bird canvas { width: 64px; }
.ow-perch-h { font-family: var(--f-title); font-size: 1.15rem; color: var(--yellow); }
.ow-addr { overflow-wrap: normal; word-break: normal; font-size: clamp(1.15rem, 0.9rem + 1vw, 1.9rem); }
.window .owlery { grid-template-columns: 1fr; }
.window .ow-addr { font-size: 1.45rem; }
/* ---------- About: Owl Post as a parchment oath note ---------- */
.about-post.oath {
  position: relative; padding: 26px 24px 16px; text-align: center;
  background: var(--parch); color: var(--parch-ink);
  border: 10px solid transparent; border-image: var(--fr-parch) 3 fill / 10px stretch; box-shadow: none;
  transform: rotate(-1.2deg); filter: drop-shadow(0 8px 0 rgba(8, 5, 16, 0.45));
}
.oath-seal { position: absolute; top: -16px; right: 18px; width: 44px; height: 44px; background: var(--seal) center / 100% 100% no-repeat; image-rendering: pixelated; transform: rotate(-12deg); }
.oath-pre { margin: 0; font: italic 400 0.95rem/1.2 var(--f-body); color: #6e5a40; }
.oath .oath-title { margin: 2px 0 6px; font: 400 2.2rem/1 'Pinyon Script', cursive; color: #7a1620; }
.oath-by { margin: 0 0 14px; padding-top: 6px; border-top: 1px solid #b39d74; font: italic 400 0.85rem/1.3 var(--f-body); color: #6e5a40; }
.oath .about-links { gap: 9px; }
.oath .about-links .btn { color: var(--parch-ink); border-image-source: var(--fr-parch); background: #f5ecd3; }
.oath .about-links .btn.btn-primary { color: #1d1840; border-image-source: var(--fr-yellow); background: var(--yellow); }
.oath .about-links .btn:hover { transform: translateX(3px); }
.oath-sign { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 12px 0 0; font: 400 1.5rem/1 'Pinyon Script', cursive; color: #1f4a33; }
.oath-owl .spr { width: 30px; height: 30px; }

@media (max-width: 640px) { .guide-foot { margin-inline: 0; } }
/* ---------- Viewport pass ---------- */
/* Room for the Sorting Hat's speech bubble above the rank cards, so it never covers the intro line. */
.ranks { margin-top: 64px; }
/* Phones: the three trophies stay in one row instead of wrapping two-plus-one. */
@media (max-width: 640px) {
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 6px; }
  .trophy { padding: 0 2px 12px; }
  .trophy .cup { width: 52px; height: 58px; }
  .trophy .trophy-art, .tier-1 .trophy-art { width: 46px; height: 51px; }
  .trophy .cup::before { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
  .t-place { font-size: 1.05rem; }
  .t-event { font-size: 0.8rem; }
  .t-post { font-size: 0.8rem; }
}
/* Short landscape screens: drop the speaker card inside rooms so the content gets the space. */
@media (max-height: 500px) and (orientation: landscape) {
  .window .scene { display: none; }
  .window-body { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .trophy .t-post { white-space: nowrap; font-size: 0.74rem; gap: 3px; }
  .trophy .t-post .ico { height: 0.6em; }
}
/* When the rank cards stack, leave room for each hat's speech bubble. */
@media (max-width: 760px) { .ranks { row-gap: 58px; } }

/* ---------- Small screens ---------- */
/* The old stacked quest-log index is gone below the desktop top bar. */
@media (max-width: 860px) { .guide-head { display: none; } .guide-wrap { gap: 0; } }
/* Phones: no game to play; the title scene stays as the opener. */
@media (max-width: 640px) {
  /* Keep the animated title screen as the opening scene; only the quest-log button remains. */
  .skip, .title-start, .title-levels, .title-hint { display: none !important; }
  .guide { padding-top: 40px; }
  /* CodeCell's emblem becomes a faint watermark behind the experience text. */
  .experience-layout { position: relative; display: block; isolation: isolate; }
  .experience-emblem { position: absolute; inset: 0; z-index: -1; display: grid; place-items: center; margin: 0; pointer-events: none; opacity: 0.12; }
  .experience-emblem .experience-logo { width: 88%; height: auto; }
}
@media (max-width: 640px) { .title-menu .btn[href="#guide"] { min-height: 52px; font-size: 1.35rem; padding-inline: 20px; } }
/* Heatmap: the drawn grid never holds its box open, so a narrower window measures (and redraws) correctly. */
.practice, .heat, .heat-wrap { min-width: 0; max-width: 100%; }
.heat-wrap { overflow: hidden; }
.heat-wrap canvas { max-width: 100%; height: auto; }
/* Trophy row: "Read the story" lines up on every trophy, and the shelf runs unbroken. */
.trophy { grid-template-rows: auto auto 1fr auto; }
.trophy .t-post { align-self: end; }
@media (max-width: 640px) { .shelf { column-gap: 0; } }
/* Project buttons: "Show details" sits with the others instead of being pushed to the far right. */
@media (max-width: 860px) { .project-toggle { margin-left: 0; } }
