/* style.css */

/*=== 스킨용 CSS 변수 초기값 ===*/
:root {
  --player-color:   #4FC3F7;
  --tracker-color:  #FFA726;
  --enemy-color:    #E53935;
  --bg-start:       #111;
  --bg-end:         #222;
  --ui-accent:      #4FC3F7;
}

/* reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(to bottom, var(--bg-start), var(--bg-end));
  font-family: Arial, sans-serif;
  overflow: hidden;
  color: white;
}

/* 광고 배너 */
#ads {
  height: 90px;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
}

/* 게임 영역 */
#game {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#player {
  position: absolute;
  width: 30px;
  height: 30px;
  background: var(--player-color);
  border-radius: 50%;
  z-index: 15;
}

.enemy.random {
  position: absolute;
  border-radius: 50%;
  background: var(--enemy-color);
  z-index: 5;
}

.enemy.tracker {
  position: absolute;
  width: 80px;
  height: 80px;
  background: var(--tracker-color);
  border-radius: 50%;
  z-index: 10;
}

.item {
  position: absolute;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.18);
  border-radius: 50%;
  pointer-events: none;
}

/* 타이머 디자인 */
.score-timer {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  font-weight: bold;
  color: var(--ui-accent);
  text-shadow: 1px 1px 2px #000;
  z-index: 1001;
}

/* 느려짐 타이머: 원래 위치로 복구 (점수판 왼쪽 간격 유지) */
.slow-timer {
  position: fixed;
  top: 100px;
  left: calc(50% - 140px - 1cm);
  font-size: 24px;
  font-weight: bold;
  color: #FFF; /* JS로 스킨별 덮어쓰기 */
  z-index: 1001;
}

.hidden { display: none; }

/* 버튼 스타일 */
.big-button {
  font-size: 1.5rem;
  padding: 12px 24px;
  background: var(--ui-accent);
  color: #222;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: background .2s;
}

.big-button:hover {
  background: #42a5f5;
}

/* 화면 레이아웃 */
.screen {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1002;
}

#gameOverText {
  font-size: 3rem;
  color: #E74C3C;
  text-shadow: 2px 2px 4px #000;
}

#comparisonText {
  font-size: 1.25rem;
  margin: 12px 0;
}

/* 랭킹 버튼 & 패널 */
#rankingButton {
  position: fixed;
  right: 30px;
  bottom: 30px;
  z-index: 1010;
  background: #222;
  color: #fff;
  border: 2px solid var(--ui-accent);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 1rem;
  cursor: pointer;
  transition: background .15s, border .15s;
}

#rankingButton:hover {
  background: #333;
  border-color: #fff;
}

#rankingPanel {
  position: fixed;
  right: 20px;
  bottom: 70px;
  background: rgba(0,0,0,0.85);
  padding: 16px;
  border-radius: 10px;
  z-index: 1011;
  min-width: 240px;
  max-width: 350px;
}

.ranking-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.ranking-tabs button {
  flex: 1;
  padding: 6px;
  background: #222;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  transition: background .2s;
}

.ranking-tabs button.active,
.ranking-tabs button:hover {
  background: var(--ui-accent);
  color: #222;
}

#rankingList {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}

#rankingList li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: .9rem;
  border-bottom: 1px solid #333;
}

/* 입력 오버레이 */
#inputOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.85);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}

#inputOverlay.hidden {
  display: none;
}

.overlay-content {
  background: #222;
  border-radius: 12px;
  padding: 24px;
  min-width: 320px;
  text-align: center;
  position: relative;
}

#congratsText {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

#nicknameInput {
  width: 100%;
  padding: 8px;
  margin-bottom: 12px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #111;
  color: #fff;
  font-size: 1rem;
}

/* 국가 선택 그리드 */
#flagGrid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  margin: 10px 0 18px 0;
  justify-items: center;
  max-height: 130px;
  overflow-y: auto;
}

/* flag-btn: 고정 테두리, hover 시 색상 변경 */
.flag-btn {
  font-size: 22px;
  background: none;
  border: 1.5px solid #444;
  border-radius: 6px;
  padding: 3px 5px;
  cursor: pointer;
  color: white;
  transition: border 0.1s;
  outline: none;
  box-shadow: none;
  position: relative;
  box-sizing: border-box;
}

.flag-btn.selected,
.flag-btn:hover {
  border-color: var(--ui-accent);
  background: #222;
}

/* hover 툴팁: 화면 밖으로 나가지 않도록 위치 조정 */
.flag-btn:hover::after {
  content: attr(data-country-name);
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .75rem;
  white-space: nowrap;
  z-index: 2001;
  pointer-events: none;
}

/* 스킨 선택 버튼 */
#skinSelector {
  position: fixed;
  top: calc(90px + 10px);
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 2000;
}

.skin-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #fff;
  cursor: pointer;
  transition: transform .1s, border .15s;
}

.skin-btn:hover {
  transform: scale(1.1);
}

.skin-btn.selected {
  border-color: var(--ui-accent);
}

.skin-btn[data-skin="default"] {
  background: #4FC3F7;
}

.skin-btn[data-skin="forest"] {
  background: #33691e;
}

.skin-btn[data-skin="blossom"] {
  background: #C29FD4;
}

.game-thumb-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 200px; height: 200px;
  margin: 24px auto 0 auto;
  background: none;
  text-decoration: none;
  cursor: pointer;
}

.game-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
  padding: 16px 16px 40px;
}

.game-card {
  text-align: center;
  width: 200px;
  background: #232323;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  padding: 18px 8px;
  transition: transform .2s;
}

.game-card img {
  width: 200px;
  height: 200px;
  min-width: 200px;
  min-height: 200px;
  max-width: 200px;
  max-height: 200px;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.23);
  background: #292929;
  margin: 0 auto;
  display: block;
  object-fit: none;     /* ← cover/contain 모두 X */
}
.game-title {
  margin-top: 14px;
  font-size: 1.19rem;
  color: #fff;
  font-weight: bold;
  letter-spacing: 0.5px;
}
@media (max-width: 600px) {
  .game-card { width: 95vw; }
  .game-card img { width: 95vw; height: 95vw; min-width: 120px; min-height: 120px; }
  .game-grid { gap: 16px; }
}

