/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* 头部样式（叠加显示） */
.game-header-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 100;
    background: none !important;
    color: white;
    padding: 0;
    box-shadow: none !important;
    backdrop-filter: none !important;
    border: none !important;
}

.game-header-overlay h1 {
    font-size: 1.8em;
    margin-bottom: 10px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: bounce 2s infinite;
    text-align: center;
}

.game-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: bounce 2s infinite;
}

.score-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: 1.2em;
    font-weight: bold;
    flex-wrap: wrap;
    flex-direction: row;
}

.health-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    justify-content: center;
}

.health-label {
    color: white;
    font-weight: bold;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.9);
    font-size: 1.1em;
}

.health-bar-container {
    width: 120px;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.health-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.3s ease, background 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.3);
}

.health-bar.low-health {
    background: linear-gradient(90deg, #f44336, #ff9800);
}

.health-bar.medium-health {
    background: linear-gradient(90deg, #ff9800, #ffc107);
}

.health-text {
    color: white;
    font-size: 10px;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
}

.invincible-section {
    margin-bottom: 5px;
    text-align: center;
}

.invincible-text {
    background: linear-gradient(45deg, #FF69B4, #00CED1, #FFD700, #32CD32, #FF4500);
    background-size: 200% 200%;
    animation: rainbow 2s ease-in-out infinite;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.bonus-hint {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    animation: pulse 2s infinite;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.level-indicator {
    background: rgba(0, 0, 0, 0.4);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
    margin-left: 10px;
    animation: levelUp 0.5s ease-in-out;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.speed-indicator {
    background: rgba(0, 0, 0, 0.4);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
    margin-left: 5px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.speed-indicator.fast {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    animation: speedWarning 1s infinite;
}

.speed-indicator.very-fast {
    background: linear-gradient(135deg, #F44336, #D32F2F);
    animation: speedWarning 0.5s infinite;
}

.score-value, .high-score-value {
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 8px;
    border-radius: 8px;
    min-width: 60px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    font-weight: bold;
}

/* 游戏主体 */
.game-main {
    position: relative;
    display: block;
    flex: 1;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
}

#gameCanvas {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    display: block;
    cursor: pointer;
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
}

#gameCanvas:hover {
    transform: scale(1.01);
}

/* 游戏覆盖层 */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    z-index: 200;
}

.overlay-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.5s ease-out;
}

.overlay-content h2 {
    color: #4a69bd;
    font-size: 2em;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.overlay-content p {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 15px;
    line-height: 1.6;
}

.controls-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-size: 0.9em;
    color: #666;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 移动端控制按钮 */
.mobile-controls {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 101;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-btn {
    background: linear-gradient(135deg, #4a5568, #2c3e50);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.mobile-btn:active {
    transform: scale(0.9);
    box-shadow: 0 1px 8px rgba(44, 62, 80, 0.7);
    transition: transform 0.1s ease;
}

.mobile-btn.pause-btn {
    background: linear-gradient(135deg, #e67e22, #d35400);
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.4);
}

.mobile-btn.pause-btn:active {
    box-shadow: 0 1px 8px rgba(230, 126, 34, 0.7);
    transform: scale(0.9);
}

.mobile-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.6);
}

.mobile-btn.pause-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.6);
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.btn-icon {
    font-size: 20px;
    line-height: 1;
}

.btn-text {
    font-size: 8px;
    margin-top: 2px;
    font-weight: bold;
}

/* 全屏按钮样式 */
.fullscreen-btn {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
    border: none;
    border-radius: 20px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    box-shadow: 0 2px 10px rgba(156, 39, 176, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
    min-width: 50px;
    height: 35px;
}

.fullscreen-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.5);
    background: linear-gradient(135deg, #AB47BC, #8E24AA);
}

.fullscreen-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 5px rgba(156, 39, 176, 0.6);
}

.fullscreen-btn .btn-icon {
    font-size: 16px;
    line-height: 1;
}

.fullscreen-btn .btn-text {
    font-size: 6px;
    margin-top: 1px;
    font-weight: bold;
}

/* 全屏模式样式 */
body:fullscreen .game-header-overlay,
body:-webkit-full-screen .game-header-overlay,
body:-moz-full-screen .game-header-overlay,
body:-ms-fullscreen .game-header-overlay {
    top: 10px;
    left: 10px;
    right: 10px;
    padding: 10px;
}

body:fullscreen .game-header-overlay h1,
body:-webkit-full-screen .game-header-overlay h1,
body:-moz-full-screen .game-header-overlay h1,
body:-ms-fullscreen .game-header-overlay h1 {
    font-size: 1.5em;
    margin-bottom: 5px;
}

/* 移动端显示控制按钮 */
@media (max-width: 768px) {
    .mobile-controls {
        display: flex;
    }
    
    /* 天空积分栏样式 - 去掉banner背景 */
    /* 天空积分栏样式 - 去掉banner背景 */
    .game-header-overlay {
        position: absolute;
        top: 15px;
        left: 15px;
        right: 15px;
        background: none !important;
        backdrop-filter: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 10px;
        z-index: 100;
    }
    
    .game-header-overlay h1 {
        font-size: 1.4em;
        margin-bottom: 8px;
        text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.6);
        text-align: center;
    }
    
    .game-header-overlay h1 {
        font-size: 1.2em;
        margin-bottom: 8px;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
        color: white;
        text-align: center;
    }
    
    .score-display {
        flex-direction: column;
        align-items: center;
        font-size: 0.85em;
        font-weight: bold;
        gap: 8px;
    }
    
    .health-section {
        margin-bottom: 5px;
    }
    
    .health-bar-container {
        width: 100px;
        height: 16px;
    }
    
    .health-text {
        font-size: 8px;
    }
    
    .score-label, .high-score-label {
        color: rgba(255, 255, 255, 0.9);
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
        font-size: 0.8em;
    }
    
    .score-value, .high-score-value {
        background: rgba(0, 0, 0, 0.3);
        color: white;
        padding: 2px 6px;
        border-radius: 12px;
        min-width: 45px;
        text-align: center;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
        font-size: 0.8em;
    }
    
    .level-indicator,
    .speed-indicator {
        font-size: 0.7em;
        padding: 3px 6px;
        margin: 2px;
        border-radius: 10px;
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
        background: rgba(0, 0, 0, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .bonus-hint {
        display: none; /* 隐藏提示，节省空间 */
    }
    
    .fullscreen-btn {
        position: absolute;
        top: 15px;
        right: 15px;
        margin: 0;
        min-width: 35px;
        height: 28px;
        background: linear-gradient(135deg, rgba(156, 39, 176, 0.7), rgba(123, 31, 162, 0.7));
        box-shadow: 0 2px 8px rgba(156, 39, 176, 0.3);
    }
    
    .fullscreen-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 3px 12px rgba(156, 39, 176, 0.5);
    }
    
    /* 移动端控制按钮优化 */
    .mobile-controls {
        bottom: 20px;
        right: 20px;
        gap: 8px;
    }
    
    .mobile-btn {
        width: 55px;
        height: 55px;
    }
}

@media (max-width: 480px) {
    /* 超小屏幕积分栏优化 */
    .game-header-overlay {
        top: 10px;
        left: 10px;
        right: 10px;
    }
    
    .game-header-overlay h1 {
        font-size: 1em;
        margin-bottom: 5px;
    }
    
    .score-display {
        font-size: 0.75em;
        gap: 2px;
        justify-content: space-between;
    }
    
    .score-label, .high-score-label {
        font-size: 0.7em;
    }
    
    .score-value, .high-score-value {
        min-width: 35px;
        padding: 1px 4px;
        font-size: 0.7em;
    }
    
    .level-indicator,
    .speed-indicator {
        font-size: 0.6em;
        padding: 1px 3px;
        margin: 1px;
    }
    
    .fullscreen-btn {
        top: 10px;
        right: 10px;
        min-width: 30px;
        height: 25px;
    }
    
    .fullscreen-btn .btn-icon {
        font-size: 12px;
    }
    
    .fullscreen-btn .btn-text {
        display: none; /* 隐藏文字，只显示图标 */
    }
    
    /* 移动端控制按钮更小 */
    .mobile-controls {
        bottom: 15px;
        right: 15px;
        gap: 6px;
    }
    
    .mobile-btn {
        width: 45px;
        height: 45px;
    }
    
    .btn-icon {
        font-size: 14px;
    }
    
    .btn-text {
        font-size: 6px;
    }
}

.controls-info p {
    margin-bottom: 8px;
    font-size: 0.9em;
}

.controls-info strong {
    color: #4a69bd;
    font-size: 1.1em;
}

.game-btn {
    background: linear-gradient(135deg, #4a5568, #2c3e50);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.4);
    position: relative;
    overflow: hidden;
    z-index: 1001;
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.6);
    background: linear-gradient(135deg, #5a6778, #3a4d63);
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.game-btn:active {
    transform: translateY(0);
}

/* 新纪录样式 */
.new-record {
    color: #ff6b6b !important;
    font-weight: bold;
    font-size: 1.3em !important;
    animation: pulse 1s infinite;
}

/* 底部控制提示已去掉 */

/* 动画效果 */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

@keyframes sparkle {
    0% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
}

@keyframes levelUp {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        background: linear-gradient(135deg, #FFD700, #FFA500);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes speedWarning {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 5px;
    }
    
    .game-header {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .game-header h1 {
        font-size: 1.5em;
        margin-bottom: 5px;
    }
    
    .score-display {
        font-size: 0.9em;
        gap: 5px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .level-indicator,
    .speed-indicator {
        font-size: 0.7em;
        padding: 3px 6px;
        margin: 2px;
    }
    
    .bonus-hint {
        font-size: 0.6em;
        padding: 3px 8px;
    }
    
    #gameCanvas {
        border: none;
        border-radius: 0;
        max-width: 100vw;
        height: 100vh;
        display: block;
    }
    
    .overlay-content {
        padding: 15px;
        margin: 5px;
        max-width: 95%;
        border-radius: 15px;
    }
    
    .overlay-content h2 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }
    
    .overlay-content p {
        font-size: 0.9em;
        margin-bottom: 10px;
    }
    
    .game-btn {
        padding: 8px 20px;
        font-size: 0.9em;
        border-radius: 25px;
    }
    
    .controls-info {
        padding: 8px;
        font-size: 0.75em;
        margin-top: 10px;
    }
    
    .game-footer {
        padding: 8px;
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    .game-header {
        padding: 5px;
        margin-bottom: 5px;
    }
    
    .game-header h1 {
        font-size: 1.2em;
        margin-bottom: 3px;
    }
    
    .score-display {
        font-size: 0.8em;
        gap: 3px;
    }
    
    .level-indicator,
    .speed-indicator,
    .bonus-hint {
        font-size: 0.6em;
        padding: 2px 4px;
        margin: 1px;
    }
    
    #gameCanvas {
        border-width: 1px;
    }
    
    .overlay-content {
        padding: 15px;
        margin: 5px;
    }
    
    .overlay-content h2 {
        font-size: 1.2em;
    }
    
    .game-btn {
        padding: 8px 20px;
        font-size: 0.9em;
    }
    
    .controls-info {
        padding: 5px;
        font-size: 0.7em;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .game-container {
        height: 100vh;
        width: 100vw;
    }
    
    .game-header-overlay {
        top: 5px;
        left: 5px;
        right: 5px;
        padding: 5px;
    }
    
    .game-header-overlay h1 {
        font-size: 0.9em;
        margin-bottom: 3px;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
    }
    
    .score-display {
        flex-direction: row;
        font-size: 0.7em;
        gap: 5px;
        align-items: center;
        justify-content: flex-start;
    }
    
    .health-section {
        margin-right: 8px;
    }
    
    .health-bar-container {
        width: 80px;
        height: 12px;
        background: rgba(0, 0, 0, 0.6);
        border: 1px solid rgba(255, 255, 255, 0.4);
    }
    
    .health-text {
        font-size: 7px;
    }
    
    .health-label {
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
    }
    
    .game-main {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
        position: relative;
        width: 100%;
        height: 100%;
    }
    
    #gameCanvas {
        max-height: 100vh;
        max-width: 100%;
        width: 100%;
        height: 100%;
    }
    
    .game-overlay .overlay-content {
        padding: 15px;
        max-width: 400px;
    }
    
    .controls-info {
        display: none;
    }
    
    .mobile-controls {
        position: fixed;
        bottom: 10px;
        right: 10px;
        flex-direction: row;
        gap: 10px;
        z-index: 101;
    }
    
    .mobile-btn {
        width: 45px;
        height: 45px;
    }
    
    .btn-icon {
        font-size: 18px;
    }
    
    .btn-text {
        display: none;
    }
    
    .fullscreen-btn {
        position: absolute;
        top: 5px;
        right: 5px;
        min-width: 30px;
        height: 25px;
        padding: 2px;
    }
    
    .fullscreen-btn .btn-text {
        display: none;
    }
}
    
    .game-header {
        width: 200px;
        padding: 10px;
        margin: 10px;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .game-header h1 {
        font-size: 1.2em;
        margin: 0 0 10px 0;
    }
    
    .score-display {
        flex-direction: column;
        font-size: 0.8em;
        gap: 5px;
        align-items: flex-start;
    }
    
.game-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    position: relative;
    width: 100%;
    height: 100%;
}
    
    #gameCanvas {
        max-height: 90vh;
        max-width: 100%;
    }
    
    .controls-info {
        display: none;
    }
    
    .mobile-controls {
        flex-direction: column;
        bottom: 15px;
        right: 15px;
        top: auto;
        transform: none;
        left: auto;
        gap: 10px;
    }
    
    .mobile-btn {
        width: 50px;
        height: 50px;
    }
    
    .game-header-overlay {
        top: 10px;
        left: 10px;
        right: 10px;
    }
    
    .game-header-overlay h1 {
        font-size: 1em;
    }
}