@font-face {
  font-family: "Press Start 2P";
  src: url("../assets/fonts/pressstart2p.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "VT323";
  src: url("../assets/fonts/vt323.woff2") format("woff2");
  font-display: swap;
}

:root {
  --ink: #1d1a20;
  --paper: #ffffff;
  --red: #f0525a;
  --red-dark: #c23842;
  --muted: #8f8d95;
  --line: #dcdbe0;
  --gold: #f2b705;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --mono: "VT323", ui-monospace, monospace;
  --sans: "Avenir Next", "Avenir", "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}

body {
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: fixed;
  inset: 0;
  user-select: none;
  -webkit-user-select: none;
}

/* ---- opening -------------------------------------------------------------- */
#paper {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.4s ease;
  cursor: default;
}
#paper.on { opacity: 1; }
#paper.gone { opacity: 0; transition: opacity 0.5s ease; pointer-events: none; }

#logo-flat {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(86vw, 96vh);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 1.2s ease;
}
#logo-flat.on { opacity: 1; }

#hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 13vh;
  margin: 0;
  text-align: center;
  font: 12px/1 var(--pixel);
  letter-spacing: 0.12em;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  z-index: 6;
}
#hint.on { opacity: 1; animation: blink 1.1s steps(2, jump-none) infinite; }

/* ---- Heart Gary ------------------------------------------------------------- */
#gary {
  position: fixed;
  display: none;
  z-index: 4;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}
#gary.on { display: block; }
#gary.away, #gary-shadow.away { opacity: 0; transition: opacity 0.25s ease; }
#gary, #gary-shadow { transition: opacity 0.25s ease; }

#gary-shadow {
  position: fixed;
  display: none;
  z-index: 3;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(29, 26, 32, 0.22), rgba(29, 26, 32, 0));
  pointer-events: none;
}
#gary-shadow.on { display: block; }
#gary-shadow.soft { opacity: 0.5; }

/* ---- corner buttons ------------------------------------------------------- */
.corner {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: 10;
  display: flex;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.corner.on { opacity: 1; pointer-events: auto; }

.chip {
  font: 9px/1 var(--pixel);
  letter-spacing: 0.06em;
  color: #6d6b73;
  background: var(--paper);
  border: 2px solid var(--line);
  padding: 9px 10px;
  cursor: pointer;
}
.chip:hover,
.chip:focus-visible {
  color: var(--ink);
  border-color: var(--ink);
  outline: none;
}

/* ---- dialog --------------------------------------------------------------- */
.dialog {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 5;
  width: min(900px, calc(100% - 32px));
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 30px 30px 16px;
  transform: translate(-50%, 18px);
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  cursor: pointer;
}
.dialog.on { opacity: 1; transform: translate(-50%, 0); }
.dialog.measure {
  visibility: hidden;
  transition: none;
  pointer-events: none;
}

.nametag {
  position: absolute;
  top: -17px;
  left: 22px;
  font: 11px/1 var(--pixel);
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--red);
  border: 3px solid var(--ink);
  padding: 7px 10px 6px;
}

.dlg-scroll {
  max-height: calc(100dvh - 210px);
  overflow: auto;
  overscroll-behavior: contain;
}

.say {
  margin: 0;
  font: 500 21px/1.5 var(--sans);
  white-space: pre-line;
}
.say .ghost { color: transparent; }

.dlg-title {
  margin: 0 0 14px;
  font: 700 20px/1.3 var(--sans);
  color: var(--red-dark);
}

.dlg-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  min-height: 34px;
}

.dots { display: flex; gap: 6px; }
.dots i {
  width: 8px;
  height: 8px;
  background: var(--line);
}
.dots i.on { background: var(--ink); }

.next {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 9px/1 var(--pixel);
  color: var(--muted);
  letter-spacing: 0.08em;
}
.next-ico { color: var(--red); animation: bob 0.9s steps(2, jump-none) infinite; }
.dialog.typing .next { visibility: hidden; }

.start {
  font: 13px/1 var(--pixel);
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--red);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 12px 16px 11px;
  cursor: pointer;
}
.start:hover, .start:focus-visible { background: var(--red-dark); outline: none; }
.start:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }

kbd {
  display: inline-block;
  min-width: 26px;
  font: 10px/1 var(--pixel);
  text-align: center;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-bottom-width: 4px;
  border-radius: 4px;
  padding: 5px 6px 3px;
  margin: 0 1px;
  vertical-align: 4px;
}
kbd.arrow {
  font: 700 17px/1 ui-monospace, Menlo, monospace;
  padding: 2px 5px 1px;
  vertical-align: 2px;
}

/* how to play */
.howto {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.howto li {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 14px;
  font: 500 18px/1.5 var(--sans);
}
.howto .ico { display: flex; justify-content: center; gap: 2px; }
.glow { color: #b07e00; text-shadow: 0 0 10px rgba(242, 183, 5, 0.85); animation: glow 1.4s ease-in-out infinite; }
.glow-dot {
  width: 22px;
  height: 22px;
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--ink), 0 0 18px 6px rgba(242, 183, 5, 0.7);
  animation: glow 1.4s ease-in-out infinite;
}
.phone {
  width: 22px;
  height: 36px;
  border: 3px solid var(--ink);
  border-radius: 4px;
  position: relative;
}
.phone::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  height: 6px;
  background: var(--red);
}

/* level cards */
.levels {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.levels li {
  border: 3px solid var(--ink);
  background: var(--paper);
  overflow: hidden;
}
.levels img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 3px solid var(--ink);
  image-rendering: pixelated;
}
.levels div { padding: 9px 10px 10px; }
.levels b {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font: 700 14px/1.3 var(--sans);
}
.levels .lv {
  flex: none;
  font: 9px/1 var(--pixel);
  color: #fff;
  background: var(--ink);
  padding: 4px 5px 3px;
}
.levels p {
  margin: 6px 0 0;
  font: 400 14px/1.4 var(--sans);
}

.pop { animation: pop 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }

.noscript {
  font: 24px/1.3 var(--mono);
  max-width: 560px;
  margin: 30vh auto 0;
  padding: 0 16px;
  text-align: center;
}

/* ---- outro: pull back, door, zoom ---------------------------------------- */
#outro {
  position: fixed;
  inset: 0;
  z-index: 2;
  background: var(--paper);
}
#outro.cut { background: transparent; }
#outro .ow { position: absolute; inset: 0; will-change: transform; }
#outro .floor {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: #e5e3ea;
  transform: scaleX(0);
  transition: transform 0.9s cubic-bezier(0.3, 0.7, 0.2, 1);
}
#outro.on .floor { transform: none; }
.portal {
  --f: 8px;
  position: absolute;
  transform: scale(0);
  transform-origin: 50% 100%;
  transition: transform 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
  box-shadow: 0 0 0 var(--f) #7a4a2a, 0 0 0 calc(var(--f) + 3px) var(--ink);
}
.portal.in { transform: none; }
#outro.cut .portal {
  box-shadow: 0 0 0 var(--f) #7a4a2a, 0 0 0 calc(var(--f) + 3px) var(--ink), 0 0 0 300vmax var(--paper);
}
.door-panel {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 31%, rgba(0, 0, 0, 0.18) 31% 34%, transparent 34% 64%, rgba(0, 0, 0, 0.18) 64% 67%, transparent 67%),
    linear-gradient(#c9874a, #b06f38);
  border: 3px solid #5a351c;
  transform-origin: 0 50%;
  transition: transform 0.45s ease-in;
}
.door-panel.open { transform: perspective(500px) rotateY(-80deg); }
.door-panel i {
  position: absolute;
  right: 12%;
  top: 52%;
  width: 12%;
  aspect-ratio: 1;
  background: var(--gold);
  box-shadow: 0 0 0 2px #5a351c;
}
.door-sign {
  position: absolute;
  left: 50%;
  bottom: calc(100% + var(--f) + 10px);
  transform: translateX(-50%);
  white-space: nowrap;
  font: 9px/1 var(--pixel);
  color: #fff;
  background: var(--red);
  border: 2px solid var(--ink);
  padding: 5px 6px 4px;
}
#walker, .level .player {
  position: absolute;
  left: 0;
  top: 0;
  image-rendering: pixelated;
  transform-origin: 50% 50%;
}
.w-shadow, .p-shadow {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(29, 26, 32, 0.25), rgba(29, 26, 32, 0));
}

/* ---- level: pixel game screen, letterboxed ------------------------------------ */
.level {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #0d0b12;
}
.level .screen {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-shadow: 0 0 0 2px #1c1827, 0 18px 60px rgba(0, 0, 0, 0.6);
  cursor: default;   /* becomes a pointer over the glowing things (game.js) */
}
.rotate-tip {
  display: none;
  position: fixed;
  top: 16px;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font: 600 14px/1.3 var(--sans);
  color: #c9c6d4;
}
.level.portrait.playing .rotate-tip { display: block; }
.pad { display: none; }
/* the "walk to the door" hint has to be read, so it is darker and blinks softly */
#hint.high { color: var(--ink); }
#hint.high.on { animation-name: blink-soft; }
@keyframes blink-soft { 50% { opacity: 0.6; } }
@media (pointer: coarse) {
  #hint.high { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 84px); }
  .level.playing .pad, #outro.play .pad {
    position: fixed;
    left: 0;
    right: 0;
    bottom: max(14px, env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-between;
    padding: 0 14px;
    pointer-events: none;
  }
  .pad div { display: flex; gap: 10px; pointer-events: auto; }
  .pad button {
    width: 58px;
    height: 58px;
    font: 14px/1 var(--pixel);
    color: var(--ink);
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid var(--ink);
    box-shadow: 3px 3px 0 #000;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }
  .pad [data-k="up"] { background: var(--gold); font-size: 11px; }
  .pad [data-k="jump"] { width: auto; padding: 0 14px; font-size: 11px; }
  .pad button.down { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
}

/* ---- work viewer ----------------------------------------------------------------- */
.work {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 11, 18, 0.72);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.work.on { opacity: 1; }
.work-box {
  position: relative;
  width: min(880px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 #000;
  padding: 26px 30px 30px;
  transform: translateY(10px);
  transition: transform 0.2s ease;
}
.work.on .work-box { transform: none; }
.work-close {
  position: sticky;
  top: 0;
  float: right;
  margin: -8px -12px 0 12px;
  font: 10px/1 var(--pixel);
  color: #fff;
  background: var(--ink);
  border: 0;
  padding: 9px 10px;
  cursor: pointer;
  z-index: 2;
}
.work-close:hover, .work-close:focus-visible { background: var(--red); outline: none; }
.work-kicker { margin: 0 0 8px; font: 10px/1 var(--pixel); color: var(--red-dark); }
.work-title { margin: 0 0 18px; font: 700 28px/1.15 var(--sans); }
.work-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.work-thumb {
  flex: none;
  padding: 0;
  border: 3px solid var(--ink);
  background: #000;
  cursor: zoom-in;
}
.work-thumb img { display: block; height: 220px; width: auto; }
.work-gallery.single .work-thumb { flex: 1; background: #fff; }
.work-gallery.single .work-thumb img { height: auto; width: 100%; max-height: 360px; object-fit: contain; }
.work-tip { margin: 6px 0 0; font: 400 13px/1.3 var(--sans); color: var(--muted); }
.work-text { margin-top: 18px; font: 400 17px/1.6 var(--sans); max-width: 68ch; }
.work-text p { margin: 0 0 12px; }
.work-big {
  position: fixed;
  inset: 0;
  z-index: 31;
  display: grid;
  place-items: center;
  background: rgba(8, 7, 12, 0.94);
  cursor: zoom-out;
}
.work-big img { max-width: 92vw; max-height: 86vh; border: 4px solid #fff; }
.big-nav, .big-close {
  position: fixed;
  font: 14px/1 var(--pixel);
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  padding: 12px 14px;
  cursor: pointer;
}
.big-nav { top: 50%; transform: translateY(-50%); }
.big-nav.prev { left: 16px; }
.big-nav.next { right: 16px; }
.big-close { top: 16px; right: 16px; font-size: 10px; }
@media (max-width: 640px) {
  .work-box { padding: 20px 18px 22px; }
  .work-title { font-size: 22px; }
  .work-thumb img { height: 160px; }
  .work-text { font-size: 15px; }
}

/* ---- motion ---------------------------------------------------------------- */
@keyframes blink { 50% { opacity: 0.25; } }
@keyframes bob { 50% { transform: translateY(3px); } }
@keyframes glow { 50% { filter: brightness(1.25); } }
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* ---- small screens ------------------------------------------------------------ */
@media (max-width: 760px) {
  .dialog { padding: 26px 18px 12px; box-shadow: 4px 4px 0 var(--ink); }
  .say { font-size: 17px; }
  .howto li { grid-template-columns: 52px 1fr; font-size: 15px; gap: 10px; }
  .levels { grid-template-columns: 1fr; gap: 8px; }
  .levels li { display: grid; grid-template-columns: 96px 1fr; }
  .levels img { aspect-ratio: auto; height: 100%; border-bottom: 0; border-right: 3px solid var(--ink); }
  .levels p { font-size: 13px; }
  .next-label { display: none; }
  .chip { font-size: 8px; padding: 8px; }
}

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

/* ---- AT3: newspaper article + podcast inside the work viewer ---------------------- */
.news {
  margin: 4px 0 8px;
  padding: 22px 26px 8px;
  background: #fbf8f1;
  border: 2px solid #e2dccd;
  font: 400 16.5px/1.65 Georgia, "Times New Roman", serif;
  color: #1f1b16;
}
.news-mast { margin: 0 0 10px; font: 700 11px/1 var(--sans); letter-spacing: 0.18em; color: var(--red-dark); }
.news-head { margin: 0 0 8px; font: 700 30px/1.15 Georgia, "Times New Roman", serif; }
.news-by { margin: 0 0 14px; font: 600 13px/1.4 var(--sans); color: #6b6459; }
.news-stand { margin: 0 0 18px; font-style: italic; font-size: 18px; line-height: 1.5; color: #3a342c; }
.news h4 { margin: 22px 0 6px; font: 700 18px/1.3 var(--sans); }
.news p { margin: 0 0 12px; }
.news figure { margin: 18px 0; }
.news .figs { display: flex; gap: 8px; }
.news .figs img { display: block; width: 100%; height: auto; min-width: 0; border: 1px solid #d8d1c2; }
.news figure.pair .figs img { width: 50%; }
.news figcaption { margin-top: 6px; font: 400 13px/1.4 var(--sans); color: #5c564c; }
.news figcaption span { display: block; color: #8b8477; }
.work-audio {
  display: grid;
  gap: 10px;
  margin: 4px 0 8px;
  padding: 16px 18px;
  background: #1d1a20;
  color: #fff;
  border: 3px solid var(--ink);
}
.work-audio b { font: 10px/1.2 var(--pixel); color: var(--gold); }
.work-audio audio { width: 100%; }
.work-audio span { font: 400 14px/1.4 var(--sans); color: #c9c6d4; }
.work-about { margin: 22px 0 0; font: 700 18px/1.3 var(--sans); color: var(--red-dark); }
@media (max-width: 640px) {
  .news { padding: 16px 14px 4px; font-size: 15px; }
  .news-head { font-size: 23px; }
}

/* ---- the last page: final reflection ------------------------------------------ */
.ending {
  --gw: 192px;   /* Heart Gary at 3× (64×50 canvas) */
  --gh: 150px;
  position: fixed;
  inset: 0;
  z-index: 8;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  transition: background-color 0.7s ease;
  user-select: text;
  -webkit-user-select: text;
  outline: none;
}
.ending.dark { background: #000; transition: none; }
.end-wrap {
  display: flex;
  justify-content: center;
  padding: calc(var(--gh) + 56px) 16px 88px;
}
.end-sheet {
  position: relative;
  width: min(780px, 100%);
  padding: 56px clamp(20px, 7vw, 76px) 52px;
  background-color: #fbfaf6;
  /* the creases left over from the crumpled draft at the start */
  background-image:
    linear-gradient(104deg, rgba(60, 40, 20, 0.018) 0 41%, rgba(60, 40, 20, 0.06) 41.15%, rgba(255, 255, 255, 0.9) 41.35%, transparent 41.6%),
    linear-gradient(17deg, transparent 0 63%, rgba(60, 40, 20, 0.05) 63.1%, rgba(255, 255, 255, 0.8) 63.3%, rgba(60, 40, 20, 0.012) 63.5%),
    linear-gradient(162deg, transparent 0 27%, rgba(60, 40, 20, 0.045) 27.1%, transparent 27.4%),
    linear-gradient(71deg, transparent 0 83%, rgba(60, 40, 20, 0.04) 83.1%, transparent 83.4%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 28px 60px -24px rgba(29, 26, 32, 0.35);
  transform: translateY(110vh) rotate(-4deg);
  transition: transform 1.05s cubic-bezier(0.16, 0.84, 0.24, 1);
}
.ending.in .end-sheet { transform: none; }

.end-gary {
  position: absolute;
  right: clamp(12px, 8%, 72px);
  top: calc(4px - var(--gh));
  width: var(--gw);
  height: var(--gh);
  pointer-events: none;
}
.end-gary canvas {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.end-gary-shadow {
  position: absolute;
  left: 18%;
  width: 64%;
  bottom: -6px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(29, 26, 32, 0.2), rgba(29, 26, 32, 0));
}
.ending.hop .end-gary canvas { animation: end-hop 0.55s ease-out; }
@keyframes end-hop {
  0%, 100% { transform: none; }
  40% { transform: translateY(-14%); }
}

.end-kicker { margin: 0; font: 10px/1 var(--pixel); letter-spacing: 0.08em; color: var(--red-dark); }
.end-title { margin: 14px 0 12px; font: 700 clamp(32px, 5.4vw, 46px)/1.08 var(--sans); }
.end-by { margin: 0; font: 400 14px/1.5 var(--sans); color: #6d6b73; }
.end-read {
  display: inline-block;
  margin-left: 10px;
  padding: 4px 6px 3px;
  border: 2px solid var(--line);
  font: 8px/1 var(--pixel);
  color: #6d6b73;
  vertical-align: 1px;
}
.end-text { margin-top: 14px; font: 400 18px/1.7 var(--sans); max-width: 64ch; }
.end-part h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 42px 0 14px;
  font: 11px/1.5 var(--pixel);
  color: var(--red-dark);
}
.end-part h3::before { content: ""; flex: none; width: 8px; height: 8px; background: var(--red); }
.end-part p { margin: 0 0 16px; }
.end-todo {
  padding: 14px 16px;
  border: 2px dashed var(--line);
  font-size: 15px;
  color: var(--muted);
}

.end-found { margin-top: 56px; padding-top: 34px; border-top: 4px solid var(--ink); }
.end-sub { margin: 0; font: 12px/1.4 var(--pixel); }
.end-sub b { color: var(--red); }
.end-note { margin: 10px 0 20px; font: 400 15px/1.5 var(--sans); color: #6d6b73; }
.end-works {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.end-work {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: 100%;
  padding: 12px 14px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.end-work:hover, .end-work:focus-visible { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--red); outline: none; }
.end-work:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.end-heart { width: 21px; height: 18px; fill: #b9b7bf; }
.end-heart.on { fill: var(--red); }
.end-wt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.end-lv { font: 8px/1.3 var(--pixel); color: var(--muted); }
.end-wt b { font: 600 15px/1.3 var(--sans); }
.end-wt small { font: 400 13px/1.3 var(--sans); color: #6d6b73; }
.end-look { font: 8px/1 var(--pixel); color: var(--red-dark); white-space: nowrap; }

.end-fin { margin-top: 68px; text-align: center; }
.end-the-end {
  margin: 0;
  font: clamp(28px, 6vw, 44px)/1 var(--pixel);
  letter-spacing: 0.04em;
  text-shadow: 4px 4px 0 var(--red);
}
.end-thanks { margin: 18px 0 28px; font: 10px/1.4 var(--pixel); color: #6d6b73; }
.end-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.end-btn {
  padding: 14px 18px 13px;
  font: 11px/1 var(--pixel);
  color: #fff;
  background: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--red);
  cursor: pointer;
}
.end-btn.ghost { color: var(--ink); background: #fff; box-shadow: 4px 4px 0 var(--line); }
.end-btn:hover, .end-btn:focus-visible { transform: translate(-1px, -1px); outline: none; }
.end-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--red); }

.end-hint {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 12px 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid var(--line);
  text-align: center;
  white-space: nowrap;
  font: 9px/1 var(--pixel);
  letter-spacing: 0.08em;
  color: #6d6b73;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.end-hint.on { opacity: 1; animation: blink 1.1s steps(2, jump-none) infinite; }
.end-hint i {
  display: block;
  width: 0;
  height: 0;
  margin: 8px auto 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid currentColor;
}

@media (max-width: 640px) {
  .ending { --gw: 128px; --gh: 100px; }
  .end-wrap { padding-top: calc(var(--gh) + 64px); }
  .end-sheet { padding: 40px 20px 36px; }
  .end-text { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .end-sheet, .ending { transition: none; }
  .ending.hop .end-gary canvas { animation: none; }
}
