:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-hex: #334155;
  --bg-hex-hover: #475569;
  --bg-selected: #6366f1;
  --bg-correct: #22c55e;
  --bg-wrong: #ef4444;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent: #818cf8;
  --target: #fbbf24;
  --border: #475569;
  --hex-size: 70px;
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

.game-header {
  text-align: center;
  padding: 1.5rem 1rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.game-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.game-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.level-info {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: center;
}

.info-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.info-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
}

.info-value.target {
  color: var(--target);
}

.info-value.current {
  color: var(--accent);
}

.info-value.best {
  color: var(--bg-correct);
}

.board-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
  overflow: auto;
}

.hex-board {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hex-row {
  display: flex;
  margin-left: 0;
}

.hex-row:nth-child(even) {
  margin-left: calc(var(--hex-size) * 0.5);
}

.hex {
  width: var(--hex-size);
  height: calc(var(--hex-size) * 1.1547);
  background: var(--bg-hex);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  margin: -2px 0;
}

.hex:hover {
  background: var(--bg-hex-hover);
  transform: scale(1.05);
}

.hex.selected {
  background: var(--bg-selected);
}

.hex.correct {
  background: var(--bg-correct);
  animation: pulse 0.4s ease;
}

.hex.wrong {
  background: var(--bg-wrong);
  animation: shake 0.4s ease;
}

.hex.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.controls-section {
  text-align: center;
}

.message-area {
  min-height: 3rem;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.message-area.success {
  color: var(--bg-correct);
}

.message-area.error {
  color: var(--bg-wrong);
}

.message-area.info {
  color: var(--text-secondary);
}

.button-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn {
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:not(:disabled):hover {
  background: #6366f1;
}

.btn-secondary {
  background: var(--bg-hex);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hex-hover);
}

.game-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

@media (max-width: 600px) {
  .level-info {
    grid-template-columns: repeat(2, 1fr);
  }
  
  :root {
    --hex-size: 55px;
  }
  
  .hex {
    font-size: 1rem;
  }
}
