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

:root {
  --primary: #6c5ce7;
  --secondary: #a29bfe;
  --dark-bg: #1a1a2e;
  --light-text: #f5f5f5;
  --accent: #fd79a8;
  --success: #00b894;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--dark-bg);
  color: var(--light-text);
  overflow: hidden;
  height: 100vh;
}

.app-container {
  display: flex;
  height: 100vh;
  flex-direction: column;
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.game-header h1 {
  flex: 1;
  text-align: center;
  font-size: 24px;
  font-weight: bold;
}

.btn-back, .btn-settings {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background 0.2s;
}

.btn-back::before {
  content: '←';
}

.btn-settings::before {
  content: '⚙';
}

.btn-back:hover, .btn-settings:hover {
  background: rgba(255, 255, 255, 0.3);
}

.header-right {
  display: flex;
  gap: 10px;
}

.game-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

.canvas-container {
  flex: 1;
  display: flex;
  position: relative;
  background: #0f0f1e;
  overflow: hidden;
  touch-action: none;
}

.game-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.touch-controls {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 5;
}

.btn-zoom-in::before {
  content: '+';
  font-size: 20px;
}

.btn-zoom-out::before {
  content: '−';
  font-size: 20px;
}

.btn-zoom-in, .btn-zoom-out {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(108, 92, 231, 0.8);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-zoom-in:hover, .btn-zoom-out:hover {
  background: rgba(108, 92, 231, 1);
}

.sidebar {
  width: 200px;
  background: #252545;
  border-left: 1px solid #3a3a5c;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.progress-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-section label {
  font-size: 12px;
  font-weight: bold;
  color: var(--secondary);
  text-transform: uppercase;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #1a1a2e;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  width: 0%;
  transition: width 0.3s ease;
}

.progress-percent {
  font-size: 12px;
  color: var(--light-text);
  text-align: right;
}

.palette-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.palette-section label {
  font-size: 12px;
  font-weight: bold;
  color: var(--secondary);
  text-transform: uppercase;
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.color-button {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  font-size: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.color-button:hover {
  transform: scale(1.05);
}

.color-button.active {
  border-color: white;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.stats-section {
  padding-top: 10px;
  border-top: 1px solid #3a3a5c;
}

.stats-content {
  font-size: 12px;
  color: #999;
  line-height: 1.6;
}

.game-footer {
  display: flex;
  gap: 10px;
  padding: 10px 15px;
  background: #252545;
  border-top: 1px solid #3a3a5c;
  justify-content: center;
}

.btn-footer {
  flex: 1;
  max-width: 100px;
  height: 40px;
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.2s;
}

.btn-footer:hover:not(:disabled) {
  background: var(--secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

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

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

.modal.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: #252545;
  border-radius: 12px;
  padding: 30px;
  max-width: 90%;
  width: 400px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--light-text);
  font-size: 24px;
  cursor: pointer;
}

.modal-content h2 {
  margin-bottom: 15px;
  font-size: 24px;
}

.settings-group {
  margin: 15px 0;
}

.settings-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}

.settings-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.btn-primary, .btn-secondary {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: var(--secondary);
}

.btn-secondary {
  background: transparent;
  color: var(--secondary);
  border: 2px solid var(--secondary);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Responsive for mobile */
@media (max-width: 768px) {
  .game-content {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    max-height: 150px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 10px;
  }

  .game-header h1 {
    font-size: 18px;
  }

  .btn-zoom-in, .btn-zoom-out {
    width: 32px;
    height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
