/* Kitty Maze: black arcade ground, neon-blue glow, Megan's colours from her tutorial design. */
:root {
  --bg: #000;
  --fg: #e6ffec;
  --muted: #9fc9aa;
  --neon: #38d97a;
  --pink: #ff9a3c;
  --gold: #ffd84d;
  --panel: #0c1e14;
  --disp: 'Fredoka', ui-rounded, system-ui, sans-serif;
  --body: 'Nunito', system-ui, sans-serif;
  --top: max(12px, env(safe-area-inset-top));
  --left: max(12px, env(safe-area-inset-left));
  --right: max(12px, env(safe-area-inset-right));
  --bottom: max(16px, env(safe-area-inset-bottom));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.4 var(--body);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; }
button { font: inherit; color: inherit; }

/* Title and "You escaped!" screens */
.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: safe center;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding: var(--top) var(--right) var(--bottom) var(--left);
  background: radial-gradient(circle at 50% 35%, #071830 0%, #000 65%);
  overflow-y: auto;
  touch-action: pan-y; /* the menu screens can scroll; the game itself never does */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
/* Short screens (an iPhone held sideways, small laptops): smaller Robi and title, so the
   whole menu fits more often. If it still doesn't fit, the screen scrolls. */
@media (max-height: 820px) {
  .screen { gap: 8px; }
  .robi-big { height: clamp(64px, 17vh, 150px); }
  #title h1 { font-size: clamp(34px, 8vh, 60px); }
  .sub { font-size: 18px; }
  .levels-note { min-height: 0; }
}
h1 {
  font: 600 clamp(40px, 10vw, 72px)/1 var(--disp);
  margin: 0;
  color: #9fd0ff;
  text-shadow: 0 0 14px var(--neon), 0 0 30px var(--neon);
}
.sub { margin: 0; color: var(--muted); font: 600 20px var(--disp); }
.robi-big { height: clamp(90px, 26vh, 220px); width: auto; filter: drop-shadow(0 0 14px rgba(120, 200, 255, .6)); }
.how { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.big {
  margin-top: 8px;
  min-width: 260px;
  padding: 14px 30px;
  border-radius: 999px;
  border: 3px solid var(--neon);
  background: var(--panel);
  box-shadow: 0 0 14px var(--neon);
  font: 600 22px var(--disp);
  cursor: pointer;
}
.big:hover:not(:disabled) { background: #12284a; }
.big:disabled { cursor: progress; border-color: #2a3b55; box-shadow: none; color: var(--muted); font-size: 18px; }
.big.failed { border-color: var(--pink); box-shadow: 0 0 12px var(--pink); font-size: 18px; }
.saved { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; max-width: 760px; }
.saved img { width: clamp(90px, 22vw, 150px); filter: drop-shadow(0 0 8px rgba(255, 255, 255, .5)); }
.saved.many { gap: 10px; }
.saved.many img { width: clamp(60px, 14vw, 104px); }
.saved .cat { position: relative; }
.saved .cat.left img { filter: grayscale(1) brightness(.35); opacity: .6; }
.saved .cat.left::after { content: '?'; position: absolute; inset: 0; display: grid; place-items: center; font: 600 32px var(--disp); color: var(--pink); }
.crown { position: relative; }
.crown::before { content: '👑'; position: absolute; left: 50%; top: -0.55em; transform: translateX(-50%); font-size: 20px; line-height: 1; z-index: 1; }
.slot.crown::before { font-size: 14px; top: -6px; }
#escaped.bad h1 { color: #ffc2ee; text-shadow: 0 0 14px var(--pink), 0 0 30px var(--pink); }
.links { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.link { background: none; border: 0; padding: 8px 4px; color: var(--muted); font: 700 16px var(--body); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.link:hover { color: var(--fg); }

/* Panel: invisible on the neon screens, a light card on Megan's pastel screens */
.panel { display: grid; justify-items: center; gap: 12px; }
#title-endings { margin-top: -4px; }

/* Megan's menu look (her "Kitty Maze Menu" design): cats and Robi on pastel blue, a light
   rounded card, deep blue Fredoka letters, white pill buttons with a blue outline.
   Used for the two endings of the journey and for the Endings screen. */
.screen.pastel {
  --blue: #3a6fc4;
  background: #bfe0fb var(--wall, none) repeat center / 750px auto;
  color-scheme: light;
}
.pastel .panel {
  width: min(560px, 100%);
  padding: clamp(18px, 4vw, 34px) clamp(16px, 4vw, 40px);
  border-radius: 36px;
  background: rgba(236, 246, 255, .9);
  box-shadow: 0 10px 40px rgba(47, 90, 153, .25);
}
.pastel h1 { color: var(--blue); text-shadow: none; font-size: clamp(34px, 8vw, 58px); }
.pastel .sub, .pastel .lead { color: #2f5a99; }
.pastel .next { color: #5b7bab; }
.pastel .big {
  background: #fff; color: var(--blue); border: 4px solid #5b8fd8; border-radius: 999px;
  box-shadow: none; font-weight: 600;
}
.pastel .big:hover:not(:disabled) { background: #eef6ff; }
.pastel .link { color: #2f5a99; }
.pastel .saved img { filter: drop-shadow(0 3px 6px rgba(47, 90, 153, .3)); }
.pastel .saved .cat.left img { filter: grayscale(1) brightness(.6); opacity: .45; }
.pastel .saved .cat.left::after { color: #c23a8f; }
/* Bad ending: Megan's drawing (the cat with a question mark for a face) on black,
   with the pale blue glow of her frame. */
#escaped.pastel.bad { background: #0d1030 var(--wall-night, none) repeat center / 750px auto; color-scheme: dark; }
#escaped.pastel.bad::before { /* darker towards the edges, so her picture stands out */
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, rgba(0, 0, 0, .35) 0%, rgba(3, 3, 16, .8) 100%);
}
#escaped.pastel.bad .panel { position: relative; background: none; box-shadow: none; padding-top: 8px; padding-bottom: 8px; animation: dusk 1.6s ease-out both; }
.end-art { display: block; width: min(560px, 100%); height: auto; border-radius: 4% / 5%; }
#esc-art { box-shadow: 0 0 40px rgba(143, 193, 220, .35); animation: flicker 4s ease-in-out 1.6s infinite; }
#escaped.pastel.bad h1 { color: #d6d0ea; text-shadow: 0 0 18px rgba(143, 193, 220, .6); animation: rise 2.2s ease-out .3s both; }
#escaped.pastel.bad .lead { color: #e2ddf2; }
#escaped.pastel.bad .next { color: #a9b9c9; font-style: italic; }
#escaped.pastel.bad .ending-tag { background: #1b2a36; color: #cfe6f2; border: 1px solid #8fc1dc; }
#escaped.pastel.bad .big { background: #000; color: #fff; border-color: #fff; box-shadow: 0 0 18px rgba(143, 193, 220, .8); }
#escaped.pastel.bad .big:hover:not(:disabled) { background: #0d1a24; }
#escaped.pastel.bad .link { color: #a9c6d6; }
@keyframes dusk { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; filter: blur(6px); } to { opacity: 1; filter: none; } }
@keyframes flicker { 0%, 100% { box-shadow: 0 0 40px rgba(143, 193, 220, .35); } 50% { box-shadow: 0 0 60px rgba(143, 193, 220, .6); } }
@media (prefers-reduced-motion: reduce) {
  #escaped.pastel.bad .panel, #escaped.pastel.bad h1, #esc-art { animation: none; }
}
.ending-tag {
  margin: 0; padding: 4px 14px; border-radius: 999px;
  font: 600 15px var(--disp); letter-spacing: .04em; text-transform: uppercase;
  background: #ffe9a8; color: #8a5a00;
}
.bad .ending-tag { background: #f3d4e6; color: #8f2f66; }

/* Endings gallery */
.end-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
@media (max-width: 520px) { .end-cards { grid-template-columns: 1fr; } }
.end-card { background: #fff; border: 3px solid #5b8fd8; border-radius: 22px; padding: 12px 12px 10px; }
.end-card.bad:not(.locked) { border-color: #8fc1dc; background: #000; }
.end-card.bad:not(.locked) h2 { color: #d6d0ea; }
.end-card.bad:not(.locked) .end-title { color: #e2ddf2; }
.end-card.bad:not(.locked) .end-text { color: #a9b9c9; }
.end-cats .end-art { width: 100%; max-width: 240px; }
.end-card h2 { margin: 0 0 6px; font: 600 20px var(--disp); color: var(--blue); }
.end-cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 4px; margin: 10px 0 4px; }
.end-cats .cat { position: relative; }
.end-cats .crown::before { font-size: 13px; top: -4px; }
.end-cats img { width: 50px; display: block; }
.end-title { margin: 4px 0 2px; font: 700 16px var(--body); color: #2f5a99; }
.end-text { margin: 0; font-size: 14px; color: #5b7bab; }
.end-card.locked { border-style: dashed; border-color: #a9c3e6; background: rgba(255, 255, 255, .6); }
.end-card.locked h2 { color: #8aa6cc; }
.end-card.locked img { filter: brightness(0) opacity(.18); }
.end-card.locked .crown::before { filter: brightness(0) opacity(.18); }

/* Journey map: Tutorial -> Stage 1 -> 2 -> 3, joined by a dotted trail */
.map-h { font-size: clamp(36px, 8vw, 60px); }
.map-top { display: flex; align-items: center; gap: 14px; }
.jnav {
  width: 48px; height: 48px; border-radius: 50%; border: 2px solid #2a3b55; background: var(--panel);
  color: #fff; font: 600 22px var(--disp); cursor: pointer; touch-action: manipulation;
}
.jnav:hover:not(:disabled) { background: #12284a; border-color: var(--neon); }
.jnav:disabled { cursor: not-allowed; opacity: .55; font-size: 18px; }
@media (min-width: 641px) { .journey.five .node { width: 118px; } }
/* Journeys 3 to 8 have 7 stages: smaller cards, and they wrap onto two rows on narrower screens. */
@media (min-width: 641px) {
  .journey.seven { flex-wrap: wrap; justify-content: center; row-gap: 14px; max-width: 980px; }
  .journey.seven .node { width: 104px; padding: 10px 4px 8px; }
  .journey.seven .node .dot { width: 46px; height: 46px; font-size: 22px; }
  .journey.seven .node .nname { font-size: 16px; }
  .journey.seven .node .ninfo { font-size: 12px; }
  .journey.seven li + li::before { width: clamp(8px, 1.4vw, 22px); }
}
@media (max-width: 640px) { .map-top { margin-top: 62px; gap: 8px; } .jnav { width: 40px; height: 40px; font-size: 18px; } } /* clear of the sound button */
.journey { list-style: none; margin: 10px 0 4px; padding: 0; display: flex; align-items: center; gap: 0; }
.journey li { display: flex; align-items: center; }
.journey li + li::before { content: ''; width: clamp(18px, 4vw, 44px); border-top: 4px dotted #2a3b55; }
.node {
  --c: var(--neon);
  position: relative;
  display: grid; justify-items: center; gap: 4px;
  width: 132px; padding: 12px 6px 10px;
  border-radius: 18px; border: 2px solid #1c2e48; background: var(--panel);
  cursor: pointer; touch-action: manipulation;
}
.node .dot {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  border: 3px solid var(--c); box-shadow: 0 0 12px var(--c); color: #fff; font: 600 26px var(--disp);
}
.node .nname { font: 600 18px var(--disp); color: #fff; }
.node .ninfo { font-size: 13px; color: var(--muted); }
.node.done .dot { background: var(--c); color: #000; }
.node.next { border-color: var(--c); box-shadow: 0 0 16px var(--c); }
.node .you { position: absolute; top: -26px; right: -10px; width: 46px; height: 46px; border-radius: 50%; background: var(--panel); border: 2px solid var(--fg); padding: 3px; animation: bob 1.2s ease-in-out infinite; }
.node.locked { cursor: not-allowed; opacity: .55; }
.node.locked .dot { border-color: #2a3b55; box-shadow: none; font-size: 22px; }
.node:hover:not(:disabled) { background: #12284a; }
@keyframes bob { 50% { transform: translateY(-5px); } }
@media (max-width: 640px) {
  .journey { flex-direction: column; margin: 4px 0; }
  .journey li { flex-direction: column; }
  .journey li + li::before { width: 0; height: 14px; border-top: 0; border-left: 4px dotted #2a3b55; }
  .node { width: min(300px, 80vw); grid-template-columns: auto 1fr; justify-items: start; align-items: center; column-gap: 12px; padding: 8px 14px; }
  .node .dot { grid-row: span 3; width: 46px; height: 46px; font-size: 22px; }
  .node .you { top: 50%; right: -16px; transform: translateY(-50%); animation: none; }
}
@media (max-height: 460px) and (min-width: 641px) { .node { width: 116px; padding: 8px 4px; } .map-h { font-size: 32px; } }
.lead { margin: 0; font: 700 22px var(--body); color: #fff; }
.next { margin: 0; color: var(--pink); font-weight: 700; }

/* What you have found */
#hud {
  position: fixed;
  top: var(--top);
  left: var(--left);
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(11, 26, 46, .85);
  border: 2px solid #1c2e48;
}
.slot { position: relative; width: 52px; height: 38px; display: grid; place-items: center; opacity: .28; filter: grayscale(1); transition: opacity .3s, filter .3s, transform .3s; }
.slot img, .slot svg { width: 100%; height: 100%; object-fit: contain; }
.slot.got { opacity: 1; filter: drop-shadow(0 0 6px rgba(255, 255, 255, .7)); transform: scale(1.08); }
/* Cats on one row; in Journey 2 the coloured keys get a row of their own underneath */
#hud { flex-direction: column; align-items: flex-start; }
.hud-row { display: flex; gap: inherit; }
.hud-row.keys .slot { width: 40px; height: 26px; }
.hud-row.keys .slot:not(.got) { filter: none; opacity: .38; } /* keep the colour, so you know which key is which */
.slot.key.used { opacity: .55; filter: grayscale(.4); transform: none; }

/* Hints and news, at the bottom (above the touch buttons on tablets and phones),
   so they never cover the maze's top hallway, where the obby is */
#toast {
  position: fixed;
  bottom: calc(var(--bottom) + 8px);
  left: 50%;
  transform: translate(-50%, 8px);
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 14px;
  background: var(--panel);
  border: 2px solid var(--neon);
  box-shadow: 0 0 10px var(--neon);
  color: #fff;
  font: 700 17px var(--body);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.touch #toast { bottom: calc(var(--bottom) + 190px); }
@media (max-height: 460px) { .touch #toast { bottom: auto; top: calc(var(--top) + 60px); } }

/* Hold to skip */
#skip {
  position: fixed;
  top: var(--top);
  right: calc(var(--right) + 122px); /* the sound and home buttons sit in the corner */
  display: grid;
  justify-items: center;
  gap: 0;
  padding: 6px;
  background: none;
  border: 0;
  color: var(--muted);
  font: 600 13px var(--body);
  cursor: pointer;
  touch-action: none;
}
#skip circle { fill: none; stroke-width: 6; }
#skip .bg { stroke: #2a3b55; }
#skip .fg { stroke: var(--fg); stroke-linecap: round; stroke-dasharray: 138.23; stroke-dashoffset: 138.23; }

/* Robi's words */
#talk {
  position: fixed;
  left: 50%;
  bottom: var(--bottom);
  transform: translateX(-50%);
  width: min(680px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  cursor: pointer;
}
#talk .face {
  flex: 0 0 auto;
  width: 124px;
  height: 124px;
  margin-right: -26px;
  border-radius: 50%;
  background: var(--panel);
  border: 4px solid var(--fg);
  box-shadow: 0 0 12px var(--neon);
  display: grid;
  place-items: center;
  z-index: 1;
}
#talk .face img { width: 86%; }
#talk .box {
  flex: 1;
  min-height: 108px;
  padding: 10px 18px 8px 42px;
  background: var(--panel);
  border: 3px solid var(--neon);
  border-radius: 14px;
  box-shadow: 0 0 12px var(--neon);
}
.name { font: 600 20px var(--disp); color: #9fd0ff; }
#say { margin: 2px 0 0; min-height: 2.7em; font: 700 clamp(17px, 2.6vw, 21px)/1.35 var(--body); color: #fff; }
.hint { text-align: right; color: var(--muted); font-size: 13px; }

/* Touch controls */
#dpad {
  position: fixed;
  left: var(--left);
  bottom: var(--bottom);
  width: 174px;
  height: 174px;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  gap: 4px;
}
#dpad button {
  border-radius: 14px;
  border: 2px solid var(--neon);
  background: rgba(11, 26, 46, .78);
  box-shadow: 0 0 10px rgba(47, 140, 255, .5);
  font-size: 22px;
  color: var(--fg);
  touch-action: none;
}
#dpad button.on { background: #1d4580; }
#dpad .up { grid-area: 1 / 2; }
#dpad .left { grid-area: 2 / 1; }
#dpad .right { grid-area: 2 / 3; }
#dpad .down { grid-area: 3 / 2; }

/* Drag-to-move: a ring where your finger went down, and a dot that follows it */
#stick {
  position: fixed;
  width: 110px;
  height: 110px;
  margin: -55px 0 0 -55px;
  border-radius: 50%;
  border: 3px solid rgba(47, 140, 255, .7);
  box-shadow: 0 0 12px rgba(47, 140, 255, .5);
  display: grid;
  place-items: center;
  pointer-events: none;
}
#stick-dot { width: 46px; height: 46px; border-radius: 50%; background: rgba(214, 236, 255, .55); }

/* Level picker: Easy / Medium / Difficult (how big the circle of light is in the maze) */
.levels { display: grid; justify-items: center; gap: 6px; margin-top: 6px; }
.levels-label { color: var(--muted); font-size: 14px; }
.levels-row { display: flex; gap: 8px; }
.levels button {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  width: 96px;
  height: 84px;
  border-radius: 14px;
  border: 2px solid #1c2e48;
  background: var(--panel);
  font: 600 16px var(--disp);
  cursor: pointer;
  touch-action: manipulation;
}
.levels button i {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd84d 0 3px, #12284a 4px var(--r), #000 calc(var(--r) + 1px));
  border: 1px solid #2a3b55;
}
.levels button[aria-pressed="true"] { border-color: var(--neon); box-shadow: 0 0 12px var(--neon); color: #fff; }
.levels button.extreme { color: #ff8fa3; }
.levels button.extreme i { border-color: #6b2333; }
.levels button.extreme[aria-pressed="true"] { border-color: #ff3b5c; box-shadow: 0 0 12px #ff3b5c; color: #fff; }
/* Four levels in a row: narrower buttons on phones */
@media (max-width: 520px) { .levels-row { gap: 6px; } .levels button { width: 80px; height: 78px; font-size: 15px; } .levels button i { width: 40px; height: 40px; } }
@media (max-width: 360px) { .levels button { width: 72px; font-size: 14px; } }
.levels-note { max-width: 330px; color: var(--muted); font-size: 13px; line-height: 1.3; min-height: 2.6em; }
.controls { display: grid; justify-items: center; gap: 6px; margin-top: 2px; }
.controls button {
  padding: 8px 14px; border-radius: 12px; border: 2px solid #2a3b55; background: var(--panel);
  color: var(--muted); font: 700 15px var(--body); cursor: pointer;
}
.controls button[aria-pressed="true"] { border-color: var(--neon); box-shadow: 0 0 12px var(--neon); color: #fff; }
.hud-foot { position: absolute; left: 6px; top: 100%; margin-top: 6px; display: flex; align-items: center; gap: 12px; }
.clock { font: 600 17px var(--disp); color: #dff1ff; font-variant-numeric: tabular-nums; text-shadow: 0 0 6px rgba(80, 170, 255, .8); white-space: nowrap; }
.hearts { font-size: 17px; letter-spacing: 1px; white-space: nowrap; filter: drop-shadow(0 0 4px rgba(255, 90, 140, .6)); }

/* Jump button (tablets and phones), bottom right */
#jump {
  position: fixed;
  right: var(--right);
  bottom: var(--bottom);
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 3px solid var(--pink);
  background: rgba(46, 8, 44, .8);
  box-shadow: 0 0 14px var(--pink);
  color: #fff;
  font: 600 22px var(--disp);
  touch-action: none;
}
#jump.on { background: #6a1a63; transform: scale(.94); }
@media (max-height: 460px) { #jump { width: 96px; height: 96px; } }

/* Sound on/off, top right on every screen (above the title and escape screens) */
#sound-wrap {
  position: fixed;
  top: var(--top);
  right: var(--right);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
}
#sound {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--neon);
  background: rgba(11, 26, 46, .85);
  box-shadow: 0 0 10px rgba(47, 140, 255, .5);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
#sound[aria-pressed="false"] { border-color: #2a3b55; box-shadow: none; }
#home {
  width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid #2a3b55; background: rgba(11, 26, 46, .85);
  font: 600 24px/1 var(--disp); color: var(--fg); cursor: pointer; touch-action: manipulation; padding: 0;
}
#home.armed { border-color: var(--pink); box-shadow: 0 0 10px var(--pink); font: 700 13px/1 var(--body); }
#sound-note {
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(11, 26, 46, .85);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .35s; }
#fade.on { opacity: 1; }

@media (max-width: 520px) {
  #talk .face { width: 88px; height: 88px; margin-right: -18px; }
  #talk .box { padding-left: 28px; min-height: 96px; }
  .slot { width: 44px; height: 32px; }
  #hud.many { gap: 2px; padding: 6px; }
  #hud.many .slot { width: 34px; height: 26px; }
}
@media (max-height: 460px) {
  .robi-big { display: none; }
  #dpad { width: 150px; height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  #toast, #fade, .slot { transition: none; }
}
@media (max-width: 420px) { #hud.many .slot { width: 28px; height: 22px; } }
@media (max-width: 520px) { .hud-row.keys .slot, #hud.many .hud-row.keys .slot { width: 30px; height: 20px; } }

/* Your time when you escape, and the journey total on the map */
.time-box { margin: 0; display: grid; gap: 2px; justify-items: center; }
.time-main { margin: 0; font: 600 20px var(--disp); color: #fff; font-variant-numeric: tabular-nums; }
.time-sub { margin: 0; font-size: 14px; color: var(--muted); }
.pastel .time-main { color: #2f5a99; }
.pastel .time-sub { color: #5b7aa8; }
#escaped.pastel.bad .time-main { color: #e6ecff; }
#escaped.pastel.bad .time-sub { color: #aab6d8; }
.node .ntime { color: #dff1ff; font-variant-numeric: tabular-nums; }
.journey-total { margin: 4px 0 0; font: 600 16px var(--disp); color: #dff1ff; font-variant-numeric: tabular-nums; text-align: center; }

/* Online leaderboard */
.online-status { margin: 4px 0 0; font: 700 15px var(--body); color: #ffd84d; max-width: 460px; text-align: center; }
.online-status.failed { color: #ff9aa8; font-weight: 400; font-size: 14px; }
.pastel .online-status { color: #2f5a99; }
.pastel .online-status.failed { color: #b0344f; }
#escaped.pastel.bad .online-status { color: #e6ecff; }
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 680px; }
.pill {
  min-width: 64px; padding: 8px 14px; border-radius: 999px; border: 2px solid #1c2e48; background: var(--panel);
  color: var(--muted); font: 600 15px var(--disp); cursor: pointer; touch-action: manipulation;
}
.pills.small .pill { min-width: 48px; padding: 6px 10px; font-size: 14px; }
.pill[aria-pressed="true"] { border-color: var(--neon); box-shadow: 0 0 10px var(--neon); color: #fff; }
.pill.extreme { color: #ff8fa3; }
.pill.extreme[aria-pressed="true"] { border-color: #ff3b5c; box-shadow: 0 0 10px #ff3b5c; color: #fff; }
.pill:disabled { cursor: progress; }
.board-what { margin: 2px 0 0; color: var(--muted); font-size: 14px; text-align: center; }
.board-list { list-style: none; margin: 0; padding: 0; width: min(420px, 92vw); display: grid; gap: 4px; }
.board-row {
  display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 12px; background: var(--panel); border: 2px solid #1c2e48;
  font: 600 17px var(--disp); color: #fff;
}
.board-row .rk { text-align: center; font-size: 18px; color: var(--muted); }
.board-row .nm { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .tm { font-variant-numeric: tabular-nums; color: #dff1ff; }
.board-row.me { border-color: #ff6fdc; box-shadow: 0 0 10px rgba(255, 111, 220, .6); }
.board-msg { padding: 14px; text-align: center; color: var(--muted); font-size: 15px; }
.board-gap { text-align: center; color: var(--muted); line-height: 1; }
.board-you { display: grid; justify-items: center; gap: 2px; color: #dff1ff; font-size: 15px; text-align: center; }
.board-you .join-link { color: #ffd84d; font-size: 17px; }
.join { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0, 4, 12, .78); padding: 16px; }
.join[hidden] { display: none; }
.join-box {
  width: min(380px, 100%); display: grid; gap: 10px; justify-items: center; text-align: center;
  padding: 22px 20px 16px; border-radius: 20px; background: var(--panel); border: 2px solid var(--neon); box-shadow: 0 0 24px rgba(47, 140, 255, .45);
}
.join-box h2 { margin: 0; font: 600 24px var(--disp); color: #fff; }
.join-note { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.35; }
#join-name {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid #2a3b55; background: #050d1a;
  color: #fff; font: 600 20px var(--disp); text-align: center;
}
#join-name:focus { outline: none; border-color: var(--neon); box-shadow: 0 0 10px var(--neon); }
.join-error { margin: 0; min-height: 1.2em; color: #ff9aa8; font-size: 14px; }
#join-save:disabled { opacity: .7; cursor: progress; }

/* The secret treasure: in the HUD, on the escape screen, and the Treasure book */
.slot.treasure canvas, .book-item canvas { position: static; inset: auto; display: block; } /* not the full-screen game canvas */
.slot.treasure canvas { width: 100%; height: 100%; object-fit: contain; }
.slot.treasure:not(.got) { opacity: .35; filter: grayscale(1) brightness(1.4); }
.treasure-line { margin: 0; font: 600 17px var(--disp); color: #ffe48a; }
.book { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; width: min(1080px, 94vw); }
.book-page { --c: #ffe14d; background: var(--panel); border: 2px solid #1c2e48; border-radius: 18px; padding: 12px 14px; text-align: left; }
.book-page.full { border-color: #ffd84d; box-shadow: 0 0 16px rgba(255, 216, 77, .45); }
.book-page h2 { margin: 0 0 8px; font: 600 20px var(--disp); color: var(--c); }
.book-page h2 small { color: var(--muted); font-size: 15px; }
.book-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.book-item { display: grid; justify-items: center; background: #070f1e; border: 1px solid #1c2e48; border-radius: 10px; padding: 3px 0 2px; }
.book-item canvas { width: 100%; max-width: 48px; height: auto; }
.book-item span { font-size: 11px; color: var(--muted); }
.book-item.got { border-color: var(--c); }
.book-item.got span { color: #fff; }
.book-hat { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.book-page.full .book-hat { color: #ffe48a; }
#board-stages { margin-top: -4px; }

/* The ghost cat (secret maze) and the cat collection */
.slot.ghost img, .saved .cat.ghost img { opacity: .7; filter: drop-shadow(0 0 6px #e6d3ff); }
.book-page.cats .book-row { grid-template-columns: repeat(7, 1fr); }
.cat-item img { width: 100%; max-width: 56px; height: 40px; object-fit: contain; }
.cat-item:not(.got) img { filter: brightness(0); opacity: .45; }
.cat-item.ghost.got img { opacity: .7; filter: drop-shadow(0 0 6px #e6d3ff); }
.cat-item.crown.got img { filter: drop-shadow(0 0 6px #ffd84d); }

/* The secret ending: the ghost cat, on purple night */
.end-card.secret { grid-column: 1 / -1; }
.end-card.secret:not(.locked) { border-color: #b46bff; background: #12061f; box-shadow: 0 0 18px rgba(180, 107, 255, .45); }
.end-card.secret:not(.locked) h2 { color: #d9b8ff; }
.end-card.secret:not(.locked) .end-title { color: #f2e6ff; }
.end-card.secret:not(.locked) .end-text { color: #bfa8dc; }
.end-cats .cat.ghost img { opacity: .7; filter: drop-shadow(0 0 8px #e6d3ff); }

/* Save to cloud */
.big.alt { border-color: #6a8fbf; box-shadow: none; font-size: 19px; }
.big.danger { border-color: #ff5c7a; box-shadow: 0 0 12px rgba(255, 92, 122, .55); }
.cloud-chip {
  background: rgba(255, 216, 77, .1); border: 1px solid rgba(255, 216, 77, .55); color: #ffe48a;
  border-radius: 999px; padding: 6px 14px; font: 700 14px var(--body); cursor: pointer;
}
.version { margin: 0; color: #4f6b8f; font-size: 12px; }
.cloud-box {
  width: min(440px, 94vw); display: grid; justify-items: center; text-align: center;
  padding: 22px 20px 16px; border-radius: 22px; background: var(--panel); border: 2px solid var(--neon); box-shadow: 0 0 24px rgba(47, 140, 255, .45);
}
.cloud-view { display: grid; justify-items: center; gap: 10px; width: 100%; }
.cloud-view h2 { margin: 0; font: 600 26px var(--disp); color: #fff; }
.cloud-note { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.4; }
.cloud-note.strong { color: #ffe48a; }
.cloud-small { margin: 4px 0 0; color: #5f7ea6; font-size: 12px; line-height: 1.35; }
.cloud-label { color: #dff1ff; font: 700 14px var(--body); }
.cloud-hint { margin: -4px 0 0; color: var(--muted); font-size: 13px; }
.cloud-or { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.cloud-input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid #2a3b55; background: #050d1a;
  color: #fff; font: 600 20px var(--disp); text-align: center; -webkit-user-select: text; user-select: text;
}
.cloud-input.code { letter-spacing: 1px; text-transform: uppercase; font-size: 18px; }
.cloud-input:focus { outline: none; border-color: var(--neon); box-shadow: 0 0 10px var(--neon); }
.cloud-error { margin: 0; min-height: 1.2em; color: #ff9aa8; font-size: 14px; }
.cloud-error:empty { min-height: 0; }
.cloud-code-box {
  margin: 0; padding: 12px 16px; border-radius: 12px; background: #050d1a; border: 2px dashed #ffd84d;
  color: #ffe48a; font: 600 24px/1.2 ui-monospace, Menlo, monospace; letter-spacing: 1px; -webkit-user-select: all; user-select: all;
}
.cloud-games { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.cloud-game { display: grid; gap: 4px; padding: 10px; border-radius: 14px; border: 1px solid #2a3b55; background: #071427; font-size: 14px; color: var(--muted); }
.cloud-game b { color: #fff; font: 600 17px var(--disp); }
.cloud-list { display: grid; justify-items: center; gap: 0; }
.link.danger { color: #ff9aa8; }
.cloud-lose { margin: 0; padding-left: 20px; text-align: left; color: #dff1ff; font-size: 15px; }
#updating { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(0, 4, 12, .9); }
#updating p { margin: 0; font: 600 22px var(--disp); color: #9fd0ff; text-shadow: 0 0 12px var(--neon); }
/* A test copy (a -preview address) says so at the top, except while playing. */
.test-copy { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 40; margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(255, 196, 0, .16); border: 1px solid rgba(255, 196, 0, .55); color: #ffe7a3; font: 600 13px var(--body); white-space: nowrap; pointer-events: none; }
