/* Find the Cat - UI shell. The scene itself is drawn on canvas. */

:root {
  --bg: #0c0f16;
  --panel: rgba(15, 20, 31, 0.82);
  --panel-solid: rgba(16, 22, 34, 0.95);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.26);
  --text: #eef3fa;
  --muted: #9db0c7;
  --amber: #f6c344;
  --amber-dark: #241a05;
  --good: #7ee08a;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app { position: fixed; inset: 0; overflow: hidden; }

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#stage:active { cursor: grabbing; }

.hidden { display: none !important; }

/* ---------------- HUD ---------------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
/* Only real controls capture clicks. Panels that are purely informational let
   clicks fall through to the scene, so a target underneath the checklist can
   always be clicked. */
#hud .btn { pointer-events: auto; }
#topbar, #checklist, #zoom-controls, #toast { pointer-events: none; }
#minimap-wrap { pointer-events: auto; }

#topbar {
  position: absolute;
  top: 10px; left: 10px; right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
  flex-wrap: wrap;
}
.spacer { flex: 1 1 auto; }

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.world { background: rgba(246, 195, 68, 0.16); color: #ffe6a8; }
.chip.found { background: rgba(126, 224, 138, 0.14); color: #cdf5d3; }
.chip.seed { color: var(--muted); font-weight: 500; font-size: 12px; }
.chip.cat {
  background: rgba(246, 195, 68, 0.18);
  color: #ffe6a8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.chip.time {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  min-width: 62px;
  text-align: center;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.14s ease, transform 0.14s ease, border-color 0.14s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.18); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn.icon { padding: 8px 11px; min-width: 38px; }
.btn.primary {
  background: linear-gradient(180deg, #ffd75e, #eeb02f);
  border-color: #ffe08a;
  color: var(--amber-dark);
}
.btn.primary:hover { background: linear-gradient(180deg, #ffe285, #f5bd42); }
.btn.on { background: rgba(246, 195, 68, 0.24); border-color: rgba(246, 195, 68, 0.5); }

/* checklist */
#checklist {
  position: absolute;
  top: 74px; right: 10px;
  width: 232px;
  max-height: calc(100% - 210px);
  overflow-y: auto;
  padding: 10px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
}
.panel-head {
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2px 0 8px 4px;
}
#item-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }

.target-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
}
.target-card .meta { display: flex; flex-direction: column; line-height: 1.25; }
.target-card .meta strong { font-size: 13px; font-weight: 600; }
.target-card .meta span { font-size: 11px; color: var(--muted); }
.target-card .thumb { flex: none; }
.target-card .tick {
  margin-left: auto;
  color: var(--good);
  font-weight: 800;
  font-size: 15px;
}
.target-card.cat {
  background: rgba(246, 195, 68, 0.14);
  border-color: rgba(246, 195, 68, 0.34);
  margin-bottom: 7px;
}
.target-card.cat .meta strong { font-size: 15px; }
.target-card.done { opacity: 0.5; }
.target-card.done .meta strong { text-decoration: line-through; }

/* zoom + minimap */
#zoom-controls {
  position: absolute;
  left: 10px; bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#zoom-controls .btn { background: var(--panel); }

#minimap-wrap {
  position: absolute;
  right: 10px; bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  line-height: 0;
  cursor: crosshair;
}
#minimap { display: block; }

#toast {
  position: absolute;
  left: 50%; bottom: 26px;
  transform: translate(-50%, 10px);
  padding: 10px 18px;
  background: rgba(12, 16, 26, 0.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#app.miss::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(232, 86, 63, 0.55);
  animation: missflash 0.4s ease-out;
}
@keyframes missflash { from { opacity: 1; } to { opacity: 0; } }

/* ---------------- screens ---------------- */
.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  display: grid;
  place-items: center;
  padding: 22px;
  background: radial-gradient(120% 90% at 50% 0%, #1b2436 0%, #0a0d14 70%);
}

.menu-card {
  width: 100%;
  max-width: 1000px;
  padding: 22px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}
.menu-head { margin-bottom: 16px; }
h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 4.6vw, 44px);
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.sub { margin: 0; color: var(--muted); font-size: 15px; }
.blurb { margin: 0; color: var(--muted); font-size: 13px; }
.blurb.small { font-size: 12px; }

.menu-row { display: flex; align-items: center; gap: 14px; margin: 14px 0 6px; flex-wrap: wrap; }
.menu-row.spread { justify-content: space-between; }

.pill-group {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.pill {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 15px;
  border-radius: 999px;
  cursor: pointer;
}
.pill.on { background: var(--amber); color: var(--amber-dark); }

.world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.world-card {
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.world-card:hover {
  transform: translateY(-3px);
  border-color: rgba(246, 195, 68, 0.55);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
}
.world-card canvas { display: block; width: 100%; }

/* A map that ships in the menu but not in this build. It still sells the game,
   so it keeps its thumbnail and stays readable — it just cannot be played. */
.world-card.locked { position: relative; }
.world-card.locked canvas { filter: saturate(0.75) brightness(0.72); }
.world-card.locked .world-info strong { color: #c3cede; }
.world-card.locked:hover { border-color: var(--line); transform: none; box-shadow: none; }
.lock-badge {
  position: absolute;
  top: 8px; right: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(12, 15, 22, 0.82);
  border: 1px solid rgba(246, 195, 68, 0.5);
  color: var(--amber);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Used to point at the call to action when somebody clicks a locked map. */
@keyframes ctaPulse {
  0% { box-shadow: 0 0 0 0 rgba(246, 195, 68, 0.55); }
  70% { box-shadow: 0 0 0 12px rgba(246, 195, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(246, 195, 68, 0); }
}
.btn.pulse { animation: ctaPulse 0.9s ease-out 2; }
.world-info { padding: 10px 13px 13px; display: grid; gap: 3px; }
.world-info strong { font-size: 15px; }
.world-info span { font-size: 12px; color: var(--muted); }
.world-info em { font-size: 11px; color: #6f83a0; font-style: normal; margin-top: 3px; }

.version { margin-top: 14px; font-size: 11px; color: #5d6f88; font-family: ui-monospace, monospace; }

.cast-wrap { margin: 6px 0 14px; }
.cast-count { float: right; color: var(--amber); }
.cast-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cast-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 168px;
}
.cast-card.met { border-color: rgba(246, 195, 68, 0.5); background: rgba(246, 195, 68, 0.1); }
/* The sprite is readable before you meet them — dimmed and desaturated rather
   than hidden, so the collection shows who is out there — and the card lights up
   in full colour once they have been found. */
.cast-card canvas { opacity: 0.62; filter: grayscale(0.55) contrast(0.95); }
.cast-card.met canvas { opacity: 1; filter: none; }
.cast-card.met { box-shadow: 0 0 0 1px rgba(246, 195, 68, 0.25); }
.cast-card .cast-meta { display: flex; flex-direction: column; line-height: 1.25; }
.cast-card .cast-meta strong { font-size: 13px; }
.cast-card .cast-meta span { font-size: 11px; color: var(--muted); }

/* results */
.win-card { max-width: 560px; text-align: center; }
.stars { font-size: 40px; color: var(--amber); letter-spacing: 4px; margin: 6px 0 14px; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.stats dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stats dd { margin: 4px 0 0; font-size: 20px; font-weight: 700; }
.win-card .menu-row { justify-content: center; }

.board-wrap { margin: 2px 0 16px; text-align: left; }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.board-row {
  display: grid;
  grid-template-columns: 20px 58px 1fr;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
}
.board-row.me {
  border-color: rgba(246, 195, 68, 0.6);
  background: rgba(246, 195, 68, 0.12);
}
.board-row .rank { color: var(--muted); font-weight: 700; }
.board-row .time {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
}
.board-row .meta { color: var(--muted); font-size: 11.5px; }
.board-empty { padding: 9px 11px; color: var(--muted); font-size: 13px; }

/* ---------------- cat-found share card ---------------- */
.cat-found-modal {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(5, 8, 13, 0.64);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: cat-modal-in 0.2s ease-out;
}
.cat-found-card {
  width: min(560px, 100%);
  padding: clamp(24px, 5vw, 40px);
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 195, 68, 0.19), transparent 48%),
    #101622;
  border: 2px solid rgba(246, 195, 68, 0.72);
  border-radius: 24px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.68), 0 0 50px rgba(246, 195, 68, 0.10);
}
.cat-found-kicker {
  color: var(--amber);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.cat-found-card h2 {
  margin: 9px 0 0;
  color: var(--text);
  font-size: clamp(22px, 4vw, 30px);
}
.cat-found-time {
  margin: 5px 0 8px;
  color: #ffd75e;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(58px, 13vw, 92px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.06em;
  line-height: 1;
  text-shadow: 0 5px 28px rgba(246, 195, 68, 0.24);
}
.cat-found-context { margin: 0 0 19px; color: var(--muted); font-size: 14px; }
.cat-found-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 20px;
}
.cat-found-stats div {
  padding: 10px 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.cat-found-stats dt { color: var(--muted); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.cat-found-stats dd { margin: 4px 0 0; font-size: 18px; font-weight: 750; }
.cat-found-actions { display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; }
.cat-found-actions .btn { min-width: 145px; padding: 11px 17px; font-size: 14px; }
.cat-share-status { min-height: 18px; margin: 12px 0 -6px; color: var(--good); font-size: 12px; }
@keyframes cat-modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------------- small screens ---------------- */
@media (max-width: 760px) {
  #topbar { padding: 7px 8px; gap: 6px; }
  .chip.seed { display: none; }
  #checklist {
    top: auto; bottom: 10px; left: 10px; right: 10px;
    width: auto;
    max-height: 128px;
  }
  #item-list {
    grid-auto-flow: column;
    grid-auto-columns: 132px;
    overflow-x: auto;
  }
  #minimap-wrap { display: none; }
  #zoom-controls { bottom: 152px; }
  #toast { bottom: 152px; }
  .cat-found-modal { padding: 12px; }
  .cat-found-card { border-radius: 19px; }
  .cat-found-actions { display: grid; }
  .cat-found-actions .btn { width: 100%; }
}
