/* Cat Creature Match — festive, uncluttered, big tap targets. */
:root {
  --green-dark: #0e3a29;
  --green: #14533a;
  --cream: #fff6e8;
  --cream-dim: #f3e2c6;
  --gold: #e2b43a;
  --gold-deep: #b88716;
  --ink: #1a241c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Avenir Next", "Segoe UI", "Trebuchet MS", "Gill Sans", sans-serif;
  --display: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--cream);
  background:
    radial-gradient(circle at 20% 0%, #1d7a54 0%, transparent 42%),
    radial-gradient(circle at 100% 80%, #0a2a1d 0%, transparent 46%),
    linear-gradient(180deg, #14533a 0%, #0e3a29 100%);
  padding: calc(12px + var(--safe-top)) 16px calc(20px + var(--safe-bottom));
  -webkit-tap-highlight-color: transparent;
}

.sparkles {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle, #ffe9a0 1.2px, transparent 1.4px),
    radial-gradient(circle, #fff8ee 1px, transparent 1.2px);
  background-size: 120px 160px, 90px 130px;
  background-position: 20px 10px, 70px 80px;
  opacity: 0.35;
  z-index: 0;
}

.top,
main {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
}

.top {
  text-align: center;
  margin-bottom: 12px;
}

h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.7rem, 6vw, 2.6rem);
  letter-spacing: 0.02em;
  margin: 0.2em 0 0.15em;
  color: #fff8ee;
  text-shadow: 0 2px 0 #0a2a1d, 0 6px 16px rgba(0, 0, 0, 0.3);
}

.status {
  margin: 0;
  font-size: clamp(1rem, 3.4vw, 1.2rem);
  color: var(--cream-dim);
  min-height: 1.4em;
}

.hidden {
  display: none !important;
}

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  background: rgba(8, 32, 22, 0.35);
  border: 2px solid rgba(226, 180, 58, 0.35);
  border-radius: 24px;
  padding: 28px 22px 32px;
  box-shadow: var(--shadow);
}

.lead {
  font-size: clamp(1.05rem, 3.6vw, 1.3rem);
  margin: 0;
  line-height: 1.4;
}

.size-choices {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(100%, 360px);
}

.btn {
  appearance: none;
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: 0.85em 1.6em;
  min-height: 64px;
  min-width: 180px;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-size {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1em;
  width: 100%;
  min-height: 88px;
  border-radius: 22px;
  line-height: 1.15;
}

.btn-sub {
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0.85;
}

.btn-primary {
  color: #1a241c;
  background: linear-gradient(180deg, #ffe9a0 0%, var(--gold) 55%, var(--gold-deep) 100%);
  box-shadow: 0 4px 0 #7a5a0c, 0 8px 18px rgba(0, 0, 0, 0.28);
}

.btn-secondary {
  color: #fff8ee;
  background: rgba(8, 32, 22, 0.45);
  border: 3px solid var(--gold);
  box-shadow: 0 4px 0 #7a5a0c, 0 8px 18px rgba(0, 0, 0, 0.2);
}

.btn-primary:active,
.btn-secondary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #7a5a0c, 0 4px 10px rgba(0, 0, 0, 0.28);
}

.game-screen {
  width: 100%;
}

.board {
  --gap: clamp(10px, 2.4vw, 18px);
  --cols: 3;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap);
  width: min(100%, 640px);
  margin: 0 auto;
}

.board[data-pairs="3"] {
  --cols: 2;
  width: min(100%, 520px);
}

.board[data-pairs="6"] {
  --cols: 3;
}

@media (min-width: 700px) {
  .board[data-pairs="6"] {
    --cols: 4;
  }
}

.card {
  appearance: none;
  display: block;
  width: 100%;
  height: auto;
  padding: 0;
  padding-bottom: 100%;
  border: 0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  position: relative;
}

.card:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.card-inner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
}

.face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* 2D show/hide so face-down cards stay visible on phones and in screenshots. */
.face.back {
  opacity: 1;
  background: #b3141c;
}

.face.front {
  opacity: 0;
  background: #14533a;
}

.card.is-flipped .face.back,
.card.is-matched .face.back {
  opacity: 0;
}

.card.is-flipped .face.front,
.card.is-matched .face.front {
  opacity: 1;
}

.card.is-matched {
  cursor: default;
}

.card.is-matched .face.front {
  box-shadow: 0 0 0 3px #ffe9a0, 0 8px 18px rgba(0, 0, 0, 0.28);
}

@media (prefers-reduced-motion: no-preference) {
  .face {
    transition: opacity 0.28s ease;
  }
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  background: rgba(8, 24, 18, 0.62);
}

.overlay-card {
  width: min(100%, 420px);
  max-height: 100%;
  overflow: auto;
  background: var(--cream);
  color: var(--ink);
  border-radius: 24px;
  padding: 22px 20px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 4px solid var(--gold);
}

.overlay-card img {
  width: min(220px, 56vw);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  display: block;
  margin: 0 auto 10px;
  background: #14533a;
}

.overlay-card h2 {
  font-family: var(--display);
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  margin: 0 0 0.1em;
  color: #7a0c14;
}

.real-name {
  margin: 0 0 0.6em;
  font-size: 1rem;
  color: #4d5a50;
}

.type-badge {
  display: inline-block;
  margin: 0 0 0.5em;
  padding: 0.2em 0.8em;
  border-radius: 999px;
  background: #14533a;
  color: #fff6e8;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
}

.power {
  margin: 0 0 0.7em;
  font-size: 1rem;
  line-height: 1.35;
  color: #3a4a40;
}

.blurb {
  margin: 0 0 1.1em;
  font-size: 1.05rem;
  line-height: 1.4;
}

.win-panel h2 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  margin: 0;
  color: #ffe9a0;
}

.win-emoji {
  font-size: 3rem;
  margin: 0;
}

.win-gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 520px;
}

.win-gallery img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #0e3a29;
}

.size-choices-win {
  width: min(100%, 360px);
  margin-top: 4px;
}

.size-choices-win .btn-size {
  min-height: 72px;
}


.real-name { display: none; }

.relation {
  margin: 0 0 0.6em;
  font-size: 1.05rem;
  font-weight: 700;
  color: #14533a;
}

.index-screen {
  width: 100%;
}

.index-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.index-top h2 {
  font-family: var(--display);
  font-size: clamp(1.4rem, 5vw, 2rem);
  margin: 0;
  color: #ffe9a0;
}

.btn-back {
  min-width: 0;
  min-height: 48px;
  padding: 0.5em 1.1em;
  font-size: 1.05rem;
}

.index-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.family {
  background: rgba(8, 32, 22, 0.35);
  border: 2px solid rgba(226, 180, 58, 0.35);
  border-radius: 24px;
  padding: 18px 16px 20px;
}

.family-header {
  font-family: var(--display);
  font-size: 1.45rem;
  margin: 0 0 12px;
  color: #ffe9a0;
  text-align: center;
}

.family-mom {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.family-kittens,
.family-friends {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.family-label {
  width: 100%;
  text-align: center;
  margin: 4px 0 2px;
  font-size: 0.95rem;
  color: var(--cream-dim);
}

.creature-chip {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  width: 92px;
  cursor: pointer;
  touch-action: manipulation;
  text-align: center;
  font-family: inherit;
}

.creature-chip.mom-chip {
  width: 120px;
}

.creature-chip img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #0e3a29;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

.creature-chip .chip-name {
  display: block;
  margin-top: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}

.creature-chip:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 16px;
}
