@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-pink: #ff6b9d;
    --secondary-pink: #f093fb;
    --primary-blue: #667eea;
    --secondary-blue: #764ba2;
    --gold: #ffd93d;
    --white: #ffffff;
    --cream: #fff5f8;
    --pastel-pink: #ffdde1;
    --pastel-blue: #e8f4fd;
    --pastel-purple: #f3e8ff;
}

body {
    font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    min-height: 100vh;
    overflow: hidden;
    touch-action: manipulation;
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 20%, #fbcfe8 40%, #f9a8d4 50%, #e9d5ff 60%, #d8b4fe 80%, #c4b5fd 100%);
    background-size: 400% 400%;
    animation: bg-flow 25s ease infinite;
    position: relative;
}

.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.particle-float {
    position: absolute;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, rgba(249, 168, 212, 0.7), rgba(216, 180, 254, 0.4));
    border-radius: 50%;
    opacity: 0.7;
    animation: float-down linear infinite;
    box-shadow: 0 0 8px rgba(249, 168, 212, 0.5);
}

@keyframes float-down {
    0% {
        transform: translateY(-10vh) rotate(0deg) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) translateX(30px);
        opacity: 0;
    }
}

.sparkles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 998;
}

.sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #fff 0%, #ffd93d 50%, transparent 100%);
    border-radius: 50%;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1); }
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
}

.screen.active {
    display: flex;
}

#splash-screen {
    background: linear-gradient(135deg, 
        #ffecd2 0%, 
        #fcb69f 25%, 
        #ff9a9e 50%, 
        #fecfef 75%, 
        #ffecd2 100%);
    animation: gradient-shift 15s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.splash-content {
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
    position: relative;
    z-index: 10;
}

.splash-decoration {
    position: absolute;
    font-size: 24px;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.splash-decoration.top-left {
    top: -60px;
    left: -30px;
    animation: float 3s ease-in-out infinite;
}

.splash-decoration.top-right {
    top: -40px;
    right: -20px;
    animation: float 3.5s ease-in-out infinite 0.5s;
}

.splash-decoration.bottom-left {
    bottom: -40px;
    left: -40px;
    animation: float 4s ease-in-out infinite 1s;
}

.splash-decoration.bottom-right {
    bottom: -50px;
    right: -50px;
    animation: float 3.2s ease-in-out infinite 0.3s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

.logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo-icon {
    font-size: 40px;
    animation: bounce-slow 2s ease-in-out infinite;
}

@keyframes bounce-slow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.game-title {
    font-size: clamp(36px, 12vw, 56px);
    background: linear-gradient(135deg, #ff6b9d 0%, #f093fb 30%, #c084fc 70%, #a855f7 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    margin: 0;
    font-weight: bold;
    animation: title-shine 3s ease-in-out infinite;
    position: relative;
}

.game-title::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    background: linear-gradient(135deg, #ff6b9d 0%, #f093fb 30%, #c084fc 70%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: blur(8px);
    opacity: 0.6;
}

@keyframes title-shine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.game-subtitle {
    font-size: clamp(16px, 5vw, 24px);
    color: #ff8fab;
    margin-bottom: 15px;
    font-style: italic;
}

.subtitle-decoration {
    color: #ffb7c5;
    font-size: 20px;
    margin-bottom: 30px;
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.btn {
    background: linear-gradient(145deg, #ff7eb3 0%, #ff6b9d 50%, #f093fb 100%);
    background-size: 200% 200%;
    color: white;
    border: 3px solid rgba(255,255,255,0.7);
    padding: 15px 45px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 
        0 6px 20px rgba(255, 107, 157, 0.5),
        0 2px 8px rgba(255, 107, 157, 0.3),
        inset 0 2px 4px rgba(255,255,255,0.5),
        inset 0 -2px 4px rgba(255, 107, 157, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover, .btn:active {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 
        0 10px 30px rgba(255, 107, 157, 0.6),
        0 4px 15px rgba(255, 107, 157, 0.4),
        inset 0 2px 4px rgba(255,255,255,0.5),
        inset 0 -2px 4px rgba(255, 107, 157, 0.2);
    background-position: 100% 50%;
}

.btn-primary {
    background: linear-gradient(145deg, #ff7eb3 0%, #ff6b9d 30%, #f093fb 70%, #c084fc 100%);
    background-size: 200% 200%;
    box-shadow: 
        0 6px 20px rgba(255, 107, 157, 0.5),
        0 4px 15px rgba(192, 132, 252, 0.4),
        0 0 30px rgba(255, 107, 157, 0.3),
        inset 0 2px 4px rgba(255,255,255,0.5),
        inset 0 -2px 4px rgba(255, 107, 157, 0.2);
}

.btn-primary:hover {
    box-shadow: 
        0 12px 35px rgba(255, 107, 157, 0.6),
        0 6px 20px rgba(192, 132, 252, 0.5),
        0 0 45px rgba(255, 107, 157, 0.4),
        inset 0 2px 4px rgba(255,255,255,0.5),
        inset 0 -2px 4px rgba(255, 107, 157, 0.2);
}

.btn-secondary {
    background: linear-gradient(145deg, #818cf8 0%, #667eea 50%, #7c3aed 100%);
    background-size: 200% 200%;
    box-shadow: 
        0 6px 20px rgba(102, 126, 234, 0.5),
        inset 0 2px 4px rgba(255,255,255,0.5),
        inset 0 -2px 4px rgba(102, 126, 234, 0.2);
}

.btn-secondary:hover {
    box-shadow: 
        0 10px 30px rgba(102, 126, 234, 0.6),
        inset 0 2px 4px rgba(255,255,255,0.5),
        inset 0 -2px 4px rgba(102, 126, 234, 0.2);
}

.btn-back {
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(15px);
    color: #ff6b9d;
    border-color: rgba(255, 107, 157, 0.4);
    padding: 12px 28px;
    font-size: 14px;
    box-shadow: 
        0 4px 15px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

.btn-back:hover {
    background: rgba(255,255,255,0.6);
    box-shadow: 
        0 6px 20px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

.btn-icon {
    font-size: 18px;
}

.splash-chibi {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.chibi-emoji {
    font-size: 40px;
    animation: chibi-bounce 1.5s ease-in-out infinite;
}

.chibi-emoji:nth-child(2) {
    animation-delay: 0.2s;
}

.chibi-emoji:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chibi-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.1); }
}

#level-select {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 50%, #a29bfe 100%);
    padding: 20px;
}

.level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.level-title {
    font-size: 28px;
    color: white;
    text-shadow: 
        0 2px 10px rgba(0,0,0,0.2),
        0 0 20px rgba(255, 215, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-icon {
    animation: spin-slow 3s linear infinite;
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.header-decoration {
    color: rgba(255,255,255,0.8);
    font-size: 18px;
}

#level-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 400px;
    width: 100%;
}

.level-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.98), rgba(255,248,250,0.95));
    border-radius: 25px;
    padding: 22px;
    text-align: center;
    cursor: pointer;
    box-shadow: 
        0 6px 20px rgba(255, 107, 157, 0.15),
        0 2px 8px rgba(0,0,0,0.1),
        inset 0 2px 4px rgba(255,255,255,0.9),
        inset 0 -2px 4px rgba(255, 107, 157, 0.05);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 3px solid rgba(255, 107, 157, 0.25);
    overflow: hidden;
}

.level-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(255, 107, 157, 0.4), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.level-card:hover {
    transform: translateY(-10px) scale(1.03);
    box-shadow: 
        0 15px 35px rgba(255, 107, 157, 0.25),
        0 8px 20px rgba(0,0,0,0.15),
        0 0 30px rgba(255, 107, 157, 0.15),
        inset 0 2px 4px rgba(255,255,255,0.9);
    border-color: rgba(255, 107, 157, 0.4);
}

.level-card:hover::before {
    opacity: 1;
}

.level-card.locked {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(30%);
}

.level-card.locked:hover {
    transform: none;
    box-shadow: 
        0 6px 20px rgba(0,0,0,0.15),
        inset 0 2px 4px rgba(255,255,255,0.9);
}

.level-card.locked:hover::before {
    opacity: 0;
}

.level-number {
    font-size: 40px;
    font-weight: bold;
    background: linear-gradient(135deg, #ff6b9d 0%, #f093fb 50%, #c084fc 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    animation: number-shine 4s ease-in-out infinite;
}

@keyframes number-shine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.level-card.locked .level-number {
    background: linear-gradient(135deg, #b0b0b0, #d0d0d0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: none;
}

.level-theme {
    font-size: 13px;
    color: #7c3aed;
    margin-bottom: 6px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(124, 58, 237, 0.2);
}

.level-target {
    font-size: 15px;
    color: #ff6b9d;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(255, 107, 157, 0.3);
}

.level-best {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
    font-weight: 500;
}

.level-card.completed .level-number {
    background: linear-gradient(135deg, #22c55e 0%, #4ade80 50%, #86efac 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.level-card.completed::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 26px;
    color: #22c55e;
    text-shadow: 0 0 15px rgba(34, 197, 94, 0.6);
    animation: check-pulse 2s ease-in-out infinite;
}

@keyframes check-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.level-card.current::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 4px solid transparent;
    border-radius: 28px;
    pointer-events: none;
    background: linear-gradient(135deg, #ffd93d, #fbbf24, #f59e0b) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: glow-border 2s ease-in-out infinite;
}

@keyframes glow-border {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 217, 61, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 217, 61, 0.8); }
}

#game-container {
    background: linear-gradient(135deg, rgba(255, 241, 247, 0.9) 0%, rgba(253, 224, 235, 0.9) 50%, rgba(249, 203, 240, 0.9) 100%);
    backdrop-filter: blur(10px);
    padding: 10px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 80vh;
    width: 100%;
    box-sizing: border-box;
    border-radius: 20px;
    border: 2px solid rgba(249, 168, 212, 0.3);
}

#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.game-info {
    flex: 1;
    margin-left: 10px;
}

.score-panel {
    display: flex;
    justify-content: space-around;
    background: linear-gradient(145deg, rgba(255,255,255,0.98), rgba(255,248,250,0.95));
    border-radius: 20px;
    padding: 15px 12px;
    box-shadow: 
        0 6px 20px rgba(255, 107, 157, 0.15),
        0 2px 8px rgba(0,0,0,0.1),
        inset 0 2px 4px rgba(255,255,255,0.9),
        inset 0 -2px 4px rgba(255, 107, 157, 0.05);
    border: 3px solid rgba(255, 107, 157, 0.25);
}

.score-item {
    text-align: center;
    flex: 1;
}

.score-item .label {
    display: block;
    font-size: 11px;
    color: #ff8fab;
    margin-bottom: 3px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.label-icon {
    font-size: 12px;
}

.score-value {
    display: block;
    font-size: 22px;
    font-weight: bold;
    background: linear-gradient(135deg, #ff6b9d, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.target-value {
    display: block;
    font-size: 22px;
    font-weight: bold;
    background: linear-gradient(135deg, #48c774, #22c55e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.moves-value {
    display: block;
    font-size: 22px;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.timer-panel {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.9);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.timer-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    border-radius: 3px;
    transition: width 0.3s ease, background 0.3s ease;
}

.timer-fill.timer-warning {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.timer-fill.timer-critical {
    background: linear-gradient(90deg, #f87171, #ef4444);
    animation: timer-pulse 0.5s ease-in-out infinite;
}

@keyframes timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.timer-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.timer-icon {
    font-size: 16px;
}

.timer-display.timer-warning {
    color: #ef4444;
    animation: timer-shake 0.5s ease-in-out infinite;
}

@keyframes timer-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.combo-display {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: #ffd93d;
    text-shadow: 
        0 2px 10px rgba(255, 217, 61, 0.5),
        0 0 20px rgba(255, 217, 61, 0.3);
    margin-top: 8px;
    animation: pulse-glow 0.8s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.combo-star {
    animation: bounce 0.5s ease-in-out infinite;
}

.combo-star:nth-child(3) {
    animation-delay: 0.25s;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

.game-board-frame {
    position: relative;
    padding: 15px;
    background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(255,248,250,0.9));
    border-radius: 28px;
    box-shadow: 
        0 10px 35px rgba(255, 107, 157, 0.2),
        0 4px 15px rgba(0,0,0,0.15),
        inset 0 2px 4px rgba(255,255,255,0.95),
        inset 0 -2px 4px rgba(255, 107, 157, 0.1);
    border: 4px solid rgba(255, 107, 157, 0.3);
}

.frame-corner {
    position: absolute;
    font-size: 24px;
    color: #ffd93d;
    text-shadow: 0 0 10px rgba(255, 217, 61, 0.5);
}

.frame-corner.top-left { top: 2px; left: 5px; }
.frame-corner.top-right { top: 2px; right: 5px; }
.frame-corner.bottom-left { bottom: 2px; left: 5px; }
.frame-corner.bottom-right { bottom: 2px; right: 5px; }

#game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 6px;
    aspect-ratio: 1;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

.grid-cell {
    aspect-ratio: 1;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 3px 12px rgba(0,0,0,0.12),
        inset 0 2px 6px rgba(255,255,255,0.7),
        inset 0 -2px 4px rgba(0,0,0,0.05);
}

.grid-cell:active {
    transform: scale(0.92);
}

.grid-cell::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    height: 35%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.7), transparent);
    border-radius: 10px 10px 50% 50%;
    pointer-events: none;
}

.grid-cell.character-0 { 
    background: linear-gradient(145deg, #e0e7ff 0%, #c7d2fe 30%, #a5b4fc 70%, #818cf8 100%); 
    border: 3px solid rgba(129, 140, 248, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(129, 140, 248, 0.2),
        0 4px 15px rgba(129, 140, 248, 0.3);
}
.grid-cell.character-1 { 
    background: linear-gradient(145deg, #fef3c7 0%, #fde68a 30%, #fcd34d 70%, #f59e0b 100%); 
    border: 3px solid rgba(245, 158, 11, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(245, 158, 11, 0.2),
        0 4px 15px rgba(245, 158, 11, 0.3);
}
.grid-cell.character-2 { 
    background: linear-gradient(145deg, #d1fae5 0%, #a7f3d0 30%, #6ee7b7 70%, #34d399 100%); 
    border: 3px solid rgba(52, 211, 153, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(52, 211, 153, 0.2),
        0 4px 15px rgba(52, 211, 153, 0.3);
}
.grid-cell.character-3 { 
    background: linear-gradient(145deg, #fecaca 0%, #fca5a5 30%, #f87171 70%, #ef4444 100%); 
    border: 3px solid rgba(239, 68, 68, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(239, 68, 68, 0.2),
        0 4px 15px rgba(239, 68, 68, 0.3);
}
.grid-cell.character-4 { 
    background: linear-gradient(145deg, #fed7aa 0%, #fdba74 30%, #fb923c 70%, #f97316 100%); 
    border: 3px solid rgba(249, 115, 22, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(249, 115, 22, 0.2),
        0 4px 15px rgba(249, 115, 22, 0.3);
}
.grid-cell.character-5 { 
    background: linear-gradient(145deg, #ddd6fe 0%, #c4b5fd 30%, #a78bfa 70%, #8b5cf6 100%); 
    border: 3px solid rgba(139, 92, 246, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(139, 92, 246, 0.2),
        0 4px 15px rgba(139, 92, 246, 0.3);
}
.grid-cell.character-6 { 
    background: linear-gradient(145deg, #a5f3fc 0%, #67e8f9 30%, #22d3ee 70%, #06b6d4 100%); 
    border: 3px solid rgba(6, 182, 212, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(6, 182, 212, 0.2),
        0 4px 15px rgba(6, 182, 212, 0.3);
}
.grid-cell.character-7 { 
    background: linear-gradient(145deg, #fce7f3 0%, #fbcfe8 30%, #f9a8d4 70%, #f472b6 100%); 
    border: 3px solid rgba(244, 114, 182, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(244, 114, 182, 0.2),
        0 4px 15px rgba(244, 114, 182, 0.3);
}
.grid-cell.character-8 { 
    background: linear-gradient(145deg, #dbeafe 0%, #bfdbfe 30%, #93c5fd 70%, #60a5fa 100%); 
    border: 3px solid rgba(96, 165, 250, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(96, 165, 250, 0.2),
        0 4px 15px rgba(96, 165, 250, 0.3);
}
.grid-cell.character-9 { 
    background: linear-gradient(145deg, #fef9c3 0%, #fef08a 30%, #fde047 70%, #facc15 100%); 
    border: 3px solid rgba(250, 204, 21, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(250, 204, 21, 0.2),
        0 4px 15px rgba(250, 204, 21, 0.3);
}
.grid-cell.character-10 { 
    background: linear-gradient(145deg, #d1fae5 0%, #a7f3d0 30%, #6ee7b7 70%, #34d399 100%); 
    border: 3px solid rgba(52, 211, 153, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(52, 211, 153, 0.2),
        0 4px 15px rgba(52, 211, 153, 0.3);
}
.grid-cell.character-11 { 
    background: linear-gradient(145deg, #fef2f2 0%, #fee2e2 30%, #fecaca 70%, #fca5a5 100%); 
    border: 3px solid rgba(252, 165, 165, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(252, 165, 165, 0.2),
        0 4px 15px rgba(252, 165, 165, 0.3);
}
.grid-cell.character-12 { 
    background: linear-gradient(145deg, #ede9fe 0%, #ddd6fe 30%, #c4b5fd 70%, #a78bfa 100%); 
    border: 3px solid rgba(167, 139, 250, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(167, 139, 250, 0.2),
        0 4px 15px rgba(167, 139, 250, 0.3);
}
.grid-cell.character-13 { 
    background: linear-gradient(145deg, #fef3c7 0%, #fde68a 30%, #fcd34d 70%, #f59e0b 100%); 
    border: 3px solid rgba(245, 158, 11, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(245, 158, 11, 0.2),
        0 4px 15px rgba(245, 158, 11, 0.3);
}
.grid-cell.character-14 { 
    background: linear-gradient(145deg, #f0fdf4 0%, #dcfce7 30%, #bbf7d0 70%, #86efac 100%); 
    border: 3px solid rgba(134, 239, 172, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(134, 239, 172, 0.2),
        0 4px 15px rgba(134, 239, 172, 0.3);
}
.grid-cell.character-15 { 
    background: linear-gradient(145deg, #fcfce8 0%, #f9f5d7 30%, #f3e8c6 70%, #ead5a3 100%); 
    border: 3px solid rgba(234, 213, 163, 0.5);
    box-shadow: 
        inset 0 2px 10px rgba(255, 255, 255, 0.6),
        inset 0 -2px 10px rgba(234, 213, 163, 0.2),
        0 4px 15px rgba(234, 213, 163, 0.3);
}

.grid-cell.selected {
    box-shadow: 
        0 0 20px 8px rgba(255, 217, 61, 0.8),
        0 4px 15px rgba(0,0,0,0.2);
    transform: scale(1.1);
    z-index: 10;
    animation: selected-pulse 0.6s ease-in-out infinite;
}

@keyframes selected-pulse {
    0%, 100% { box-shadow: 0 0 20px 8px rgba(255, 217, 61, 0.8); }
    50% { box-shadow: 0 0 30px 12px rgba(255, 217, 61, 1); }
}

.grid-cell .emoji {
    font-size: clamp(30px, 9vw, 45px);
    line-height: 1;
    user-select: none;
    pointer-events: none;
    filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.2));
    animation: float-gentle 2s ease-in-out infinite;
}

.grid-cell .character-img {
    width: 90%;
    height: 90%;
    object-fit: cover;
    user-select: none;
    pointer-events: none;
    filter: drop-shadow(1px 2px 4px rgba(0,0,0,0.25));
    animation: float-gentle 2s ease-in-out infinite;
    border-radius: 10px;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

@keyframes float-gentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.grid-cell.special-line {
    box-shadow: 
        inset 0 0 15px rgba(255, 100, 100, 0.6),
        0 0 10px rgba(255, 100, 100, 0.3);
    animation: glow-red 1.5s ease-in-out infinite;
}

.grid-cell.special-bomb {
    box-shadow: 
        inset 0 0 15px rgba(100, 100, 255, 0.6),
        0 0 10px rgba(100, 100, 255, 0.3);
    animation: glow-blue 1.5s ease-in-out infinite;
}

.grid-cell.special-rainbow {
    background: linear-gradient(45deg, 
        red, orange, yellow, green, blue, purple, red) !important;
    background-size: 400% 400% !important;
    animation: rainbow-flow 3s linear infinite;
}

@keyframes glow-red {
    0%, 100% { box-shadow: inset 0 0 15px rgba(255, 100, 100, 0.6), 0 0 10px rgba(255, 100, 100, 0.3); }
    50% { box-shadow: inset 0 0 25px rgba(255, 100, 100, 0.8), 0 0 20px rgba(255, 100, 100, 0.5); }
}

@keyframes glow-blue {
    0%, 100% { box-shadow: inset 0 0 15px rgba(100, 100, 255, 0.6), 0 0 10px rgba(100, 100, 255, 0.3); }
    50% { box-shadow: inset 0 0 25px rgba(100, 100, 255, 0.8), 0 0 20px rgba(100, 100, 255, 0.5); }
}

@keyframes rainbow-flow {
    0% { background-position: 0% 50%; }
    100% { background-position: 400% 50%; }
}

.grid-cell.obstacle-ice {
    background: linear-gradient(145deg, #e0f7fa, #b2ebf2) !important;
    opacity: 0.85;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.grid-cell.obstacle-chain {
    background: linear-gradient(145deg, #8d6e63, #a1887f) !important;
}

.grid-cell.obstacle-lava {
    background: linear-gradient(145deg, #ff5722, #ff9800) !important;
    animation: lava-glow 0.6s ease-in-out infinite;
}

.grid-cell.obstacle-portal {
    background: linear-gradient(145deg, #9c27b0, #673ab7) !important;
    animation: portal-spin 2s linear infinite;
}

@keyframes lava-glow {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 1; box-shadow: 0 0 15px rgba(255, 87, 34, 0.5); }
}

@keyframes portal-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes popup {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    50% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes explode {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.8) rotate(180deg); opacity: 0.6; }
    100% { transform: scale(0) rotate(360deg); opacity: 0; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes shake-screen {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.grid-cell.popup { animation: popup 0.4s ease-out; }
.grid-cell.explode { animation: explode 0.5s ease-out forwards; }
.grid-cell.shake { animation: shake 0.4s ease; }
.grid-cell.bounce { animation: bounce 0.5s ease; }

.grid-cell.hint {
    animation: bounce 0.6s ease infinite;
}

#game-footer {
    margin-top: 15px;
    text-align: center;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(145deg, rgba(255,255,255,0.99), rgba(255,245,250,0.98));
    padding: 40px 35px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 
        0 20px 60px rgba(255, 107, 157, 0.25),
        0 10px 30px rgba(0,0,0,0.2),
        0 0 40px rgba(255, 107, 157, 0.15),
        inset 0 2px 4px rgba(255,255,255,0.95);
    animation: popup 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 340px;
    width: 90%;
    border: 4px solid rgba(255, 107, 157, 0.35);
    position: relative;
    overflow: hidden;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #ff6b9d, #f093fb, #c084fc, #f093fb, #ff6b9d);
    background-size: 200% 100%;
    animation: modal-shine 3s ease-in-out infinite;
}

@keyframes modal-shine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 200% 50%; }
}

.modal-decoration {
    font-size: 16px;
    color: #ffb7c5;
    margin: 10px 0;
}

.modal-stars {
    font-size: 24px;
    margin: 10px 0;
    animation: wave 1.5s ease-in-out infinite;
}

.modal-content h2 {
    color: #ff6b9d;
    margin-bottom: 10px;
    font-size: 32px;
    text-shadow: 0 2px 10px rgba(255, 107, 157, 0.3);
}

.modal-content p {
    font-size: 16px;
    color: #666;
    margin: 8px 0;
}

.final-score-text, .target-score-text {
    font-size: 14px !important;
    color: #999 !important;
}

.final-score-value {
    font-size: 42px !important;
    font-weight: bold;
    background: linear-gradient(135deg, #ff6b9d, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.target-score-value {
    font-size: 24px !important;
    font-weight: bold;
    color: #48c774 !important;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.modal-buttons .btn {
    flex: 1;
    padding: 12px 25px;
}

.combo-popup {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(45px, 18vw, 80px);
    font-weight: bold;
    background: linear-gradient(135deg, #ffd93d, #ff6b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 
        0 0 30px rgba(255, 217, 61, 0.5),
        0 0 60px rgba(255, 107, 157, 0.3);
    pointer-events: none;
    z-index: 500;
    animation: combo-bounce 0.7s ease;
}

@keyframes combo-bounce {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-180deg); opacity: 0; }
    40% { transform: translate(-50%, -50%) scale(1.6) rotate(10deg); }
    70% { transform: translate(-50%, -50%) scale(0.9); }
    100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
}

.combo-popup.hidden {
    display: none;
}

.floating-score {
    position: fixed;
    top: 50%;
    left: 50%;
    pointer-events: none;
    z-index: 600;
}

.score-float {
    position: absolute;
    font-size: 28px;
    font-weight: bold;
    background: linear-gradient(135deg, #ffd93d, #ff6b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 10px rgba(255, 217, 61, 0.5);
    animation: float-up 1.2s ease-out forwards;
}

@keyframes float-up {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-100px) scale(1.3); }
}

.screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0);
    pointer-events: none;
    z-index: 900;
}

.screen-flash.flash {
    animation: white-flash 0.4s ease-out;
}

@keyframes white-flash {
    0% { background: rgba(255, 255, 255, 0); }
    40% { background: rgba(255, 255, 255, 0.9); }
    100% { background: rgba(255, 255, 255, 0); }
}

.screen-flash.fire {
    animation: fire-flash 0.6s ease-out;
}

@keyframes fire-flash {
    0% { background: rgba(255, 100, 0, 0); }
    30% { background: rgba(255, 150, 50, 0.7); }
    100% { background: rgba(255, 100, 0, 0); }
}

.particle {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 700;
}

.heart-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 800;
}

.heart-particle {
    position: absolute;
    font-size: 20px;
    animation: heart-float 2s ease-out forwards;
}

@keyframes heart-float {
    0% { opacity: 1; transform: translateY(0) scale(0.5) rotate(0deg); }
    50% { opacity: 1; transform: translateY(-50px) scale(1) rotate(180deg); }
    100% { opacity: 0; transform: translateY(-100px) scale(0.8) rotate(360deg); }
}

@media (max-width: 480px) {
    #game-container {
        padding: 5px;
    }

    .score-panel {
        padding: 10px;
    }

    .score-value, .target-value, .moves-value {
        font-size: 18px;
    }

    #game-board {
        gap: 4px;
        padding: 6px;
    }

    .level-card {
        padding: 15px;
    }

    .level-number {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    #game-board {
        max-width: 100%;
        gap: 2px;
        padding: 4px;
    }
    
    .grid-cell {
        border-radius: 10px;
    }
    
    .grid-cell .character-img {
        width: 75%;
        height: 75%;
    }
}

@media (min-width: 768px) {
    #game-board {
        max-width: 400px;
        margin: 0 auto;
    }

    #level-grid {
        max-width: 500px;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bg-flow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}