:root {
  --cream: #fff6e9;
  --cream-2: #ffecd1;
  --ginger: #ee8a3d;
  --ginger-dark: #d16a1f;
  --brown: #5b3a29;
  --brown-soft: #8a6250;
  --shadow-cat: #2f2a2e;
  --win-glow: #ffd166;
  --radius: 16px;
  font-family: "Baloo 2", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--brown);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

.paw-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.35;
  background-image: radial-gradient(circle at 2px 2px, var(--ginger) 2px, transparent 2.5px);
  background-size: 42px 42px;
  background-position: 0 0, 21px 21px;
}

.banner {
  position: relative;
  width: 100%;
  max-width: 640px;
  height: 200px;
  border-radius: 0 0 24px 24px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(91, 58, 41, 0.2);
  background: linear-gradient(135deg, var(--ginger), var(--ginger-dark));
}

.banner-cat {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.9;
}

.banner-cat.hidden-img {
  display: none;
}

.banner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.45));
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.banner-overlay h1 {
  margin: 0;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.subtitle {
  margin: 4px 0 0;
  font-weight: 500;
  opacity: 0.95;
}

main {
  width: 100%;
  max-width: 640px;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.status-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--cream-2);
  border: 2px solid transparent;
  font-weight: 700;
  transition: all 0.2s ease;
}

.player-chip.active {
  border-color: var(--ginger);
  background: #fff;
  box-shadow: 0 2px 8px rgba(238, 138, 61, 0.35);
  transform: translateY(-1px);
}

.chip-mark {
  font-size: 1.4rem;
}

.status {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--brown-soft);
  padding: 8px;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(91, 58, 41, 0.25);
}

.cell {
  background: var(--cream);
  border: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  padding: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.cell:hover:not(:disabled) {
  background: var(--cream-2);
}

.cell:active:not(:disabled) {
  transform: scale(0.94);
}

.cell:disabled {
  cursor: default;
}

.cell.win {
  background: var(--win-glow);
  animation: pop 0.4s ease;
}

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.new-game-btn {
  border: none;
  background: var(--ginger);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 24px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(209, 106, 31, 0.4);
  transition: background 0.15s ease, transform 0.1s ease;
}

.new-game-btn:hover {
  background: var(--ginger-dark);
}

.new-game-btn:active {
  transform: scale(0.97);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(47, 42, 46, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
  transition: opacity 0.2s ease;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  background: var(--cream);
  border-radius: 20px;
  padding: 20px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.overlay-cat {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 14px;
  background: var(--cream-2);
}

.overlay-cat.hidden-img {
  display: none;
}

.overlay-text {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--brown);
}

@media (max-width: 400px) {
  .banner-overlay h1 {
    font-size: 2rem;
  }
  .player-chip .chip-name {
    display: none;
  }
}
