/* ============================================================
   GEOMETRY DASH - STYLES
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;900&family=Pusab&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0e1a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  font-family: 'Outfit', sans-serif;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation; /* 禁止移动端双击缩放 */
}

#gameCanvas {
  display: block;
  background: #0a0e1a;
  image-rendering: pixelated;
  border-radius: 4px;
  box-shadow:
    0 0 40px rgba(0, 255, 135, 0.08),
    0 0 120px rgba(0, 212, 255, 0.04);
  touch-action: none; /* 游戏区不响应滚动/缩放手势，专用于点击跳跃 */
}

/* UI Overlays */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Main Menu */
#mainMenu {
  background: linear-gradient(135deg, #0a1428, #1a2a4a, #0a1428);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.title-container {
  text-align: center;
  margin-bottom: 3rem;
  animation: float 4s ease-in-out infinite;
}

.gd-title {
  font-family: 'Pusab', 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 6rem;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 
    0px 4px 0px #aaa,
    0px 8px 0px #555,
    0px 12px 10px rgba(0,0,0,0.8);
  line-height: 1.1;
  -webkit-text-stroke: 2px black;
}

.subtitle {
  font-size: 1.5rem;
  color: #00d4ff;
  letter-spacing: 8px;
  text-transform: uppercase;
  margin-top: 0.5rem;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.gd-play-btn {
  width: 140px;
  height: 140px;
  background: linear-gradient(to bottom, #4ade80, #16a34a);
  border: 6px solid #fff;
  border-radius: 20px;
  box-shadow: 
    inset 0 -10px 0 rgba(0,0,0,0.2),
    0 10px 20px rgba(0,0,0,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
}

.gd-play-btn:hover {
  transform: scale(1.05);
}

.gd-play-btn:active {
  transform: scale(0.95);
  box-shadow: 
    inset 0 -5px 0 rgba(0,0,0,0.2),
    0 5px 10px rgba(0,0,0,0.5);
}

/* 主菜单底部：仓库来源说明（扒仓库声明） */
.repo-note {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  margin: 0 auto;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
  line-height: 1.5;
  font-family: 'Outfit', sans-serif;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}
.repo-note a {
  color: #5eead4;
  text-decoration: underline;
  word-break: break-all;
}
.repo-note a:active { color: #fff; }

.play-triangle {
  width: 0;
  height: 0;
  border-top: 30px solid transparent;
  border-bottom: 30px solid transparent;
  border-left: 50px solid #fff;
  margin-left: 15px;
  filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.3));
}

/* Level Select */
#levelSelect {
  background: #0a0e1a;
  padding: 2rem;
  justify-content: flex-start;
}

.level-header {
  width: 100%;
  max-width: 1000px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.back-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.level-slider-container {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1000px;
  position: relative;
  justify-content: center;
}

.scroll-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 50px;
  height: 80px;
  border-radius: 8px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  z-index: 2;
  flex-shrink: 0;
}

.scroll-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.scroll-btn:active {
  transform: scale(0.9);
}

.level-slider {
  display: flex;
  flex-direction: row;
  gap: 2.5rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 1rem 10px;
  width: calc(100% - 120px);
  margin: 0 10px;
  scrollbar-width: none;
  touch-action: pan-x; /* 选关列表支持触摸横向滑动 */
}

.level-slider::-webkit-scrollbar {
  display: none;
}

.level-card {
  flex: 0 0 auto;
  width: min(90vw, 450px);
  background: rgba(255, 255, 255, 0.05);
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2.5rem;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.level-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.08);
}

.level-number {
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 700;
}

.level-name {
  font-size: 2.5rem;
  color: white;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.level-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.difficulty-badge-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.difficulty-badge {
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #0a0e1a;
  background: #fff;
}

.difficulty-face svg {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.stars {
  color: #fbbf24;
  font-size: 1.6rem;
  font-weight: 700;
}

/* In-Game HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
}

.hud-text {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.progress-container {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 10px;
  background: rgba(0,0,0,0.5);
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.2);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: #00ff87;
  width: 0%;
  transition: width 0.1s linear;
}

/* Death Screen */
#deathScreen {
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(5px);
}

#deathScreen h2 {
  font-size: 4rem;
  color: #ff3366;
  margin-bottom: 1rem;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(255, 51, 102, 0.5);
}

.attempt-text {
  font-size: 1.5rem;
  color: white;
  margin-bottom: 2rem;
}

.action-text {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.6);
  animation: pulse 1.5s infinite;
}

/* Pause & Quit Buttons */
.gd-btn {
  padding: 15px 30px;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  text-transform: uppercase;
  border: 4px solid #fff;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  box-shadow: 
    inset 0 -6px 0 rgba(0,0,0,0.2),
    0 8px 15px rgba(0,0,0,0.5);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  transition: transform 0.1s;
}

.gd-btn:hover { transform: scale(1.05); }
.gd-btn:active { transform: scale(0.95); }

.gd-btn-green { background: linear-gradient(to bottom, #4ade80, #16a34a); }
.gd-btn-red { background: linear-gradient(to bottom, #f87171, #dc2626); }

.gd-quit-btn { 
  background: linear-gradient(to bottom, #f59e0b, #d97706); 
  border: 3px solid #fff; 
  border-radius: 10px; 
  color: #fff; 
  font-weight: bold; 
  font-family: 'Outfit', sans-serif;
  padding: 10px 20px; 
  font-size: 1.2rem; 
  cursor: pointer; 
  box-shadow: 0 4px 10px rgba(0,0,0,0.3); 
}
.gd-quit-btn:hover { transform: scale(1.05); }

.pause-menu-buttons {
  display: flex;
  gap: 20px;
  margin-top: 30px;
}

/* 暂停面板内的冰霜开关：独占一行，与「继续/退出」按钮分开 */
.frost-toggle-pause {
  justify-content: center;
  margin-top: 10px;
  margin-bottom: 6px;
  padding: 8px 14px;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
}
}

#pauseScreen {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

#pauseScreen h2 {
  font-size: 5rem;
  color: #fff;
  text-shadow: 0 0 20px rgba(255,255,255,0.5);
}

.mt-4 { margin-top: 2rem; }

/* Level Complete */
#completeScreen {
  background: rgba(10, 14, 26, 0.9);
  backdrop-filter: blur(10px);
}

#completeScreen h2 {
  font-size: 4rem;
  color: #00ff87;
  margin-bottom: 1rem;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(0, 255, 135, 0.5);
}

.stats-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(0, 255, 135, 0.3);
  border-radius: 16px;
  padding: 2rem;
  margin: 2rem 0;
  text-align: center;
}

.stats-card p {
  color: white;
  font-size: 1.2rem;
  margin: 0.5rem 0;
}

/* Animations */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Prevent context menu on right click */
canvas {
  -webkit-tap-highlight-color: transparent;
}

/* Unlock Panel */
.unlock-panel {
  width: 100%;
  max-width: 1000px;
  margin-bottom: 1.5rem;
  text-align: center;
}
.unlock-panel.locked-panel {
  background: rgba(255, 179, 0, 0.08);
  border: 1px solid rgba(255, 179, 0, 0.35);
  border-radius: 14px;
  padding: 1rem 1.2rem;
}
.unlock-panel.unlocked {
  background: rgba(0, 255, 135, 0.08);
  border: 1px solid rgba(0, 255, 135, 0.35);
  border-radius: 14px;
  padding: 0.8rem 1.2rem;
}
.unlock-text { color: #ffd27a; font-size: 1.05rem; margin-bottom: 0.8rem; }
.unlock-text b { color: #fff; letter-spacing: 1px; }
.unlock-ok { color: #00ff87; font-size: 1.2rem; font-weight: 700; }
.unlock-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.unlock-hint { color: rgba(255,255,255,0.7); font-size: 0.95rem; margin-top: 0.8rem; min-height: 1.2rem; }
.unlock-panel.flash { animation: unlockFlash 0.7s ease; }
@keyframes unlockFlash {
  0%, 100% { box-shadow: 0 0 0 rgba(255,179,0,0); }
  50% { box-shadow: 0 0 24px rgba(255,179,0,0.6); }
}

/* Locked level cards */
.level-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
}
.level-card.locked:hover { transform: none; background: rgba(255,255,255,0.05); }
.lock-note {
  color: #ffb84d;
  font-size: 1rem;
  font-weight: 700;
  background: rgba(0,0,0,0.25);
  border-radius: 10px;
  padding: 8px 12px;
  text-align: center;
}

/* 竖屏提示（仅移动端竖屏显示，不阻塞游戏） */
#rotateHint {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 20px;
  z-index: 50;
  display: none;
  pointer-events: none;
  white-space: nowrap;
}
@media (orientation: portrait) and (max-width: 768px) {
  #rotateHint { display: block; }
}

/* 触摸跳跃按钮：真实 DOM 元素，自带事件，不依赖 canvas 的 window 事件派发 */
#jumpBtn {
  position: fixed;
  right: 26px;
  bottom: 40px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #5eead4, #14b8a6);
  border: 4px solid #fff;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  box-shadow: 0 8px 18px rgba(0,0,0,0.5), inset 0 -5px 0 rgba(0,0,0,0.2);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
  cursor: pointer;
}
#jumpBtn:active {
  transform: scale(0.92);
  filter: brightness(1.12);
}

/* 选关界面标题与占位（替代原 inline style，便于手机端适配） */
.level-select-title {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
}
.level-title-spacer {
  width: 80px;
  flex-shrink: 0;
}

/* 冰封特效开关（选关界面右上角） */
.frost-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
}
.frost-toggle input { display: none; }
.frost-toggle-label { color: rgba(255,255,255,0.85); font-size: 1rem; font-weight: 700; }
.frost-switch {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: 13px;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.25);
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.frost-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.frost-toggle input:checked + .frost-switch {
  background: linear-gradient(to bottom, #7dd3fc, #0ea5e9);
  border-color: #7dd3fc;
}
.frost-toggle input:checked + .frost-switch::after {
  transform: translateX(22px);
}

/* 游戏内 HUD 冰霜开关（右上角，仅游戏中显示） */
.frost-toggle-hud {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 50;
  display: none;
  background: rgba(0,0,0,0.35);
  padding: 6px 10px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ===== 选关界面手机端适配（覆盖手机竖屏与横屏） ===== */
@media (max-width: 950px), (max-height: 560px) {
  #levelSelect { padding: 0.8rem; }
  .level-header { margin-bottom: 0.8rem; max-width: 100%; }
  .level-select-title { font-size: 1.05rem; }
  .back-btn { padding: 6px 12px; font-size: 0.9rem; }
  .frost-toggle { font-size: 0.85rem; gap: 6px; }
  .frost-switch { width: 40px; height: 22px; border-radius: 11px; }
  .frost-switch::after { width: 15px; height: 15px; top: 2px; left: 2px; }
  .frost-toggle input:checked + .frost-switch::after { transform: translateX(18px); }
  .level-slider-container { max-width: 100%; }
  .level-slider { gap: 0.9rem; padding: 0.5rem 2px; width: calc(100% - 64px); }
  .scroll-btn { width: 28px; height: 46px; font-size: 0.9rem; }
  .level-card {
    width: min(86vw, 320px);
    padding: 1rem;
    gap: 0.6rem;
    border-radius: 14px;
    border-width: 2px;
  }
  .level-number { font-size: 0.95rem; }
  .level-name { font-size: 1.4rem; margin-bottom: 0.2rem; }
  .difficulty-badge { font-size: 0.9rem; padding: 5px 12px; }
  .stars { font-size: 1.05rem; }
  .lock-note { font-size: 0.78rem; padding: 5px 8px; }
  .unlock-panel { max-width: 100%; }
  .unlock-text { font-size: 0.85rem; }
  .unlock-actions { gap: 6px; }
}
