* {
  box-sizing: border-box;
}

:root {
  --pink-50: #fff8fb;
  --pink-100: #ffeef5;
  --pink-200: #ffd9e8;
  --pink-300: #ffc4dc;
  --pink-400: #f7a9c7;
  --pink-500: #ed8eb5;
  --pink-700: #b9517c;
  --text: #6d4053;
  --white: #ffffff;
  --shadow: 0 18px 45px rgba(207, 126, 158, 0.22);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, #fff 0 12%, transparent 13%),
    linear-gradient(145deg, #fff9fc 0%, #ffeaf3 50%, #fff5fa 100%);
}

button {
  font: inherit;
}

.game-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.game-card {
  width: min(92vw, 470px);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 32px;
  padding: 30px;
  text-align: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  position: relative;
  z-index: 2;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--pink-700);
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 9vw, 4rem);
  line-height: 1;
  color: #d96f9d;
  letter-spacing: -0.06em;
}

.subtitle {
  margin: 10px 0 22px;
  color: #8a5b6d;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.score-box {
  background: var(--pink-50);
  border: 1px solid var(--pink-200);
  border-radius: 18px;
  padding: 12px 8px;
}

.score-label {
  display: block;
  font-size: 0.72rem;
  color: #9d6b7f;
  margin-bottom: 3px;
}

.score-box strong {
  font-size: 1.25rem;
  color: var(--pink-700);
}

.status {
  min-height: 28px;
  margin: 4px 0 16px;
  font-weight: 800;
  color: #a94d75;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.cell {
  aspect-ratio: 1;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(145deg, #fff, #ffeaf3);
  box-shadow:
    inset 0 0 0 1px rgba(240, 174, 199, 0.45),
    0 8px 18px rgba(222, 142, 172, 0.14);
  color: #d96f9d;
  font-size: clamp(2rem, 11vw, 4rem);
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.cell:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  background: #fff4f8;
  box-shadow:
    inset 0 0 0 1px rgba(240, 174, 199, 0.6),
    0 12px 24px rgba(222, 142, 172, 0.2);
}

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

.cell.x {
  color: #e982ad;
}

.cell.o {
  color: #c66d9a;
}

.cell.win {
  animation: pop 480ms ease-in-out infinite alternate;
  background: #ffdce9;
}

.reset-button {
  width: 100%;
  margin-top: 18px;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  background: #f2a2c1;
  color: white;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(219, 117, 158, 0.22);
  transition: transform 150ms ease, filter 150ms ease;
}

.reset-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
}

.tiny-note {
  margin: 12px 0 0;
  font-size: 0.76rem;
  color: #a37788;
}

.flower {
  position: absolute;
  color: rgba(240, 164, 193, 0.5);
  font-size: 7rem;
  animation: float 5s ease-in-out infinite;
  user-select: none;
}

.flower-one {
  top: 8%;
  left: 7%;
  transform: rotate(-12deg);
}

.flower-two {
  right: 8%;
  bottom: 6%;
  animation-delay: 1.4s;
}

@keyframes pop {
  from { transform: scale(1); }
  to { transform: scale(1.07); }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-14px) rotate(8deg); }
}

@media (max-width: 520px) {
  .game-card {
    padding: 24px 18px;
    border-radius: 26px;
  }

  .cell {
    border-radius: 18px;
  }

  .flower {
    font-size: 4.5rem;
  }
}


.petal-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 20;
}

.petal {
  position: absolute;
  top: -40px;
  width: 18px;
  height: 28px;
  background: #ffc4dc;
  border-radius: 70% 30% 70% 30%;
  opacity: 0;
  transform: rotate(0deg);
  animation: petalFall 1.7s ease-out forwards;
}

.petal:nth-child(3n) {
  background: #ffe0ec;
}

.petal:nth-child(4n) {
  background: #f7a9c7;
}

.celebration-message {
  min-height: 34px;
  margin: -4px 0 12px;
  font-size: 0.96rem;
  font-weight: 800;
  color: #c45f8a;
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
}

.celebration-message.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@keyframes petalFall {
  0% {
    opacity: 0;
    transform: translateY(-20px) rotate(0deg) scale(0.8);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(110vh) rotate(540deg) scale(1.1);
  }
}
