﻿/* ===============================================================
   蹦蹦球扫雷 3D — 样式表
   =============================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow: hidden; height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #0b0e1f 0%, #1b1e3f 100%);
    user-select: none;
    -webkit-user-select: none;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* =============================================================
   设备不支持界面
   ============================================================= */
#unsupportedScreen {
    position: fixed; inset: 0;
    background: linear-gradient(135deg, #0b0e1f, #1b1e3f);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}
.unsupported-content { text-align: center; }

.bouncing-ball-wrapper {
    position: relative;
    width: 80px; height: 180px;
    margin: 0 auto 30px;
}
.bouncing-ball {
    position: absolute; left: 50%;
    width: 60px; height: 60px; margin-left: -30px;
    background: linear-gradient(135deg, #6ee7ff, #9f7eff);
    border-radius: 50%;
    box-shadow: 0 0 25px rgba(110, 231, 255, 0.6);
    animation: bbBounce 0.8s cubic-bezier(0.36, 0, 0.66, -0.56) infinite alternate;
}
.ball-shadow {
    position: absolute; bottom: 0; left: 50%;
    width: 50px; height: 12px; margin-left: -25px;
    background: rgba(110, 231, 255, 0.25);
    border-radius: 50%;
    animation: bbShadow 0.8s cubic-bezier(0.36, 0, 0.66, -0.56) infinite alternate;
}
@keyframes bbBounce {
    0%   { bottom: 20px; }
    100% { bottom: 140px; }
}
@keyframes bbShadow {
    0%   { transform: scaleX(1); opacity: 0.4; }
    100% { transform: scaleX(0.4); opacity: 0.15; }
}
.unsupported-loading {
    color: #6ee7ff; font-size: 28px; font-weight: bold;
    margin-bottom: 12px;
    text-shadow: 0 2px 15px rgba(110, 231, 255, 0.5);
}
.unsupported-hint {
    color: #a8c7ff; font-size: 14px; line-height: 1.8; opacity: 0.7;
}

/* =============================================================
   画布
   ============================================================= */
#gameCanvas { display: block; cursor: grabbing; }
#gameCanvas:active { cursor: grab; }

/* =============================================================
   加载画面
   ============================================================= */
#loadingScreen {
    position: fixed; inset: 0;
    background: linear-gradient(135deg, #0b0e1f, #1b1e3f);
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    z-index: 10000;
}
.loadingContent { text-align: center; }
.loadingLogo {
    width: 120px; height: 120px;
    margin: 0 auto 30px;
    background: linear-gradient(135deg, #6ee7ff, #9f7eff);
    border-radius: 50%;
    animation: loadingPulse 1.5s ease-in-out infinite;
}
@keyframes loadingPulse {
    0%, 100% { transform: scale(1);   box-shadow: 0 0 40px rgba(110, 231, 255, 0.5); }
    50%      { transform: scale(1.1); box-shadow: 0 0 60px rgba(110, 231, 255, 0.8); }
}
.loadingText {
    color: #6ee7ff; font-size: 24px; margin-bottom: 20px;
    text-shadow: 0 4px 20px rgba(110, 231, 255, 0.5);
}
.loadingBar {
    width: 300px; height: 6px;
    background: rgba(110, 231, 255, 0.2);
    border-radius: 3px; overflow: hidden;
}
.loadingBarFill {
    height: 100%;
    background: linear-gradient(90deg, #6ee7ff, #9f7eff);
    border-radius: 3px;
    animation: loadingProgress 2s ease-out forwards;
}
@keyframes loadingProgress { from { width: 0%; } to { width: 100%; } }

/* =============================================================
   主 HUD 面板（左上）
   ============================================================= */
#mainHUD {
    position: fixed; top: 20px; left: 20px;
    padding: 15px 12px 0 13px;
    background: linear-gradient(135deg, rgba(15, 20, 40, 0.95), rgba(25, 35, 60, 0.9));
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-radius: 15px; color: #fff; min-width: 260px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.1),
        inset 0 -1px 0 rgba(0,0,0,0.3);
    border: 1px solid rgba(100, 150, 255, 0.2);
    z-index: 1000;
    animation: slideInLeft 0.5s ease-out;
}
@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}
#mainHUD h1 {
    font-size: 22px; margin-bottom: 15px;
    background: linear-gradient(135deg, #6ee7ff, #9f7eff);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: bold;
}
.hudSection {
    margin: 12px 0; padding: 10px;
    background: rgba(0,0,0,0.3); border-radius: 8px;
    border-left: 3px solid #6ee7ff;
}
.hudRow {
    display: flex; justify-content: space-between;
    align-items: center; margin: 5px 0; font-size: 14px;
}
.hudLabel { color: #a8c7ff; font-weight: 500; }
.hudValue {
    color: #fff; font-weight: bold; font-size: 16px;
    text-shadow: 0 0 10px rgba(110, 231, 255, 0.5);
}
.hudValue.highlight { color: #ffd700; animation: pulse 0.5s ease; }
@keyframes pulse { 0%,100%{transform:scale(1);} 50%{transform:scale(1.2);} }

/* ---------- 进度条 ---------- */
.progressBar {
    width: 100%; height: 8px;
    background: rgba(0,0,0,0.5); border-radius: 4px;
    overflow: hidden; margin-top: 5px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}
.progressFill {
    height: 100%;
    background: linear-gradient(90deg, #6ee7ff, #9f7eff);
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
    box-shadow: 0 0 10px rgba(110, 231, 255, 0.5);
}
.progressFill.danger {
    background: linear-gradient(90deg, #ff6b6b, #ff9f40);
}
.progressFill.charged {
    background: linear-gradient(90deg, #ffd700, #ffed4e);
    animation: shimmer 1s linear infinite;
}
@keyframes shimmer { 0%{filter:brightness(1);} 50%{filter:brightness(1.3);} 100%{filter:brightness(1);} }
.progressFill.golden {
    background: linear-gradient(90deg, #ffd700, #ffaa00);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    animation: goldenShimmer 1s linear infinite;
}
@keyframes goldenShimmer { 0%{filter:brightness(1);} 50%{filter:brightness(1.5);} 100%{filter:brightness(1);} }

/* =============================================================
   右下角面板（倒计时 + 金币 + 变身）
   ============================================================= */
#bottomRightPanel {
    position: fixed; bottom: 20px; right: 20px;
    background: linear-gradient(135deg, rgba(15, 20, 40, 0.95), rgba(25, 35, 60, 0.9));
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-radius: 15px; padding: 18px 22px;
    border: 1px solid rgba(100, 150, 255, 0.2);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 1000; text-align: center; min-width: 170px;
    animation: slideInRight 0.5s ease-out 0.2s both;
}
.countdown-wrapper { margin-bottom: 12px; }
.countdown-label {
    color: #a8c7ff; font-size: 12px; margin-bottom: 4px;
}
.countdown-value {
    font-size: 56px; font-weight: 900;
    color: #6ee7ff;
    text-shadow: 0 0 20px rgba(110, 231, 255, 0.6);
    font-family: 'Courier New', monospace;
    letter-spacing: 4px; line-height: 1;
}
.countdown-value.warning {
    color: #ff6b6b;
    text-shadow: 0 0 20px rgba(255, 100, 100, 0.8);
    animation: countdownPulse 1s ease-in-out infinite;
}
@keyframes countdownPulse { 0%,100%{transform:scale(1);} 50%{transform:scale(1.08);} }

.br-info {
    border-top: 1px solid rgba(100, 150, 255, 0.15);
    padding-top: 10px;
}
.brRow {
    display: flex; justify-content: space-between;
    align-items: center; margin: 5px 0; font-size: 14px;
}
.brLabel { color: #a8c7ff; }
.brValue {
    color: #fff; font-weight: bold;
    text-shadow: 0 0 10px rgba(110, 231, 255, 0.5);
}

/* =============================================================
   控制说明面板
   ============================================================= */
#controls {
    position: fixed; bottom: 20px; left: 20px;
    background: rgba(15, 20, 40, 0.9);
    backdrop-filter: blur(10px);
    padding: 15px; border-radius: 12px;
    color: #a8c7ff; font-size: 12px; line-height: 1.6;
    max-width: 320px;
    border: 1px solid rgba(100, 150, 255, 0.2);
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
    animation: slideInUp 0.5s ease-out 0.3s both;
}
@keyframes slideInUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
#controls h3 { color: #6ee7ff; margin-bottom: 10px; font-size: 14px; }
.controlItem { margin: 5px 0; display: flex; align-items: center; }
.controlKey {
    display: inline-block;
    background: linear-gradient(135deg, #2a3f5f, #3a4f7f);
    padding: 3px 8px; border-radius: 4px;
    margin-right: 8px; font-weight: bold; color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    min-width: 60px; text-align: center;
}

/* =============================================================
   小地图
   ============================================================= */
#minimap {
    position: fixed; top: 20px; right: 20px;
    width: 200px; height: 200px;
    background: rgba(15, 20, 40, 0.95);
    border: 2px solid rgba(110, 231, 255, 0.3);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    z-index: 999;
    animation: slideInRight 0.5s ease-out 0.2s both;
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
#minimapCanvas { width: 100%; height: 100%; border-radius: 10px; }

/* =============================================================
   消息提示
   ============================================================= */
#messageCenter {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none; z-index: 2000;
}
.gameMessage {
    background: linear-gradient(135deg, rgba(15, 20, 40, 0.95), rgba(110, 231, 255, 0.2));
    backdrop-filter: blur(10px); color: #fff;
    padding: 15px 30px; border-radius: 50px;
    margin: 10px 0; font-size: 18px; font-weight: bold;
    text-align: center;
    box-shadow: 0 10px 40px rgba(110, 231, 255, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2);
    border: 1px solid rgba(110, 231, 255, 0.5);
    opacity: 0; transform: scale(0.5) translateY(20px);
    animation: messagePopup 0.5s ease-out forwards;
}
@keyframes messagePopup { to { opacity:1; transform:scale(1) translateY(0); } }
.gameMessage.fadeOut { animation: messageFadeOut 0.3s ease-out forwards; }
@keyframes messageFadeOut { to { opacity:0; transform:scale(0.8) translateY(-20px); } }

/* =============================================================
   暂停菜单
   ============================================================= */
#pauseMenu {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(10px);
    display: none; justify-content: center; align-items: center;
    z-index: 3000;
}
#pauseMenu.active { display: flex; }
.pauseContent {
    background: linear-gradient(135deg, rgba(25, 35, 60, 0.98), rgba(15, 20, 40, 0.98));
    padding: 40px; border-radius: 20px; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid rgba(110, 231, 255, 0.3);
    animation: scaleIn 0.3s ease-out;
}
@keyframes scaleIn { from{transform:scale(0.8);opacity:0;} to{transform:scale(1);opacity:1;} }
.pauseContent h2 {
    color: #6ee7ff; margin-bottom: 30px; font-size: 32px;
    text-shadow: 0 4px 20px rgba(110, 231, 255, 0.5);
}
.menuButton {
    display: block; width: 200px; margin: 15px auto;
    padding: 12px 24px;
    background: linear-gradient(135deg, #6ee7ff, #9f7eff);
    color: #fff; border: none; border-radius: 25px;
    font-size: 16px; font-weight: bold; cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(110, 231, 255, 0.3);
}
.menuButton:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(110, 231, 255, 0.5); }
.menuButton:active { transform: translateY(0); }

/* =============================================================
   设置面板
   ============================================================= */
#settingsPanel {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: rgba(15, 20, 40, 0.95); backdrop-filter: blur(10px);
    padding: 20px; border-radius: 12px; color: #fff;
    display: none; z-index: 3100;
    border: 1px solid rgba(100, 150, 255, 0.2);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
#settingsPanel.active { display: block; animation: settingsPanelPop 0.25s ease-out; }
@keyframes settingsPanelPop {
    from { transform: translate(-50%, -50%) scale(0.96); opacity: 0; }
    to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.settingRow { margin: 15px 0; display: flex; justify-content: space-between; align-items: center; }
.settingLabel { color: #a8c7ff; margin-right: 20px; }
.settingSlider {
    width: 150px; height: 6px;
    -webkit-appearance: none; appearance: none;
    background: rgba(110, 231, 255, 0.2); border-radius: 3px; outline: none;
}
.settingSlider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 18px; height: 18px;
    background: linear-gradient(135deg, #6ee7ff, #9f7eff);
    border-radius: 50%; cursor: pointer;
    box-shadow: 0 2px 10px rgba(110, 231, 255, 0.5);
}
.settingSlider::-moz-range-thumb {
    width: 18px; height: 18px;
    background: linear-gradient(135deg, #6ee7ff, #9f7eff);
    border-radius: 50%; cursor: pointer;
    box-shadow: 0 2px 10px rgba(110, 231, 255, 0.5);
}

/* =============================================================
   游戏结束界面
   ============================================================= */
#gameComplete {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.9); backdrop-filter: blur(15px);
    display: none; justify-content: center; align-items: center;
    z-index: 4000;
}
#gameComplete.active { display: flex; }
.completeContent {
    background: linear-gradient(135deg, rgba(25, 35, 60, 0.98), rgba(15, 20, 40, 0.98));
    padding: 50px; border-radius: 25px; text-align: center;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
    border: 2px solid rgba(255, 215, 0, 0.5);
    animation: victoryAnimation 0.5s ease-out;
}
@keyframes victoryAnimation {
    0%  { transform: scale(0) rotate(180deg); opacity: 0; }
    50% { transform: scale(1.1) rotate(10deg); }
    100%{ transform: scale(1) rotate(0deg);    opacity: 1; }
}
.completeContent h1 {
    color: #ffd700; font-size: 42px; margin-bottom: 10px;
    text-shadow: 0 5px 30px rgba(255, 215, 0, 0.5);
    animation: glow 2s ease-in-out infinite;
}
@keyframes glow {
    0%,100% { text-shadow: 0 5px 30px rgba(255, 215, 0, 0.5); }
    50%     { text-shadow: 0 5px 50px rgba(255, 215, 0, 0.8); }
}
.complete-subtitle { color: #a8c7ff; font-size: 16px; margin-bottom: 25px; }
.statsGrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin: 30px 0; }
.statCard {
    background: rgba(0,0,0,0.3); padding: 15px; border-radius: 10px;
    border-left: 3px solid #6ee7ff;
}
.statCard h3 { color: #a8c7ff; font-size: 14px; margin-bottom: 5px; }
.statCard p { color: #fff; font-size: 24px; font-weight: bold; }

/* =============================================================
   音效按钮
   ============================================================= */
#soundToggle {
    position: fixed; top: 20px; right: 240px;
    width: 50px; height: 50px;
    background: linear-gradient(135deg, rgba(15, 20, 40, 0.95), rgba(25, 35, 60, 0.9));
    border: 1px solid rgba(110, 231, 255, 0.3);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
    transition: all 0.3s ease; z-index: 1000;
}
#soundToggle:hover { transform: scale(1.1); box-shadow: 0 8px 30px rgba(110, 231, 255, 0.5); }
#soundToggle.muted { opacity: 0.5; }

/* =============================================================
   粒子效果容器
   ============================================================= */
#particleContainer {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 500;
}
.particle {
    position: absolute; width: 4px; height: 4px;
    background: #6ee7ff; border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 2s ease-out forwards;
}
@keyframes particleFloat {
    0%  { transform: translate(0,0) scale(1); opacity: 1; }
    100%{ transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* =============================================================
   金身模式
   ============================================================= */
.golden-particle {
    background: radial-gradient(circle, #fff8dc, #ffd700) !important;
    width: 8px !important; height: 8px !important;
    box-shadow: 0 0 10px #ffd700;
}
.golden-ring {
    position: absolute; width: 100px; height: 100px;
    border: 3px solid #ffd700; border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ringExpand 1s ease-out forwards;
}
@keyframes ringExpand {
    0%  { width: 100px; height: 100px; opacity: 1; border-width: 3px; }
    100%{ width: 400px; height: 400px; opacity: 0; border-width: 1px; }
}
body.golden-mode #mainHUD {
    border-color: rgba(255, 234, 167, 0.5);
    box-shadow: 0 10px 40px rgba(255, 234, 167, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.3),
        inset 0 -1px 0 rgba(0,0,0,0.2);
}
body.golden-mode .hudSection { border-left-color: #ffeaa7; }
body.golden-mode #gameCanvas { box-shadow: 0 0 50px rgba(255, 234, 167, 0.3); }

/* =============================================================
   指针穿透
   ============================================================= */
#mainHUD,
#bottomRightPanel,
#controls,
#minimap,
#messageCenter,
#particleContainer,
#soundToggle,
#loadingScreen {
    pointer-events: none;
}
#pauseMenu.active,
#settingsPanel.active,
#gameComplete.active { pointer-events: auto; }
#pauseMenu.active *,
#settingsPanel.active *,
#gameComplete.active * { pointer-events: auto; }

/* =============================================================
   响应式
   ============================================================= */
@media (max-width: 900px) {
    #mainHUD { top: 10px; left: 10px; min-width: 220px; padding: 12px; }
    #mainHUD h1 { font-size: 18px; }
    #controls { bottom: 10px; left: 10px; max-width: 260px; }
    #minimap { width: 150px; height: 150px; }
    #bottomRightPanel { bottom: 10px; right: 10px; min-width: 140px; padding: 12px 15px; }
    .countdown-value { font-size: 42px; }
    .completeContent { padding: 30px; }
    .completeContent h1 { font-size: 32px; }
}
.gpu-accelerated { transform: translateZ(0); will-change: transform; }
@media (prefers-contrast: high) {
    #mainHUD, #controls, #minimap, #bottomRightPanel { border: 2px solid #fff; }
    .hudValue { font-weight: 900; }
}
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
