:root {
  --bg-dark: #090a0d;
  --panel-bg: #111317;
  --panel-border: #222632;
  --text-main: #f1f5f9;
  --text-muted: #64748b;
  --accent-white: #ffffff;
  --accent-orange: #ff6600;
  --guide-blue: #00d4ff;
  --danger-red: #ef4444;
  --font-mono: 'Consolas', 'JetBrains Mono', 'Courier New', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Pretendard", sans-serif;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-sans);
  color: var(--text-main);
}

/* 3D 뷰포트 컨테이너 */
#canvas-container {
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

canvas {
  display: block;
  outline: none;
}

/* 크로스헤어 (JavaScript renderCrosshair에 의해 동적 렌더링) */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: none;
  z-index: 20;
}

/* 크로스헤어 설정 박스 및 미리보기 레이아웃 */
.crosshair-settings-box {
  background: #14171e;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 14px 18px;
}

.ch-config-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 8px;
  align-items: center;
}

/* ========================================================
   세팅창 UI 크기 및 글씨 크기 10% 확대 조정 스타일
   ======================================================== */
#settings-modal .ui-panel {
  width: 722px; /* 656px 기준 10% 확대 */
  padding: 20px 24px;
  gap: 15px;
  border-radius: 6px;
}

#settings-modal .panel-header {
  padding-bottom: 11px;
}

#settings-modal .panel-title {
  font-size: 15px; /* 13.5px 기준 10% 확대 */
  letter-spacing: 1.1px;
}

#settings-modal .game-select-grid {
  gap: 8px;
}

#settings-modal .game-btn {
  padding: 7px 11px;
  gap: 9px;
}

#settings-modal .game-btn-text {
  font-size: 11.5px; /* 10.5px 기준 10% 확대 */
}

#settings-modal .game-icon-box {
  width: 20px;
  height: 20px;
}

#settings-modal .form-grid {
  gap: 10px 16px;
}

#settings-modal .form-group {
  gap: 5px;
}

#settings-modal label {
  font-size: 10px; /* 9px 기준 10% 확대 */
  letter-spacing: 0.4px;
}

#settings-modal input,
#settings-modal select {
  font-size: 11.5px; /* 10.5px 기준 10% 확대 */
  padding: 7px 10px;
  height: 34px;
}

#settings-modal input[type="color"] {
  height: 34px;
  padding: 2px;
}

#settings-modal .sens-toggle-row {
  padding: 7px 11px;
}

#settings-modal .crosshair-settings-box {
  padding: 11px 15px;
}

#settings-modal #crosshair-preview-box {
  height: 42px; /* 38px 기준 10% 확대 */
}

#settings-modal .calc-box {
  padding: 9px 15px;
}

#settings-modal .calc-title {
  font-size: 9px; /* 8px 기준 10% 확대 */
}

#settings-modal .calc-val {
  font-size: 12px; /* 11px 기준 10% 확대 */
}

#settings-modal .btn {
  font-size: 10.5px; /* 9.5px 기준 10% 확대 */
  padding: 8px 18px;
}

#settings-modal .btn.btn-sm {
  font-size: 10px;
  padding: 5px 9px;
}

#settings-modal .tooltip-content {
  font-size: 10px;
  padding: 5px 9px;
}

.ch-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ch-field input[type="color"] {
  height: 36px;
  padding: 2px;
  cursor: pointer;
}

.ch-preview-container {
  grid-column: span 2;
}

#crosshair-preview-box {
  width: 100%;
  height: 48px;
  background: #2b2b2b;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#crosshair-preview {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Real-time headline guide line (1px precision horizontal line) */
#headline-guide {
  position: absolute;
  top: 0;
  left: 0;
  width: 250vw; /* Wide coverage ensuring no clipping when rolled */
  height: 1px;
  transform-origin: center center;
  background: linear-gradient(
    90deg,
    rgba(0, 212, 255, 0) 0%,
    rgba(0, 212, 255, 0.6) 20%,
    #00d4ff 50%,
    rgba(0, 212, 255, 0.6) 80%,
    rgba(0, 212, 255, 0) 100%
  );
  box-shadow: 0 0 4px rgba(0, 212, 255, 0.5);
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
  z-index: 15;
}

/* Headline elevation warning badge displayed above crosshair when guide line is active */
#headline-warning {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0);
  padding: 6px 14px;
  border-radius: 4px;
  background: rgba(17, 19, 23, 0.88);
  border: 1px solid rgba(255, 82, 82, 0.75);
  color: #ff5252;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  opacity: 0;
  will-change: opacity;
  z-index: 21;
}

/* 대기샷 생성 예고 시 헤드라인 및 이전 사격점 피드백 라인 (초슬림 1px) */
.preaim-feedback-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  pointer-events: none;
  display: none;
  opacity: 0;
  will-change: transform, opacity;
  z-index: 14;
}

.preaim-feedback-line.blue-line {
  background: linear-gradient(
    90deg,
    rgba(0, 212, 255, 0) 0%,
    rgba(0, 212, 255, 0.6) 15%,
    #00d4ff 50%,
    rgba(0, 212, 255, 0.6) 85%,
    rgba(0, 212, 255, 0) 100%
  );
  box-shadow: 0 0 4px rgba(0, 212, 255, 0.6);
}

.preaim-feedback-line.red-line {
  background: linear-gradient(
    90deg,
    rgba(255, 59, 48, 0) 0%,
    rgba(255, 59, 48, 0.6) 15%,
    #ff3b30 50%,
    rgba(255, 59, 48, 0.6) 85%,
    rgba(255, 59, 48, 0) 100%
  );
  box-shadow: 0 0 4px rgba(255, 59, 48, 0.6);
}

/* 화면 우측 상단 실시간 FPS 디스플레이 */
#fps-display {
  position: fixed;
  top: 18px;
  right: 28px;
  background: rgba(17, 19, 23, 0.85);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  padding: 6px 14px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  pointer-events: none;
  z-index: 300;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.fps-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-muted);
}

#fps-value {
  font-size: 15px;
  font-weight: 700;
  color: #00ff66;
  min-width: 28px;
  text-align: right;
}

/* 3, 2, 1 카운트다운 오버레이 */
#countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 50;
  background: rgba(0, 0, 0, 0.35);
}

#countdown-text {
  font-family: var(--font-mono);
  font-size: 88px;
  font-weight: 800;
  color: var(--accent-white);
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.6), 0 0 60px rgba(0, 212, 255, 0.5);
  transform: scale(1);
  transition: transform 0.15s ease-out;
}

/* 인게임 실시간 HUD */
#hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 16px 28px;
  display: none;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 25;
}

.hud-panel {
  background: rgba(17, 19, 23, 0.88);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  padding: 10px 22px;
  border-radius: 4px;
  display: flex;
  gap: 28px;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hud-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.hud-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-white);
}

.hud-game-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.highlight-val {
  color: var(--guide-blue);
}

/* 서바이벌 HP 바 */
#hp-container {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 25;
  pointer-events: none;
}
.hp-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.hp-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.hp-bar-fill {
  width: 100%;
  height: 100%;
  background: var(--accent-white);
  transition: width 0.12s ease-out;
}

/* 모던 UI 모달 */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(9, 10, 13, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.ui-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  width: 820px;
  max-width: 92%;
  border-radius: 6px;
  padding: 28px 34px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.85);
  max-height: 94vh;
  overflow-y: auto;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 14px;
}

.panel-title {
  font-size: 17px;
  letter-spacing: 1.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-white);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.active-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: #181b22;
  border: 1px solid #2b303e;
  padding: 4px 10px;
  border-radius: 4px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.active-badge:hover {
  border-color: var(--accent-white);
  background: #232834;
  color: var(--accent-white);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

/* 모드 카드 (4개 항목 지원을 위한 2열 그리드) */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.mode-card {
  background: #15181e;
  border: 1px solid var(--panel-border);
  padding: 18px 20px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}
.mode-card:hover {
  border-color: var(--accent-white);
  background: #1a1e26;
  transform: translateY(-2px);
}
.mode-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-white);
}
.mode-meta {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* 최고 점수 / 평균 점수 배지 */
.mode-score-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--guide-blue);
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.25);
  padding: 3px 8px;
  border-radius: 3px;
  margin-top: 4px;
  align-self: flex-start;
}

/* Requirement: 대기샷 타깃 스폰 예고 UI 인디케이터 (50% 축소 및 바닥 핑 스타일) */
.preaim-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  margin-left: -11px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 22;
  will-change: transform, opacity;
  transition: opacity 0.2s ease-out; /* 0.2s smooth proximity fade */
  opacity: 1;
}

.preaim-marker-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1.5px solid #ef4444;
  box-shadow: 0 0 6px #ef4444, inset 0 0 3px #ef4444;
  animation: preaim-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.preaim-marker-icon {
  font-size: 8px;
  font-weight: 800;
  color: #ef4444;
  text-shadow: 0 0 4px rgba(239, 68, 68, 0.9);
}

.preaim-marker-countdown {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  color: #fca5a5;
  background: rgba(0, 0, 0, 0.8);
  padding: 0px 3px;
  border-radius: 2px;
  border: 0.5px solid rgba(239, 68, 68, 0.5);
  margin-top: 2px;
  white-space: nowrap;
}

@keyframes preaim-ping {
  0% {
    transform: scale(0.7);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0.1;
  }
}
.mode-card:hover {
  border-color: var(--accent-white);
  background: #1a1e26;
  transform: translateY(-2px);
}
.mode-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-white);
}
.mode-meta {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* 게임 선택 버튼 그리드 (공식 아이콘 포함) */
.game-select-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.game-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #14171e;
  border: 1px solid var(--panel-border);
  padding: 10px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.game-btn:hover {
  border-color: #4b5563;
  background: #1a1e27;
}
.game-btn.active {
  border-color: var(--accent-white);
  background: #232834;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}
.game-btn-text {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
}

/* 공식 벡터 SVG 아이콘 래퍼 */
.game-icon-box {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.game-icon-box.sm {
  width: 18px;
  height: 18px;
}
.game-icon-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* 폼 요소 그리드 */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}
.form-group.span-2 {
  grid-column: span 2;
}

.sens-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #14161c;
  border: 1px dashed var(--panel-border);
  border-radius: 4px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.label-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #94a3b8;
  text-transform: uppercase;
}

input, select {
  background: #15181f;
  border: 1px solid var(--panel-border);
  color: var(--accent-white);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s ease;
}
input:focus, select:focus {
  border-color: var(--accent-white);
}

/* 툴팁 UI */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 10px;
  font-family: var(--font-mono);
  background: #222733;
  color: #94a3b8;
  border-radius: 50%;
  cursor: help;
}
.tooltip-icon:hover + .tooltip-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.tooltip-content {
  position: absolute;
  top: -34px;
  left: 0;
  background: #000;
  border: 1px solid #333a4d;
  color: #e2e8f0;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: all 0.15s ease;
  z-index: 200;
}

/* 수치 연산 박스 */
.calc-box {
  background: #0d0e12;
  border: 1px solid #1c202a;
  padding: 12px 18px;
  border-radius: 4px;
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.calc-box.vertical {
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}
.calc-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.calc-title {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.calc-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-white);
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Consistent button row layout */
.btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 6px;
}

/* Main menu footer row with left language selector and right settings button */
.btn-row.menu-footer-row {
  justify-content: space-between;
  align-items: center;
}

.lang-selector-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-selector-wrap label {
  margin: 0;
  white-space: nowrap;
}

.lang-selector-wrap select {
  min-width: 120px;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  cursor: pointer;
}

.btn {
  background: #181b22;
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn.btn-sm {
  padding: 6px 12px;
  font-size: 11px;
}
.btn.btn-secondary {
  background: #202530;
  border-color: #353c4d;
}
.btn:hover {
  border-color: var(--accent-white);
  color: var(--accent-white);
  background: #20242e;
}
.btn-primary {
  background: var(--accent-white);
  color: #000000;
  border-color: var(--accent-white);
}
.btn-primary:hover {
  background: #e2e8f0;
  border-color: #e2e8f0;
  color: #000;
}

/* 알림 배너 */
.alert-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 12px;
  color: #fca5a5;
  display: none;
}

/* 커스텀 스크롤바 */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #0d0f14;
}
::-webkit-scrollbar-thumb {
  background: #262c3b;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b4459;
}

/* 분석 결과표 버튼 및 카드 하단 레이아웃 */
.mode-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mode-card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.btn-report {
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.35);
  color: var(--guide-blue);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-report:hover {
  background: var(--guide-blue);
  color: #000;
  border-color: var(--guide-blue);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
}

/* 분석 결과표 전용 모달 그리드 레이아웃 */
.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.report-section {
  background: #14171f;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.report-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #94a3b8;
  text-transform: uppercase;
}
.report-rank-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #0d0f14;
  border-radius: 4px;
  border: 1px solid #1c202a;
}
.report-rank-badge {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 900;
  min-width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--guide-blue);
  color: var(--guide-blue);
  box-shadow: 0 0 14px rgba(0, 212, 255, 0.2);
}
.report-stat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.report-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: #181c25;
  border-radius: 4px;
}
.report-stat-label {
  font-size: 11px;
  color: #94a3b8;
}
.report-stat-val-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.report-stat-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-white);
}
.report-stat-grade {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  min-width: 26px;
  text-align: right;
}
.report-criteria-box {
  background: #0d0e12;
  border: 1px dashed #2a3142;
  padding: 12px 16px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.criteria-title {
  color: #e2e8f0;
  font-weight: 700;
}
.criteria-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}