* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #202124;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 24px 16px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #e8eaed;
  user-select: none;
  -webkit-user-select: none;
}

#back-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  color: #fff;
  text-decoration: none;
  font-size: 22px;
  font-weight: 700;
  z-index: 20;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #5f6368;
  transition: background 0.2s;
  line-height: 1;
}

#back-btn:hover {
  background: #80868b;
}

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 960px;
  width: 100%;
}

#header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 18px;
  font-weight: 500;
}

#timer {
  color: #9aa0a6;
  font-variant-numeric: tabular-nums;
}

#controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

#difficulty-select {
  background: #3c4043;
  color: #e8eaed;
  border: none;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  appearance: auto;
}

#difficulty-select:hover {
  background: #5f6368;
}

#new-game-btn {
  background: #3c4043;
  color: #e8eaed;
  border: none;
  padding: 10px 28px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

#new-game-btn:hover {
  background: #5f6368;
}

#board-wrapper {
  background: #292a2d;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
}

canvas#board {
  display: block;
  cursor: crosshair;
  border-radius: 8px;
}

#word-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  max-width: 900px;
}

.word-tag {
  font-size: 15px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  background: #3c4043;
  transition: background 0.2s, color 0.2s;
  letter-spacing: 1px;
}

.word-tag.found {
  background: #2e7d32;
  color: #a5d6a7;
  text-decoration: line-through;
}

#hint-text {
  font-size: 13px;
  color: #5f6368;
  margin-top: 4px;
}

#win-message {
  font-size: 22px;
  font-weight: 700;
  color: #4caf50;
  animation: pop-in 0.4s ease-out;
}

@keyframes pop-in {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 500px) {
  body {
    padding: 16px 8px;
  }

  #header {
    font-size: 15px;
  }

  .word-tag {
    font-size: 13px;
    padding: 3px 8px;
  }
}
