@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background-color: #0088ee;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Inter, sans-serif;
}

/* HEADER JA PAINIKE SAMALLA RIVILLÄ */
.top-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 90px;
  padding: 12px 20px;
  margin-bottom: 40px;
  background-color: #ffcb05;
}

.header {
  width: 100%;
  text-align: center;
}

.header-title {
  margin: 0;
  color: #000;
  font-family: "Montserrat", sans-serif;
  font-size: clamp(1.3rem, 4vw, 2.8rem);
  font-weight: 700;
  text-align: center;
}

h1 {
  font-size: clamp(1.3rem, 4vw, 2.8rem);
  color: #000;
  margin: 0;
}

/* SHOW RULES */
.rules-btn {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
}

.btn {
  cursor: pointer;
  border: 0;
  padding: 10px 20px;
  background: #000;
  color: #fff;
  border-radius: 5px;
}

.btn:focus {
  outline: 0;
}

.btn:hover {
  background: #222;
}

.btn:active {
  transform: scale(0.98);
}

.rules-btn:active {
  transform: translateY(-50%) scale(0.98);
}

#close-btn {
  margin-top: 20px;
}

/* PELIALUE */
canvas {
  background: #f0f0f0;
  display: block;
  border-radius: 5px;
  max-width: 100%;
  height: auto;
  margin-bottom: 40px;
}

/* FOOTER */
.footer {
  width: 100%;
  margin-top: auto;
  padding: 16px 12px 12px;
  background-color: #ffcb05;
  text-align: center;
  flex-shrink: 0;
}

.footer-text {
  max-width: 800px;
  margin: 0 auto;
  color: #000;
  font-family: "Montserrat", sans-serif;
  font-size: clamp(0.75rem, 2vw, 1.5rem);
  font-weight: 700;
  line-height: 1.5;
}

.heart {
  color: #ff0000;
}

/* RULES-PANEELI */
.rules {
  position: fixed;
  top: 0;
  left: 0;
  /* background: #333; */
  background: #dcdcdc;
  color: #000;
  height: 100vh;
  height: 100dvh;
  width: min(400px, 90vw);
  padding: 20px;
  line-height: 1.5;
  transform: translateX(-100%);
  transition: transform 0.4s ease-in-out;
  z-index: 10;
  overflow-y: auto;
}

.rules.show {
  transform: translateX(0);
}

/* PLAY AGAIN */
.playagain-container {
  display: none;
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 30px;
  width: 320px;
  max-width: calc(100% - 32px);
  text-align: center;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.playagain-container.show {
  display: block;
}

.playagain-container h2 {
  margin-bottom: 12px;
  font-size: 24px;
  font-weight: 700;
}

.playagain-container p {
  margin-bottom: 20px;
}

.playagain-options {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.playagain-btn {
  padding: 10px 25px;
  border: none;
  border-radius: 6px;
  background: #0095dd;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.playagain-btn:hover {
  background: #007bb5;
}

#no-btn {
  background: #dc3545;
}

#no-btn:hover {
  background: #b02a37;
}

#showHighestScore {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #ffcb05;
  color: #000;
  padding: 20px 30px;
  border-radius: 12px;
  font-family: "Montserrat", sans-serif;
  font-size: 30px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  visibility: hidden;
}

.highest-score {
  display: block;
  font-size: 48px;
  font-weight: 700;
  color: #000;
  margin-top: 10px;
}

/* START GAME */
.start-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  width: 360px;
  max-width: calc(100% - 32px);
  padding: 30px;
  text-align: center;
  background: #ffcb05;
  color: #000;
  border-radius: 12px;
}

.start-container h2 {
  margin-top: 0;
  font-size: 24px;
}

.start-container p {
  margin-bottom: 20px;
}

.start-container .btn {
  background: #1a1a1a;
  color: #fff;
}

.start-container .btn:hover {
  background: #333;
}
