:root {
  --primary: #0984E3;
  --secondary: #74B9FF;
  --accent: #E17055;
  --bg: #0D1B2A;
  --card-bg: rgba(27, 38, 59, 0.7);
  --text: #E0E1DD;
  --radius: 12px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(9, 132, 227, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(225, 112, 85, 0.1) 0px, transparent 50%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

.container {
  width: 90%;
  max-width: 800px;
  min-height: 600px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--secondary);
  text-transform: uppercase;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.4s ease-out;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Category Selection */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  width: 100%;
  margin-top: 1rem;
}

.category-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.category-btn:hover {
  background: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(9, 132, 227, 0.3);
}

.category-btn i {
  font-size: 1.5rem;
}

/* Game Screen */
.game-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 1.5rem;
}

.stats {
  display: flex;
  gap: 1.5rem;
}

.stat-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.canvas-container {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

#hangmanCanvas {
  max-width: 100%;
}

.word-display {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.letter-slot {
  width: 35px;
  height: 45px;
  border-bottom: 3px solid var(--secondary);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.keyboard {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  max-width: 600px;
}

.key {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.key:hover:not(:disabled) {
  background: var(--secondary);
  color: var(--bg);
}

.key:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.key.correct {
  background: #2ecc71;
  color: white;
}

.key.wrong {
  background: var(--accent);
  color: white;
}

.controls {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
}

.btn {
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg);
  padding: 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--primary);
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.modal h2 {
  margin-bottom: 1rem;
  color: var(--secondary);
}

.result-text {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

.word-reveal {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 1rem;
  }
  .letter-slot {
    width: 25px;
    height: 35px;
    font-size: 1.4rem;
  }
  .key {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
}
