/* Match-3 Game Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Disable text cursor and focus effects for all non-input elements */
*:not(input):not(textarea):not([contenteditable="true"]) {
  cursor: default !important;
  outline: none !important;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Keep pointer cursor for buttons and clickable elements */
button, .btn, [onclick], .clickable {
  cursor: pointer !important;
}

/* Ensure level nodes and city nodes use pointer cursor */
.city-node, .level-node {
  cursor: pointer !important;
}

/* Remove outline for all focus states */
*:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Special handling for titles, text, span elements to ensure no text cursor */
h1, h2, h3, h4, h5, h6, p, div, span, label, .modal-title, .city-name, .city-population {
  cursor: default !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

/* Disable text selection and cursor for game interface elements */
.game-container *, .level-map-container *, .modal-content * {
  cursor: default !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

/* Re-enable pointer cursor for buttons */
.game-container button, .level-map-container button, .modal-content button {
  cursor: pointer !important;
}

/* 完全禁用文本光标 - 最强制规则 */
body * {
  cursor: default !important;
}

/* 只对真正可点击的元素启用pointer */
button, .btn, .city-node, .level-node, [role="button"], .clickable {
  cursor: pointer !important;
}

/* 确保没有任何元素可被聚焦产生文本光标 */
* {
  -webkit-tap-highlight-color: transparent !important;
}

/* 禁用所有可能的文本交互 */
body, html {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -khtml-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.game-container {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 1.5rem;
  max-width: 38rem;
  width: 100%;
  position: relative;
}

.game-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.game-title {
  font-size: 1.875rem;
  font-weight: bold;
  color: #6b46c1;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(107, 70, 193, 0.3);
}

.game-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.stat-item {
  font-size: 0.95rem;
  font-weight: 600;
  color: #374151;
}

.stat-value {
  color: #7c3aed;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(124, 58, 237, 0.3);
}

/* V2.0: 目标面板样式 */
.objectives-panel {
  margin-top: 1rem;
  padding: 0.75rem;
  background: linear-gradient(145deg, #f3f4f6, #e5e7eb);
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
}

.objectives-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.objectives-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.objective-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.5rem;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 0.3rem;
  font-size: 0.8rem;
}

.objective-description {
  color: #374151;
  font-weight: 500;
}

.objective-progress {
  font-weight: 600;
  color: #7c3aed;
}

.objective-item.completed {
  background: linear-gradient(145deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.2));
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.objective-item.completed .objective-progress {
  color: #059669;
}

.objective-item.completed::after {
  content: '✓';
  color: #059669;
  font-weight: bold;
  margin-left: 0.5rem;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0.35rem;
  background: linear-gradient(145deg, #e5e7eb, #d1d5db);
  padding: 0.7rem;
  border-radius: 0.75rem;
  margin: 0 auto;
  width: fit-content;
  position: relative;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.15);
}

.candy-cell {
  width: 2.8rem;
  height: 2.8rem;
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), inset 0 2px 0 rgba(255, 255, 255, 0.7);
  position: relative;
  overflow: visible;
  transform: scale(1);
}

.candy-cell:hover {
  background: linear-gradient(145deg, #f3f4f6, #e2e8f0);
  transform: scale(1.15) translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.9);
  z-index: 10;
}

.candy-cell.selected {
  border-color: #8b5cf6;
  background: linear-gradient(145deg, #ede9fe, #ddd6fe);
  transform: scale(1.2);
  box-shadow: 0 0 25px rgba(139, 92, 246, 0.6), 0 12px 30px rgba(0, 0, 0, 0.2);
  z-index: 15;
}

.candy-cell.power-up {
  background: linear-gradient(145deg, #fef3c7, #fde68a);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.8), 0 6px 20px rgba(0, 0, 0, 0.15);
  animation: pulse-glow 1.5s infinite;
  font-size: 2rem;
  font-weight: bold;
}

.game-controls {
  margin-top: 1.5rem;
  text-align: center;
}

.btn {
  background: linear-gradient(145deg, #7c3aed, #6d28d9);
  color: white;
  font-weight: bold;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn:hover {
  background: linear-gradient(145deg, #6d28d9, #5b21b6);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
}

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

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  z-index: 9999; /* 确保弹窗在最上层 */
}

.modal-content {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  max-width: 20rem;
  width: 90%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.5);
  animation: modal-appear 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
  border: 3px solid transparent;
  background-clip: padding-box;
  position: relative;
  overflow: hidden;
  z-index: 10000; /* 弹窗内容在最上层 */
}

.modal-content::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #fbbf24, #f59e0b, #d97706, #fbbf24);
  border-radius: 1rem;
  z-index: -1;
  animation: rainbow-border 2s linear infinite;
}

@keyframes rainbow-border {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.modal-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #6b46c1;
  margin-bottom: 1rem;
  text-shadow: 0 2px 4px rgba(107, 70, 193, 0.3);
  animation: title-glow 2s ease-in-out infinite alternate;
}

@keyframes title-glow {
  0% {
    text-shadow: 0 2px 4px rgba(107, 70, 193, 0.3), 0 0 10px rgba(251, 191, 36, 0.4);
  }
  100% {
    text-shadow: 0 2px 8px rgba(107, 70, 193, 0.6), 0 0 20px rgba(251, 191, 36, 0.8);
  }
}

.modal-text {
  color: #374151;
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}

/* Enhanced Animations */
@keyframes bounce-in {
  0% {
    transform: scale(0) rotate(180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.3) rotate(360deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(1) rotate(360deg);
    opacity: 1;
  }
}

@keyframes explode {
  0% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(1.5) rotate(180deg);
    opacity: 0.7;
  }
  100% {
    transform: scale(0) rotate(360deg);
    opacity: 0;
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0) translateY(0); }
  10% { transform: translateX(-8px) translateY(-3px); }
  20% { transform: translateX(8px) translateY(3px); }
  30% { transform: translateX(-6px) translateY(-2px); }
  40% { transform: translateX(6px) translateY(4px); }
  50% { transform: translateX(-4px) translateY(-1px); }
  60% { transform: translateX(4px) translateY(2px); }
  70% { transform: translateX(-3px) translateY(-1px); }
  80% { transform: translateX(3px) translateY(1px); }
  90% { transform: translateX(-2px) translateY(-1px); }
}

@keyframes fall-in {
  0% {
    transform: translateY(-100px) scale(0.8);
    opacity: 0;
  }
  50% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.6), 0 4px 15px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow: 0 0 25px rgba(251, 191, 36, 0.8), 0 6px 20px rgba(0, 0, 0, 0.15);
  }
}

@keyframes combo-flash {
  0% { 
    background: rgba(251, 191, 36, 0);
    box-shadow: inset 0 0 0 rgba(251, 191, 36, 0);
  }
  50% { 
    background: rgba(251, 191, 36, 0.2);
    box-shadow: inset 0 0 20px rgba(251, 191, 36, 0.3);
  }
  100% { 
    background: rgba(251, 191, 36, 0);
    box-shadow: inset 0 0 0 rgba(251, 191, 36, 0);
  }
}

@keyframes modal-appear {
  0% {
    transform: scale(0.5) rotate(-10deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.1) rotate(5deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes power-blast {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(2);
    opacity: 0.5;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

/* Special Effect Classes */
.candy-cell.exploding {
  animation: explode 0.5s ease-out forwards;
  z-index: 20;
}

.candy-cell.falling {
  animation: fall-in 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.candy-cell.new {
  animation: bounce-in 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.game-container.shake {
  animation: shake 0.5s ease-in-out;
}

.game-container.combo {
  animation: combo-flash 0.3s ease;
}

/* Particle System */
.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 100;
}

.particle.star {
  background: #fbbf24;
  box-shadow: 0 0 10px #fbbf24;
}

.particle.heart {
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
}

.particle.spark {
  background: #8b5cf6;
  box-shadow: 0 0 8px #8b5cf6;
}

@keyframes particle-burst {
  0% {
    transform: scale(0) translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(1) translate(var(--end-x, 30px), var(--end-y, 30px)) rotate(180deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(0) translate(var(--end-x, 30px), var(--end-y, 30px)) rotate(360deg);
    opacity: 0;
  }
}

.particle.burst {
  animation: particle-burst 0.8s ease-out forwards;
}

/* Score Popup */
.score-popup {
  position: absolute;
  font-size: 1.2rem;
  font-weight: bold;
  color: #fbbf24;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 50;
  animation: score-popup 1s ease-out forwards;
}

@keyframes score-popup {
  0% {
    transform: scale(0.5) translateY(0);
    opacity: 0;
  }
  30% {
    transform: scale(1.2) translateY(-10px);
    opacity: 1;
  }
  100% {
    transform: scale(1) translateY(-50px);
    opacity: 0;
  }
}

/* Power-up Blast Effect */
.blast-effect {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.8) 0%, transparent 70%);
  animation: power-blast 0.8s ease-out forwards;
  pointer-events: none;
  z-index: 25;
}

/* 提示系统动画 */
.candy-cell.hint-bounce {
  animation: hint-bounce 1s ease-in-out infinite;
  z-index: 30;
  box-shadow: 0 0 25px rgba(124, 58, 237, 0.8), 0 0 40px rgba(124, 58, 237, 0.6) !important;
}

@keyframes hint-bounce {
  0%, 100% {
    transform: scale(1) translateY(0);
  }
  25% {
    transform: scale(1.2) translateY(-8px);
  }
  50% {
    transform: scale(1.1) translateY(-4px);
  }
  75% {
    transform: scale(1.15) translateY(-6px);
  }
}

/* 庆祝烟花效果 */
.firework {
  position: fixed;
  width: 4px;
  height: 4px;
  pointer-events: none;
  z-index: 1000;
}

.firework-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: firework-burst 2s ease-out forwards;
}

@keyframes firework-burst {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--end-x), var(--end-y)) scale(0);
    opacity: 0;
  }
}

/* V2.0: 障碍物样式 */
.candy-cell.jelly-obstacle {
  background: linear-gradient(145deg, rgba(74, 222, 128, 0.4), rgba(34, 197, 94, 0.4)), 
              linear-gradient(145deg, #ffffff, #f8fafc);
  border: 2px solid rgba(34, 197, 94, 0.6);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.7);
}

.candy-cell.jelly-obstacle.double-jelly {
  background: linear-gradient(145deg, rgba(74, 222, 128, 0.7), rgba(34, 197, 94, 0.7)), 
              linear-gradient(145deg, #ffffff, #f8fafc);
  border: 2px solid rgba(34, 197, 94, 0.8);
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.7);
}

.candy-cell.chocolate-obstacle {
  background: linear-gradient(145deg, rgba(92, 51, 23, 0.9), rgba(69, 39, 160, 0.9)), 
              linear-gradient(145deg, #451a03, #365314);
  border: 2px solid #451a03;
  box-shadow: 0 4px 12px rgba(92, 51, 23, 0.6), inset 0 2px 0 rgba(0, 0, 0, 0.3);
  position: relative;
}

.candy-cell.chocolate-obstacle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 60%;
  background: #92400e;
  border-radius: 4px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.candy-cell.chain-obstacle {
  background: linear-gradient(145deg, rgba(156, 163, 175, 0.8), rgba(107, 114, 128, 0.8)), 
              linear-gradient(145deg, #ffffff, #f8fafc);
  border: 2px solid #6b7280;
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.7);
  position: relative;
}

.candy-cell.chain-obstacle::before {
  content: '🔗';
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 0.8rem;
  color: #374151;
}

.candy-cell.chain-obstacle::after {
  content: attr(data-chain-strength);
  position: absolute;
  bottom: 2px;
  left: 2px;
  font-size: 0.7rem;
  font-weight: bold;
  color: #374151;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 障碍物动画效果 */
.candy-cell.jelly-obstacle.clearing {
  animation: jelly-break 0.6s ease-out forwards;
}

@keyframes jelly-break {
  0% {
    background: linear-gradient(145deg, rgba(74, 222, 128, 0.4), rgba(34, 197, 94, 0.4)), 
                linear-gradient(145deg, #ffffff, #f8fafc);
  }
  50% {
    background: linear-gradient(145deg, rgba(74, 222, 128, 0.8), rgba(34, 197, 94, 0.8)), 
                linear-gradient(145deg, #ffffff, #f8fafc);
    transform: scale(1.1);
  }
  100% {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-color: transparent;
    transform: scale(1);
  }
}

.candy-cell.chocolate-obstacle.clearing {
  animation: chocolate-melt 0.8s ease-out forwards;
}

@keyframes chocolate-melt {
  0% {
    background: linear-gradient(145deg, rgba(92, 51, 23, 0.9), rgba(69, 39, 160, 0.9)), 
                linear-gradient(145deg, #451a03, #365314);
  }
  50% {
    background: linear-gradient(145deg, rgba(92, 51, 23, 0.6), rgba(69, 39, 160, 0.6)), 
                linear-gradient(145deg, #451a03, #365314);
    transform: scale(0.9);
  }
  100% {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-color: transparent;
    transform: scale(1);
  }
}

.candy-cell.chain-obstacle.clearing {
  animation: chain-break 0.5s ease-out forwards;
}

@keyframes chain-break {
  0% {
    background: linear-gradient(145deg, rgba(156, 163, 175, 0.8), rgba(107, 114, 128, 0.8)), 
                linear-gradient(145deg, #ffffff, #f8fafc);
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-5deg) scale(1.1);
  }
  50% {
    transform: rotate(5deg) scale(1.1);
  }
  75% {
    transform: rotate(-3deg) scale(0.9);
  }
  100% {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-color: transparent;
    transform: rotate(0deg) scale(1);
  }
}

/* V2.0: 传送门样式 */
.candy-cell.portal {
  background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, rgba(124, 58, 237, 0.2) 50%, transparent 70%),
              linear-gradient(145deg, #ffffff, #f8fafc);
  border: 3px solid rgba(139, 92, 246, 0.8);
  box-shadow: 
    0 0 20px rgba(139, 92, 246, 0.6),
    0 6px 20px rgba(0, 0, 0, 0.15),
    inset 0 0 15px rgba(139, 92, 246, 0.2);
  position: relative;
  overflow: visible;
  animation: portal-pulse 2s infinite;
}

.candy-cell.portal::before {
  content: '🌀';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  font-size: 1.5rem;
  animation: portal-spin 3s linear infinite;
  z-index: 5;
}

.candy-cell.portal::after {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border: 2px solid transparent;
  border-radius: 0.75rem;
  background: linear-gradient(45deg, 
    rgba(139, 92, 246, 0.6), 
    transparent 30%, 
    transparent 70%, 
    rgba(124, 58, 237, 0.6));
  background-size: 200% 200%;
  animation: portal-border 4s linear infinite;
  z-index: -1;
}

@keyframes portal-pulse {
  0%, 100% {
    box-shadow: 
      0 0 20px rgba(139, 92, 246, 0.6),
      0 6px 20px rgba(0, 0, 0, 0.15),
      inset 0 0 15px rgba(139, 92, 246, 0.2);
  }
  50% {
    box-shadow: 
      0 0 30px rgba(139, 92, 246, 0.8),
      0 8px 25px rgba(0, 0, 0, 0.2),
      inset 0 0 25px rgba(139, 92, 246, 0.4);
  }
}

@keyframes portal-spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes portal-border {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 传送特效 */
.portal-teleport-effect {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.8) 0%, rgba(124, 58, 237, 0.6) 30%, transparent 70%);
  animation: portal-teleport 1s ease-out forwards;
  pointer-events: none;
  z-index: 10;
}

@keyframes portal-teleport {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(2) rotate(180deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(4) rotate(360deg);
    opacity: 0;
  }
}

/* V2.0: 星级评价样式 */
.stars-display {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.star {
  font-size: 2rem;
  transition: all 0.3s ease;
}

.star.earned {
  animation: star-shine 1s ease-in-out;
  filter: brightness(1.2) saturate(1.5);
}

.star.unearned {
  opacity: 0.3;
  filter: grayscale(1);
}

@keyframes star-shine {
  0%, 100% {
    transform: scale(1);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  }
  50% {
    transform: scale(1.1);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  }
}

.phase-info {
  text-align: center;
  font-size: 0.9rem;
  color: #6b46c1;
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding: 0.3rem 0.8rem;
  background: linear-gradient(145deg, rgba(107, 70, 193, 0.1), rgba(124, 58, 237, 0.1));
  border-radius: 1rem;
  border: 1px solid rgba(107, 70, 193, 0.2);
}

/* 州选择界面样式 */
.state-selection-container {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.state-selection-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1) 2px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 150px 150px, 200px 200px;
  animation: float-stars 30s infinite linear;
  pointer-events: none;
  z-index: 1;
}

.state-selection-header {
  text-align: center;
  margin-bottom: 3rem;
  z-index: 2;
  position: relative;
}

.selection-subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  margin-top: 1rem;
  max-width: 600px;
}

.states-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 900px;
  width: 100%;
  z-index: 2;
  position: relative;
}

.state-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 1.5rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 3px solid transparent;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.state-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.state-card:hover::before {
  left: 100%;
}

.state-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
  border-color: rgba(107, 70, 193, 0.3);
}

.state-card[data-state="california"]:hover {
  border-color: #3b82f6;
  box-shadow: 0 30px 60px rgba(59, 130, 246, 0.2);
}

.state-card[data-state="texas"]:hover {
  border-color: #dc2626;
  box-shadow: 0 30px 60px rgba(220, 38, 38, 0.2);
}

.state-card[data-state="florida"]:hover {
  border-color: #f59e0b;
  box-shadow: 0 30px 60px rgba(245, 158, 11, 0.2);
}

.state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  display: block;
}

.state-name {
  font-size: 1.5rem;
  font-weight: bold;
  color: #1f2937;
  margin-bottom: 1rem;
}

.state-description {
  color: #6b7280;
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.state-preview {
  font-size: 0.9rem;
  color: #9ca3af;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  display: inline-block;
}

.selection-footer {
  margin-top: 2rem;
  text-align: center;
  z-index: 2;
  position: relative;
}

.selection-footer p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
}

/* 州选择动画 */
.state-card {
  animation: state-card-appear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.state-card:nth-child(2) {
  animation-delay: 0.2s;
}

.state-card:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes state-card-appear {
  0% {
    opacity: 0;
    transform: translateY(50px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .states-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .state-card {
    padding: 1.5rem;
  }
  
  .state-icon {
    font-size: 3rem;
  }
  
  .state-name {
    font-size: 1.3rem;
  }
}

/* V2.0: 关卡地图界面样式 - 加州地图主题 */
.level-map-container {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 30%, #06b6d4 60%, #10b981 100%);
  min-height: 100vh;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* 背景装饰元素 - 加州主题星空效果 */
.level-map-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 15% 25%, rgba(255, 255, 255, 0.15) 2px, transparent 2px),
    radial-gradient(circle at 70% 40%, rgba(255, 215, 0, 0.1) 1px, transparent 1px),
    radial-gradient(circle at 85% 70%, rgba(255, 255, 255, 0.08) 3px, transparent 3px),
    radial-gradient(circle at 25% 80%, rgba(255, 215, 0, 0.06) 2px, transparent 2px);
  background-size: 120px 120px, 180px 180px, 100px 100px, 140px 140px;
  animation: california-stars 25s infinite linear;
  pointer-events: none;
  z-index: 1;
}

@keyframes california-stars {
  0% { transform: translateY(0px) translateX(0px); }
  50% { transform: translateY(-50px) translateX(20px); }
  100% { transform: translateY(-100px) translateX(0px); }
}

.level-map-header {
  text-align: center;
  margin-bottom: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 2;
}

.player-progress {
  display: flex;
  justify-content: space-around;
  margin-top: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.progress-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.progress-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.3rem;
}

.progress-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.level-map-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2rem 0;
  position: relative;
  z-index: 2;
}

.level-path {
  width: 100%;
  max-width: 1000px;
  height: min(80vh, 800px);      /* 响应式高度：80%视窗高度，最大800px */
  overflow-y: auto;
  padding: clamp(1rem, 4vw, 3rem); /* 响应式内边距 */
  background: 
    linear-gradient(145deg, rgba(34, 197, 94, 0.1), rgba(22, 163, 74, 0.05)),
    radial-gradient(ellipse at 30% 70%, rgba(139, 69, 19, 0.08) 20%, transparent 50%),
    rgba(255, 255, 255, 0.03);
  border-radius: 1.5rem;
  backdrop-filter: blur(8px);
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* 路径轨迹 */
.level-path-trail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 30; /* 降低路径的层级 */
}

.path-segment {
  position: absolute;
  background: linear-gradient(45deg, 
    rgba(255, 215, 0, 0.6) 0%, 
    rgba(255, 193, 7, 0.4) 25%,
    transparent  50%,
    rgba(255, 193, 7, 0.4) 75%,
    rgba(255, 215, 0, 0.6) 100%);
  background-size: 20px 20px;
  border-radius: 8px;
  animation: path-glow 3s ease-in-out infinite alternate;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

@keyframes path-glow {
  0% { 
    opacity: 0.4;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
  }
  100% { 
    opacity: 0.8;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
  }
}

/* 加州城市关卡节点特殊样式 - 修复覆盖问题 */
.city-node {
  /* 真正的3列均匀布局 - 增大尺寸充分利用空间 */
  width: 100px;                 /* 从80px增加到100px */
  height: 100px;
  min-width: 100px;
  min-height: 100px;
  max-width: 100px;
  max-height: 100px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f8fafc, #e2e8f0);
  border: 3px solid rgba(59, 130, 246, 0.3);
  box-shadow: 
    0 6px 20px rgba(0, 0, 0, 0.15),
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    0 0 0 2px rgba(255, 255, 255, 0.1);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.8rem;            /* 相应调整字体大小 */
  font-weight: 600;
  color: #1e40af;
  position: absolute;
  padding: 8px;                 /* 增加内边距 */
  /* 使用transform居中，避免圆圈被截断 */
  transform: translate(-50%, -50%);
  /* iPad专用：防止WebKit引擎的子像素渲染问题 */
  -webkit-transform: translate(-50%, -50%);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  /* 强制GPU加速以提高定位精度 */
  will-change: transform;
}

.city-node::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: linear-gradient(45deg, 
    rgba(59, 130, 246, 0.2), 
    transparent 30%, 
    transparent 70%, 
    rgba(34, 197, 94, 0.2));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.city-node:hover::before {
  opacity: 1;
  animation: city-pulse 2s infinite;
}

@keyframes city-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.7;
  }
}

.city-name {
  font-size: 0.7rem;           /* 适配100px圆圈的字体 */
  font-weight: 700;
  color: #1e40af;
  margin-top: 1px;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
  line-height: 1;
  word-wrap: break-word;
  max-width: 85px;             /* 适配100px圆圈的最大宽度 */
  text-align: center;
}

.city-population {
  font-size: 0.6rem;           /* 适配100px圆圈的字体 */
  color: #059669;
  font-weight: 600;
  margin-top: 1px;
  opacity: 0.8;
}

/* 城市关卡状态样式 */
.city-node.completed {
  background: linear-gradient(145deg, #10b981, #059669);
  color: white;
  border-color: #065f46;
  box-shadow: 
    0 8px 25px rgba(16, 185, 129, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.3),
    0 0 20px rgba(16, 185, 129, 0.3);
}

.city-node.completed .city-name,
.city-node.completed .city-population {
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.city-node.current {
  background: linear-gradient(145deg, 
    #FF6B6B, #FF8E53, #FF6B6B);
  background-size: 200% 200%;
  color: white;
  border: 4px solid #FF4757;
  /* 去掉闪烁动画 animation: pulse-current-city 2.5s infinite, gradient-shift 4s ease-in-out infinite; */
  box-shadow: 
    0 0 25px rgba(255, 107, 107, 0.7),
    0 12px 35px rgba(255, 107, 107, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.4);
  transform: translate(-50%, -50%);
  z-index: 50;
}

.city-node.current .city-name,
.city-node.current .city-population {
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.city-node.current::before {
  opacity: 1;
  background: linear-gradient(45deg, 
    rgba(255, 107, 107, 0.4), 
    transparent 30%, 
    transparent 70%, 
    rgba(255, 107, 107, 0.4));
  /* 去掉旋转动画 animation: rotate-glow 5s linear infinite; */
}

@keyframes pulse-current-city {
  0%, 100% {
    box-shadow: 
      0 0 25px rgba(255, 107, 107, 0.7),
      0 12px 35px rgba(255, 107, 107, 0.5),
      inset 0 2px 0 rgba(255, 255, 255, 0.4);
    transform: scale(1.15);
  }
  50% {
    box-shadow: 
      0 0 35px rgba(255, 107, 107, 0.9),
      0 16px 45px rgba(255, 107, 107, 0.7),
      inset 0 2px 0 rgba(255, 255, 255, 0.6);
    transform: scale(1.2);
  }
}

.city-node.locked {
  background: linear-gradient(145deg, #9ca3af, #6b7280);
  color: #d1d5db;
  cursor: not-allowed;
  opacity: 0.5;
  border-color: #4b5563;
}

.city-node.locked .city-name,
.city-node.locked .city-population {
  color: rgba(209, 213, 219, 0.7);
}

.city-node:hover:not(.locked) {
  transform: translate(-50%, -50%);
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    0 0 15px rgba(59, 130, 246, 0.3);
}

.level-node {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  border: 3px solid transparent;
  background: linear-gradient(145deg, #f3f4f6, #d1d5db);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.15),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

/* 关卡节点装饰 */
.level-node::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: linear-gradient(45deg, 
    rgba(255, 255, 255, 0.2), 
    transparent 30%, 
    transparent 70%, 
    rgba(255, 255, 255, 0.2));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.level-node-number {
  font-size: 1.2rem;
  font-weight: bold;
  color: #374151;
  margin-bottom: 0.2rem;
}

.level-node-stars {
  font-size: 1rem;              /* 增大星星字体 */
  height: 16px;                 /* 增加高度 */
  display: flex;
  gap: 2px;                     /* 增加星星间距 */
  justify-content: center;      /* 居中显示 */
  margin-top: 2px;              /* 增加上边距 */
}

/* 关卡节点状态 */
.level-node.completed {
  background: linear-gradient(145deg, #10b981, #059669);
  color: white;
  border-color: #065f46;
}

.level-node.current {
  background: linear-gradient(145deg, 
    #FF6B6B, #FF8E53, #FF6B6B);
  background-size: 200% 200%;
  color: white;
  border: 3px solid #FF4757;
  /* 去掉闪烁动画 animation: pulse-current 2s infinite, gradient-shift 3s ease-in-out infinite; */
  box-shadow: 
    0 0 20px rgba(255, 107, 107, 0.6),
    0 8px 25px rgba(255, 107, 107, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
  /* 移除scale避免iPad定位偏移 */
}

.level-node.current::before {
  opacity: 1;
  background: linear-gradient(45deg, 
    rgba(255, 107, 107, 0.4), 
    transparent 30%, 
    transparent 70%, 
    rgba(255, 107, 107, 0.4));
  /* 去掉旋转动画 animation: rotate-glow 4s linear infinite; */
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

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

.level-node.locked {
  background: linear-gradient(145deg, #9ca3af, #6b7280);
  color: #d1d5db;
  cursor: not-allowed;
  opacity: 0.6;
}

.level-node:hover:not(.locked) {
  /* 移除scale避免iPad定位偏移 */
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  border-color: rgba(59, 130, 246, 0.6);
}

.level-node:hover:not(.locked)::before {
  opacity: 1;
}

/* 当前关卡脉冲效果增强 - 移除scale避免iPad定位偏移 */
@keyframes pulse-current {
  0%, 100% {
    box-shadow: 
      0 0 20px rgba(255, 107, 107, 0.6),
      0 8px 25px rgba(255, 107, 107, 0.4),
      inset 0 2px 0 rgba(255, 255, 255, 0.3);
  }
  50% {
    box-shadow: 
      0 0 30px rgba(255, 107, 107, 0.8),
      0 12px 35px rgba(255, 107, 107, 0.6),
      inset 0 2px 0 rgba(255, 255, 255, 0.5);
  }
}

/* 关卡连接路径 - 更新为隐藏原始连接线 */
.level-node::after {
  display: none; /* 隐藏原始静态连接线 */
}

.level-node:nth-child(5n)::after {
  display: none;
}

.level-node:nth-child(5n)::before {
  display: none; /* 隐藏原始垂直连接线 */
}

.level-map-footer {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* 游戏导航样式 */
.game-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
}

.btn-nav {
  background: rgba(107, 70, 193, 0.1);
  color: #6b46c1;
  border: 1px solid rgba(107, 70, 193, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-nav:hover {
  background: rgba(107, 70, 193, 0.2);
  border-color: rgba(107, 70, 193, 0.5);
}

.current-level-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: #374151;
  margin: 0;
}

.level-phase-badge {
  font-size: 0.8rem;
  padding: 0.3rem 0.8rem;
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(107, 70, 193, 0.1), rgba(124, 58, 237, 0.1));
  color: #6b46c1;
  border: 1px solid rgba(107, 70, 193, 0.2);
  font-weight: 500;
}

/* 按钮样式增强 */
.btn.primary {
  background: linear-gradient(145deg, #7c3aed, #6d28d9);
  color: white;
}

.btn.secondary {
  background: linear-gradient(145deg, #f3f4f6, #e5e7eb);
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn.secondary:hover {
  background: linear-gradient(145deg, #e5e7eb, #d1d5db);
}

/* 关卡信息弹窗 */
.level-info-content {
  max-width: 400px;
  padding: 2rem;
  z-index: 10001; /* 关卡信息弹窗最高优先级 */
}

.level-info-phase {
  text-align: center;
  font-size: 0.9rem;
  padding: 0.3rem 0.8rem;
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(107, 70, 193, 0.1), rgba(124, 58, 237, 0.1));
  color: #6b46c1;
  border: 1px solid rgba(107, 70, 193, 0.2);
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.level-info-objectives {
  margin-bottom: 1.5rem;
}

.level-info-objective {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.level-info-objective:last-child {
  border-bottom: none;
}

.level-info-objective-icon {
  font-size: 1.2rem;
  margin-right: 0.8rem;
}

.level-info-objective-text {
  font-size: 0.9rem;
  color: #374151;
}

.level-info-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.info-stat {
  text-align: center;
}

.info-label {
  display: block;
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 0.3rem;
}

.info-value {
  font-size: 1.1rem;
  font-weight: bold;
  color: #374151;
}

.stars-small {
  font-size: 1rem;
}

.level-info-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.level-info-actions .btn {
  flex: 1;
  max-width: 140px;
}

/* 响应式设计 */
@media (max-width: 480px) {
  .game-container {
    padding: 1rem;
    max-width: 28rem;
  }
  
  .candy-cell {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.4rem;
  }
  
  .candy-cell.power-up {
    font-size: 1.6rem;
  }
  
  .game-title {
    font-size: 1.5rem;
  }
  
  .stat-item {
    font-size: 0.9rem;
  }
  
  .game-board {
    gap: 0.15rem;
    padding: 0.5rem;
  }
  
  /* 移动端3列网格优化 - 使用更小的固定尺寸 */
  .city-node {
    width: 75px;                 /* iPhone进一步缩小到60px */
    height: 75px;
    min-width: 60px;
    min-height: 60px;
    max-width: 75px;
    max-height: 75px;
    font-size: 0.65rem;          /* 调整字体适配更小尺寸 */
    padding: 4px;
  }
  
  .city-name {
    font-size: 0.55rem;
    max-width: 50px;
    line-height: 0.9;
  }
  
  .city-population {
    font-size: 0.45rem;
  }
  
  /* 移动端状态优化 - 减少scale避免定位问题 */
  .city-node.current {
    transform: translate(-50%, -50%);
    box-shadow: 
      0 0 20px rgba(255, 107, 107, 0.8),
      0 8px 25px rgba(255, 107, 107, 0.6),
      inset 0 2px 0 rgba(255, 255, 255, 0.5);
    border-width: 3px;  /* 适配更小尺寸的边框 */
  }
  
  .city-node:hover:not(.locked) {
    transform: translate(-50%, -50%);
    box-shadow: 
      0 6px 20px rgba(0, 0, 0, 0.25),
      inset 0 2px 0 rgba(255, 255, 255, 0.6),
      0 0 12px rgba(59, 130, 246, 0.4);
  }
  
  /* 调整地图容器在小屏幕上的表现 */
  .level-path {
    height: min(65vh, 550px); /* iPhone进一步减少高度 */
    padding: clamp(0.3rem, 1vw, 0.8rem); /* 减少内边距以缩小圆形间距 */
  }
}

/* iPhone专用优化 - 进一步减少间距 */
@media (max-width: 414px) and (-webkit-min-device-pixel-ratio: 2) {
  .city-node {
    width: 75px;                 /* iPhone专用更小尺寸 */
    height: 75px;
    min-width: 55px;
    min-height: 55px;
    max-width: 75px;
    max-height: 75px;
    font-size: 0.6rem;
    padding: 3px;
  }
  
  .city-name {
    font-size: 0.5rem;
    max-width: 45px;
    line-height: 0.85;
  }
  
  .city-population {
    font-size: 0.4rem;
  }
  
  .level-path {
    height: min(60vh, 500px); /* iPhone专用更紧凑高度 */
    padding: clamp(0.2rem, 0.5vw, 0.5rem); /* iPhone专用更小内边距以减少间距 */
  }
}

/* iPad和平板设备专用优化 - 修复位置偏移问题 */
@media (min-width: 481px) and (max-width: 1024px) and (orientation: both) {
  /* 强制iPad使用精确定位 */
  .level-path {
    position: relative;
    width: 100%;
    height: min(80vh, 800px);
    overflow: visible;  /* 确保内容不会被裁切 */
    padding: clamp(2rem, 5vw, 4rem);
    /* 添加边界以防止偏移 */
    box-sizing: border-box;
  }
  
  /* iPad专用的关卡节点定位修正 */
  .city-node {
    width: 90px;                /* iPad使用90px */
    height: 90px;
    min-width: 90px;
    min-height: 90px; 
    max-width: 90px;
    max-height: 90px;
    font-size: 0.75rem;
    padding: 7px;
    position: absolute;
    /* 确保精确居中，消除任何浏览器默认偏移 */
    transform: translate(-50%, -50%);
    /* 强制硬件加速以提高定位精度 */
    transform-style: preserve-3d;
    will-change: transform;
    /* 防止触摸偏移 */
    touch-action: manipulation;
  }
  
  /* iPad专用hover和current状态 - 移除scale避免定位偏移 */
  .city-node:hover:not(.locked) {
    transform: translate(-50%, -50%);
    box-shadow: 
      0 10px 30px rgba(0, 0, 0, 0.25),
      inset 0 2px 0 rgba(255, 255, 255, 0.6),
      0 0 20px rgba(59, 130, 246, 0.4);
  }
  
  .city-node.current {
    transform: translate(-50%, -50%);
    box-shadow: 
      0 0 30px rgba(255, 107, 107, 0.8),
      0 15px 40px rgba(255, 107, 107, 0.6),
      inset 0 2px 0 rgba(255, 255, 255, 0.5);
  }
  
  /* iPad专用字体调整 */
  .city-name {
    font-size: 0.65rem;
    max-width: 65px;
    line-height: 1;
  }
  
  .city-population {
    font-size: 0.55rem;
  }
  
  /* iPad专用地图头部调整 */
  .level-map-header {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  /* 确保iPad下的容器不产生额外偏移 */
  .level-map-container {
    padding: 1.5rem;
    overflow-x: hidden;
    overflow-y: auto;
    /* 防止iOS Safari的弹性滚动影响定位 */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  /* iPad横屏特殊处理 */
  @media (orientation: landscape) {
    .level-path {
      height: min(70vh, 650px);
      padding: clamp(1.5rem, 4vw, 3rem);
    }
    
    .city-node {
      width: 70px;
      height: 70px;
      min-width: 70px;
      min-height: 70px;
      max-width: 70px; 
      max-height: 70px;
    }
  }
}