:root {
  color-scheme: dark;
  --bg: #10170f;
  --panel: rgba(16, 23, 15, 0.74);
  --text: #fff8df;
  --muted: #cdd7b8;
  --grass: #8dd34b;
  --play: #f4c430;
  --mint: #43d48c;
  --ink: #050805;
  --line: rgba(255, 248, 223, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 12%, rgba(141, 211, 75, 0.28), transparent 28rem),
    radial-gradient(circle at 86% 20%, rgba(244, 196, 48, 0.22), transparent 24rem),
    linear-gradient(135deg, #0b120b 0%, var(--bg) 46%, #171106 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#confetti {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.page-shell {
  width: min(1120px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 36px);
  display: grid;
  gap: 18px;
  align-content: center;
}

.hero {
  min-height: calc(100svh - 132px);
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(300px, 1fr);
  gap: clamp(22px, 5vw, 64px);
  align-items: center;
}

.photo-stage {
  position: relative;
  width: min(100%, 520px);
  justify-self: center;
  aspect-ratio: 41 / 51;
  border: 1px solid rgba(255, 248, 223, 0.26);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  animation: floatIn 760ms ease-out both;
}

.photo-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: inherit;
  pointer-events: none;
}

.photo-stage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.scanline {
  position: absolute;
  left: 0;
  right: 0;
  top: -24%;
  height: 20%;
  z-index: 2;
  background: linear-gradient(180deg, transparent, rgba(255, 248, 223, 0.26), transparent);
  animation: scan 4s ease-in-out infinite 1.2s;
  mix-blend-mode: screen;
}

.copy {
  max-width: 600px;
  animation: riseIn 700ms ease-out 120ms both;
}

.eyebrow,
.small-label {
  margin: 0 0 12px;
  color: var(--play);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.18rem, 5.8vw, 5.65rem);
  line-height: 0.94;
  letter-spacing: 0;
  text-wrap: balance;
}

.lead {
  max-width: 560px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: clamp(1.03rem, 2.3vw, 1.26rem);
  line-height: 1.5;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chips span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(255, 248, 223, 0.08);
  color: #f9ffd8;
  font-size: 0.92rem;
  backdrop-filter: blur(10px);
}

.moment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.moment h2 {
  max-width: 780px;
  margin-bottom: 0;
  color: #ecf7d0;
  font-size: clamp(1.15rem, 2.5vw, 2rem);
  line-height: 1.14;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(4, 34px);
  gap: 8px;
  flex: 0 0 auto;
}

.swatch {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.18);
}

.grass {
  background: var(--grass);
}

.play {
  background: var(--play);
}

.night {
  background: #10170f;
}

.light {
  background: #fff8df;
}

.game-zone {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(300px, 430px);
  gap: clamp(20px, 4vw, 48px);
  align-items: center;
  border-top: 1px solid var(--line);
  padding: clamp(22px, 5vw, 58px) 0 clamp(28px, 5vw, 68px);
}

.game-copy h2 {
  max-width: 680px;
  margin-bottom: 14px;
  color: #ecf7d0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.96;
  letter-spacing: 0;
  text-wrap: balance;
}

.game-copy p:not(.small-label) {
  max-width: 520px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.game-panel {
  width: 100%;
  border: 1px solid rgba(255, 248, 223, 0.2);
  border-radius: 8px;
  padding: clamp(14px, 3vw, 20px);
  background: linear-gradient(180deg, rgba(255, 248, 223, 0.1), rgba(5, 8, 5, 0.24));
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.28);
}

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

.scoreboard div {
  min-width: 0;
  border: 1px solid rgba(255, 248, 223, 0.15);
  border-radius: 8px;
  padding: 10px 8px;
  background: rgba(0, 0, 0, 0.18);
  text-align: center;
}

.scoreboard span {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.78rem;
}

.scoreboard strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 1.55rem;
}

.game-status {
  min-height: 30px;
  margin-bottom: 12px;
  color: var(--play);
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: min(100%, 390px);
  margin: 0 auto;
  aspect-ratio: 1;
}

.cell {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 248, 223, 0.22);
  border-radius: 8px;
  background: rgba(255, 248, 223, 0.08);
  color: var(--text);
  cursor: pointer;
  font: 900 clamp(2.4rem, 16vw, 5rem) / 1 Inter, ui-sans-serif, system-ui, sans-serif;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
  -webkit-tap-highlight-color: transparent;
}

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

.cell:not(:disabled):hover {
  border-color: rgba(244, 196, 48, 0.72);
  background: rgba(244, 196, 48, 0.12);
}

.cell.mark-x {
  color: var(--play);
  text-shadow: 0 0 18px rgba(244, 196, 48, 0.34);
}

.cell.mark-o {
  color: var(--mint);
  text-shadow: 0 0 18px rgba(67, 212, 140, 0.34);
}

.cell.win {
  border-color: rgba(255, 248, 223, 0.78);
  background: rgba(141, 211, 75, 0.22);
}

.reset-game {
  display: block;
  width: min(100%, 390px);
  margin: 14px auto 0;
  border: 1px solid rgba(255, 248, 223, 0.22);
  border-radius: 8px;
  padding: 13px 16px;
  background: var(--play);
  color: var(--ink);
  cursor: pointer;
  font: 900 1rem / 1 Inter, ui-sans-serif, system-ui, sans-serif;
}

.reset-game:active {
  transform: translateY(1px);
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(18px) rotate(-1.5deg) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(-0.4deg) scale(1);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scan {
  0%,
  42% {
    transform: translateY(0);
    opacity: 0;
  }
  52% {
    opacity: 1;
  }
  78%,
  100% {
    transform: translateY(720%);
    opacity: 0;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 14px;
    align-content: start;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 20px;
    padding-top: 12px;
  }

  .photo-stage {
    width: min(100%, 390px);
    max-height: 58svh;
  }

  h1 {
    font-size: clamp(2.05rem, 12vw, 3.4rem);
  }

  .moment {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 18px;
  }

  .game-zone {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .game-panel {
    padding: 12px;
  }

  .scoreboard {
    gap: 6px;
  }

  .scoreboard div {
    padding: 9px 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
