.text-shadow {
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.text-shadow-lg {
  text-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.glass-effect {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.tile-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  border-radius: 0.5rem;
  font-weight: bold;
  z-index: 10;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.tile-inner img {
  width: 60%;
  height: 60%;
  object-fit: contain;
  margin-bottom: 0.25rem;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}
.tile-inner img.loaded {
  opacity: 1;
}
.tile-inner .name {
  font-size: 0.75rem;
  font-family: 'Inter', sans-serif;
}
.tile-merged .tile-inner {
  animation: pop 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  z-index: 20;
  will-change: transform;
}
@keyframes pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes victoryAppear {
  0% {
    opacity: 0;
    transform: scale(0.8) rotate(-5deg);
    filter: blur(10px);
  }
  50% {
    transform: scale(1.1) rotate(3deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
    filter: blur(0);
  }
}
.victory-card {
  animation: victoryAppear 2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.game-message {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  animation: fadeIn 0.5s ease-in-out;
  border-radius: 0.5rem;
}
.game-message.game-won, .game-message.game-over {
  display: flex;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.game-message .message {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
  font-family: 'Inter', sans-serif;
  color: white;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
.game-message .quote {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: white;
  font-family: 'Inter', sans-serif;
  max-width: 80%;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}
.game-message button {
  font-size: 1.2rem;
  padding: 0.5rem 1.5rem;
  border-radius: 0.25rem;
  background: white;
  color: #333;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
  font-family: 'Inter', sans-serif;
  border: none;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.game-message button:hover {
  background: #f0f0f0;
}
.game-message button:active {
  transform: translateY(2px);
}
.help-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-in-out;
}
.help-modal.active {
  display: flex;
}
.help-content {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}
.help-content h2 {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
  text-align: center;
  font-family: 'Inter', sans-serif;
}
.help-content ul {
  list-style-type: none;
  padding: 0;
}
.help-content li {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  border-radius: 0.25rem;
  background: #f9f9f9;
}
.help-content li img {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
  margin-right: 0.75rem;
  border-radius: 0.25rem;
}
.help-content .character-info {
  flex: 1;
}
.help-content .character-name {
  font-weight: bold;
  font-size: 0.9rem;
}
.help-content .character-description {
  font-size: 0.8rem;
  color: #666;
}
.help-content .character-value {
  font-weight: bold;
  color: #333;
  margin-left: 0.5rem;
}
.board-size-btn.active {
  background-color: rgba(255, 255, 255, 0.3);
  color: white;
}

/* 小度设备专属断点 */
@media (device-width: 1024px) and (device-height: 600px) {
  .game-container {
    padding: 16px !important;
  }
  .tile-inner .name {
    font-size: 14px;
  }
  .game-message .message {
    font-size: 28px !important;
  }
}

@media (device-width: 1280px) and (device-height: 800px) {
  .game-container {
    padding: 24px !important;
  }
  .tile-inner .name {
    font-size: 16px;
  }
}

/* 触控区域规范：按钮最小尺寸8mm（约32px@160dpi） */
#info-btn, #restart-btn, #music-toggle {
  min-width: 48px !important;
  min-height: 48px !important;
  padding: 12px !important;
}

/* 焦点样式（参考官方"遥控器交互规范"） */
.board-size-btn:focus,
#info-btn:focus,
#restart-btn:focus {
  outline: 2px solid #d4af37;
  outline-offset: 2px;
}

/* 禁用hover样式（遥控器设备无需hover） */
@media (pointer: coarse) {
  .board-size-btn:hover {
    background-color: inherit;
  }
}

/* 优化动画性能 */
@media (max-width: 1024px) {
  .tile-merged .tile-inner, .victory-card {
    animation: none !important;
  }
}

/* 游戏容器特殊阴影效果 */
.game-container {
  box-shadow: 0 10px 25px rgba(0,0,0,0.5), 0 6px 12px rgba(0,0,0,0.3), inset 0 1px 3px rgba(255,255,255,0.1);
}