@import url("https://fonts.googleapis.com/css2?family=EB+Garamond:wght@400;600&family=Great+Vibes&family=UnifrakturMaguntia&family=VT323&display=swap");



* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 16px;

  display: grid;
  place-items: center;

  background: #201113;
  color: #f5eee8;

  font-family: "EB Garamond", Georgia, serif;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:focus-visible {
  outline: 3px solid #ff9a9f;
  outline-offset: 5px;
}



.game {
  width: min(100%, 520px);
  min-height: 700px;
  padding: 50px 55px 45px;
  text-align: center;

  background-color: #251f20;
  background-image: url("../assets/rose-thorn-border.png");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.eyebrow {
  margin: 0 0 12px;

  color: #c4aaa7;
  font-family: "VT323", monospace;
  font-size: 1rem;
  letter-spacing: 0.2em;
}

h1 {
  margin: 0;

  font-family: "UnifrakturMaguntia", Georgia, serif;
  font-size: clamp(1.8rem, 7.5vw, 2.75rem);
  font-weight: normal;
  line-height: 1.15;
}

.tagline {
  margin: 10px 0 10px;

  color: #f26569;
  font-family: "Great Vibes", cursive;
  font-size: 1.35rem;
}



#entrance {
  padding-top: 25px;
}

.invitation {
  margin: 20px 0 0;

  font-family: "Great Vibes", cursive;
  font-size: 1.75rem;
}

.heart-button {
  width: min(100%, 300px);
  margin: 0 auto;
  padding: 0;
  border: none;

  display: flex;
  flex-direction: column;
  align-items: center;

  background: transparent;
  transition: transform 0.2s, filter 0.2s;
}

.heart-button img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.heart-button span {
  margin-top: -20px;

  color: #ff858b;
  font-family: "VT323", monospace;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
}

.heart-button:hover {
  transform: scale(1.04);
  filter: drop-shadow(0 0 12px #e9294a70);
}

.entrance-note {
  margin-top: 30px;
  color: #c4aaa7;
}

#entrance.leaving {
  pointer-events: none;
  animation: fade-out 0.4s forwards;
}

#game-screen.appearing {
  animation: fade-in 0.4s both;
}



.scoreboard {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.player {
  font-family: "UnifrakturMaguntia", Georgia, serif;
  font-size: 1.3rem;
  opacity: 0.55;
  transition: opacity 0.2s;
}

.player.active {
  opacity: 1;
}

#love-label {
  color: #ff666e;
}

.score {
  margin: 0;
  font-family: "VT323", monospace;
  font-size: 1.8rem;
}

.separator {
  margin: 0 5px;
  color: #c4aaa7;
}

.score-pop {
  display: inline-block;
  animation: score-pop 0.4s;
}

.turn {
  margin: 14px 0 18px;

  color: #c4aaa7;
  font-family: "VT323", monospace;
  font-size: 1.2rem;
}



.board {
  width: min(100%, 270px);
  aspect-ratio: 1;
  margin: 0 auto;

  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;

  border: 4px solid #e7ded8;
  background: #e7ded8;
}

.cell {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border: none;

  display: grid;
  place-items: center;

  background: #2e2425;
  transition: background 0.2s;
}

.cell:hover:not(:disabled) {
  background: #493235;
}

.cell:disabled {
  cursor: default;
  opacity: 1;
}



.piece {
  display: block;
  animation: place-piece 0.3s ease-out;
}

.heart-piece {
  position: relative;
  width: 60px;
  height: 60px;
  overflow: hidden;
}

.heart-piece img {
  position: absolute;
  top: 50%;
  left: 50%;

  width: 190px;
  height: 190px;
  max-width: none;

  transform: translate(-50%, -50%);
  image-rendering: pixelated;
}

.dagger-piece img {
  display: block;
  width: 48px;
  height: 48px;

  transform: rotate(-45deg);
  filter: invert(95%) sepia(9%);
}

.cell.winner::after {
  content: "";
  position: absolute;
  inset: 6px;

  border: 3px solid #ff323c;
  pointer-events: none;

  animation: glow 1.5s infinite;
}



.result {
  min-height: 65px;
  margin-top: 22px;
}

h2 {
  margin: 0 0 4px;

  color: #ff6268;
  font-family: "UnifrakturMaguntia", Georgia, serif;
  font-size: 1.6rem;
  font-weight: normal;
}

.result p {
  margin: 0;
  color: #c4aaa7;
}

.new-round {
  padding: 11px 11px;
  border: 2px solid #eee4df;

  background: transparent;
  font-family: "UnifrakturMaguntia", Georgia, serif;
  font-size: 1.4rem;

  transition: background 0.2s, border-color 0.2s;
}

.new-round:hover {
  background: #491e24;
  border-color: #ff6268;
}

.new-round.ready {
  border-color: #ff555e;
  animation: glow 1.5s infinite;
}

footer {
  margin-top: 15px;

  display: flex;
  justify-content: center;
  gap: 20px;
}

footer button {
  padding: 5px 0;
  border: none;

  background: transparent;
  color: #c4aaa7;
  font-size: 0.9rem;
}

#home a {
  padding: 5px 0;
  border: none;
  background: transparent;
  color: #c4aaa7;
  text-decoration: none;
  font-size: 0.9rem;
}

footer button:hover {
  color: white;
  text-decoration: underline;
}

#home a:hover {
  color: white;
  text-decoration: underline;
}

/* ANIMATIONS */

@keyframes place-piece {
  0% {
    transform: scale(0);
  }

  75% {
    transform: scale(1.15);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes glow {
  50% {
    box-shadow: 0 0 15px #ff293960;
  }
}

@keyframes score-pop {
  50% {
    transform: translateY(-3px) scale(1.2);
    color: #ff686e;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
    transform: scale(1.05);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* SMALL SCREENS */

@media (max-width: 480px) {
  body {
    padding: 12px;
  }

  .game {
    padding: 45px 28px 40px;
  }

  .tagline {
    font-size: 1.2rem;
  }

  .invitation {
    font-size: 1.5rem;
  }

  .scoreboard {
    gap: 16px;
  }

  .heart-piece {
    width: 50px;
    height: 50px;
  }

  .heart-piece img {
    width: 165px;
    height: 165px;
  }
}

/* Respect the player's motion preference. */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}