:root {
  --primary-color: #FF006E;
  --secondary-color: #FB5607;
  --accent-color: #FFBE0B;
  --purple-color: #8338EC;
  --blue-color: #3A86FF;
  --dark-bg: #0a0a0a;
  --card-bg: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --border-color: #333333;
  --success-color: #00ff88;
  --warning-color: #ff8800;
  --error-color: #ff4444;
}

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

body {
  font-family: 'Arial', sans-serif;
  background: linear-gradient(135deg, var(--dark-bg) 0%, #1a1a2e 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Header Styles */
.app-header {
  background: linear-gradient(45deg, var(--primary-color), var(--purple-color));
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(255, 0, 110, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 {
  font-size: 1.5rem;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.header-controls {
  display: flex;
  gap: 0.5rem;
}

/* Button Styles */
.btn {
  background: linear-gradient(45deg, var(--card-bg), #2a2a2a);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 0.5rem 1rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn-primary {
  border-color: var(--primary-color);
  box-shadow: 0 0 15px rgba(255, 0, 110, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 0 25px rgba(255, 0, 110, 0.6);
}

.btn-secondary {
  border-color: var(--secondary-color);
  box-shadow: 0 0 15px rgba(251, 86, 7, 0.4);
}

.btn-secondary:hover {
  box-shadow: 0 0 25px rgba(251, 86, 7, 0.6);
}

.btn-success {
  border-color: var(--success-color);
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.btn-success:hover {
  box-shadow: 0 0 25px rgba(0, 255, 136, 0.6);
}

.btn-warning {
  border-color: var(--warning-color);
  box-shadow: 0 0 15px rgba(255, 136, 0, 0.4);
}

.btn-warning:hover {
  box-shadow: 0 0 25px rgba(255, 136, 0, 0.6);
}

/* Main Content */
.app-main {
  padding: 1rem;
  padding-bottom: 100px;
  min-height: calc(100vh - 120px);
}

.content-section {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.content-section.active {
  display: block;
}

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

/* Game Section */
.game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.level-info, .score-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.level-label, .score-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

#current-level, #current-score {
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--accent-color);
  text-shadow: 0 0 10px rgba(255, 190, 11, 0.5);
}

.game-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1rem 0;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#game-canvas {
  border: 2px solid var(--purple-color);
  border-radius: 8px;
  background: #0f0f0f;
  box-shadow: 0 0 20px rgba(131, 56, 236, 0.3);
  max-width: 100%;
  height: auto;
}

.grid-overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  pointer-events: none;
  border-radius: 8px;
}

.game-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.game-status {
  text-align: center;
  margin-top: 1rem;
  padding: 0.5rem;
  border-radius: 8px;
  font-weight: bold;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-status.success {
  background: rgba(0, 255, 136, 0.2);
  border: 2px solid var(--success-color);
  color: var(--success-color);
}

.game-status.error {
  background: rgba(255, 68, 68, 0.2);
  border: 2px solid var(--error-color);
  color: var(--error-color);
}

.game-status.info {
  background: rgba(58, 134, 255, 0.2);
  border: 2px solid var(--blue-color);
  color: var(--blue-color);
}

/* Levels Section */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.level-card {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.level-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.level-card.completed {
  border-color: var(--success-color);
  background: linear-gradient(45deg, var(--card-bg), rgba(0, 255, 136, 0.1));
}

.level-card.completed::after {
  content: '✓';
  position: absolute;
  top: 5px;
  right: 8px;
  color: var(--success-color);
  font-size: 0.8rem;
}

.level-card.current {
  border-color: var(--primary-color);
  box-shadow: 0 0 15px rgba(255, 0, 110, 0.4);
}

.level-number {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-primary);
}

/* Stats Section */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.stat-item {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.stat-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.stat-item i {
  font-size: 2rem;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-primary);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* FAQ Section */
.faq-container {
  margin-top: 1rem;
}

.faq-item {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 1rem;
  overflow: hidden;
  transition: all 0.3s ease;
}

.faq-item:hover {
  border-color: var(--primary-color);
}

.faq-question {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 1rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s ease;
}

.faq-question:hover {
  background: rgba(255, 255, 255, 0.05);
}

.faq-question[aria-expanded="true"] .faq-icon {
  transform: rotate(45deg);
  color: var(--primary-color);
}

.faq-icon {
  font-size: 1.2rem;
  transition: all 0.3s ease;
  color: var(--text-secondary);
}

.faq-answer {
  padding: 0 1rem 1rem 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  animation: slideDown 0.3s ease-out;
}

.faq-answer[hidden] {
  display: none;
}

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

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(45deg, var(--card-bg), #2a2a2a);
  border-top: 2px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0;
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  min-width: 60px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.nav-item.active {
  color: var(--primary-color);
  text-shadow: 0 0 10px rgba(255, 0, 110, 0.5);
}

.nav-item i {
  font-size: 1.2rem;
}

.nav-item span {
  font-size: 0.7rem;
  font-weight: 500;
}

/* Footer */
footer {
  background: var(--dark-bg);
  color: var(--text-secondary);
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  border-top: 1px solid var(--border-color);
  margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-header h1 {
    font-size: 1.2rem;
  }
  
  .header-controls .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
  
  .game-info {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  
  .game-controls {
    flex-direction: column;
    align-items: center;
  }
  
  .stats-container {
    grid-template-columns: 1fr;
  }
  
  .levels-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }
  
  #game-canvas {
    width: 100%;
    max-width: 350px;
  }
}

@media (max-width: 480px) {
  .app-main {
    padding: 0.5rem;
    padding-bottom: 100px;
  }
  
  .game-container {
    padding: 0.5rem;
  }
  
  .btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }
  
  .nav-item span {
    font-size: 0.6rem;
  }
  
  .nav-item i {
    font-size: 1rem;
  }
}

/* Loading and Animations */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Glow effects */
.glow {
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 0 5px var(--primary-color), 0 0 10px var(--primary-color);
  }
  to {
    box-shadow: 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
  }
}

/* Hint highlighting */
.hint-highlight {
  background: rgba(255, 190, 11, 0.3) !important;
  border: 2px solid var(--accent-color) !important;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
