:root {
  --bg-dark: #06070d;
  --bg-card: rgba(10, 12, 26, 0.72);
  --border-card: rgba(255, 255, 255, 0.08);
  --accent: #ff9900;
  --neon-violet: #8c52ff;
  --neon-blue: #00f0ff;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
}

/* Lucide Icons Styles */
i[data-lucide] {
  vertical-align: middle;
  width: 1.2rem;
  height: 1.2rem;
}
.icon-sm {
  width: 1.1rem !important;
  height: 1.1rem !important;
  margin-right: 4px;
}
.icon-lg {
  width: 2.5rem !important;
  height: 2.5rem !important;
  margin-bottom: 8px;
}
.hud-icon-btn i[data-lucide] {
  margin-right: 0;
  width: 1.4rem !important;
  height: 1.4rem !important;
}

html {
  height: 100%;
}

body {
  font-family: 'Outfit', 'Noto Sans KR', 'Inter', sans-serif !important;
  background-color: var(--bg-dark) !important;
  color: var(--text-main) !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

/* 핀볼 실시간 렌더링 캔버스 (전체 배경화) */
#pinball-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: radial-gradient(circle at 50% 30%, #0d0f22 0%, #05060b 80%);
}

/* 홀로그램 플로팅 유리 제어판 (좌측 정렬) */
.pinball-control-panel {
  position: absolute;
  top: 30px;
  left: 30px;
  width: 370px;
  height: calc(100% - 60px);
  z-index: 2;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  padding: 24px;
  box-sizing: border-box;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6),
              inset 0 1px 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 14px;
  pointer-events: auto;
  overflow-y: auto;
}
.pinball-control-panel::-webkit-scrollbar { width: 6px; }
.pinball-control-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12); border-radius: 99px;
}

/* 패널 브랜드 타이틀 */
.panel-brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.5px;
  margin: 0;
  white-space: nowrap;
  min-width: 0;
}
.panel-row--header {
  flex-wrap: wrap;
  row-gap: 4px;
}

/* 맵 선택 세그먼트 */
.map-select-row { margin-top: -2px; }
.map-select-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.map-segment {
  display: inline-flex;
  padding: 3px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 99px;
}
.map-seg-btn {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.map-seg-btn:hover:not(.active):not(.locked) { color: rgba(255,255,255,0.85); }
.map-seg-btn.active {
  background: rgba(255,153,0,0.18);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255,153,0,0.35);
}
.map-seg-btn.locked {
  opacity: 0.35;
  cursor: not-allowed;
}
.map-seg-btn.locked::after { content: " (Locked)"; font-size: 0.6rem; }

/* 셔플 아이콘 버튼 + 인원수 텍스트 */
.member-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  margin-left: 4px;
  letter-spacing: 0;
  text-transform: none;
}
.shuffle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.shuffle-btn:hover {
  background: rgba(255,153,0,0.14);
  border-color: rgba(255,153,0,0.35);
  color: #fff;
}
.shuffle-btn--danger { padding: 5px 9px; color: rgba(255,255,255,0.45); }
.shuffle-btn--danger:hover { background: rgba(255,60,60,0.18); border-color: rgba(255,60,60,0.4); color: #ff6060; }
.shuffle-ico { font-size: 0.82rem; line-height: 1; }

/* 설정 타이틀 */
.panel-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.8px;
  margin-bottom: 2px;
}

/* 다크 입력 폼 (레거시 유지) */
.panel-textarea {
  width: 100%;
  height: 62px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #fff;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.82rem;
  resize: none;
  outline: none;
  box-sizing: border-box;
  line-height: 1.4;
}
.panel-textarea:focus { border-color: var(--accent); }

/* ── 태그(칩) 방식 멤버 입력 ──────────────────────────────── */
.member-tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 38px;
  max-height: 110px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px 8px 0 0;
  padding: 6px 8px;
  box-sizing: border-box;
  align-content: flex-start;
}
.member-tag-container:empty::before {
  content: '참가자가 없습니다';
  color: rgba(255,255,255,0.22);
  font-size: 0.72rem;
  line-height: 26px;
}
.member-tag-container::-webkit-scrollbar { width: 4px; }
.member-tag-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15); border-radius: 99px;
}
.member-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 10px;
  background: rgba(255, 153, 0, 0.12);
  border: 1px solid rgba(255, 153, 0, 0.3);
  border-radius: 99px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  max-width: 120px;
}
.member-tag span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-tag-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none;
  color: rgba(255,255,255,0.55);
  font-size: 0.65rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s;
}
.member-tag-del:hover { background: rgba(255,51,51,0.45); color: #fff; }
body.theme-canyon .member-tag {
  background: rgba(199, 134, 90, 0.12);
  border-color: rgba(199, 134, 90, 0.3);
}

.member-input-row {
  display: flex;
  gap: 0;
}
.member-input-field {
  flex: 1;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: none;
  border-right: none;
  border-radius: 0 0 0 8px;
  color: #fff;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  box-sizing: border-box;
  min-width: 0;
}
.member-input-field:focus { border-color: var(--accent); }
.member-input-field::placeholder { color: rgba(255,255,255,0.25); font-size: 0.72rem; }
.member-add-btn {
  width: 36px;
  background: rgba(255, 153, 0, 0.18);
  border: 1px solid rgba(255, 153, 0, 0.3);
  border-top: none;
  border-left: 1px solid rgba(255,255,255,0.06);
  border-radius: 0 0 8px 0;
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.member-add-btn:hover { background: rgba(255, 153, 0, 0.3); }
.member-add-btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
body.theme-canyon .member-add-btn {
  background: rgba(199,134,90,0.18);
  border-color: rgba(199,134,90,0.3);
  color: var(--accent);
}
body.theme-canyon .member-add-btn:hover { background: rgba(199,134,90,0.3); }

/* 라디오 그룹 포맷 */
.rule-radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  border-radius: 10px;
}

.rule-radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #d1d5db;
  font-weight: 600;
}

.rule-radio-item input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
  width: 14px;
  height: 14px;
}

.rule-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 2px;
}

/* 브라우저 기본 스피너 제거 */
.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.stepper-input[type=number] { -moz-appearance: textfield; }

/* 일체형 스태퍼 박스 */
.number-stepper {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  box-sizing: border-box;
  transition: border-color 0.18s ease;
}
.stepper-input {
  width: 100%;
  padding: 6px 0;
  border: 0 !important;
  background: transparent !important;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  font-family: inherit;
  cursor: default;
  box-sizing: border-box;
}
.stepper-btn {
  width: 28px;
  align-self: stretch;
  border: 0;
  background: rgba(255, 255, 255, 0.01);
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}
.stepper-btn:hover {
  background: rgba(255, 153, 0, 0.08);
  color: var(--accent);
}
.stepper-btn.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* 가상 코드가 흐르는 터미널 로그 */
#pinball-terminal {
  display: none;
  width: 100%;
  height: 72px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  color: #00f0ff;
  padding: 6px 10px;
  box-sizing: border-box;
  overflow-y: auto;
  line-height: 1.35;
}

/* 버튼 스타일 */
.panel-btn {
  padding: 10px;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-orange {
  background: linear-gradient(90deg, var(--accent), #ffb700);
  box-shadow: 0 4px 15px rgba(255, 153, 0, 0.2);
}
.btn-orange:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 153, 0, 0.35);
}

.btn-reset {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-reset:hover {
  background: rgba(255, 255, 255, 0.12);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}

.badge.orange {
  background: rgba(255, 153, 0, 0.12);
  border-color: rgba(255, 153, 0, 0.25);
  color: var(--accent);
}

/* 실시간 리더보드 테이블 */
.leaderboard-container {
  flex: 1;
  min-height: 0;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 8px;
  overflow-y: auto;
  box-sizing: border-box;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.leaderboard-table th {
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.leaderboard-table td {
  padding: 5px 6px;
  color: #e5e7eb;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.leaderboard-rank {
  font-weight: 800;
  width: 32px;
}
.leaderboard-rank.top-rank {
  color: var(--accent);
}

/* 당첨 오버레이 팝업 카드 (중앙 플로팅 연출) */
.pinball-modal {
  position: absolute;
  top: 50%;
  left: clamp(50%, calc(50% + 200px), calc(100% - 250px));
  transform: translate(-50%, -50%);
  width: 450px;
  background: rgba(18, 20, 38, 0.95);
  border: 2px solid var(--accent);
  border-radius: 24px;
  padding: 36px;
  text-align: center;
  z-index: 10;
  box-shadow: 0 25px 60px rgba(255, 153, 0, 0.3),
              inset 0 1px 1px rgba(255, 255, 255, 0.15);
  display: none;
  animation: cardPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
}

@keyframes cardPop {
  0% { transform: translate(-50%, -50%) scale(0.7) translateY(30px); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1) translateY(0); opacity: 1; }
}

.modal-winner-badge {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 6px;
}

.modal-winner-names {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  margin: 12px 0 18px 0;
  line-height: 1.3;
}

/* ❄️ Freeze Mode 호버 토스트 */
.freeze-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  background: rgba(0,240,255,0.12);
  border: 1px solid rgba(0,240,255,0.28);
  border-radius: 50%;
  font-size: 0.68rem;
  color: #00f0ff;
  cursor: pointer;
  flex-shrink: 0;
}
.freeze-toast {
  position: fixed;
  top: 0; left: 0;
  transform: none;
  width: 210px;
  background: rgba(4, 10, 24, 0.97);
  border: 1px solid rgba(0,240,255,0.25);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.72rem;
  color: #9de8f8;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 999;
  white-space: normal;
  box-shadow: 0 4px 20px rgba(0,240,255,0.12);
}

/* ── 패널 유틸리티 클래스 ────────────────────────────────── */

.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-row--mb2 { margin-bottom: 2px; }

.panel-title-flush { margin: 0; }
.panel-title-dim { color: rgba(255, 255, 255, 0.25); }

.panel-input {
  width: 100%;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
  box-sizing: border-box;
  outline: none;
  font-family: inherit;
}
.panel-input:disabled { cursor: not-allowed; }

.panel-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 10px;
  align-items: center;
}

.panel-grid-buttons {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 10px;
}

.panel-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid rgba(0, 240, 255, 0.12);
  border-radius: 8px;
}
.freeze-mode-label-group {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
}
.freeze-mode-label-group .panel-toggle-label { flex: unset; }
.freeze-mode-hint-text {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.3;
}
.panel-toggle-checkbox {
  accent-color: #00f0ff;
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}
.panel-toggle-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #00f0ff;
  cursor: pointer;
  letter-spacing: 0.5px;
  flex: 1;
  line-height: 1;
}

.badge-sm { font-size: 0.68rem; padding: 2px 8px; }
.badge-btn { font-size: 0.65rem; border: none; cursor: pointer; }

.leaderboard-title {
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 3px;
}
.leaderboard-table .col-time { text-align: right; }
.leaderboard-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.2);
  padding: 20px 0;
}

.modal-icon { font-size: 2.5rem; margin-bottom: 6px; }
.modal-subtext {
  font-size: 0.95rem;
  color: #cbd5e1;
  margin-bottom: 24px;
  line-height: 1.45;
}
.btn-modal-close { padding: 8px 30px; font-size: 0.85rem; }

/* ── Zigzag Canyon 바위 테마 ─────────────────────────────── */
body.theme-canyon {
  --bg-dark:     #180a04;
  --bg-card:     rgba(28, 14, 6, 0.84);
  --border-card: rgba(140, 75, 47, 0.22);
  --accent:  #C7865A;
  --neon-violet: #8C4B2F;
  --neon-blue:   #D8B08C;
  background-color: var(--bg-dark) !important;
}

body.theme-canyon #pinball-canvas {
  background: radial-gradient(circle at 50% 30%, #2a1208 0%, #0e0603 80%);
}

body.theme-canyon #pinball-terminal {
  border-color: rgba(166, 94, 59, 0.3);
  color: #D8B08C;
}

body.theme-canyon .freeze-hint {
  background: rgba(199, 134, 90, 0.12);
  border-color: rgba(199, 134, 90, 0.28);
  color: #D8B08C;
}

body.theme-canyon .shuffle-btn:hover {
  background: rgba(199,134,90,0.16);
  border-color: rgba(199,134,90,0.38);
}

body.theme-canyon .freeze-toast {
  background: rgba(24, 10, 4, 0.97);
  border-color: rgba(166, 94, 59, 0.3);
  color: #D8B08C;
  box-shadow: 0 4px 20px rgba(140, 75, 47, 0.15);
}

body.theme-canyon .panel-toggle-row {
  background: rgba(140, 75, 47, 0.08);
  border-color: rgba(140, 75, 47, 0.2);
}

body.theme-canyon .panel-toggle-checkbox { accent-color: #D8B08C; }

body.theme-canyon .panel-toggle-label { color: #D8B08C; }

body.theme-canyon .map-seg-btn.active {
  background: rgba(199,134,90,0.2);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(199,134,90,0.4);
}

/* 🔒 비활성화(잠금) 상태의 컨트롤 연출 */
.pinball-control-panel input:disabled,
.pinball-control-panel textarea:disabled,
.pinball-control-panel select:disabled {
  cursor: not-allowed !important;
  opacity: 0.45 !important;
  filter: grayscale(0.5);
  box-shadow: none !important;
  border-color: rgba(255, 255, 255, 0.04) !important;
  background: rgba(0, 0, 0, 0.2) !important;
}

/* ── 소형 PC 화면 대응 (Issue #16) ──────────────────────────
   대상: 1024px–1400px 범위의 작은 PC 화면
   변경 범위: style.css 전용, game.js / camera.js / ui.js 무변경
   ─────────────────────────────────────────────────────────── */

/* 전 해상도 공통: 패널·모달 뷰포트 초과 방지 */
.pinball-control-panel {
  max-width: calc(100vw - 24px);
}
.pinball-modal {
  box-sizing: border-box;
  max-width: calc(100vw - 32px);
}

/* 1400px 이하: 제어 패널 폭 330px */
@media (max-width: 1400px) {
  .pinball-control-panel {
    width: 330px;
  }
}

/* 1280px 이하: 패널 300px, 여백·폰트 축소, 모달 너비 조정 */
@media (max-width: 1280px) {
  .pinball-control-panel {
    width: 300px;
    left: 20px;
    padding: 18px;
    gap: 10px;
  }

  .panel-brand-title {
    font-size: 0.95rem;
  }

  .panel-btn {
    font-size: 0.82rem;
    padding: 8px;
  }

  .pinball-modal {
    width: min(400px, calc(100vw - 32px));
    padding: 28px 24px;
  }

  .modal-winner-names {
    font-size: 1.8rem;
  }
}

/* 1024px 이하: 패널 최소화, 모달 중앙 고정 */
@media (max-width: 1024px) {
  .pinball-control-panel {
    width: 260px;
    left: 16px;
    top: 16px;
    padding: 14px;
    gap: 8px;
  }

  .panel-section-title {
    font-size: 0.72rem;
  }

  .panel-textarea {
    height: 52px;
  }

  .pinball-modal {
    left: 50%;
    width: min(380px, calc(100vw - 32px));
  }
}

/* ── 모바일 UI (≤768px) ──────────────────────────────────────
   Wizard 2-Step 패널, 게임 오버레이, 회전 안내
   ─────────────────────────────────────────────────────────── */

/* 데스크탑에서 모바일 전용 요소 숨김 */
.mobile-step-nav { display: none; }
#mobile-game-overlay { display: none; }
#mobile-rotate-overlay { display: none; }
.float-home-btn { display: none; }

@media (max-width: 768px) {
  /* 전체화면 Wizard 패널 */
  .pinball-control-panel {
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100% !important;
    max-width: 100%;
    height: 100%;
    border-radius: 0;
    padding: 20px 16px 20px;
    z-index: 20;
    border: none;
    box-shadow: none;
  }

  /* 단일 페이지 설정 (step 위저드 비활성) */
  .pinball-control-panel .leaderboard-container { display: none; }

  /* 스텝 내비게이션 — 단일 페이지 전환으로 숨김 */
  .mobile-step-nav { display: none !important; }
  .mobile-step-indicator {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.45);
    font-weight: 600;
  }
  .mobile-nav-btn {
    padding: 8px 18px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    min-width: 80px;
  }
  .mobile-nav-btn:active { background: rgba(255,255,255,0.14); }

  /* 게임 모드: Wizard 숨김, 모달 최상위 */
  body.mobile-game-active .pinball-control-panel { display: none; }
  body.mobile-game-active .pinball-modal { z-index: 30; }

  /* 게임 오버레이 활성화 */
  body.mobile-game-active #mobile-game-overlay { display: block; }
}

/* 게임 오버레이 — 화면 우측 상단 고정 */
#mobile-game-overlay {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 15;
  pointer-events: auto;
}

/* 미니 리더보드 칩 */
.mobile-mini-lb {
  background: rgba(0,0,0,0.82);
  border: 1px solid rgba(255,220,80,0.35);
  border-radius: 12px;
  padding: 8px 12px 6px;
  min-width: 145px;
  cursor: pointer;
  user-select: none;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 0 1px rgba(255,220,80,0.1), 0 4px 16px rgba(0,0,0,0.4);
  transition: border-color 0.2s;
}
.mobile-mini-lb:active { border-color: rgba(255,220,80,0.7); }
.mobile-mini-lb-tap-hint {
  font-size: 0.6rem;
  color: rgba(255,220,80,0.55);
  text-align: right;
  letter-spacing: 0.3px;
  padding-top: 3px;
}
.mobile-mini-lb-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.8;
}
.mobile-mini-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* 전체 순위 오버레이 — flex column: 헤더 고정, 목록 스크롤, 버튼 sticky */
.mobile-full-lb {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6,7,13,0.97);
  z-index: 350;
  box-sizing: border-box;
  flex-direction: column;
  padding: 20px 16px 0;
}
.mobile-full-lb-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.mobile-full-lb-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 1px;
}
.mobile-close-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 0.75rem;
  padding: 5px 12px;
  cursor: pointer;
  font-family: inherit;
}
#mobile-full-lb-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-reset-btn {
  flex-shrink: 0;
  margin: 12px 0 16px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: rgba(255,255,255,0.55);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
}
.mobile-reset-btn:active { background: rgba(255,40,40,0.1); border-color: rgba(255,40,40,0.2); }

/* 팝업 닫기 후 플로팅 홈 버튼 */
.float-home-btn {
  position: fixed;
  top: 22vh; left: 50%; transform: translateX(-50%);
  z-index: 14;
  padding: 10px 24px;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.55);
  border-radius: 50px;
  color: rgba(255,255,255,0.85);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
.float-home-btn:active { background: rgba(255,255,255,0.08); }

/* 회전 안내 오버레이 */
#mobile-rotate-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6,7,13,0.97);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.rotate-icon { font-size: 2.8rem; }
.rotate-msg {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

@media (max-width: 768px) and (orientation: landscape) {
  body:not(.mobile-game-active) #mobile-rotate-overlay { display: flex; }
}

.sound-badge {
  margin-left: auto;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.sound-badge.active {
  background: rgba(0, 240, 255, 0.15);
  color: var(--neon-blue);
  border: 1px solid rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}
.sound-badge.muted {
  background: rgba(255, 51, 102, 0.15);
  color: #ff3366;
  border: 1px solid rgba(255, 51, 102, 0.3);
  opacity: 0.7;
}
.sound-badge:hover {
  transform: scale(1.05);
  opacity: 1;
}

/* ── Active Rule Indicator (게임 중 규칙 표시 오버레이) ── */
.active-rule-indicator {
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  background: rgba(15, 20, 35, 0.92);
  border: 1px solid rgba(0, 240, 255, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(0,240,255,0.15);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
  pointer-events: auto; /* 라디오 버튼 클릭 원천 차단 */
  animation: fadeInOverlay 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.rule-icon { font-size: 2rem; filter: drop-shadow(0 0 8px rgba(255,255,255,0.4)); }
.rule-text-group { display: flex; flex-direction: column; justify-content: center; }
.rule-title { font-size: 1.15rem; font-weight: 800; color: #fff; letter-spacing: 0.5px; margin-bottom: 2px; }
.rule-desc { font-size: 0.9rem; font-weight: 500; color: rgba(255,255,255,0.8); }

body.theme-canyon .active-rule-indicator {
  background: rgba(24, 10, 4, 0.92);
  border-color: rgba(199, 134, 90, 0.35);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(199, 134, 90, 0.15);
}

@keyframes fadeInOverlay {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════════
   PC 인게임 HUD — 경주 중 좌측 패널을 치우고 핵심 정보만 표시
   ═══════════════════════════════════════════════════════════════ */

/* 세팅 패널: 게임 시작 시 왼쪽으로 부드럽게 슬라이드 아웃 */
.pinball-control-panel {
  transition: transform 0.55s cubic-bezier(0.7, 0, 0.2, 1),
              opacity 0.4s ease;
}
body.pc-game-active .pinball-control-panel {
  transform: translateX(calc(-100% - 60px));
  opacity: 0;
  pointer-events: none;
}

/* HUD 컨테이너 — 기본 숨김, 경주 중에만 표시 */
.pc-hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  pointer-events: none;
  font-family: 'Outfit', 'Noto Sans KR', sans-serif;
}
.pc-hud > * { pointer-events: auto; }
body.pc-game-active .pc-hud { display: block; }

/* HUD 요소 등장 페이드 — 모션 선호 시에만, 기본 상태는 항상 표시 */
@keyframes hudFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  body.pc-game-active .hud-goal,
  body.pc-game-active .hud-board,
  body.pc-game-active .hud-controls {
    animation: hudFadeIn 0.45s ease;
  }
}

/* ① 당첨 조건(목표) */
.hud-goal {
  position: absolute;
  top: 38px;
  left: 38px;
  display: flex;
  align-items: center;
  gap: 13px;
}
.hud-goal-icon {
  font-size: 1.7rem;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.7));
}
.hud-goal-main { display: flex; flex-direction: column; gap: 3px; }
.hud-goal-eyebrow {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}
.hud-goal-text {
  font-size: 1.32rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.2px;
  line-height: 1.15;
  white-space: nowrap;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85);
}

/* ② 실시간 순위표 */
.hud-board {
  position: absolute;
  top: 108px;
  left: 38px;
  width: 326px;
}
.hud-board-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.38);
  margin-bottom: 12px;
}
.hud-board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.hud-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  transition: background 0.2s ease;
}
.hud-row--empty {
  justify-content: center;
  color: rgba(255, 255, 255, 0.32);
  font-size: 0.85rem;
  border-bottom: none;
}
.hud-row.progress { opacity: 0.74; }
.hud-row-rank {
  font-size: 0.98rem;
  font-weight: 800;
  width: 22px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-variant-numeric: tabular-nums;
}
.hud-row-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 9px currentColor;
}
.hud-row-name {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #f3f4f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 7px rgba(0, 0, 0, 0.85);
}
.hud-row-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--neon-blue);
  font-variant-numeric: tabular-nums;
}
.hud-row-time--live { color: rgba(255, 255, 255, 0.34); }

/* 당첨권 진입 강조 — 좌측 보더 대신 은은한 틴트 + 컬러 */
.hud-row.is-top {
  background: linear-gradient(90deg, rgba(255, 153, 0, 0.14), rgba(255, 153, 0, 0));
}
.hud-row.is-top .hud-row-rank { color: var(--accent); }
.hud-row.is-top .hud-row-name { color: #fff; }
body.theme-canyon .hud-row.is-top {
  background: linear-gradient(90deg, rgba(199, 134, 90, 0.18), rgba(199, 134, 90, 0));
}

/* ③④ 컨트롤 (정지 / 음소거) */
.hud-controls {
  position: absolute;
  left: 38px;
  bottom: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hud-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 12, 26, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #e5e7eb;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}
.hud-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
}
.hud-icon-btn--square {
  width: 42px;
  padding: 0;
  font-size: 1.15rem;
}
.hud-icon-btn.muted {
  color: #ff3366;
  border-color: rgba(255, 51, 102, 0.35);
  background: rgba(255, 51, 102, 0.12);
}
.hud-icon-btn--quit:hover {
  background: rgba(255, 51, 102, 0.16);
  border-color: rgba(255, 51, 102, 0.5);
  color: #ff8aa6;
}
.hud-icon-btn--home:hover {
  background: rgba(0, 240, 255, 0.14);
  border-color: rgba(0, 240, 255, 0.45);
  color: #9decff;
}

/* 종료 확인 다이얼로그 */
.hud-confirm {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 5, 12, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.hud-confirm.open { display: flex; }
.hud-confirm-card {
  width: 360px;
  max-width: calc(100vw - 40px);
  background: rgba(16, 19, 34, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 28px 26px 22px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: hudCardPop 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes hudCardPop {
  0%   { opacity: 0; transform: scale(0.82) translateY(12px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.hud-confirm-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}
.hud-confirm-desc {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
  margin-bottom: 22px;
}
.hud-confirm-actions {
  display: flex;
  gap: 10px;
}
.hud-confirm-btn {
  flex: 1;
  height: 46px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}
.hud-confirm-btn.cancel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e5e7eb;
}
.hud-confirm-btn.cancel:hover { background: rgba(255, 255, 255, 0.12); }
.hud-confirm-btn.ok {
  background: #ff3366;
  border: 1px solid #ff3366;
  color: #fff;
}
.hud-confirm-btn.ok:hover { background: #ff1f55; box-shadow: 0 6px 20px rgba(255, 51, 102, 0.35); }

/* 모바일에서는 PC HUD 완전 비활성 (모바일 오버레이 사용) */
@media (max-width: 768px) {
  .pc-hud,
  .hud-confirm { display: none !important; }
  body.pc-game-active .pinball-control-panel {
    transform: none;
    opacity: 1;
  }
}
