/* ==========================================================================
   K-FOOTBALL CHAMPIONSHIP - STYLESHEET
   FIFA / FC Style Modern Sports UI & Layout
   ========================================================================== */

:root {
  --bg-dark: #0a0e17;
  --panel-bg: rgba(15, 23, 42, 0.85);
  --panel-border: rgba(255, 255, 255, 0.12);
  --primary-blue: #00d2ff;
  --blue-glow: rgba(0, 210, 255, 0.4);
  --primary-red: #ff2a5f;
  --red-glow: rgba(255, 42, 95, 0.4);
  --accent-gold: #ffd200;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Rajdhani', 'Outfit', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-main);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 메인 게임 래퍼 */
#game-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 1600px;
  max-height: 900px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #06090e;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

/* 게임 캔버스 */
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #1e3a1e;
  cursor: crosshair;
}

/* ==========================================================================
   상단 스코어보드 & HUD
   ========================================================================== */
.hud-container {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  padding: 8px 24px;
  border-radius: 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 210, 255, 0.1);
  z-index: 20;
  transition: all 0.3s ease;
}

.hud-container.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -20px);
}

.team-score {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-badge {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 1px;
}

.blue-badge {
  background: linear-gradient(135deg, #0052d4, #00d2ff);
  color: #fff;
  box-shadow: 0 0 12px var(--blue-glow);
}

.red-badge {
  background: linear-gradient(135deg, #d31027, #ff2a5f);
  color: #fff;
  box-shadow: 0 0 12px var(--red-glow);
}

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

.red-info {
  align-items: flex-end;
}

.team-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
}

.blue-text { color: var(--primary-blue); }
.red-text { color: var(--primary-red); }

.diff-badge {
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-gold);
  text-transform: uppercase;
  background: rgba(255, 210, 0, 0.15);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.stamina-container {
  width: 70px;
  height: 5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  margin-top: 3px;
  overflow: hidden;
}

.stamina-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #00d2ff, #00ff87);
  transition: width 0.1s linear;
}

.score-digit {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  min-width: 32px;
  text-align: center;
  line-height: 1;
}

.blue-team .score-digit {
  color: #ffffff;
  text-shadow: 0 0 12px var(--blue-glow);
}

.red-team .score-digit {
  color: #ffffff;
  text-shadow: 0 0 12px var(--red-glow);
}

/* 경기 타이머 & 레이더 */
.match-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.period-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.timer-display {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: #ffd200;
  letter-spacing: 1.5px;
}

.radar-box {
  margin-top: 4px;
  width: 120px;
  height: 70px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

#radarCanvas {
  width: 100%;
  height: 100%;
}

.hud-buttons {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

/* ==========================================================================
   하단 HUD 가이드
   ========================================================================== */
.bottom-hud-container {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.bottom-hud-container.hidden {
  opacity: 0;
}

.action-hints {
  display: flex;
  gap: 12px;
  background: rgba(10, 15, 25, 0.75);
  backdrop-filter: blur(8px);
  padding: 6px 18px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: var(--text-muted);
}

.hint-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

kbd {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
}

/* ==========================================================================
   골 세레머니 오버레이
   ========================================================================== */
.goal-screen {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.8) 100%);
  z-index: 40;
  pointer-events: none;
  animation: fadeIn 0.2s ease-out;
}

.goal-screen.hidden {
  display: none;
}

.goal-banner {
  text-align: center;
  transform: scale(0.8);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.goal-text {
  font-family: var(--font-display);
  font-size: 96px;
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #fff700, #ff8400, #ff1e00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 35px rgba(255, 140, 0, 0.9));
  animation: pulseGlow 1s infinite alternate;
}

.goal-subtext {
  font-family: var(--font-main);
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
  margin-top: 10px;
  letter-spacing: 2px;
}

@keyframes popIn {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulseGlow {
  0% { filter: drop-shadow(0 0 25px rgba(255, 140, 0, 0.7)); }
  100% { filter: drop-shadow(0 0 50px rgba(255, 50, 0, 1)); transform: scale(1.05); }
}

/* ==========================================================================
   메뉴 및 모달 오버레이
   ========================================================================== */
.menu-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  transition: opacity 0.3s ease;
}

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

.glass-panel {
  background: rgba(18, 26, 43, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 210, 255, 0.15);
  border-radius: 24px;
  padding: 36px 40px;
  max-width: 640px;
  width: 90%;
  text-align: center;
}

.logo-area .sub-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary-blue);
  letter-spacing: 3px;
  margin-bottom: 6px;
}

.main-title {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1.1;
  color: #ffffff;
  margin-bottom: 8px;
}

.main-title span {
  background: linear-gradient(135deg, var(--primary-blue), #00ffaa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 24px;
  text-align: left;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.option-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.opt-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: 12px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.opt-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.opt-btn.active {
  background: linear-gradient(135deg, #0066ff, #00d2ff);
  border-color: #00d2ff;
  color: #fff;
  box-shadow: 0 4px 16px var(--blue-glow);
}

.opt-btn.danger-btn.active {
  background: linear-gradient(135deg, #d31027, #ff2a5f);
  border-color: #ff2a5f;
  box-shadow: 0 4px 16px var(--red-glow);
}

/* 조작 방법 가이드 */
.controls-guide {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 14px;
  padding: 16px 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 24px;
  text-align: left;
}

.controls-guide h3 {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-gold);
  margin-bottom: 12px;
}

.controls-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.ctrl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}

.ctrl-row strong {
  color: #ffffff;
  font-weight: 600;
}

/* 메인 액션 버튼 */
.btn-primary-glow {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #00d2ff, #0052d4);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(0, 210, 255, 0.4);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary-glow:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 40px rgba(0, 210, 255, 0.6);
}

.btn-primary-glow:active {
  transform: translateY(1px);
}

.btn-secondary {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn-danger {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 42, 95, 0.3);
  background: rgba(255, 42, 95, 0.12);
  color: #ff6b8b;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: rgba(255, 42, 95, 0.25);
  color: #fff;
}

/* 일시정지 & 게임오버 모달 */
.pause-card h2, .result-card h2 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 24px;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 20px;
}

.final-score-display {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 24px;
}

.final-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.final-digit {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 900;
  color: #fff;
}

.score-vs {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--text-muted);
}

.stats-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  padding: 14px 20px;
}

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

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

.stat-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
}

/* ==========================================================================
   모바일 가상 컨트롤러
   ========================================================================== */
.touch-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 30px 40px;
}

.touch-overlay.hidden {
  display: none !important;
}

.joystick-zone {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  position: relative;
  pointer-events: auto;
  touch-action: none;
}

.joystick-stick {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, #00d2ff, #0052d4);
  box-shadow: 0 0 15px var(--blue-glow);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.touch-buttons {
  display: grid;
  grid-template-columns: repeat(2, 70px);
  gap: 16px;
  pointer-events: auto;
}

.touch-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: none;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  touch-action: manipulation;
}

.touch-btn:active {
  transform: scale(0.92);
}

.sprint-btn { background: #3b82f6; }
.pass-btn { background: #10b981; }
.shoot-btn { background: #ef4444; }
.tackle-btn { background: #f59e0b; }

/* 미디어 쿼리 (반응형 모바일 조정) */
@media (max-width: 768px) {
  .hud-container {
    padding: 6px 14px;
    gap: 8px;
    top: 8px;
  }
  .radar-box {
    display: none;
  }
  .team-name {
    display: none;
  }
  .score-digit {
    font-size: 26px;
  }
  .timer-display {
    font-size: 18px;
  }
  .bottom-hud-container {
    display: none;
  }
  .touch-overlay {
    padding: 16px 20px;
  }
  .glass-panel {
    padding: 24px 20px;
  }
  .main-title {
    font-size: 28px;
  }
}