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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 5px;
    overflow: hidden;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 450px;
    min-height: 100vh;
    padding: 10px;
    position: relative;
}

.game-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.logo {
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-blocks {
    display: flex;
    gap: 3px;
}

.logo-block {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.block-i {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    box-shadow: 0 0 12px rgba(255, 107, 107, 0.6);
}

.block-o {
    background: linear-gradient(135deg, #4ecdc4 0%, #3db8b0 100%);
    box-shadow: 0 0 12px rgba(78, 205, 196, 0.6);
}

.block-t {
    background: linear-gradient(135deg, #a8e6cf 0%, #88d4ab 100%);
    box-shadow: 0 0 12px rgba(168, 230, 207, 0.6);
}

.game-title {
    font-size: 1.4em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    font-weight: bold;
    letter-spacing: 1.5px;
}

.bottom-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
    max-width: 300px;
    align-self: center;
    flex-shrink: 0;
    z-index: 110;
    position: relative;
}

.daily-reward-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(255, 152, 0, 0.4);
    animation: glow 2s ease-in-out infinite;
    flex: 1;
    text-align: center;
}

.daily-reward-btn:hover {
    transform: scale(1.05);
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 2px 10px rgba(255, 152, 0, 0.4);
    }
    50% {
        box-shadow: 0 2px 15px rgba(255, 152, 0, 0.8);
    }
}

.game-area {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    flex: 1;
    min-height: 0;
    justify-content: center;
    position: relative;
    flex-wrap: nowrap;
}

.game-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 300px;
    width: 100%;
}

#gameCanvas {
    border: 3px solid rgba(102, 126, 234, 0.5);
    border-radius: 15px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0d1117 100%);
    display: block;
    max-width: 100%;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.3),
                inset 0 0 20px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.game-info {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8) 0%, rgba(15, 52, 96, 0.8) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 130px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
    flex-shrink: 0;
}

.info-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.5), transparent);
    margin: 2px 0;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
}

.powerup-item {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.2) 0%, rgba(255, 87, 34, 0.2) 100%);
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.powerup-item span:last-child {
    color: #ff9800;
    text-shadow: 0 0 6px rgba(255, 152, 0, 0.5);
}

.powerup-btn-container {
    display: flex;
    justify-content: center;
    padding: 2px 4px;
}

.powerup-btn-container .powerup-btn {
    width: 100%;
    padding: 4px 8px;
    font-size: 0.7em;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8) 0%, rgba(118, 75, 162, 0.8) 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    font-weight: bold;
}

.label {
    font-weight: bold;
    color: #a0a0a0;
    font-size: 0.65em;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.info-item span:last-child {
    font-size: 0.9em;
    font-weight: bold;
    color: #667eea;
    text-shadow: 0 0 6px rgba(102, 126, 234, 0.5);
}

.next-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    margin-top: 6px;
}

.next-block h3 {
    font-size: 0.7em;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

#nextCanvas {
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 6px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0d1117 100%);
    display: block;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.2);
}

.game-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    width: 100%;
    margin-top: 8px;
    align-self: flex-start;
}

.control-btn {
    padding: 8px;
    font-size: 0.9em;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8) 0%, rgba(118, 75, 162, 0.8) 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    font-weight: bold;
    text-align: center;
}

#dropBtn, #pauseBtn, #musicBtn {
    padding: 6px;
    font-size: 0.8em;
}

.control-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 1) 0%, rgba(118, 75, 162, 1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

#rotateBtn {
    grid-column: 2;
    grid-row: 1;
}

#leftBtn {
    grid-column: 1;
    grid-row: 2;
}

#downBtn {
    grid-column: 2;
    grid-row: 2;
}

#rightBtn {
    grid-column: 3;
    grid-row: 2;
}

#dropBtn {
    grid-column: 1;
    grid-row: 3;
    font-size: 0.8em;
    padding: 6px;
}

#pauseBtn {
    grid-column: 2;
    grid-row: 3;
    font-size: 0.8em;
    padding: 6px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.8) 0%, rgba(255, 152, 0, 0.8) 100%);
}

#pauseBtn:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 1) 0%, rgba(255, 152, 0, 1) 100%);
}

#musicBtn {
    grid-column: 3;
    grid-row: 3;
    font-size: 0.8em;
    padding: 6px;
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.8) 0%, rgba(103, 58, 183, 0.8) 100%);
}

#musicBtn:hover {
    background: linear-gradient(135deg, rgba(156, 39, 176, 1) 0%, rgba(103, 58, 183, 1) 100%);
}

.controls-hint {
    margin-top: 8px;
    text-align: center;
}

.controls-hint p {
    font-size: 0.75em;
    color: #888;
    letter-spacing: 0.5px;
}

/* Banner广告容器 */
#bannerAdContainer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

/* 开始界面 */
.start-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 52, 96, 0.95) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 25px;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.start-screen h2 {
    font-size: 2.5em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    letter-spacing: 3px;
    text-align: center;
}

.start-screen p {
    font-size: 1.2em;
    color: #ffffff;
    text-align: center;
}

.start-btn {
    padding: 15px 50px;
    font-size: 1.5em;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

.start-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.6);
}

.start-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.ranking-btn {
    padding: 12px 40px;
    font-size: 1.2em;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
    margin-top: 10px;
}

.ranking-btn:hover {
    background: linear-gradient(135deg, #f57c00 0%, #ef6c00 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 152, 0, 0.6);
}

.ranking-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 152, 0, 0.3);
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 52, 96, 0.95) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 25px;
    z-index: 100;
    display: none;
    backdrop-filter: blur(10px);
}

.watch-ad-btn {
    padding: 15px 40px;
    font-size: 1.3em;
    background: linear-gradient(135deg, #ff5722 0%, #f44336 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(255, 87, 34, 0.4);
    animation: pulse-ad 2s ease-in-out infinite;
}

@keyframes pulse-ad {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 87, 34, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 25px rgba(255, 87, 34, 0.6);
    }
}

.watch-ad-btn:hover {
    background: linear-gradient(135deg, #f44336 0%, #e91e63 100%);
    transform: translateY(-3px);
}

.clear-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 99;
    pointer-events: none;
}

.confetti {
    position: fixed;
    top: -10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: confetti-fall 2s ease-in-out forwards;
    z-index: 98;
    pointer-events: none;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.game-over h2 {
    font-size: 3em;
    background: linear-gradient(135deg, #f44336 0%, #e91e63 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    letter-spacing: 3px;
    animation: pulse 2s ease-in-out infinite;
}

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

.game-over p {
    font-size: 1.5em;
    color: #ffffff;
}

.game-over span {
    color: #667eea;
    font-weight: bold;
    font-size: 1.2em;
    text-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

#restartBtn {
    padding: 15px 40px;
    font-size: 1.3em;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

#restartBtn:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.6);
}

#restartBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.share-btn {
    padding: 15px 40px;
    font-size: 1.3em;
    background: linear-gradient(135deg, #2196F3 0%, #0b7dda 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
}

.share-btn:hover {
    background: linear-gradient(135deg, #0b7dda 0%, #0a66b8 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(33, 150, 243, 0.6);
}

.share-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(33, 150, 243, 0.3);
}

/* 分享面板 */
.share-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 52, 96, 0.95) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 25px;
    z-index: 101;
    display: none;
    backdrop-filter: blur(10px);
}

.ranking-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 52, 96, 0.95) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 25px;
    z-index: 101;
    display: none;
    backdrop-filter: blur(10px);
}

.ranking-panel h3 {
    font-size: 2em;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    letter-spacing: 2px;
}

.ranking-list {
    width: 80%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 4px solid #ff9800;
    transition: all 0.3s ease;
}

.ranking-item:hover {
    background: rgba(255, 152, 0, 0.1);
    transform: translateX(5px);
}

.ranking-item .rank {
    font-weight: bold;
    color: #ff9800;
    margin-right: 15px;
    min-width: 30px;
}

.ranking-item .name {
    flex: 1;
    color: #ffffff;
}

.ranking-item .score {
    font-weight: bold;
    color: #4caf50;
}

.close-ranking-btn {
    padding: 12px 40px;
    font-size: 1.1em;
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(158, 158, 158, 0.4);
}

.close-ranking-btn:hover {
    background: linear-gradient(135deg, #757575 0%, #616161 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(158, 158, 158, 0.6);
}

.close-ranking-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(158, 158, 158, 0.3);
}

.share-panel h3 {
    font-size: 2em;
    background: linear-gradient(135deg, #2196F3 0%, #0b7dda 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    letter-spacing: 2px;
}

.share-panel p {
    font-size: 1.2em;
    color: #ffffff;
    text-align: center;
    max-width: 80%;
}

#shareFriendBtn {
    padding: 15px 50px;
    font-size: 1.3em;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

#shareFriendBtn:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.6);
}

#cancelShareBtn {
    padding: 12px 40px;
    font-size: 1.1em;
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(158, 158, 158, 0.4);
}

#cancelShareBtn:hover {
    background: linear-gradient(135deg, #757575 0%, #616161 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(158, 158, 158, 0.6);
}

.invite-friend-btn {
    padding: 8px 16px;
    font-size: 0.8em;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    letter-spacing: 0.8px;
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.4);
    flex: 1;
    text-align: center;
}

.invite-friend-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.6);
}

.invite-friend-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

/* 道具效果提示 */
.powerup-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    font-weight: bold;
    color: #ff9800;
    text-shadow: 0 0 20px rgba(255, 152, 0, 0.8);
    z-index: 200;
    animation: powerup-pop 1.5s ease-out forwards;
    pointer-events: none;
}

@keyframes powerup-pop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1) translateY(-50px);
    }
}

@media (max-width: 375px) {
    .game-title {
        font-size: 1.5em;
    }
    
    .game-info {
        font-size: 0.9em;
        max-width: 280px;
    }
    
    .control-btn {
        padding: 10px;
        font-size: 1em;
    }
    
    .game-over h2 {
        font-size: 2.2em;
    }
    
    .game-over p {
        font-size: 1.2em;
    }
    
    .logo-block {
        width: 20px;
        height: 20px;
    }
    
    .daily-reward-btn {
        font-size: 0.8em;
        padding: 6px 12px;
    }
}

@media (max-width: 320px) {
    .game-title {
        font-size: 1.3em;
    }
    
    .game-info {
        max-width: 250px;
    }
    
    .control-btn {
        padding: 8px;
        font-size: 0.9em;
    }
    
    .game-controls {
        max-width: 280px;
    }
}
