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

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 100%);
    color: #fff;
    overflow: hidden;
    position: relative;
    height: 100vh;
    user-select: none;
}

/* 游戏容器 */
.game-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* 屏幕样式 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 开始屏幕样式 */
#start-screen {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 100%);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.title-container {
    text-align: center;
    margin-bottom: 30px;
    animation: bounce 2s infinite;
}

.game-title {
    font-size: 4.5rem;
    font-weight: 700;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    background: linear-gradient(to right, #fff, #ffeb3b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.game-subtitle {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-characters {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.hero-character {
    font-size: 5rem;
    margin: 0 15px;
    animation: float 3s infinite ease-in-out;
    animation-delay: calc(var(--i) * 0.2s);
}

.hero-character:nth-child(1) {
    --i: 0;
}

.hero-character:nth-child(2) {
    --i: 1;
}

.hero-character:nth-child(3) {
    --i: 2;
}

/* 货币显示样式 */
.currency-display {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 15px;
    border-radius: 50px;
    backdrop-filter: blur(5px);
    z-index: 10;
}

.currency-icon {
    font-size: 1.5rem;
    margin-right: 8px;
}

.currency-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffeb3b;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.shop-currency {
    position: relative;
    top: auto;
    right: auto;
    margin: 0 auto 20px;
    justify-content: center;
    width: fit-content;
}

/* 游戏按钮样式 */
.game-btn {
    padding: 15px 30px;
    margin: 10px;
    border: none;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    will-change: transform;
    transform: translateZ(0);
}

/* 商城界面样式 */
.shop-tabs {
    display: flex;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50px;
    padding: 5px;
    width: 80%;
    max-width: 400px;
}

.shop-tab {
    flex: 1;
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.shop-tab.active {
    background: linear-gradient(135deg, #ffeb3b 0%, #ffc107 100%);
    color: #333;
}

.shop-content {
    width: 90%;
    max-width: 800px;
    height: 50vh;
    overflow-y: auto;
    margin-bottom: 20px;
}

.shop-page {
    display: none;
}

.shop-page.active {
    display: block;
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.shop-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    backdrop-filter: blur(5px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.shop-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.item-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.item-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.item-description {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.8);
}

.item-price {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #ffeb3b;
}

.buy-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.buy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.buy-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 刀光拖尾预览 */
.trail-preview {
    width: 80px;
    height: 5px;
    margin: 15px auto;
    border-radius: 5px;
}

.rainbow-trail {
    background: linear-gradient(to right, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
}

.fire-trail {
    background: linear-gradient(to right, #ff4500, #ff8c00, #ffa500);
}

.ice-trail {
    background: linear-gradient(to right, #00bfff, #1e90ff, #4169e1);
}

.default-trail {
    background: rgba(255, 255, 255, 0.8);
}

/* 道具栏样式 */
.inventory-section {
    width: 90%;
    max-width: 800px;
    margin-bottom: 20px;
}

.inventory-section h3 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.inventory-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    min-height: 60px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 15px;
}

.inventory-item {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.inventory-item-icon {
    font-size: 1.5rem;
}

.inventory-item-name {
    font-weight: 700;
}

.inventory-item-count {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 700;
}

.primary-btn {
    background: linear-gradient(135deg, #ffeb3b 0%, #ffc107 100%);
    color: #333;
}

.secondary-btn {
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    color: #fff;
}

.game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.game-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 游戏屏幕样式 */
#game-screen {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 100%);
    padding: 0;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 1;
}

/* 分数面板样式 */
.score-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 15px;
    backdrop-filter: blur(5px);
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    font-size: 1rem;
    margin-bottom: 5px;
    color: #ffeb3b;
}

.score-value {
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* 生命值样式 */
.lives-container {
    display: flex;
    gap: 5px;
}

.life-icon {
    width: 25px;
    height: 25px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ff4d4d"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/></svg>') no-repeat center;
    background-size: contain;
}

/* 暂停按钮样式 */
.pause-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.pause-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

/* 连击效果样式 */
.combo-effect-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    pointer-events: none;
}

.combo-text {
    font-size: 3rem;
    font-weight: 700;
    color: #ffeb3b;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: comboAnimation 1s ease-out forwards;
}

/* 暂停屏幕样式 */
#pause-screen {
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
}

/* 道具效果样式 */
.shield-active {
    border: 3px solid #4a90e2;
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.5);
}

.double-score-active {
    color: #ffcc00 !important;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.8);
    animation: pulse 1s infinite;
}

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

/* 游戏结束屏幕样式 */
#end-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 20;
    color: white;
    text-align: center;
    padding-top: 100px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

.game-over-title {
    font-size: 3rem;
    margin-bottom: 30px;
    color: #ff6b6b;
}

.game-over-stats {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin: 0 auto 30px;
    max-width: 400px;
}

.final-score {
    font-size: 1.8rem;
    color: #ffd700;
    margin-bottom: 10px;
}

.game-over-screen .earned-currency {
    font-size: 1.4rem;
    color: #4caf50;
    margin-bottom: 15px;
}

.high-score {
    font-size: 1.2rem;
    color: #ff9800;
    margin-bottom: 5px;
}

.highest-combo {
    font-size: 1.2rem;
    color: #9c27b0;
    margin-bottom: 5px;
}

.reached-level {
    font-size: 1.2rem;
    color: #00bcd4;
    margin-bottom: 20px;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.game-over-btn {
    padding: 12px 30px;
    font-size: 1.2rem;
    background: linear-gradient(45deg, #ff6b6b, #ff8e53);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
}

.game-over-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    z-index: 1000;
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

#game-over-screen .game-over-stats {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    width: 80%;
    max-width: 400px;
}

#game-over-screen .final-score {
    font-size: 1.8rem;
    margin: 15px 0;
    color: #FFD700;
    font-weight: 700;
}

#game-over-screen .earned-currency {
    font-size: 1.4rem;
    margin: 10px 0;
    color: #4CAF50;
    font-weight: 600;
}

#end-screen .earned-currency {
    font-size: 1.4rem;
    margin: 10px 0;
    color: #4CAF50;
    font-weight: 600;
}

.screen-title {
    font-size: 3rem;
    margin-bottom: 30px;
    text-align: center;
    color: #ffeb3b;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.score-summary {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(5px);
}

/* 游戏说明屏幕样式 */
#tutorial-screen {
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    padding: 20px;
}

.tutorial-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
    max-width: 600px;
}

.tutorial-item {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 15px;
}

.tutorial-icon {
    font-size: 2.5rem;
    min-width: 60px;
    text-align: center;
}

.tutorial-text {
    font-size: 1.1rem;
    line-height: 1.5;
}

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

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

@keyframes comboAnimation {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-title {
        font-size: 3.5rem;
    }
    
    .game-subtitle {
        font-size: 2rem;
    }
    
    .hero-character {
        font-size: 4rem;
        margin: 0 10px;
    }
    
    .game-btn {
        padding: 12px 25px;
        font-size: 1rem;
        min-width: 180px;
        min-height: 55px;
    }
    
    #start-btn {
        width: 220px;
        height: 65px;
    }
    
    .score-panel {
        top: 10px;
        left: 10px;
        padding: 10px;
        gap: 10px;
    }
    
    .score-label {
        font-size: 0.9rem;
    }
    
    .score-value {
        font-size: 1.5rem;
    }
    
    .pause-btn {
        width: 45px;
        height: 45px;
        top: 10px;
        right: 10px;
    }
    
    .screen-title {
        font-size: 2.5rem;
    }
    
    .tutorial-content {
        gap: 15px;
    }
    
    .tutorial-item {
        padding: 12px;
    }
    
    .tutorial-icon {
        font-size: 2rem;
        min-width: 50px;
    }
    
    .tutorial-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 3rem;
    }
    
    .game-subtitle {
        font-size: 1.8rem;
    }
    
    .hero-character {
        font-size: 3.5rem;
        margin: 0 8px;
    }
    
    .game-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        min-width: 160px;
        min-height: 50px;
    }
    
    .score-panel {
        flex-direction: row;
        top: 5px;
        left: 5px;
        right: 5px;
        justify-content: space-around;
        padding: 8px;
    }
    
    .score-item {
        align-items: center;
    }
    
    .score-label {
        font-size: 0.8rem;
        margin-bottom: 2px;
    }
    
    .score-value {
        font-size: 1.2rem;
    }
    
    .pause-btn {
        width: 40px;
        height: 40px;
    }
    
    .screen-title {
        font-size: 2rem;
    }
    
    .tutorial-content {
        gap: 12px;
    }
    
    .tutorial-item {
        padding: 10px;
    }
    
    .tutorial-icon {
        font-size: 1.8rem;
        min-width: 40px;
    }
    
    .tutorial-text {
        font-size: 0.9rem;
    }
}