/* 消消乐游戏样式 - 从HTML中提取 */

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

body {
    font-family: 'Microsoft YaHei', 'SF Pro Display', -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #2c3e50;
    padding: 20px;
    overflow-x: hidden;
}

.game-container {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

h1 {
    text-align: center;
    font-size: 2.8rem;
    color: #2c3e50;
    margin-bottom: 30px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.info-item {
    background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
    color: white;
    padding: 15px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
    transition: transform 0.3s ease;
}

.info-item:hover {
    transform: translateY(-2px);
}

.info-label {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.6rem;
    font-weight: 700;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.game-board {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 30px;
    background: #ecf0f1;
    border-radius: 15px;
    margin-bottom: 25px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-radius: 15px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 4px;
    aspect-ratio: 1;
    max-width: 600px;
    margin: 0 auto;
    background: #34495e;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.gem {
    width: 100%;
    height: 100%;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.gem:hover {
    transform: scale(1.1);
    z-index: 10;
}

.gem.selected {
    transform: scale(1.15);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.gem.hint {
    animation: hintPulse 1s ease-in-out infinite;
}

@keyframes hintPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 255, 255, 0.7); }
    50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(255, 255, 255, 0.7); }
}

/* 宝石颜色样式 */
.gem.red { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.gem.blue { background: linear-gradient(135deg, #3498db, #2980b9); }
.gem.green { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.gem.yellow { background: linear-gradient(135deg, #f1c40f, #f39c12); }
.gem.purple { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.gem.orange { background: linear-gradient(135deg, #e67e22, #d35400); }
.gem.pink { background: linear-gradient(135deg, #e91e63, #ad1457); }

.gem.bomb {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    box-shadow: 0 0 15px rgba(52, 73, 94, 0.6);
}

.gem.rainbow {
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    background-size: 300% 300%;
    animation: rainbow 2s ease-in-out infinite;
}

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

.gem.falling {
    animation: fall 0.5s ease-in;
}

@keyframes fall {
    0% { transform: translateY(-100px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.gem.exploding {
    animation: explode 0.6s ease-out;
}

@keyframes explode {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.8; }
    100% { transform: scale(0); opacity: 0; }
}

.combo-indicator {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff6b6b, #ffa726);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    animation: comboFloat 1.5s ease-out;
    pointer-events: none;
}

@keyframes comboFloat {
    0% { opacity: 0; transform: translate(-50%, 20px); }
    30% { opacity: 1; transform: translate(-50%, -10px); }
    100% { opacity: 0; transform: translate(-50%, -40px); }
}

.score-popup {
    position: absolute;
    color: #27ae60;
    font-weight: 700;
    font-size: 1.2rem;
    pointer-events: none;
    animation: scoreFloat 2s ease-out;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes scoreFloat {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-50px); }
}

@keyframes floatUp {
    0% { opacity: 1; transform: translate(-50%, -50%); }
    100% { opacity: 0; transform: translate(-50%, -150%); }
}

.instructions {
    background: rgba(255, 255, 255, 0.8);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.instructions h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
    text-align: center;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    margin-bottom: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.instructions li:hover {
    transform: translateX(5px);
}

.special-gems {
    margin-top: 30px;
    background: rgba(255, 255, 255, 0.8);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.special-gems h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
    text-align: center;
}

.special-gem-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.special-gem-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.special-gem-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.special-gem-desc {
    flex: 1;
}

.special-gem-desc h4 {
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 1rem;
}

.special-gem-desc p {
    color: #7f8c8d;
    font-size: 0.85rem;
    line-height: 1.4;
}

.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-over-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    margin: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.game-over-content h2 {
    color: #27ae60;
    margin-bottom: 20px;
    font-size: 2rem;
}

.final-stats {
    margin-bottom: 25px;
}

.final-stats p {
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #2c3e50;
}

/* 道具栏样式 */
.power-ups {
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.power-ups h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
    text-align: center;
}

.power-up-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.power-up-item {
    background: white;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
}

.power-up-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.power-up-item.active {
    border-color: #27ae60;
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
}

.power-up-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.power-up-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.power-up-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.power-up-count {
    font-size: 1.2rem;
    font-weight: 700;
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
    min-width: 30px;
}

/* 设置界面样式 */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.settings-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.settings-content h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 1.8rem;
    text-align: center;
}

.setting-group {
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 12px;
}

.setting-group h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-label {
    font-weight: 600;
    color: #495057;
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 25px;
    background: #ccc;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch.active {
    background: #27ae60;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch.active::after {
    transform: translateX(25px);
}

.volume-slider {
    width: 100px;
}

.difficulty-select {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

.achievements-section {
    margin-top: 20px;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.achievement-item {
    background: white;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
}

.achievement-item.unlocked {
    border-color: #ffd700;
    background: linear-gradient(135deg, #fff9c4, #ffeaa7);
}

.achievement-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.achievement-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.achievement-desc {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.4;
}

/* 粒子效果 */
.particle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    animation: particleFloat 2s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.5);
    }
}

/* 连击效果 */
.combo-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ff6b6b, #ffa726);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
    animation: comboAppear 0.5s ease-out;
    pointer-events: none;
    z-index: 100;
}

@keyframes comboAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 关卡完成和游戏结束弹窗 */
.level-complete, .game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: popupAppear 0.5s ease-out;
}

@keyframes popupAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.level-complete h2, .game-over h2 {
    color: #27ae60;
    margin-bottom: 20px;
    font-size: 2rem;
}

.level-stats, .game-over-stats {
    margin-bottom: 25px;
}

.level-stats div, .game-over-stats div {
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #2c3e50;
    padding: 8px 15px;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 20px;
        margin: 10px;
    }

    h1 {
        font-size: 2.2rem;
    }

    .game-info {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .info-item {
        padding: 12px;
    }

    .info-value {
        font-size: 1.4rem;
    }

    .controls {
        gap: 10px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.8rem;
    }

    .grid-container {
        max-width: 480px;
        padding: 15px;
    }

    .gem {
        font-size: 28px;
    }

    .special-gem-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .game-info {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 200px;
    }

    .grid-container {
        max-width: 420px;
    }

    .gem {
        font-size: 24px;
    }
}