* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.home-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.logo-section {
    margin-top: 40px;
    margin-bottom: 30px;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-emoji {
    font-size: 64px;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.logo h1 {
    font-size: 48px;
    color: #FF6B6B;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 5px;
}

.subtitle {
    font-size: 18px;
    color: #666;
}

.stats-section {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}

.stat-item {
    background: white;
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: #FF6B6B;
}

.stat-label {
    font-size: 14px;
    color: #888;
}

.start-section {
    margin-bottom: 30px;
}

.start-btn {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
    border: none;
    padding: 20px 60px;
    font-size: 24px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto 20px;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(255, 107, 107, 0.5);
}

.btn-icon {
    font-size: 28px;
}

.level-select {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.level-option {
    padding: 10px 30px;
    background: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
    font-weight: bold;
}

.level-option.active {
    background: #FF6B6B;
    color: white;
}

.level-option:hover {
    transform: scale(1.05);
}

.rules-section {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    text-align: left;
}

.rules-section h3 {
    color: #FF6B6B;
    margin-bottom: 15px;
    font-size: 20px;
}

.rules-section ul {
    list-style: none;
}

.rules-section li {
    padding: 8px 0;
    color: #555;
    font-size: 16px;
}

.difficulty-hint {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.easy-badge, .hard-badge {
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}

.easy-badge {
    background: #4ECDC4;
    color: white;
}

.hard-badge {
    background: #FF6B6B;
    color: white;
}

.share-section {
    margin-bottom: 30px;
}

.share-btn {
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(78, 205, 196, 0.5);
}

.share-tip {
    color: #666;
    margin-top: 10px;
    font-size: 14px;
}

.footer {
    color: #999;
    font-size: 12px;
}

.game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 15px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.back-btn {
    background: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    color: #666;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.level-badge {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 18px;
}

.score-display {
    font-size: 18px;
    font-weight: bold;
    color: #555;
}

.game-board {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

.tiles-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    position: relative;
}

.tile {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    position: absolute;
    border: 3px solid #fff;
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
}

.tile:hover:not(.blocked) {
    transform: translate(3px, 3px) scale(1.1);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.tile.selected {
    transform: translate(3px, 3px) scale(1.15);
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.5);
    border-color: #FF6B6B;
}

.tile.blocked {
    opacity: 0.5;
    cursor: not-allowed;
}

.tile.matched {
    animation: matchPop 0.3s ease forwards;
}

@keyframes matchPop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; }
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #FF6B6B;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.slots-container {
    margin-top: 20px;
}

.slots {
    display: flex;
    justify-content: center;
    gap: 10px;
    background: rgba(255,255,255,0.9);
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.slot {
    width: 60px;
    height: 60px;
    background: #f5f5f5;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    border: 3px dashed #ddd;
    transition: all 0.2s ease;
}

.slot.filled {
    background: white;
    border: 3px solid #FF6B6B;
}

.slot.full-warning {
    animation: pulseRed 0.5s ease infinite;
}

@keyframes pulseRed {
    0%, 100% { border-color: #FF6B6B; }
    50% { border-color: #ff0000; }
}

.slots-warning {
    text-align: center;
    margin-top: 10px;
    color: #FF6B6B;
    font-weight: bold;
    display: none;
    animation: shake 0.5s ease infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.control-btn {
    background: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.hint-btn {
    color: #4ECDC4;
}

.shuffle-btn {
    color: #FF6B6B;
}

.restart-btn {
    color: #999;
}

.tile-preview {
    margin-top: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.tile-types {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.tile-types .tile {
    position: static;
    cursor: default;
    background: #f9f9f9;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

.modal h2 {
    font-size: 32px;
    color: #FF6B6B;
    margin-bottom: 15px;
}

.modal p {
    color: #666;
    font-size: 18px;
    margin-bottom: 30px;
}

.modal-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.modal-btn {
    padding: 15px 35px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.modal-btn.primary {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
}

.modal-btn.secondary {
    background: #f0f0f0;
    color: #666;
}

.modal-btn:hover {
    transform: translateY(-3px);
}

.result-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 30px;
    text-align: center;
}

.result-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

.result-container h1 {
    font-size: 42px;
    color: #FF6B6B;
    margin-bottom: 10px;
}

.result-container p {
    font-size: 20px;
    color: #666;
    margin-bottom: 30px;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}

.result-stat {
    background: white;
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.result-stat .stat-icon {
    display: block;
    font-size: 32px;
    margin-bottom: 5px;
}

.result-stat .stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #555;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.action-btn {
    padding: 18px 40px;
    border-radius: 30px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.action-btn.primary {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
}

.action-btn.secondary {
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    color: white;
}

.action-btn.outline {
    background: white;
    color: #666;
    border: 2px solid #ddd;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.share-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

.share-card-header {
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    padding: 15px;
    color: white;
    font-weight: bold;
}

.share-card-content {
    padding: 20px;
}

.share-card-content p {
    color: #555;
    font-size: 16px;
}

.challenge-hint {
    background: linear-gradient(135deg, #FFE66D 0%, #FFD93D 100%);
    padding: 15px;
    border-radius: 15px;
    color: #333;
    font-weight: bold;
    font-size: 16px;
}

.celebration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: none;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #FF6B6B;
    animation: fall linear infinite;
}

.confetti:nth-child(2) { left: 10%; background: #4ECDC4; animation-duration: 2.5s; }
.confetti:nth-child(3) { left: 20%; background: #FFE66D; animation-duration: 3s; }
.confetti:nth-child(4) { left: 40%; background: #FF8E53; animation-duration: 2.8s; }
.confetti:nth-child(5) { left: 60%; background: #95E1D3; animation-duration: 2.3s; }
.confetti:nth-child(6) { left: 80%; background: #DDA0DD; animation-duration: 3.2s; }

@keyframes fall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

@media (max-width: 768px) {
    .tile {
        width: 50px;
        height: 50px;
        font-size: 26px;
    }
    
    .slot {
        width: 50px;
        height: 50px;
        font-size: 26px;
    }
    
    .game-board {
        padding: 10px;
        min-height: 350px;
    }
    
    .logo h1 {
        font-size: 36px;
    }
    
    .logo-emoji {
        font-size: 48px;
    }
    
    .stats-section {
        gap: 20px;
    }
    
    .stat-item {
        padding: 10px 15px;
    }
    
    .stat-value {
        font-size: 22px;
    }
}

/* 分享海报弹窗 */
.poster-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}
.poster-overlay.show {
    display: flex;
}
.poster-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 400px;
    width: 100%;
}
.poster-tip {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin-top: 12px;
    margin-bottom: 8px;
}
.poster-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}
.poster-btn {
    padding: 10px 28px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
    box-shadow: 0 4px 15px rgba(78,205,196,0.4);
    transition: transform 0.2s;
}
.poster-btn:hover { transform: translateY(-2px); }
.poster-btn.secondary {
    background: rgba(255,255,255,0.15);
    box-shadow: none;
    border: 1px solid rgba(255,255,255,0.3);
}
.poster-close {
    margin-top: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
}
.poster-close:hover { background: rgba(255,255,255,0.35); }