*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
  background: linear-gradient(160deg, #1a2f1a 0%, #0d1f14 50%, #0a1610 100%);
  color: #e8f5e9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.wrap {
  text-align: center;
  max-width: 100%;
}

.title {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: 0.08em;
  color: #a5d6a7;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.hud {
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: center;
  align-items: center;
  font-size: 0.95rem;
  color: #c8e6c9;
}

.hud .hint {
  opacity: 0.85;
  font-size: 0.85rem;
}

.canvas-box {
  position: relative;
  display: inline-block;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 2px #2e7d32;
}

#game {
  display: block;
  vertical-align: top;
  background: #1b3d1f;
  border-radius: 6px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem;
  background: rgba(10, 20, 12, 0.88);
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.overlay.hidden {
  display: none;
}

.overlay-title {
  margin: 0;
  font-size: 1.5rem;
  color: #ef9a9a;
}

.overlay-score {
  margin: 0;
  font-size: 1.1rem;
}

.overlay-hint {
  margin: 0;
  font-size: 0.9rem;
  color: #a5d6a7;
  opacity: 0.9;
}

.restart-btn {
  margin-top: 0.5rem;
  padding: 0.55rem 1.25rem;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  color: #1b3d1f;
  background: #81c784;
  border: none;
  border-radius: 6px;
  font-weight: 600;
}

.restart-btn:hover {
  background: #a5d6a7;
}

.restart-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
