/* Meowbino web — cozy premium, warm-paper aesthetic.
   Fredoka (rounded display) + Nunito (body). Warm cream, day-orange & night-dusk accents. */

@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/Fredoka-subset.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/Nunito-subset.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --paper: #fbf3e4;
  --paper-2: #fdf8ee;
  --card: #fffdf8;
  --ink: #4a3c44;
  --ink-soft: #7a6b72;
  --day: #ea7a3d;
  --day-tile: #ffe0ba;
  --day-tile-2: #ffd3a0;
  --night: #7d6ba8;
  --night-tile: #d7cdec;
  --night-tile-2: #c6b8e4;
  --line: #ecdfc9;
  --good: #6fae7c;
  --bad: #e0736e;
  --shadow: 0 10px 30px -14px rgba(120, 82, 45, 0.35);
  --shadow-soft: 0 4px 14px -8px rgba(120, 82, 45, 0.3);
  --radius: 22px;
  --radius-sm: 14px;
  --wrap: 1080px;
  --font-body: 'Nunito', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Fredoka', var(--font-body);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 82% -8%, #fde9d4 0%, rgba(253, 233, 212, 0) 60%),
    radial-gradient(900px 500px at 8% 4%, #f7ecfb 0%, rgba(247, 236, 251, 0) 55%),
    var(--paper);
  line-height: 1.6;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--day);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  color: var(--ink);
  margin: 0 0 0.5em;
}
h1 {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  letter-spacing: -0.01em;
}
h2 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
}
h3 {
  font-size: 1.2rem;
}

.wrap {
  width: min(100% - 2rem, var(--wrap));
  margin-inline: auto;
}
.narrow {
  max-width: 720px;
}

/* ---- header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: saturate(1.4) blur(8px);
  background: rgba(251, 243, 228, 0.82);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--ink);
  font-weight: 600;
}
.brand:hover {
  text-decoration: none;
}
.brand img.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
}
.brand img.brand-word {
  height: 46px;
  width: auto;
  display: block;
}
.nav {
  margin-left: auto;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}
.nav a {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
}
.nav a:hover {
  color: var(--ink);
  background: #fff5e3;
  text-decoration: none;
}
.nav a.cta {
  color: #fff;
  background: var(--day);
  box-shadow: var(--shadow-soft);
}
.nav a.cta:hover {
  background: #e06a2a;
  color: #fff;
}

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  color: #fff;
  background: var(--day);
  box-shadow: var(--shadow);
  transition:
    transform 0.12s ease,
    background 0.15s ease;
}
.btn:hover {
  background: #e06a2a;
  text-decoration: none;
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn.ghost {
  color: var(--ink);
  background: var(--card);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line);
}
.btn.ghost:hover {
  background: #fff5e3;
}
.btn.small {
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
}

/* ---- hero ---- */
.hero {
  padding: clamp(2rem, 6vw, 4rem) 0 1.5rem;
  text-align: center;
}
.eyebrow {
  display: inline-block;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--night);
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}
.hero p.lede {
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 40ch;
  margin: 0.8rem auto 1.4rem;
}
.cta-row {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---- cards / sections ---- */
section {
  padding: 1.6rem 0;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow-soft);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.rule-card h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.rule-num {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: var(--day-tile);
  color: var(--day);
  font-family: var(--font-display);
  font-weight: 600;
}

/* meet-the-cats */
.cats {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
}
.cat-chip {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 1.2rem 0.8rem 0.8rem;
  box-shadow: var(--shadow-soft);
}
.cat-chip .pic {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  display: grid;
  place-items: center;
}
.cat-chip.day .pic {
  background: var(--day-tile);
}
.cat-chip.night .pic {
  background: var(--night-tile);
}
.cat-chip img {
  width: 62px;
  height: 62px;
}
.cat-chip b {
  font-family: var(--font-display);
  font-weight: 600;
}
.cat-chip span {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* ---- board widget ---- */
.board-shell {
  max-width: 560px;
  margin: 0 auto;
}
.board-frame {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(0.6rem, 2.5vw, 1.1rem);
  box-shadow: var(--shadow);
}
.board {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  display: grid;
  gap: clamp(3px, 1.2vw, 6px);
  touch-action: manipulation;
}
.board.n8 {
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}
.cell {
  position: relative;
  border: none;
  padding: 0;
  border-radius: clamp(8px, 2.2vw, 14px);
  background: #f6ecda;
  box-shadow: inset 0 0 0 1px rgba(120, 82, 45, 0.06);
  cursor: pointer;
  overflow: hidden;
  transition:
    background 0.14s ease,
    transform 0.08s ease;
  touch-action: manipulation;
}
.cell:active {
  transform: scale(0.96);
}
.cell .art {
  position: absolute;
  inset: 8%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity 0.14s ease,
    transform 0.18s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.cell.sun {
  background: var(--day-tile);
}
.cell.moon {
  background: var(--night-tile);
}
.cell.sun .art {
  background-image: image-set(
    url('/images/cat_day-160.webp') type('image/webp'),
    url('/images/cat_day-320.png') type('image/png')
  );
  background-image: -webkit-image-set(url('/images/cat_day-160.webp') 1x);
  opacity: 1;
  transform: scale(1);
}
.cell.moon .art {
  background-image: image-set(
    url('/images/cat_night-160.webp') type('image/webp'),
    url('/images/cat_night-320.png') type('image/png')
  );
  background-image: -webkit-image-set(url('/images/cat_night-160.webp') 1x);
  opacity: 1;
  transform: scale(1);
}
.cell.given {
  cursor: default;
  box-shadow:
    inset 0 0 0 2px rgba(120, 82, 45, 0.16),
    inset 0 0 0 1px rgba(120, 82, 45, 0.06);
}
.cell.given::after {
  /* tiny paw pin marking a locked clue — not colour-only */
  content: '';
  position: absolute;
  top: 6%;
  right: 6%;
  width: 16%;
  height: 16%;
  border-radius: 999px;
  background: rgba(74, 60, 68, 0.28);
  box-shadow:
    -0.32em -0.1em 0 -0.14em rgba(74, 60, 68, 0.28),
    0.32em -0.1em 0 -0.14em rgba(74, 60, 68, 0.28),
    0 -0.34em 0 -0.14em rgba(74, 60, 68, 0.28);
}
.cell.bad {
  animation: nudge 0.4s ease;
}
.cell.bad::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 3px var(--bad),
    0 0 12px -2px rgba(224, 115, 110, 0.7);
  pointer-events: none;
}
@keyframes nudge {
  25% {
    transform: translateX(-2px);
  }
  75% {
    transform: translateX(2px);
  }
}

/* =/× markers between two cells (inline SVG glyphs, geometrically centered) */
.marker {
  position: absolute;
  z-index: 4;
  width: clamp(21px, 5.5vw, 30px);
  height: clamp(21px, 5.5vw, 30px);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-soft);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.marker svg {
  width: 64%;
  height: 64%;
  display: block;
}
.marker svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
.marker.bad {
  color: #fff;
  background: var(--bad);
  border-color: var(--bad);
}

.board-controls {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.board-status {
  text-align: center;
  min-height: 1.5em;
  margin: 0.7rem 0 0;
  font-weight: 700;
  color: var(--ink-soft);
}
.board-status.win {
  color: var(--good);
}
.board-noscript {
  text-align: center;
  color: var(--ink-soft);
  padding: 1rem;
}

/* win celebration */
.board.win .cell.sun .art,
.board.win .cell.moon .art {
  animation: wiggle 0.6s ease;
}
@keyframes wiggle {
  20% {
    transform: scale(1.08) rotate(-6deg);
  }
  60% {
    transform: scale(1.08) rotate(6deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to {
    transform: translateY(110vh) rotate(540deg);
    opacity: 0.9;
  }
}

/* ---- prose (legal / how-to) ---- */
.prose h2 {
  margin-top: 1.6rem;
}
.prose p,
.prose li {
  color: #59484f;
}
.prose ul {
  padding-left: 1.2rem;
}
.updated {
  color: var(--ink-soft);
  font-style: italic;
}

/* mini demo grids (how-to-play) */
.mini {
  display: inline-grid;
  gap: 3px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow-soft);
  vertical-align: middle;
}
.mini i {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #f6ecda;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  color: var(--ink-soft);
}
.mini i.s {
  background: var(--day-tile);
}
.mini i.m {
  background: var(--night-tile);
}
.mini i.x {
  outline: 2px solid var(--bad);
  outline-offset: -2px;
}

/* download badges */
.badges {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}
.badge-ph {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--ink);
  color: #fff;
  border-radius: 14px;
  padding: 0.7rem 1.2rem;
  font-family: var(--font-display);
  opacity: 0.55;
  cursor: not-allowed;
}
.badge-ph small {
  display: block;
  font-size: 0.7rem;
  opacity: 0.8;
  font-family: var(--font-body);
}
.badge-ph b {
  font-size: 1.1rem;
}
.soon {
  font-size: 0.72rem;
  background: var(--day);
  color: #fff;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 800;
}

/* section helpers */
.center {
  text-align: center;
}
.pill-note {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  color: var(--night);
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}
.divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 1.5rem 0;
}

/* ---- footer ---- */
.site-footer {
  margin-top: 2.5rem;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}
.site-footer .wrap {
  padding: 2rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: flex-start;
  justify-content: space-between;
}
.foot-brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--ink);
}
.foot-brand img {
  height: 36px;
  width: auto;
  display: block;
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}
.foot-links a {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.92rem;
}
.foot-note {
  color: var(--ink-soft);
  font-size: 0.85rem;
  width: 100%;
}
.lang-select {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}
.lang-select .lang-globe {
  font-size: 1rem;
  line-height: 1;
}
.lang-select select {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  max-width: 100%;
}
.lang-select select:focus-visible {
  outline: 2px solid var(--day);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .nav a:not(.cta) {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
  }
  .brand span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  .cell .art,
  .board.win .cell .art {
    animation: none !important;
    transition: none !important;
  }
}
