:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #ec4899;
  --background: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #22c55e;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 0.75rem;
}

body.dark {
  --primary: #818cf8;
  --primary-dark: #6366f1;
  --secondary: #f472b6;
  --background: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--background);
  color: var(--text);
  line-height: 1.5;
  transition: background-color 0.3s, color 0.3s;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 1rem;
  gap: 1rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

button {
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  font-family: inherit;
}

button:hover {
  background-color: var(--border);
}

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

button.primary:hover {
  background-color: var(--primary-dark);
}

.game-area {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  flex: 1;
  min-height: 0;
}

.canvas-container {
  background-color: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

canvas {
  touch-action: none;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.panel {
  background-color: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.panel h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 1.25rem;
}

#word-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

#word-list li {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background-color: var(--background);
  font-size: 0.9rem;
  transition: all 0.2s;
}

#word-list li.found {
  background-color: var(--success);
  color: white;
  text-decoration: line-through;
  opacity: 0.7;
}

.settings {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
}

input[type="range"] {
  width: 100%;
}

textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  font-family: inherit;
  background-color: var(--background);
  color: var(--text);
  resize: vertical;
  min-height: 80px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .game-area {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    gap: 1rem;
  }

  .sidebar {
    order: 2;
  }

  .canvas-container {
    aspect-ratio: 1;
  }
}
