/* ---------- Meowdoku ---------- */

.stage { justify-content: center; gap: 10px; padding: 8px 10px; }

/* ---------- status bar ---------- */

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  font-variant-numeric: tabular-nums;
}

.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  font-size: 14px;
  font-weight: 700;
}
.chip--time { color: var(--text-2); }
.chip--best { color: var(--muted); }
.chip--cats { color: var(--text-2); }

/* Four chips is one too many below about 360px. "3/6" says "cats" well
   enough on its own, so the word goes screen-reader-only rather than away. */
@media (max-width: 359px) {
  .statusbar { gap: 5px; }
  .chip { padding: 5px 9px; font-size: 13px; }
  .chip--cats span {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
}

/* Hearts: filled while you still have them, hollow once spent. */
.chip--lives { gap: 3px; padding: 5px 10px; }
.chip--lives svg { width: 16px; height: 16px; display: block; color: var(--bad); }
.chip--lives svg.is-spent { color: var(--surface-3); }
.chip--lives.is-low svg:not(.is-spent) { animation: pulse-heart .9s var(--ease) infinite; }

@keyframes pulse-heart {
  50% { transform: scale(1.16); }
}

/* ---------- board ---------- */

.board-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.board {
  --wall: #0b0d11;
  --seam: rgb(255 255 255 / .06);
  display: grid;
  grid-template-columns: repeat(var(--n, 6), var(--cell, 44px));
  grid-auto-rows: var(--cell, 44px);
  border-radius: var(--r-sm);
  overflow: hidden;
  position: relative;
  /* The whole board is a drag surface, so the page must not scroll with it. */
  touch-action: none;
  box-shadow: 0 0 0 2px var(--wall), 0 10px 30px rgb(0 0 0 / .4);
}

/* One muted tint per region. Each state names its own --rc and everything
   else reads it, so the cat's eyes are always punched out in exactly the
   colour behind them. Deliberately untransitioned: a fading background would
   drift away from the eyes for the length of the fade. */
.mcell {
  --rc: color-mix(in srgb, var(--hue) 30%, var(--surface));
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--rc);
  color: var(--text);
}
.mcell:active { --rc: color-mix(in srgb, var(--hue) 44%, var(--surface)); }

.g0 { --hue: #7aa2ff; }
.g1 { --hue: #e0574a; }
.g2 { --hue: #55b972; }
.g3 { --hue: #d9a92f; }
.g4 { --hue: #a97ae0; }
.g5 { --hue: #3fae94; }
.g6 { --hue: #e08a4a; }
.g7 { --hue: #d97ab0; }
.g8 { --hue: #6f7c93; }

/* ---------- cell contents ---------- */

.mcell svg { width: 74%; height: 74%; display: block; }

/* A pencilled-out cell: dimmed, with a small cross. */
.mcell.is-x { --rc: color-mix(in srgb, var(--hue) 15%, var(--surface)); }
.mcell.is-x svg {
  width: 34%;
  height: 34%;
  color: color-mix(in srgb, var(--hue) 55%, var(--muted));
}

.mcell.is-cat { --rc: color-mix(in srgb, var(--hue) 48%, var(--surface)); }
.mcell.is-cat svg { animation: cat-in .22s var(--ease); }

.cat__head { fill: var(--text); }
/* Eyes and nose are cut back to the cell colour rather than drawn on. */
.cat__cut  { fill: var(--rc); }

@keyframes cat-in {
  from { transform: scale(.5); opacity: 0; }
}

/* A cat placed by the hint button, so it reads as not-quite-yours. */
.mcell.is-hint { box-shadow: inset 0 0 0 3px var(--accent) !important; }

/* Rule break: flash the offender and whoever it clashed with. */
.mcell.is-bad { animation: bad-flash .5s var(--ease); }

@keyframes bad-flash {
  0%, 100% { background: var(--rc); }
  20%, 60% { background: var(--bad); }
}

.mcell.is-clash svg .cat__head { animation: clash-ink .5s var(--ease); }

@keyframes clash-ink {
  20%, 60% { fill: var(--bad); }
}

/* Curtain call once the board is solved. */
.board.is-won .mcell.is-cat svg { animation: cat-cheer .5s var(--ease); }
.board.is-won .mcell.is-cat:nth-child(2n) svg { animation-delay: .07s; }
.board.is-won .mcell.is-cat:nth-child(3n) svg { animation-delay: .14s; }

@keyframes cat-cheer {
  40% { transform: translateY(-14%) scale(1.14); }
}

/* ---------- overlay ---------- */

.overlay {
  position: absolute;
  inset: -8px;
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgb(14 16 20 / .88);
  z-index: 5;
  animation: fade-in .25s var(--ease);
}
.overlay[hidden] { display: none; }
.overlay b { font-size: 25px; font-weight: 800; }
.overlay p { margin: 0; font-size: 14px; color: var(--text-2); text-align: center; }
.overlay .overlay__btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------- controls ---------- */

.helpers { display: flex; gap: 8px; }
.helpers .btn { min-height: 40px; padding: 0 16px; font-size: 14px; }

.pad { display: flex; gap: 8px; justify-content: center; }
.pad .btn { flex: 1 1 0; min-width: 0; padding: 0 6px; font-size: 14px; }
.pad .btn.is-on { background: var(--accent); border-color: transparent; color: #0b0e14; }
