/* The world is pixel art; the interface stays quiet: dark glass, hairline
   edges, pixel type, colour only where it carries meaning. */

/* Pixelify Sans draws "5" almost like "8", so digits (and only digits)
   come from Silkscreen, scaled to sit with Pixelify's lowercase. */
@font-face {
  font-family: "WC Digits";
  src: url(https://fonts.gstatic.com/s/silkscreen/v6/m8JXjfVPf62XiF7kO-i9YLNlaw.woff2) format("woff2");
  unicode-range: U+0030-0039;
  size-adjust: 84%;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #05070d;
  --ink: rgba(255, 255, 255, 0.94);
  --muted: rgba(255, 255, 255, 0.67);
  --faint: rgba(255, 255, 255, 0.38);
  --glass: rgba(12, 16, 25, 0.41);
  --glass-strong: rgba(12, 16, 25, 0.62);
  --edge: rgba(255, 255, 255, 0.09);
  --edge-strong: rgba(255, 255, 255, 0.16);
  --fill: rgba(255, 255, 255, 0.06);
  --fill-hover: rgba(255, 255, 255, 0.11);
  --fill-active: rgba(255, 255, 255, 0.92);
  --accent: #8ffcff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.42), 0 2px 8px rgba(0, 0, 0, 0.25);
  --blur: blur(28px) saturate(140%);
  --font: "WC Digits", "Pixelify Sans", ui-sans-serif, system-ui, sans-serif;
  --label: "Silkscreen", "Pixelify Sans", ui-sans-serif, sans-serif;
  --mono: "VT323", ui-monospace, Menlo, Consolas, monospace;
  --cursor: crosshair;
  --cursor-cat: pointer;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--ink); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  cursor: var(--cursor);
  touch-action: none;
  opacity: 0;
  transition: opacity 600ms ease;
}
body.is-ready #world { opacity: 1; }
#world.is-over-cat { cursor: var(--cursor-cat); }

/* Soft vignette only. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, 0.45) 100%);
  z-index: 1;
}

/* ---- Glass surfaces ---------------------------------------------------- */

.pixel-panel {
  position: fixed;
  z-index: 3;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.075), transparent 55%), var(--glass);
  border: 1px solid rgba(204, 229, 241, 0.24);
  border-radius: 3px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.pixel-panel button {
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.pixel-panel button:hover { background: var(--fill-hover); color: var(--ink); }
.pixel-panel button:focus-visible { outline: 2px solid rgba(143, 252, 255, 0.6); outline-offset: 1px; }
.pixel-panel button[aria-pressed="true"] { background: var(--fill-active); color: #0b0d14; }

/* Every glass panel gets a crisp one-pixel, stepped RGB contour. Windows
   with .neon use their own animated version of the same outline below. */
.pixel-panel:not(.neon)::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  pointer-events: none;
  background: conic-gradient(from 30deg, #50d7ef, #8178f2, #ff6278, #f4c65a, #75e5a5, #50d7ef);
  clip-path: polygon(0 5px, 3px 5px, 3px 2px, 7px 2px, 7px 0,
    calc(100% - 7px) 0, calc(100% - 7px) 2px, calc(100% - 3px) 2px,
    calc(100% - 3px) 5px, 100% 5px, 100% calc(100% - 5px),
    calc(100% - 3px) calc(100% - 5px), calc(100% - 3px) calc(100% - 2px),
    calc(100% - 7px) calc(100% - 2px), calc(100% - 7px) 100%,
    7px 100%, 7px calc(100% - 2px), 3px calc(100% - 2px),
    3px calc(100% - 5px), 0 calc(100% - 5px));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0.65;
}
.pixel-panel button:not(.close), .pixel-panel .photo-download {
  border-radius: 0;
  clip-path: polygon(0 4px, 3px 4px, 3px 1px, 6px 1px, 6px 0,
    calc(100% - 4px) 0, calc(100% - 4px) 2px, 100% 2px,
    100% calc(100% - 4px), calc(100% - 3px) calc(100% - 4px),
    calc(100% - 3px) 100%, 4px 100%, 4px calc(100% - 2px),
    0 calc(100% - 2px));
}
.pixel-panel button[aria-pressed="true"], .card .play-as,
.achievement-actions #share-x {
  background: #edf4f2;
  box-shadow: inset 0 -2px 0 #b4c5d0;
  color: #101722;
  filter: drop-shadow(-1px 0 0 rgba(255, 79, 107, 0.6))
    drop-shadow(1px 0 0 rgba(57, 217, 240, 0.6));
}
.pixel-panel button:focus-visible {
  outline-offset: -2px;
  filter: drop-shadow(0 0 3px var(--accent));
}

.eyebrow {
  margin: 0 0 6px;
  font-family: var(--label);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}

.close {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0 !important;
  border-radius: 2px !important;
  font-size: 18px !important;
  line-height: 1;
  color: var(--muted);
}

/* ---- HUD ---------------------------------------------------------------- */

.brand { top: 16px; left: 16px; padding: 10px 14px 11px; }
.brand .eyebrow { margin-bottom: 3px; font-size: 9px; }
.brand h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: 0.02em; line-height: 1.1; }
.brand h1 span { font-weight: 400; color: var(--muted); }
.brand .mission-objective {
  margin: 7px 0 0;
  padding-top: 6px;
  border-top: 1px solid var(--edge);
  font-family: var(--label);
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
}
.brand .mission-objective::before { content: "▸"; margin-right: 5px; color: var(--accent); }
.brand .mission-objective.is-complete { color: var(--accent); }

.hud { top: 16px; right: 16px; display: flex; gap: 2px; align-items: center; padding: 4px; }
.hud .you,
.hud .progress { padding: 0 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.hud .you { display: inline-flex; align-items: center; gap: 7px; font-size: 0; }
.hud .you::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.hud .you b { font-size: 13px; font-weight: 600; color: var(--ink); }
.hud .progress { border-left: 1px solid var(--edge); }
.hud .progress b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.district-nav { left: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 2px; padding: 4px; }
.district-nav button { display: flex; align-items: center; gap: 10px; text-align: left; }
.district-nav span { font-family: var(--label); font-size: 10px; color: var(--faint); }

.district-banner.is-mission { top: 18%; }
.district-banner.is-mission.is-visible { animation-duration: 3.8s; }
.district-banner.is-mission .name { font-size: clamp(20px, 3vw, 30px); }
.district-banner.is-mission .sub { font-size: 13px; }

.hint {
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  margin: 0;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid rgba(204, 229, 241, 0.28);
  border-radius: 0;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  white-space: nowrap;
  pointer-events: none;
}

/* Name tag above a cat. */
.tag {
  position: fixed;
  z-index: 2;
  top: 0;
  left: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: -6px;
  padding: 5px 6px 5px 11px;
  background: var(--glass-strong);
  border: 1px solid rgba(204, 229, 241, 0.28);
  border-radius: 0;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  white-space: nowrap;
}
.tag .name { font-size: 13px; font-weight: 600; }
.tag .hint {
  position: static;
  transform: none;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  background: var(--fill);
  border: 0;
  border-radius: 2px;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body > .hint, .tag, .tag .hint {
  clip-path: polygon(0 4px, 3px 4px, 3px 1px, 6px 1px, 6px 0,
    calc(100% - 6px) 0, calc(100% - 6px) 2px,
    calc(100% - 2px) 2px, calc(100% - 2px) 5px, 100% 5px,
    100% calc(100% - 4px), calc(100% - 3px) calc(100% - 4px),
    calc(100% - 3px) 100%, 4px 100%, 4px calc(100% - 2px),
    0 calc(100% - 2px));
}
body > .hint::before, .tag::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  pointer-events: none;
  background: linear-gradient(110deg, #ff617b, #ffe66a, #55e7a6, #4bd9ff, #9f83f4);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0.8;
}

/* District title when you enter a new area. */
.district-banner {
  position: fixed;
  z-index: 2;
  top: 17%;
  left: 50%;
  transform: translate(-50%, -8px);
  display: grid;
  justify-items: center;
  gap: 4px;
  pointer-events: none;
  opacity: 0;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.8);
}
.district-banner.is-visible { animation: banner 2.6s ease forwards; }
.district-banner .num { font-family: var(--label); font-size: 12px; letter-spacing: 0.2em; color: var(--muted); text-shadow: 0 1px 0 #07101a, 0 2px 8px #07101a; }
.district-banner .name {
  font-size: clamp(32px, 5.5vw, 52px);
  font-weight: 700;
  letter-spacing: 0.01em;
  -webkit-text-stroke: 1px #07101a;
  paint-order: stroke fill;
  text-shadow: -2px 0 #ff4b68, 2px 0 #4377ff, 0 2px #58e38b,
    0 -2px #ffd457, 0 3px 0 #07101a, 0 5px 14px #07101a;
}
.district-banner .sub { font-size: 14px; color: var(--muted); text-shadow: 0 1px 2px #07101a, 0 3px 10px #07101a; }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -8px); }
  12%, 75% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 4px); }
}

/* ---- Cat card ----------------------------------------------------------- */

.card {
  --aura: var(--accent);
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  width: min(340px, calc(100vw - 32px));
  padding: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.07), transparent 55%), var(--glass-strong);
}
.card .close { position: absolute; top: 14px; right: 14px; z-index: 1; background: rgba(0, 0, 0, 0.25) !important; }
.card .close:hover { background: var(--fill-hover) !important; }
.card-art {
  height: 168px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background:
    radial-gradient(60% 55% at 50% 72%, color-mix(in srgb, var(--aura) 22%, transparent), transparent 70%),
    rgba(255, 255, 255, 0.03);
}
.card-art .sprite { width: 192px; height: 208px; zoom: 0.8; background-repeat: no-repeat; background-size: 1536px 2288px; image-rendering: pixelated; }
.card-body { padding: 16px 12px 10px; }
.card h2 { margin: 0 0 8px; font-size: 26px; font-weight: 600; letter-spacing: 0.01em; line-height: 1; }
.card p { margin: 0 0 16px; font-size: 14px; line-height: 1.45; color: var(--muted); }

.states {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 3px;
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 10px;
}
.states button { padding: 6px 2px; font-size: 12px; border-radius: 7px; }

.install {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 8px;
  padding: 10px 6px 6px 12px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 10px;
}
.install-label { grid-column: 1 / -1; font-family: var(--label); font-size: 9px; text-transform: uppercase; color: var(--faint); }
.install code { font-family: var(--mono); font-size: 20px; line-height: 1; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.install button { font-size: 12px; background: var(--fill); }

.card .play-as {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #0b0d14;
  background: var(--fill-active);
}
.card .play-as:hover { background: #fff; color: #0b0d14; }

/* ---- Neon glitch edge ---------------------------------------------------
   Rainbow hairline around every window that opens, split into red / blue
   copies like the chromatic fringe on the pets, with a rare glitch jolt. */

@property --neon-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.neon {
  box-shadow: var(--shadow), 0 0 22px -6px rgba(255, 59, 214, 0.45), 0 0 34px -10px rgba(59, 216, 255, 0.4);
}
.neon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0;
  pointer-events: none;
  background: conic-gradient(from var(--neon-angle), #ff3b6b, #ff9b3b, #ffe53b, #4dff8a, #3bd8ff, #7a5bff, #ff3bd6, #ff3b6b);
  clip-path: polygon(0 5px, 3px 5px, 3px 2px, 7px 2px, 7px 0,
    calc(100% - 7px) 0, calc(100% - 7px) 2px, calc(100% - 3px) 2px,
    calc(100% - 3px) 5px, 100% 5px, 100% calc(100% - 5px),
    calc(100% - 3px) calc(100% - 5px), calc(100% - 3px) calc(100% - 2px),
    calc(100% - 7px) calc(100% - 2px), calc(100% - 7px) 100%,
    7px 100%, 7px calc(100% - 2px), 3px calc(100% - 2px),
    3px calc(100% - 5px), 0 calc(100% - 5px));
  padding: 1px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  filter: drop-shadow(-1px 0 0 rgba(255, 40, 90, 0.75)) drop-shadow(1px 0 0 rgba(40, 120, 255, 0.75));
  animation: neon-spin 7s linear infinite, neon-glitch 5.5s steps(1) infinite;
  z-index: 2;
}
@keyframes neon-spin { to { --neon-angle: 360deg; } }
@keyframes neon-glitch {
  0%, 88%, 100% { transform: none; }
  89% { transform: translate(-2px, 0); }
  90% { transform: translate(1px, 1px); }
  91% { transform: translate(-1px, 0); }
  92% { transform: translate(1px, 0); }
}

/* ---- Collection --------------------------------------------------------- */

.collection {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 32px));
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  z-index: 4;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.07), transparent 55%), var(--glass-strong);
}
.collection header { display: flex; justify-content: space-between; align-items: center; padding: 14px 12px 12px 18px; border-bottom: 1px solid var(--edge); }
.collection h2 { margin: 0; font-size: 15px; font-weight: 600; }
.collection ul { list-style: none; margin: 0; padding: 6px 8px 10px; overflow: auto; scrollbar-width: thin; }
.collection .group { padding: 14px 10px 6px; font-family: var(--label); font-size: 10px; text-transform: uppercase; color: var(--faint); }
.collection .row { width: 100%; display: grid; grid-template-columns: 36px 26px 1fr auto; gap: 10px; align-items: center; padding: 5px 10px; text-align: left; color: var(--ink); }
.collection .thumb { width: 36px; height: 39px; background-size: 288px 429px; background-position: -216px 0; image-rendering: pixelated; }
.collection .num { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.collection .name { font-size: 14px; font-weight: 500; }
.collection .seen { font-size: 11px; color: var(--faint); }
.collection .row[data-met="true"] .seen { color: var(--accent); }
.collection .achievement-row { color: var(--accent); background: var(--fill); margin: 8px 0 4px; padding: 10px 12px; width: 100%; text-align: left; }
.hud .progress.is-complete { color: var(--accent); cursor: pointer; }
.hud .progress.is-complete:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Completion uses the same glass, pixel type and thin aura as existing windows. */
.achievement { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(410px, calc(100vw - 32px)); z-index: 6; padding: 24px; text-align: center; background: linear-gradient(145deg, rgba(255, 255, 255, 0.07), transparent 55%), var(--glass-strong); }
.achievement .close { position: absolute; top: 12px; right: 12px; }
.achievement .eyebrow { color: var(--accent); }
.achievement-photo { display: block; width: 100%; height: auto; margin: 14px auto 15px; border-radius: 5px; image-rendering: pixelated; }
.achievement h2 { margin: 0 0 10px; font-size: 24px; line-height: 1.1; }
.achievement p:not(.eyebrow) { margin: 0 0 19px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.achievement-actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.achievement-actions button, .achievement-actions .photo-download { background: var(--fill); color: var(--ink); border: 0; border-radius: var(--radius-sm); padding: 8px 10px; font: 500 12px var(--font); text-decoration: none; cursor: pointer; }
.achievement-actions .photo-download:hover { background: var(--fill-hover); }
.achievement-actions #share-x { background: var(--fill-active); color: #0b0d14; }
.achievement-actions #share-x:hover { background: #fff; color: #0b0d14; }

/* ---- Install panel ------------------------------------------------------ */

.install-panel {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, calc(100vw - 32px));
  z-index: 4;
  padding: 18px 18px 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.07), transparent 55%), var(--glass-strong);
}
.install-panel header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.install-panel h2 { margin: 0; font-size: 24px; font-weight: 600; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--edge); }
.steps li:first-child { border-top: 0; }
.step-num { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--fill); font-family: var(--label); font-size: 11px; color: var(--muted); }
.steps h3 { margin: 3px 0 8px; font-size: 16px; font-weight: 600; }
.steps h3 small { margin-left: 6px; font-size: 13px; font-weight: 400; color: var(--faint); }
.snippet { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 9px 6px 9px 12px; background: rgba(0, 0, 0, 0.3); border-radius: 10px; }
.snippet code { font-family: var(--mono); font-size: 17px; line-height: 1.15; white-space: pre-wrap; word-break: break-word; color: var(--ink); }
.snippet button { align-self: start; font-size: 12px; background: var(--fill); }
.note { margin: 8px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.note code { font-family: var(--mono); font-size: 16px; color: var(--ink); }

.install .setup-link {
  grid-column: 1 / -1;
  justify-self: start;
  padding: 2px 0;
  font-size: 12px;
  color: var(--faint);
  background: none !important;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.2);
  text-underline-offset: 3px;
}
.install .setup-link:hover { color: var(--ink); }

.fade { position: fixed; inset: 0; z-index: 5; background: #000; opacity: 0; pointer-events: none; transition: opacity 240ms ease; }
.fade.is-on { opacity: 1; }

body.is-editing :is(.brand, .hud, .district-nav, .hint, .tag, .district-banner, .card, .install-panel, .achievement) { display: none !important; }

body[data-mode="overview"] .hint::after { content: " · click anywhere to go there"; }

/* ---- Pixel window frame (Windows 98 feel) -------------------------------
   Same glass and type; only the chrome changes. From outside in: a hard
   stepped drop shadow, a 2px dark outline, the 2px rainbow edge, then a 1px
   bevel (light top-left, dark bottom-right). Everything is solid pixels:
   no blur, no rounded corners. */

.pixel-panel {
  border: 0;
  border-radius: 0;
  box-shadow:
    0 0 0 2px #05070c,
    6px 6px 0 2px rgba(0, 0, 0, 0.34),
    inset 3px 3px 0 rgba(255, 255, 255, 0.2),
    inset -3px -3px 0 rgba(0, 0, 0, 0.42);
}
.neon {
  box-shadow:
    0 0 0 2px #05070c,
    6px 6px 0 2px rgba(0, 0, 0, 0.34),
    inset 3px 3px 0 rgba(255, 255, 255, 0.2),
    inset -3px -3px 0 rgba(0, 0, 0, 0.42),
    0 0 26px -8px rgba(255, 59, 214, 0.4);
}

/* The rainbow edge: 2px, stepped 2px corners, drawn inside the box so
   scrolling windows never clip it. */
.pixel-panel:not(.neon)::before,
.neon::before {
  inset: 0;
  padding: 2px;
  border-radius: 0;
  clip-path: polygon(0 2px, 2px 2px, 2px 0, calc(100% - 2px) 0, calc(100% - 2px) 2px,
    100% 2px, 100% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px),
    calc(100% - 2px) 100%, 2px 100%, 2px calc(100% - 2px), 0 calc(100% - 2px));
}
.pixel-panel:not(.neon)::before { opacity: 0.8; }

/* Buttons: flat at rest; on hover a raised Win98 bevel with a hard pixel
   shadow line, pressed inverts it. Inset shadows survive the stepped
   clip-path the buttons already use. */
.pixel-panel button:not(.close):not(.row):not(.setup-link):hover,
.pixel-panel .photo-download:hover {
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.32),
    inset -2px -2px 0 rgba(0, 0, 0, 0.6),
    inset -4px -4px 0 rgba(0, 0, 0, 0.22);
}
.pixel-panel button:not(.close):not(.row):not(.setup-link):active,
.pixel-panel .photo-download:active {
  transform: translate(1px, 1px);
  box-shadow:
    inset 2px 2px 0 rgba(0, 0, 0, 0.6),
    inset -2px -2px 0 rgba(255, 255, 255, 0.22);
}
.pixel-panel button[aria-pressed="true"],
.card .play-as,
.achievement-actions #share-x {
  box-shadow:
    inset 2px 2px 0 #ffffff,
    inset -2px -2px 0 #9aabb8;
}
.pixel-panel button[aria-pressed="true"]:hover,
.card .play-as:hover,
.achievement-actions #share-x:hover {
  box-shadow:
    inset 2px 2px 0 #ffffff,
    inset -2px -2px 0 #7d8e9c,
    inset -4px -4px 0 rgba(0, 0, 0, 0.18);
}

/* Close box: the small raised square of a Win98 title bar. */
.pixel-panel .close {
  border-radius: 0 !important;
  background: rgba(255, 255, 255, 0.08) !important;
  box-shadow:
    0 0 0 1px #05070c,
    inset 2px 2px 0 rgba(255, 255, 255, 0.3),
    inset -2px -2px 0 rgba(0, 0, 0, 0.55);
}
.pixel-panel .close:hover { background: rgba(255, 255, 255, 0.16) !important; color: var(--ink); }
.pixel-panel .close:active {
  box-shadow:
    0 0 0 1px #05070c,
    inset 2px 2px 0 rgba(0, 0, 0, 0.55),
    inset -2px -2px 0 rgba(255, 255, 255, 0.2);
}

/* Inner areas become sunken fields: dark top-left, light bottom-right. */
.card-art,
.states,
.install,
.snippet,
.achievement-photo {
  border-radius: 0;
  box-shadow:
    inset 2px 2px 0 rgba(0, 0, 0, 0.5),
    inset -2px -2px 0 rgba(255, 255, 255, 0.12);
}
.achievement-photo { box-shadow: 0 0 0 2px #05070c, 0 0 0 3px rgba(255, 255, 255, 0.14); }
.states button { border-radius: 0; }
.step-num {
  border-radius: 0;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.2), inset -2px -2px 0 rgba(0, 0, 0, 0.45);
}
.collection header { border-bottom: 2px solid rgba(0, 0, 0, 0.45); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1); }
.steps li { border-top: 0; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35), inset 0 3px 0 rgba(255, 255, 255, 0.07); }
.steps li:first-child { box-shadow: none; }
.hud .progress { border-left: 0; box-shadow: -2px 0 0 rgba(0, 0, 0, 0.4), -3px 0 0 rgba(255, 255, 255, 0.1); }

/* Pixel scrollbars inside windows. */
.pixel-panel ::-webkit-scrollbar,
.pixel-panel::-webkit-scrollbar { width: 12px; height: 12px; }
.pixel-panel ::-webkit-scrollbar-track,
.pixel-panel::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
.pixel-panel ::-webkit-scrollbar-thumb,
.pixel-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.28), inset -2px -2px 0 rgba(0, 0, 0, 0.5);
}

/* ---- Small screens ------------------------------------------------------ */

@media (max-width: 820px) {
  .brand { top: 8px; left: 8px; padding: 8px 12px; max-width: 42vw; }
  .brand .eyebrow { display: none; }
  .brand h1 { font-size: 13px; }
  .brand h1 span { display: none; }
  .brand .mission-objective { margin-top: 5px; padding-top: 5px; font-size: 9px; white-space: normal; }
  .hud { top: 8px; right: 8px; }
  .hud .you { display: none; }
  .hud .progress { border-left: 0; padding: 0 6px; font-size: 12px; }
  .hud .progress span { display: none; }
  .hud button { padding: 6px 9px; font-size: 12px; }
  .district-nav { flex-direction: row; left: 8px; right: 8px; bottom: 8px; overflow-x: auto; scrollbar-width: none; }
  .district-nav button { white-space: nowrap; font-size: 12px; }
  .hint { display: none; }
  .card { top: auto; bottom: 62px; transform: none; right: 8px; left: 8px; width: auto; max-height: 64vh; overflow: auto; }
  .card-art { height: 124px; }
  .card-art .sprite { zoom: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .district-banner.is-visible { animation-duration: 0.01s; }
  .pixel-panel button { transition: none; }
  .neon::before { animation: none; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: rgba(12, 14, 22, 0.86); --glass-strong: rgba(12, 14, 22, 0.94); }
}

/* Sound toggle in the HUD: a pixel speaker with waves, an X while off. */
.hud .music-toggle { position: relative; display: inline-grid; place-items: center; min-width: 30px; }
.hud .music-toggle svg { width: 16px; height: 14px; fill: currentColor; }
.hud .music-toggle .sound-off { display: none; }
.hud .music-toggle[aria-pressed="false"] { opacity: .6; }
.hud .music-toggle[aria-pressed="false"] .sound-on { display: none; }
.hud .music-toggle[aria-pressed="false"] .sound-off { display: inline; }
.hud .music-toggle.is-on svg { filter: drop-shadow(-1px 0 #00eadb) drop-shadow(1px 0 #ff49cf); }

/* Loading screen (removed once the map and the 25 pets are ready). */
.loading { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--bg); transition: opacity 500ms ease; font-family: var(--label); }
.loading.is-done { opacity: 0; pointer-events: none; }
.loading-title { margin: 0; font-family: var(--font); font-size: 26px; font-weight: 700; letter-spacing: .02em; color: var(--ink); }
.loading-title span { color: var(--accent); }
.loading-bar { width: min(260px, 70vw); height: 12px; padding: 2px; background: #05070c; box-shadow: 0 0 0 2px rgba(255, 255, 255, .16); }
.loading-bar i { display: block; height: 100%; width: 4%; background: linear-gradient(90deg, #ff3b6b, #ff9b3b, #ffe53b, #4dff8a, #3bd8ff, #7a5bff, #ff3bd6); transition: width 200ms steps(4, end); }
.loading-text { margin: 0; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .loading, .loading-bar i { transition: none; } }

/* Home link: the title (with a pixel house) returns to weirdcats.xyz. */
.brand .home-link { display: inline-flex; align-items: center; gap: 7px; color: inherit; text-decoration: none; }
.brand .home-link svg { width: 13px; height: 13px; fill: var(--accent); flex: none; }
.brand .home-link:hover, .brand .home-link:focus-visible { text-shadow: -1px 0 #00eadb, 1px 0 #ff49cf; }
.brand .home-link:hover svg { filter: drop-shadow(-1px 0 #00eadb) drop-shadow(1px 0 #ff49cf); }

/* Narrow phones: title + HUD do not fit side by side. The HUD becomes a bar
   across the top and the title panel sits just below it. */
@media (max-width: 480px) {
  .hud { left: 8px; right: 8px; justify-content: space-between; }
  .brand { top: 56px; max-width: 60vw; }
}

/* Explicit way back to the site, under the mission line. */
.brand .return-home {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 5px 9px 4px;
  font-family: var(--label); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
  color: var(--ink); background: rgba(255, 255, 255, .06);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .14), inset -2px -2px 0 rgba(0, 0, 0, .5);
}
.brand .return-home span { color: var(--accent); }
.brand .return-home:hover, .brand .return-home:focus-visible { background: rgba(255, 255, 255, .12); text-shadow: -1px 0 #00eadb, 1px 0 #ff49cf; }
@media (max-width: 820px) { .brand .return-home { margin-top: 6px; padding: 4px 8px 3px; font-size: 9px; } }

/* ---- Collection as a dock ------------------------------------------------
   It stays open while you jump between cats, so it moves out of the middle:
   a left-side dock on desktop, a bottom sheet on phones. No backdrop blur on
   the big panels: blurring a map that redraws 60 times a second made
   scrolling stutter. */
.collection, .card, .achievement, #install {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), transparent 55%), rgba(12, 14, 22, 0.94);
}
.collection .thumb { background-size: 100% 100%; background-position: 0 0; }
.collection ul { overscroll-behavior: contain; }
@media (min-width: 821px) {
  .collection { top: 132px; left: 16px; transform: none; width: 330px; max-height: calc(100vh - 220px); }
}
@media (max-width: 820px) {
  .collection { top: auto; bottom: 56px; left: 8px; right: 8px; transform: none; width: auto; max-height: 44vh; }
}
/* Touch devices: no backdrop blur anywhere (glass becomes near-opaque). */
@media (pointer: coarse) {
  :root { --blur: none; --glass: rgba(12, 14, 22, 0.86); --glass-strong: rgba(12, 14, 22, 0.94); }
}

/* Draggable panels (src/drag.js). */
.drag-handle { cursor: grab; user-select: none; -webkit-user-select: none; }
.is-dragging .drag-handle { cursor: grabbing; }
.is-dragging { transition: none !important; }
.card-art.drag-handle { position: relative; }
.card-art.drag-handle::after {
  content: ""; position: absolute; top: 7px; left: 50%; width: 28px; height: 4px; transform: translateX(-50%);
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .35) 0 4px, transparent 4px 8px);
}
.collection header.drag-handle h2::before { content: "⠿ "; color: var(--faint); }

/* ---- "Get your card" nudge (after all 25 cats are found) ----------------
   A claim button above the bottom edge plus a pulsing 25/25 chip. The button
   stays once the District is complete; the pulsing stops after the card is
   shared, downloaded or its message copied. */
.claim-card {
  position: fixed; z-index: 4; left: 50%; bottom: 64px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 10px; padding: 11px 18px 10px;
  font-family: var(--label); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink);
  background: rgba(10, 12, 20, .92); border: 0; cursor: pointer; white-space: nowrap;
  box-shadow: 0 0 0 2px #05070c, 6px 6px 0 2px rgba(0, 0, 0, .34), 0 0 24px -4px rgba(255, 59, 214, .6), 0 0 34px -8px rgba(59, 216, 255, .55);
  animation: claim-pulse 1.6s steps(8, end) infinite;
}
.claim-card::before {
  content: ""; position: absolute; inset: 0; padding: 2px; pointer-events: none;
  background: linear-gradient(90deg, #ff3b6b, #ff9b3b, #ffe53b, #4dff8a, #3bd8ff, #7a5bff, #ff3bd6, #ff3b6b);
  background-size: 200% 100%; animation: claim-rim 2.4s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.claim-card b { color: var(--accent); font-weight: 400; }
.claim-star { color: #ffe53b; animation: claim-blink 1s steps(2, end) infinite; }
.claim-arrow { color: var(--accent); }
.claim-card:hover, .claim-card:focus-visible { text-shadow: -1px 0 #00eadb, 1px 0 #ff49cf; }
.claim-card.is-claimed, .claim-card.is-claimed .claim-star { animation: none; }
@keyframes claim-pulse { 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.05); } }
@keyframes claim-rim { to { background-position: 200% 0; } }
@keyframes claim-blink { 50% { opacity: .2; } }

.hud .progress.is-claim { color: #ffe53b; animation: claim-chip 1s steps(2, end) infinite; }
.hud .progress.is-claim b { color: #ffe53b; }
@keyframes claim-chip { 50% { text-shadow: -1px 0 #00eadb, 1px 0 #ff49cf; opacity: .55; } }

@media (max-width: 820px) {
  .claim-card { bottom: 60px; font-size: 10px; padding: 10px 14px 9px; max-width: calc(100vw - 24px); }
}
@media (prefers-reduced-motion: reduce) {
  .claim-card, .claim-card::before, .claim-star, .hud .progress.is-claim { animation: none; }
}

/* ---- YOU WIN! band ---------------------------------------------------- */
.you-win { position: fixed; inset: 0; z-index: 7; display: grid; place-items: center; pointer-events: none; }
.you-win-band {
  pointer-events: auto; cursor: pointer; width: 100%; border: 0; padding: 22px 16px 20px;
  display: grid; justify-items: center; gap: 8px; color: var(--ink);
  background: linear-gradient(90deg, transparent, rgba(5, 7, 13, .94) 12%, rgba(5, 7, 13, .94) 88%, transparent);
  position: relative; transform: scaleY(0); transition: transform 260ms steps(5, end);
}
.you-win-band::before, .you-win-band::after {
  content: ""; position: absolute; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, #ff3b6b 10%, #ff9b3b, #ffe53b, #4dff8a, #3bd8ff, #7a5bff, #ff3bd6 90%, transparent);
}
.you-win-band::before { top: 0; }
.you-win-band::after { bottom: 0; }
.you-win.is-on .you-win-band { transform: scaleY(1); }
.you-win-title {
  position: relative; font-family: var(--font); font-weight: 700; letter-spacing: .06em;
  font-size: clamp(44px, 11vw, 112px); line-height: 1;
  text-shadow: -4px 0 #00eadb, 4px 0 #ff49cf, 0 6px 0 #05070c;
  transform: scale(2.4); opacity: 0;
}
.you-win.is-on .you-win-title { animation: win-slam 420ms steps(6, end) 120ms forwards, win-glitch 1.6s steps(2, end) 700ms infinite; }
.you-win-sub { font-family: var(--label); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); opacity: 0; }
.you-win-sub b { color: #ffe53b; font-weight: 400; margin-left: 10px; animation: claim-blink 1s steps(2, end) infinite; }
.you-win.is-on .you-win-sub { animation: win-fade 200ms steps(3, end) 520ms forwards; }
@keyframes win-slam { to { transform: scale(1); opacity: 1; } }
@keyframes win-glitch {
  0%, 100% { text-shadow: -4px 0 #00eadb, 4px 0 #ff49cf, 0 6px 0 #05070c; translate: 0 0; }
  50% { text-shadow: 4px 0 #ffe53b, -4px 0 #7a5bff, 0 6px 0 #05070c; translate: 2px 0; }
}
@keyframes win-fade { to { opacity: 1; } }
@media (max-width: 820px) { .you-win-sub { font-size: 10px; } .you-win-sub span { display: block; } .you-win-sub b { margin: 6px 0 0; display: block; } }
@media (prefers-reduced-motion: reduce) {
  .you-win-band { transition: none; }
  .you-win.is-on .you-win-title, .you-win.is-on .you-win-sub { animation: none; transform: none; opacity: 1; }
}
