/* 게임 헤더 스타일링 */
.game-header {
  padding: 4rem 2rem;
  background: linear-gradient(135deg, #fa3030 0%, #f65c5c 100%);
  border-radius: 0 0 3rem 3rem;
  margin-bottom: 3rem;
  position: relative;
  overflow: hidden;
}

.game-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
  opacity: 0.5;
}

.header-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: white;
  animation: pulse 2s infinite;
}

.game-header .title {
  color: white;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-header .subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto;
}

.header-content {
  position: relative;
  text-align: center;
  z-index: 1;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  font-size: 1.1rem;
}

.feature-item i {
  font-size: 1.25rem;
  opacity: 0.9;
  animation: float 3s ease-in-out infinite;
}

.feature-item:nth-child(2) i {
  animation-delay: 0.5s;
}

.feature-item:nth-child(3) i {
  animation-delay: 1s;
}

/* 게임 화면에서의 헤더 스타일 */
.game-screen .game-header {
  background: white;
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border-radius: 0;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

@media screen and (max-width: 768px) {
  .game-header {
    padding: 2rem 1rem;
  }
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.header-card {
  background: white;
  border-radius: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  padding: 2.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.3s ease;
}

.game-card {
  transition: transform 0.3s ease;
  cursor: pointer;
  height: 100%;
}

.game-card:hover {
  transform: translateY(-5px);
}

.game-card.is-coming-soon {
  opacity: 0.7;
  cursor: not-allowed;
}

.game-card .card-content {
  padding: 2rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-card .icon {
  margin-bottom: 1rem;
}

.game-card .title {
  margin-bottom: 1.5rem !important;
}

.game-card .subtitle {
  margin-bottom: 1.5rem !important;
  flex-grow: 1;
}

.game-card .button {
  margin-top: auto;
}

.game-card .tag {
  margin-top: auto;
}

/* 모바일 컨트롤 스타일 */
.mobile-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: min(12vh, 80px);
  padding: min(1.5vh, 10px) min(3vw, 20px);
  background: rgba(245, 245, 245, 0.9);
  backdrop-filter: blur(4px);
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.control-button {
  flex: 1;
  width: min(30vw, 240px);
  height: min(5vh, 50px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  font-size: min(4vw, 24px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.control-button:active {
  background: rgba(255, 255, 255, 0.7);
  transform: scale(0.95);
}

.control-button i {
  font-size: min(4vw, 24px);
}

/* 반응형 조정 */
@media (max-width: 768px) {
  .game-card .card-content {
    padding: 1.5rem;
  }

  .game-card .subtitle {
    font-size: 0.9rem !important;
  }

  .control-button {
    opacity: 0.8;
  }

  .control-button:active {
    opacity: 1;
  }

  .game-canvas-container {
    height: calc(100% - min(6vh, 40px));
  }

  .game-screen {
    bottom: min(12vh, 80px);
  }

  .mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  .back-to-games {
    font-size: 0.9rem;
    padding: 0.3rem 0.8rem;
  }

  .game-title {
    font-size: 2rem;
  }

  .game-subtitle {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
  }

  .feature-tag {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }

  #gameCanvas {
    max-height: calc(100% - min(12vh, 80px));
  }
}

/* 게임 화이지 스타일 */
.game-page {
  display: block;
}

/* 게임 화면 스타일 */
.game-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.game-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  height: 100%;
  padding: 0;
  margin: 0;
}

.game-canvas-container {
  flex: 1;
  position: relative;
  background: #f5f5f5;
  overflow: hidden;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

#gameCanvas {
  position: relative;
  transform: none;
  margin: 0;
  padding: 0;
  background: white;
  max-width: 100%;
  max-height: 100%;
}

.back-to-games {
  font-size: min(2.5vw, 1rem);
  padding: min(1vh, 0.5rem) min(2vw, 1rem);
}

/* 게임오버 오버레이 스타일 */
.game-over-overlay {
  position: absolute;
  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: 10;
}

.game-over-content {
  text-align: center;
  color: white;
  padding: 2rem;
}

.game-over-content .title {
  font-size: 3rem;
  color: white;
  margin-bottom: 1rem;
}

.game-over-content .score {
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

.game-over-content .restart-button {
  min-width: 200px;
  font-size: 1.25rem;
}

/* 게임별 컨트롤 */
.dodge-controls,
.homerun-controls {
  display: none;
  width: 100%;
  justify-content: space-between;
}

.dodge-controls {
  gap: min(4vw, 30px);
}

.homerun-controls {
  justify-content: space-between;
  gap: min(4vw, 30px);
  padding: 0 min(4vw, 30px);
}

.homerun-controls .swing-button {
  width: min(40vw, 200px);
}

.homerun-controls .left-button,
.homerun-controls .right-button {
  width: min(15vw, 80px);
  background: #2196f3;
}

.homerun-controls .left-button:active,
.homerun-controls .right-button:active {
  background: #1976d2;
}

/* 게임에 따라 적절한 컨트롤 표시 */
[data-game="dodge"] .dodge-controls {
  display: flex;
}

[data-game="homerun"] .homerun-controls {
  display: flex;
}

.game-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#gameCanvas {
  max-width: 100%;
  max-height: calc(100% - 80px); /* 모바일 컨트롤 높이만큼 공간 확보 */
}

.mobile-controls {
  display: none; /* 기본적으로 숨김 */
  width: 100%;
  height: 80px;
  padding: 10px;
  justify-content: center;
  align-items: center;
  gap: 20px;
  background: rgba(0, 0, 0, 0.1);
}

.control-button {
  padding: 10px 20px;
  font-size: 20px;
  border: none;
  border-radius: 8px;
  background: #4caf50;
  color: white;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.swing-button {
  padding: 15px 30px;
  font-weight: bold;
  background: #f44336;
}

/* 모바일 환경에서만 컨트롤 표시 */
@media (max-width: 768px) {
  .mobile-controls {
    display: flex;
  }
}

/* 버튼 터치 효과 */
.control-button:active {
  opacity: 0.8;
  transform: scale(0.95);
}

/* 반응형 스타일 */
@media (max-width: 768px) {
  .game-header {
    padding: 1rem 0;
  }

  .container {
    padding: 0 1rem;
  }

  .header-card {
    padding: 1.5rem;
    border-radius: 20px;
  }

  .feature-item {
    justify-content: center;
  }
}
