:root {
  --bg-start: #15243b;
  --bg-end: #0d1621;
  --card: rgba(255, 255, 255, 0.1);
  --card-border: rgba(255, 255, 255, 0.18);
  --surface: rgba(255, 255, 255, 0.08);
  --text: #eef5ff;
  --muted: #b8c7e1;
  --accent: #f87171;
  --accent-strong: #b91c1c;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(
      circle at top left,
      rgba(97, 168, 255, 0.18),
      transparent 24%
    ),
    radial-gradient(
      circle at bottom right,
      rgba(255, 190, 100, 0.14),
      transparent 18%
    ),
    linear-gradient(135deg, var(--bg-start), var(--bg-end));
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.hero {
  width: min(100%, 980px);
}

.hero-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 32px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  padding: 36px;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}

.hero-icon {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  font-size: 2.4rem;
}

.hero-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 18px;
}

h1 {
  margin: 0;
  font-size: clamp(2.75rem, 5vw, 4.2rem);
}

.hero-brand p {
  margin: 8px 0 0;
  max-width: 640px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 1rem;
}

.mode-section h2 {
  margin: 0;
  font-size: 2.75rem;
  color: var(--accent);
}

#game-container {
  margin-top: 24px;
  padding: 24px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.16);
}

#hangman-drawing {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

#hangman-canvas {
  width: 220px;
  height: 220px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

#word-display {
  width: 100%;
  font-size: 2rem;
  margin-bottom: 18px;
  letter-spacing: 0.12em;
  color: #eef5ff;
  min-height: 3rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
}

#alphabet {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.alphabet-button {
  width: 100%;
  min-width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #eef5ff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.alphabet-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.alphabet-button:disabled {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.55);
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.08);
}

#message {
  font-size: 1rem;
  color: #ffb3b3;
  font-weight: 700;
  min-height: 1.4rem;
  width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin: 18px 0 10px;
}

button {
  min-width: 150px;
  padding: 14px 22px;
  border: none;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

#restart-btn {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #fff;
  box-shadow: 0 18px 30px rgba(14, 165, 233, 0.24);
}

#hint-btn {
  background: linear-gradient(135deg, #facc15, #f59e0b);
  color: #1f2937;
  box-shadow: 0 18px 30px rgba(250, 204, 21, 0.24);
}

#back-btn {
  display: block;
  width: min(100%, 220px);
  margin: 18px auto 0;
  background: rgba(255, 255, 255, 0.12);
  color: #eef5ff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

#back-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

body.win {
  background: radial-gradient(circle at top, #fffde7, #e8f5e9 25%, #ffffff 70%);
}
a{
  text-decoration: none;
}

#message.win {
  font-size: 36px;
  color: rgb(144, 238, 144);
  text-shadow:
    0 0 12px rgba(255, 255, 255, 0.5),
    0 0 20px rgba(144, 238, 144, 0.6);
  animation: win-pop 0.8s ease-out;
}

#message.win .celebrate-word {
  display: block;
  font-size: clamp(1.8rem, 4vw, 42px);
  margin-top: 10px;
  letter-spacing: 0.16em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.confetti-piece {
  position: fixed;
  top: 0;
  width: 10px;
  height: 10px;
  opacity: 0.9;
  border-radius: 2px;
  z-index: 9999;
  animation: confetti-fall 1.8s ease-out forwards;
}

@keyframes win-pop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  70% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(120vh) rotate(720deg);
    opacity: 0;
  }
}

@media (max-width: 760px) {
  .hero-card {
    padding: 28px 18px;
  }

  #game-container {
    padding: 20px;
    overflow-x: hidden;
  }

  #word-display {
    font-size: 1.55rem !important;
    letter-spacing: 0.09em;
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #message.win {
    font-size: 1.35rem;
  }

  #message.win .celebrate-word {
    font-size: 1.8rem;
    letter-spacing: 0.12em;
  }

  .alphabet-button {
    min-width: 48px;
  }

  .button-row,
  #back-btn {
    width: 100%;
  }

  #back-btn {
    max-width: unset;
  }

  h1 {
    font-size: 29px;
  }
  h2 {
    font-size: 44px;
  }
}
