/* ==========================================================================
   픽셀 서바이버 (Pixel Survivor) - 스타일시트
   - 다크 모던 테마 (배경 #222)
   - 모바일 터치 완벽 최적화 (더블탭/스크롤/선택 방지)
   - 세련된 글래스모피즘 HUD UI
   ========================================================================== */

:root {
  --bg-color: #222222;
  --panel-bg: rgba(28, 28, 35, 0.75);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --accent-blue: #3b82f6;
  --accent-red: #ef4444;
  --accent-yellow: #facc15;
  --accent-green: #10b981;
  --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-color);
}

/* 캔버스 (전체 화면 풀스크린 반응형) */
#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  background-color: var(--bg-color);
  cursor: crosshair;
}

/* 상단 HUD 오버레이 */
.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

/* 경험치 바 */
.exp-bar-container {
  position: relative;
  width: 100%;
  height: 14px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.exp-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #059669, #10b981, #34d399);
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.level-badge {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ecfdf5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  font-family: var(--font-mono);
}

/* 스탯 정보 카드 로우 */
.stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hud-card {
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.hud-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

/* 체력 바 */
.hp-card {
  flex: 1.4;
}

.hp-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 3px;
}

.hp-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f87171);
  transition: width 0.15s ease-out;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.hp-text {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #fecaca;
  align-self: flex-end;
}

/* 타이머 */
.timer-card {
  flex: 0.9;
  align-items: center;
}

.timer-text {
  font-size: 16px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fef08a;
  letter-spacing: 1px;
}

/* 킬 카운트 */
.kills-card {
  flex: 0.8;
  align-items: center;
}

.kills-text {
  font-size: 16px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #ffffff;
}

/* 무기 인디케이터 */
.weapon-indicator {
  position: absolute;
  bottom: 24px;
  left: 20px;
  z-index: 10;
  pointer-events: none;
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.weapon-icon {
  font-size: 20px;
  background: rgba(250, 204, 21, 0.15);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(250, 204, 21, 0.4);
}

.weapon-info {
  display: flex;
  flex-direction: column;
}

.weapon-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-yellow);
}

.weapon-cd {
  font-size: 10px;
  color: var(--text-muted);
}

/* 하단 조작 가이드 안내 */
.controls-guide {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 10;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.45);
  padding: 6px 14px;
  border-radius: 999px;
  letter-spacing: 0.2px;
  animation: pulse-guide 2.5s infinite ease-in-out;
  white-space: nowrap;
}

@keyframes pulse-guide {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

/* 모달 팝업 */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 1;
  transition: opacity 0.25s ease-out;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  width: 90%;
  max-width: 360px;
  background: #1f1f28;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: scale-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scale-up {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--accent-red);
  margin-bottom: 8px;
}

.modal-title.victory {
  color: #34d399;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.modal-stats {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.stat-name {
  color: var(--text-muted);
}

.stat-val {
  font-weight: 700;
  font-family: var(--font-mono);
  color: #ffffff;
}

.btn-restart {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-restart:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.6);
}

.btn-restart:active {
  transform: scale(0.98);
}

/* 시작 안내 오버레이 (Autoplay 우회용 터치 프롬프트) */
.start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 15, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.start-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: rgba(28, 28, 35, 0.88);
  padding: 24px 32px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  animation: float-pulse 2s infinite ease-in-out;
}

.start-pulse-icon {
  font-size: 38px;
  animation: bounce-icon 1.5s infinite ease-in-out;
}

.start-prompt-title {
  font-size: 20px;
  font-weight: 800;
  color: #FACC15;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 10px rgba(250, 204, 21, 0.3);
}

.start-prompt-sub {
  font-size: 13px;
  color: #9CA3AF;
  letter-spacing: 0.2px;
}

@keyframes float-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6); }
  50% { transform: scale(1.03); box-shadow: 0 20px 44px rgba(250, 204, 21, 0.25); }
}

@keyframes bounce-icon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
