* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: #05070f;
  color: #e8ecff;
  font-family: "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

#stars {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.game {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(10, 14, 30, 0.6);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid rgba(140, 170, 255, 0.2);
}

.hud h1 {
  font-size: 1.25rem;
  margin: 0;
  letter-spacing: 0.5px;
  color: #9fc3ff;
}

.stats {
  display: flex;
  gap: 24px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 50px;
}

.stat .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #7b8bbd;
  letter-spacing: 1px;
}

.stat span:last-child {
  font-size: 1.3rem;
  font-weight: 600;
  color: #fff;
}

.playfield {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.playfield::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(180deg, rgba(60, 90, 180, 0.15), rgba(60, 90, 180, 0.45));
  border-top: 2px solid rgba(140, 170, 255, 0.5);
}

.word {
  position: absolute;
  top: -30px;
  font-size: 1.1rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(20, 26, 50, 0.7);
  border: 1px solid rgba(140, 170, 255, 0.3);
  white-space: nowrap;
  color: #cdd8ff;
}

.word .matched {
  color: #6cff9e;
  font-weight: 700;
}

.word.active {
  border-color: #6cff9e;
  box-shadow: 0 0 12px rgba(108, 255, 158, 0.5);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  background: rgba(5, 7, 15, 0.85);
}

.overlay.hidden {
  display: none;
}

.overlay h2 {
  font-size: 1.8rem;
  color: #9fc3ff;
  margin: 0;
}

.overlay p {
  color: #b7c2e8;
  max-width: 360px;
}

.overlay button {
  padding: 10px 28px;
  font-size: 1rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #5b7cff, #9f5bff);
  color: white;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease;
}

.overlay button:hover {
  transform: scale(1.05);
}

.hidden-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
