body {
  font-family: "Arial", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-container {
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 20px;
  text-align: center;
  max-width: 95vw; /* 全屏宽度 */
  width: 100%;
  position: relative;
  margin: 0 auto;
}

.language-selector {
  position: absolute;
  top: 20px;
  right: 20px;
}

.language-btn {
  background: linear-gradient(45deg, #3498db, #2980b9);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.language-btn .arrow {
  transition: transform 0.3s ease;
}

.language-btn.active .arrow {
  transform: rotate(180deg);
}

.language-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  display: none;
}

.language-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  display: block;
}

.language-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  color: #333;
}

.language-option:hover {
  background-color: #f5f5f5;
}

.language-option .flag {
  font-size: 16px;
}

.language-option span:last-child {
  font-weight: 500;
}

h1 {
  color: #333;
  margin-bottom: 20px;
  font-size: 2.5em;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
  display: flex;
  justify-content: space-between;
  margin: 20px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  font-size: 1.2em;
  font-weight: bold;
}

.moves-left {
  color: #e74c3c;
}

.target-color {
  color: #27ae60;
}

.grid-container {
  display: inline-block;
  border: 3px solid #333;
  border-radius: 10px;
  padding: 10px;
  background: #f0f0f0;
  margin: 20px 0;
}

.grid {
  display: grid;
  gap: 2px;
  background: #333;
}

.cell {
  width: 40px;
  height: 40px;
  border: 1px solid #666;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 3px;
}

.cell:hover {
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.cell.animating {
  animation: colorFlip 0.6s ease-in-out;
}

@keyframes colorFlip {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(90deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

.controls {
  margin: 20px 0;
}

.btn {
  background: linear-gradient(45deg, #3498db, #2980b9);
  color: white;
  border: none;
  padding: 12px 24px;
  margin: 0 10px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

.btn:active {
  transform: translateY(0);
}

.btn.reduce-difficulty {
  background: linear-gradient(45deg, #f39c12, #e67e22);
}

.btn.retry {
  background: linear-gradient(45deg, #e74c3c, #c0392b);
}

.btn.new-game {
  background: linear-gradient(45deg, #27ae60, #229954);
}

.color-palette {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px 0;
}

.color-sample {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #333;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.color-sample:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.color-sample.selected {
  border: 4px solid #fff;
  box-shadow: 0 0 0 3px #333, 0 4px 15px rgba(0, 0, 0, 0.3);
  transform: scale(1.1);
}

.color-sample::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  font-size: 18px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.color-sample.selected::after {
  opacity: 1;
}

.target-color-display {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 4px solid #333;
  margin: 0 auto;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
  animation: pulse 2s infinite;
}

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

.game-status {
  font-size: 1.5em;
  font-weight: bold;
  margin: 20px 0;
  padding: 15px;
  border-radius: 10px;
}

.status-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-failure {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.hidden {
  display: none;
}

.difficulty-info {
  background: #e3f2fd;
  padding: 10px;
  border-radius: 8px;
  margin: 10px 0;
  font-size: 0.9em;
  color: #1976d2;
}

/* 网格大小控制器样式 */
.grid-controls {
  margin: 15px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 2px solid #e9ecef;
}

.grid-controls label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #495057;
}

.grid-controls input[type="range"] {
  width: 100%;
  max-width: 300px;
  margin: 10px 0;
  accent-color: #3498db;
}

.grid-controls span {
  display: inline-block;
  margin-left: 10px;
  font-weight: bold;
  color: #007bff;
  padding: 4px 8px;
  background: #e3f2fd;
  border-radius: 4px;
}

/* 手机响应式设计 */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .game-container {
    max-width: 98vw;
    padding: 15px;
    border-radius: 10px;
  }
  
  .language-selector {
    position: static;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
  }
  
  .game-info {
    flex-direction: column;
    gap: 10px;
    font-size: 0.9em;
  }
  
  .color-palette {
    gap: 8px;
    padding: 10px;
  }
  
  .color-sample {
    width: 40px;
    height: 40px;
  }
  
  .game-controls {
    flex-direction: column;
    gap: 10px;
  }
  
  .control-btn {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
  }
  
  h1 {
    font-size: 1.5em;
    margin: 10px 0;
  }
  
  .grid-controls {
    padding: 10px;
  }
  
  .grid-controls input[type="range"] {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .game-container {
    padding: 10px;
  }
  
  .color-sample {
    width: 35px;
    height: 35px;
  }
  
  .language-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  h1 {
    font-size: 1.3em;
  }
  
  .difficulty-info {
    font-size: 0.8em;
    padding: 8px;
  }
}
