/* ==========================================================================
   Jelly Bean PlayEngine: Fall Guys Pop Arcade Stylesheet
   Candy pastels, rounded jelly components, bouncy physics aesthetic
   ========================================================================== */

:root {
  --bg-main: #f0f4f9;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-glass: rgba(255, 255, 255, 0.75);
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-glow: rgba(255, 71, 126, 0.4);
  
  --candy-pink: #ff477e;
  --candy-mint: #06d6a0;
  --candy-yellow: #ffd166;
  --candy-blue: #118ab2;
  --candy-purple: #9d4edd;
  --candy-orange: #ff7b00;
  --candy-red: #ef476f;
  
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  
  --font-display: 'Fredoka', 'Jua', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  --font-body: 'Nunito', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

body.jelly-theme {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 10% 15%, rgba(255, 71, 126, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 85%, rgba(6, 214, 160, 0.1) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(157, 78, 221, 0.05) 0%, transparent 60%);
  color: var(--text-main);
  font-family: var(--font-body);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   1. 최상단 네비게이션 헤더
   ========================================================================== */
.top-nav {
  height: 64px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-bottom: 2px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffd166, #ff477e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 6px 15px rgba(255, 71, 126, 0.35);
  animation: floatBounce 3s ease-in-out infinite;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.5px;
  color: #0f172a;
}

.accent-text {
  color: var(--candy-pink);
  text-shadow: 0 2px 8px rgba(255, 71, 126, 0.25);
}

.brand-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(6, 214, 160, 0.15);
  border: 1px solid rgba(6, 214, 160, 0.3);
  border-radius: 30px;
}

.status-dot {
  width: 9px;
  height: 9px;
  background: var(--candy-mint);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--candy-mint);
  animation: pulse 1.5s infinite;
}

.status-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #059669;
}

.nav-btn {
  padding: 8px 16px;
  border-radius: 30px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(255, 71, 126, 0.2);
  border-color: var(--candy-pink);
  color: var(--candy-pink);
}

/* ==========================================================================
   2. 메인 3단 콕핏 레이아웃
   ========================================================================== */
.cockpit-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(210px, 290px) minmax(360px, 1fr) minmax(230px, 300px);
  gap: 14px;
  padding: 12px 16px;
  overflow: hidden;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

/* --- [좌측] 10대 토이 블록 사이드바 --- */
.sidebar-left {
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.panel-icon {
  font-size: 20px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: #0f172a;
}

.panel-subtext {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.brick-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.brick-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.brick-item {
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.brick-item:hover {
  background: #ffffff;
  border-color: var(--candy-pink);
  transform: translateX(4px) scale(1.02);
  box-shadow: 0 8px 18px rgba(255, 71, 126, 0.15);
}

.brick-item.active {
  background: linear-gradient(135deg, rgba(255, 71, 126, 0.12), rgba(6, 214, 160, 0.1));
  border-color: var(--candy-pink);
  border-width: 2px;
  box-shadow: 0 8px 20px rgba(255, 71, 126, 0.2);
}

.brick-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brick-num {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--candy-pink);
}

.brick-category-tag {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-muted);
}

.brick-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.012em;
  line-height: 1.35;
  color: #1e293b;
  word-break: keep-all;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- [중앙] 3D 인터랙티브 뷰포트 --- */
.viewport-center {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.viewport-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.brick-badge {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 71, 126, 0.12);
  color: var(--candy-pink);
  border: 1px solid rgba(255, 71, 126, 0.25);
  display: inline-block;
  margin-bottom: 4px;
}

.brick-headline {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.015em;
  color: #0f172a;
}

.mode-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 30px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.screen-wrapper {
  flex: 1;
  position: relative;
  background: #edf2f7;
  border-radius: 24px;
  border: 3px solid #ffffff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.06);
}

.sim-screen {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

/* 3D Physics Engine Initial Loading Overlay (WASM Loading Indicator) */
.engine-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(246, 249, 253, 0.92);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  opacity: 1;
}

.engine-loading-overlay.fade-out {
  opacity: 0 !important;
  pointer-events: none !important;
}

.engine-loading-overlay.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  display: none !important;
}

.loading-box {
  background: rgba(255, 255, 255, 0.96);
  padding: 16px 26px;
  border-radius: 20px;
  box-shadow: 0 10px 32px rgba(255, 107, 154, 0.16), 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 2px solid rgba(255, 140, 180, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 90%;
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.loading-msg {
  font-family: var(--font-display, 'Jua', 'Nunito', sans-serif);
  font-size: 14.5px;
  font-weight: 700;
  color: #4a3040;
  text-align: center;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.mini-progress-track {
  width: 220px;
  height: 8px;
  background: rgba(226, 232, 240, 0.85);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.mini-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff7ba5, #ffb38a, #48e5c2);
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(255, 123, 165, 0.65);
  transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-percent-box {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -2px;
}

.loading-percent {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 13.5px;
  font-weight: 800;
  color: #ff477e;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 4px rgba(255, 71, 126, 0.2);
  display: inline-block;
  transition: color 0.25s ease, transform 0.25s ease;
}

.sound-toggle.muted {
  opacity: 0.6;
  background: #f1f5f9;
}

/* 오버레이 HUD */
.hud-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 10px;
  pointer-events: none;
  z-index: 10;
}

.hud-item {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 1);
  border-radius: 16px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
}

.hud-label {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
}

.hud-value {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.candy-pink { color: var(--candy-pink); }
.candy-blue { color: var(--candy-blue); }
.candy-red { color: var(--candy-red); }
.candy-orange { color: var(--candy-orange); }

/* 인터랙티브 게임 상태 오버레이 배너 (폴가이즈 스타일) */
.game-overlay-banner {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 20;
  padding: 24px;
  text-align: center;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ready-overlay {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  transition: all 0.25s ease;
}

.ready-overlay:hover {
  background: rgba(255, 255, 255, 0.35);
}

.overlay-icon {
  font-size: 52px;
  animation: floatBounce 2s ease-in-out infinite;
}

.overlay-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.5px;
}

.overlay-sub {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.result-stats {
  display: flex;
  gap: 20px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  background: #ffffff;
  padding: 10px 24px;
  border-radius: 20px;
  border: 2px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
}

.overlay-btn-row {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.overlay-play-btn {
  padding: 12px 30px;
  border-radius: 30px;
  background: linear-gradient(135deg, #ff477e, #ff7b00);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255, 71, 126, 0.35);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.overlay-play-btn:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 12px 28px rgba(255, 71, 126, 0.5);
}

.overlay-secondary-btn {
  padding: 12px 22px;
  border-radius: 30px;
  background: #ffffff;
  border: 2px solid var(--candy-blue);
  color: var(--candy-blue);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(17, 138, 178, 0.15);
  transition: all 0.2s ease;
}
.overlay-secondary-btn:hover {
  background: rgba(17, 138, 178, 0.08);
  transform: translateY(-2px);
}

/* 실시간 키패드 */
.keyboard-pad {
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.03);
}

.keypad-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.key-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-box {
  background: #ffffff;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 7px 12px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
  transition: all 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.03);
}

.key-box .sub {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 1px;
}

.key-box.active {
  background: var(--candy-pink);
  color: #ffffff;
  border-color: #ffffff;
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 8px 20px rgba(255, 71, 126, 0.4);
}
.key-box.active .sub {
  color: #ffffff;
}

.space-key {
  flex: 1;
  min-width: 90px;
}

.arrow-key.active {
  background: var(--candy-mint);
  box-shadow: 0 8px 20px rgba(6, 214, 160, 0.4);
}

/* --- [우측] 파라미터 컨트롤 데크 --- */
.sidebar-right {
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(6, 214, 160, 0.45) rgba(0, 0, 0, 0.03);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  padding-right: 6px;
}

.sidebar-right::-webkit-scrollbar {
  width: 5px;
}

.sidebar-right::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
}

.sidebar-right::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--candy-mint), #0284c7);
  border-radius: 8px;
}

.control-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.card-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--candy-pink);
}

.mode-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-btn {
  padding: 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.04);
  border: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: rgba(255, 71, 126, 0.12);
  border-color: var(--candy-pink);
  color: var(--candy-pink);
  box-shadow: 0 4px 14px rgba(255, 71, 126, 0.15);
}

.card-help {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  line-height: 1.4;
}

.action-btn-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-action-trigger {
  width: 100%;
  padding: 11px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 71, 126, 0.1), rgba(6, 214, 160, 0.1));
  border: 2px solid rgba(255, 71, 126, 0.25);
  color: #0f172a;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-action-trigger:hover {
  background: linear-gradient(135deg, var(--candy-pink), var(--candy-orange));
  color: #ffffff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(255, 71, 126, 0.3);
}

.neon-slider {
  width: 100%;
  height: 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
  outline: none;
  accent-color: var(--candy-pink);
  cursor: pointer;
}

.gravity-presets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.preset-pill {
  padding: 7px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-pill:hover, .preset-pill.active {
  background: var(--candy-blue);
  color: #ffffff;
  border-color: var(--candy-blue);
  box-shadow: 0 4px 10px rgba(17, 138, 178, 0.25);
}

.bottom-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.action-main-btn {
  width: 100%;
  padding: 12px;
  border-radius: 30px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: none;
}

.start-btn {
  background: linear-gradient(135deg, #06d6a0, #118ab2);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(6, 214, 160, 0.35);
}
.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(6, 214, 160, 0.5);
}

.reset-btn {
  background: rgba(239, 71, 111, 0.12);
  border: 1px solid rgba(239, 71, 111, 0.3);
  color: var(--candy-red);
}
.reset-btn:hover {
  background: var(--candy-red);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(239, 71, 111, 0.3);
}

.export-btn {
  background: #ffffff;
  border: 2px solid var(--candy-purple);
  color: var(--candy-purple);
  box-shadow: 0 4px 12px rgba(157, 78, 221, 0.12);
}
.export-btn:hover {
  background: var(--candy-purple);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(157, 78, 221, 0.3);
}

/* ==========================================================================
   3. 하단 실시간 물리 엔진 & 로보틱스 텔레메트리 바 (정적 고정형)
   ========================================================================== */
.bottom-banner {
  height: 38px;
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.02);
}

.banner-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace, var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -0.1px;
  user-select: none;
  text-align: center;
}

/* ==========================================================================
   4. 코드 내보내기 모달
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  width: 100%;
  max-width: 760px;
  background: #ffffff;
  border: 3px solid var(--candy-pink);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 85vh;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

.modal-body {
  padding: 18px 24px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-desc {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.5;
}

.code-tabs {
  display: flex;
  gap: 8px;
}

.code-tab {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.code-tab.active {
  background: var(--candy-pink);
  color: #ffffff;
}

.code-container {
  background: #0f172a;
  border-radius: 16px;
  padding: 16px;
  overflow-x: auto;
  max-height: 360px;
}

.code-content {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #f1f5f9;
  line-height: 1.5;
  white-space: pre;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn {
  padding: 10px 20px;
  border-radius: 30px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.copy-btn {
  background: var(--candy-pink);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 12px rgba(255, 71, 126, 0.3);
}
.copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 71, 126, 0.5);
}

.close-btn {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-main);
}

/* 귀여운 애니메이션 */
@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes popIn {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 4px 14px rgba(157, 78, 221, 0.4); }
  50% { box-shadow: 0 4px 24px rgba(255, 71, 126, 0.7); }
}

/* ==========================================================================
   3대 업그레이드 전용 스타일: BGM 토글, 3-Way 카메라 바, Victory 배너, HUD
   ========================================================================== */
.bgm-toggle {
  background: rgba(157, 78, 221, 0.12);
  border: 1px solid rgba(157, 78, 221, 0.3);
  color: #7b2cbf;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bgm-toggle:hover {
  background: rgba(157, 78, 221, 0.22);
  transform: translateY(-1px);
}
.bgm-toggle.playing {
  background: linear-gradient(135deg, #9d4edd, #ff477e);
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 4px 14px rgba(157, 78, 221, 0.4);
  animation: pulseGlow 2s infinite;
}

/* 3-Way 카메라 바 */
.camera-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.camera-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.camera-bar-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.camera-pill-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cam-pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #ffffff;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.cam-pill:hover {
  background: rgba(255, 71, 126, 0.08);
  border-color: var(--candy-pink);
  transform: translateY(-2px);
}

.cam-pill.active {
  background: linear-gradient(135deg, var(--candy-pink), var(--candy-orange));
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(255, 71, 126, 0.35);
  transform: translateY(-1px);
}

.cam-tip {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

.cam-tip strong {
  color: var(--candy-purple);
  font-family: var(--font-mono);
}

/* 승리 / 골 달성 축하 오버레이 배너 */
.victory-overlay {
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.97) 20%, rgba(255, 246, 215, 0.94) 100%) !important;
  border: 3px solid #ffd166 !important;
  box-shadow: inset 0 0 50px rgba(255, 209, 102, 0.35);
}

.victory-icon {
  font-size: 64px !important;
  animation: floatBounce 1.2s ease-in-out infinite, pulse 1.5s infinite !important;
}

.victory-title {
  color: #ff7b00 !important;
  font-size: 32px !important;
  text-shadow: 0 4px 14px rgba(255, 123, 0, 0.35);
}

.victory-sub {
  font-size: 15px !important;
  color: #334155 !important;
  max-width: 440px;
}

/* 추가 컬러 및 HUD 뱃지 */
.candy-yellow { color: #f59e0b !important; }
.candy-mint { color: #059669 !important; }

/* ==========================================================================
   5. 반응형 미디어 쿼리 (Hugging Face Spaces Iframe & 모바일 지원)
   ========================================================================== */
/* 데스크톱 아케이드: 항상 3단 가로 와이드 레이아웃 유지 및 유연한 뷰포트 적응 */
.cockpit-grid {
  min-width: 0;
}

@media (min-width: 1440px) {
  .cockpit-grid {
    grid-template-columns: 320px 1fr 320px;
    gap: 16px;
    padding: 16px 20px;
  }
}

@media (max-width: 1200px) {
  .cockpit-grid {
    grid-template-columns: minmax(190px, 250px) minmax(320px, 1fr) minmax(210px, 260px);
    gap: 10px;
    padding: 10px 12px;
  }
}

@media (max-width: 960px) {
  .cockpit-grid {
    grid-template-columns: minmax(170px, 210px) minmax(280px, 1fr) minmax(190px, 230px);
    gap: 8px;
    padding: 8px 8px;
  }
}


