

* {
  box-sizing: border-box;
}

body {
  background-image: url("Chalkboard.jpg");
  font-family: "Fredericka the Great", serif;
  color: #fff;
  margin: 0;
  min-height: 100vh;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 40px 16px 24px;
}

.hidden {
  display: none;
}

.title {
  margin: 0 0 70px 0;
  line-height: 1.1;
  font-size: 84px;
  text-align: center;
  font-weight: 400;
}

.home, .game {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(760px, 100%);
}

/* Home */
.menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 50px;
}

.menu-btn {
  font-family: "Fredericka the Great", serif;
  font-size: 30px;
  padding: 8px 26px;
  color: white;
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

/*.menu-btn:hover {
  background: rgba(255,255,255,0.08);
} */

.stats {
  font-size: 20px;
  line-height: 1.25;
  margin: 10px 0 16px;
}

/* Game top bar */
.topbar {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  margin-bottom: 6px;
}

.back-link {
  color: white;
  text-decoration: none;
  font-size: 28px;
  border: none;
  padding: 4px 12px;
  
}

/*.back-link:hover {
  background: rgba(255,255,255,0.08);
} */

.sep {
  margin: 0 10px;
  opacity: 0.8;
}


/* Game UI */
.next {
  font-size: 22px;
  margin: 0 0 6px 0;
}

.board-wrap {
  position: relative;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 100px);
  grid-template-rows: repeat(4, 100px);
  gap: 1px;
  margin: 0 auto;
}

.cell {
  width: 110px;
  height: 110px;
  display: flex;
  justify-content: center;
  align-items: center;

  font-family: "Fredericka the Great", serif;
  font-size: 50px;
  color: white;

  background-image: url("cell-outline.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;

  background-color: transparent;
  border: none;

  transition: transform 0.15s ease, opacity 0.15s ease;
}

.clear {
  opacity: 0;
  transform: scale(0.6);
}

.info {
  margin-top: 8px;
  font-size: 40px;
}

.game-over {
  color: #ff5555;
  font-size: 40px;
  margin-top: 8px;
  min-height: 48px;
}

/* How to play */
.howto {
  margin-top: 18px;
  max-width: 560px;
  font-size: 18px;
  line-height: 1.25;
  text-align: center;
}

.howto h2 {
  margin: 0 0 6px 0;
  font-size: 28px;
  line-height: 1.1;
}

.howto p {
  margin: 6px 0;
}

.howto ul {
  margin: 6px 0 0 0;
  padding: 0;
  list-style: none;
}

.howto li {
  margin: 4px 0;
}

/* FX layer */
.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Chalk ring */
.chalk-ring {
  position: absolute;
  width: 0;
  height: 0;
}

.chalk-ring svg {
  width: 100%;
  height: 100%;
}

.chalk-stroke {
  fill: none;
  stroke: rgba(255,255,255,0.95);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#chalk);
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawRing 0.24s ease-out forwards;
}

@keyframes drawRing {
  to { stroke-dashoffset: 0; }
}

/* Floating score popups */
.score-pop {
  position: absolute;
  pointer-events: none;
  font-size: 34px;
  line-height: 1.05;
  color: #fff;
  white-space: nowrap;
  opacity: 0;
  animation: popFloat 0.9s ease-out forwards;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

.score-pop .bonus {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

@keyframes popFloat {
  0%   { opacity: 0; transform: translateY(10px) scale(0.95); }
  15%  { opacity: 1; transform: translateY(0px) scale(1.02); }
  100% { opacity: 0; transform: translateY(-26px) scale(1.0); }
}
