:root {
  --bg-color: #0A1A1A;
  --surface-color: #1e293b;
  --surface-glass: rgba(30, 41, 59, 0.7);
  --primary-color: #00CEC9;
  --secondary-color: #81ECEC;
  --accent-color: #E17055;
  --text-color: #ffffff;
  --text-muted: #94a3b8;
  --border-radius: 12px;
  --font-family: 'Inter', system-ui, sans-serif;
  --transition: 0.3s ease;
  --cell-size: 40px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app-container {
  width: 100%;
  max-width: 1200px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.controls {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

select {
  background: var(--surface-color);
  color: var(--text-color);
  border: 1px solid var(--primary-color);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--secondary-color);
}

.btn-primary {
  background: var(--primary-color);
  color: var(--bg-color);
  border: none;
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--secondary-color);
  transform: translateY(-1px);
}

main {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

.game-area {
  background: var(--surface-glass);
  padding: 2rem;
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

canvas {
  background: transparent;
  cursor: crosshair;
  touch-action: none;
  max-width: 100%;
}

.sidebar {
  background: var(--surface-glass);
  padding: 2rem;
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar h2 {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  color: var(--secondary-color);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.5rem;
}

.word-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.word-list li {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  font-size: 0.9rem;
  transition: var(--transition);
  color: var(--text-muted);
}

.word-list li.found {
  background: rgba(0, 206, 201, 0.2);
  color: var(--primary-color);
  text-decoration: line-through;
  opacity: 0.7;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  background: var(--surface-color);
  padding: 3rem;
  border-radius: var(--border-radius);
  text-align: center;
  border: 1px solid var(--primary-color);
  box-shadow: 0 0 30px rgba(0, 206, 201, 0.2);
  transform: translateY(0);
  transition: transform 0.3s;
}

.modal.hidden .modal-content {
  transform: translateY(20px);
}

.modal h2 {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.modal p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .app-container {
    padding: 1rem;
    gap: 1rem;
  }

  header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  main {
    grid-template-columns: 1fr;
  }

  .controls {
    width: 100%;
    justify-content: space-between;
  }

  .timer {
    order: 2;
  }

  .game-area {
    padding: 1rem;
  }
}
