:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #3f37c9;
    --accent: #f72585;
    --light: #f8f9fa;
    --dark: #212529;
    --success: #4cc9f0;
    --danger: #ef233c;
    --warning: #f8961e;
    --info: #4895ef;
    --background: #1a1a2e;
    --card-bg: #16213e;
    --text-light: #e2e2e2;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--background);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    color: var(--text-light);
    touch-action: manipulation;
    user-select: none;
    overflow-x: hidden;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin-bottom: 20px;
    position: relative;
}

h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(to right, #4cc9f0, #4361ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 1px;
    text-shadow: 0 2px 10px rgba(67, 97, 238, 0.3);
}

.controls {
    display: flex;
    gap: 10px;
}

.btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(67, 97, 238, 0.2);
    border: 2px solid rgba(67, 97, 238, 0.3);
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: scale(1.1);
    background: rgba(67, 97, 238, 0.3);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.2);
}

.btn i {
    pointer-events: none;
}

.game-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 100%;
    width: 100%;
    align-items: center;
    position: relative;
}

.score-board {
    position: relative;
    background: var(--card-bg);
    padding: 15px 25px;
    border-radius: 15px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(67, 97, 238, 0.2);
}

.score-value {
    font-weight: 700;
    color: var(--success);
    text-shadow: 0 0 10px rgba(76, 201, 240, 0.5);
}

.score-add {
    position: absolute;
    right: 20px;
    color: var(--success);
    font-weight: bold;
    animation: scorePop 0.8s forwards;
    opacity: 0;
    text-shadow: 0 0 5px rgba(76, 201, 240, 0.8);
}

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

.grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-gap: 4px;
    background: var(--card-bg);
    padding: 12px;
    border-radius: 20px;
    margin: 0 auto;
    width: fit-content;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(67, 97, 238, 0.2);
}

.cell {
    width: 32px;
    height: 32px;
    background: rgba(67, 97, 238, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease-out;
    position: relative;
    border: 1px solid rgba(67, 97, 238, 0.1);
}

.cell.filled {
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.3);
}

/* Colors for filled cells */
.cell.filled.line {
    background: linear-gradient(135deg, #f72585, #b5179e);
    box-shadow: 0 0 10px rgba(247, 37, 133, 0.5);
}
.cell.filled.square {
    background: linear-gradient(135deg, #4895ef, #4361ee);
    box-shadow: 0 0 10px rgba(67, 97, 238, 0.5);
}
.cell.filled.l-shape {
    background: linear-gradient(135deg, #4cc9f0, #4895ef);
    box-shadow: 0 0 10px rgba(76, 201, 240, 0.5);
}
.cell.filled.z-shape {
    background: linear-gradient(135deg, #7209b7, #560bad);
    box-shadow: 0 0 10px rgba(114, 9, 183, 0.5);
}
.cell.filled.t-shape {
    background: linear-gradient(135deg, #f8961e, #f3722c);
    box-shadow: 0 0 10px rgba(248, 150, 30, 0.5);
}
.cell.filled.s-shape {
    background: linear-gradient(135deg, #43aa8b, #4d908e);
    box-shadow: 0 0 10px rgba(67, 170, 139, 0.5);
}
.cell.filled.j-shape {
    background: linear-gradient(135deg, #f94144, #f3722c);
    box-shadow: 0 0 10px rgba(249, 65, 68, 0.5);
}
.cell.filled.single {
    background: linear-gradient(135deg, #7209b7, #560bad);
    box-shadow: 0 0 10px rgba(114, 9, 183, 0.5);
}
.cell.filled.double {
    background: linear-gradient(135deg, #43aa8b, #4d908e);
    box-shadow: 0 0 10px rgba(67, 170, 139, 0.5);
}
.cell.filled.triple-corner {
    background: linear-gradient(135deg, #f8961e, #f3722c);
    box-shadow: 0 0 10px rgba(248, 150, 30, 0.5);
}
.cell.filled.nine-block {
    background: linear-gradient(135deg, #f72585, #b5179e);
    box-shadow: 0 0 10px rgba(247, 37, 133, 0.5);
}

.cell.highlight {
    background: rgba(76, 201, 240, 0.6);
    transform: scale(0.95);
    box-shadow: 0 0 15px rgba(76, 201, 240, 0.5);
}

.cell.invalid {
    background: rgba(239, 35, 60, 0.4);
    transform: scale(0.95);
    box-shadow: 0 0 15px rgba(239, 35, 60, 0.3);
}

.cell.clearing {
    animation: clearCell 0.5s forwards;
}

@keyframes clearCell {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; box-shadow: 0 0 20px white; }
    100% { transform: scale(0); opacity: 0; }
}

.blocks-container {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 500px;
    margin-top: 10px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 20px;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(67, 97, 238, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.block-slot {
    width: 90px;
    height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    background: rgba(67, 97, 238, 0.1);
    border-radius: 15px;
    border: 2px dashed rgba(67, 97, 238, 0.3);
}

.block-slot:hover {
    transform: translateY(-5px);
    background: rgba(67, 97, 238, 0.2);
}

.block {
    display: inline-grid;
    padding: 5px;
    cursor: pointer;
    touch-action: none;
    transition: all 0.3s ease;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.3));
}

.block.size-1 {
    grid-template-columns: repeat(1, 1fr);
}
.block.size-2 {
    grid-template-columns: repeat(2, 1fr);
}
.block.size-3 {
    grid-template-columns: repeat(3, 1fr);
}

.block.active {
    opacity: 0.9;
    transform: scale(1.1);
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.4));
}

.block.double-tap {
    animation: blockPulse 0.3s;
}

@keyframes blockPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.block-cell {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    transition: all 0.2s;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
}

.block-cell.empty {
    opacity: 0;
}

/* Colors for different shapes */
.block-cell.line {
    background: linear-gradient(135deg, #f72585, #b5179e);
}
.block-cell.square {
    background: linear-gradient(135deg, #4895ef, #4361ee);
}
.block-cell.l-shape {
    background: linear-gradient(135deg, #4cc9f0, #4895ef);
}
.block-cell.z-shape {
    background: linear-gradient(135deg, #7209b7, #560bad);
}
.block-cell.t-shape {
    background: linear-gradient(135deg, #f8961e, #f3722c);
}
.block-cell.s-shape {
    background: linear-gradient(135deg, #43aa8b, #4d908e);
}
.block-cell.j-shape {
    background: linear-gradient(135deg, #f94144, #f3722c);
}
.block-cell.single {
    background: linear-gradient(135deg, #7209b7, #560bad);
}
.block-cell.double {
    background: linear-gradient(135deg, #43aa8b, #4d908e);
}
.block-cell.triple-corner {
    background: linear-gradient(135deg, #f8961e, #f3722c);
}
.block-cell.nine-block {
    background: linear-gradient(135deg, #f72585, #b5179e);
}

.action-buttons {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.action-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(67, 97, 238, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(67, 97, 238, 0.4);
}

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

.action-btn i {
    font-size: 1.1rem;
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
    text-align: center;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-over h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, #4cc9f0, #4361ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Montserrat', sans-serif;
    text-shadow: 0 2px 10px rgba(67, 97, 238, 0.3);
}

.game-over p {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.game-over .action-btn {
    font-size: 1.1rem;
    padding: 15px 30px;
}

.pause-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.pause-menu h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    background: linear-gradient(to right, #4cc9f0, #4361ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Montserrat', sans-serif;
    text-shadow: 0 2px 10px rgba(67, 97, 238, 0.3);
}

.pause-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 80%;
    max-width: 300px;
}

.pause-btn {
    padding: 15px;
    border-radius: 12px;
    background: rgba(67, 97, 238, 0.2);
    border: 2px solid rgba(67, 97, 238, 0.3);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.pause-btn:hover {
    background: rgba(67, 97, 238, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.2);
}

.pause-btn i {
    font-size: 1.2rem;
}

/* Main menu */
.main-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
    text-align: center;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease;
    padding: 20px;
}

.logo {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(to right, #4cc9f0, #4361ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 2px;
    text-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.menu-subtitle {
    font-size: 1.2rem;
    margin-bottom: 40px;
    max-width: 300px;
    line-height: 1.6;
    color: var(--text-light);
    opacity: 0.8;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 250px;
}

.menu-btn {
    padding: 15px;
    border-radius: 12px;
    background: rgba(67, 97, 238, 0.2);
    border: 2px solid rgba(67, 97, 238, 0.3);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1rem;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.menu-btn:hover {
    background: rgba(67, 97, 238, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.2);
}

.menu-btn i {
    font-size: 1.2rem;
}

.menu-settings {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.menu-settings .btn {
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
}

.hidden {
    display: none !important;
}

/* Animations */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.floating {
    animation: float 3s ease-in-out infinite;
}

/* Particle effect */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background: rgba(76, 201, 240, 0.5);
    border-radius: 50%;
    animation: float-particle 15s infinite linear;
}

@keyframes float-particle {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px);
        opacity: 0;
    }
}

/* Style for active block when dragging */
.block-ghost {
    position: absolute;
    pointer-events: none;
    z-index: 100;
    opacity: 0.8;
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.4));
}

/* Neon highlight */
.neon-text {
    text-shadow: 0 0 5px #4cc9f0, 0 0 10px #4cc9f0, 0 0 15px #4cc9f0;
}

/* Responsiveness */
@media (max-width: 600px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .logo {
        font-size: 2.5rem;
    }
    
    .cell {
        width: 28px;
        height: 28px;
    }
    
    .block-cell {
        width: 18px;
        height: 18px;
    }
    
    .blocks-container {
        max-width: 100%;
        padding: 15px;
    }
    
    .block-slot {
        width: 80px;
        height: 80px;
    }
    
    .btn {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .action-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .game-over h2 {
        font-size: 2rem;
    }
    
    .game-over p {
        font-size: 1.2rem;
    }
}