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

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.info-panel {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.2em;
    color: #555;
    flex-wrap: wrap;
    gap: 10px;
}

.score, .timer {
    padding: 10px 20px;
    background: #f0f0f0;
    border-radius: 8px;
}

.game-board {
    display: inline-grid;
    grid-template-columns: repeat(8, 60px);
    grid-template-rows: repeat(9, 60px);
    gap: 4px;
    background: #333;
    padding: 8px;
    border-radius: 10px;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.3);
}

.jewel {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: jewelSpawn 0.4s ease-out;
}

@keyframes jewelSpawn {
    from {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.jewel:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.jewel:active {
    transform: scale(0.95);
}

.jewel.selected {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 0, 0.8);
    border: 3px solid yellow;
    animation: pulse 0.6s ease-in-out infinite;
}

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

.jewel.swapping {
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.jewel.matched {
    animation: matchPop 0.5s ease-out forwards;
}

@keyframes matchPop {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3) rotate(10deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

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

@keyframes fall {
    from {
        transform: translateY(-60px);
        opacity: 0.5;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.jewel.empty {
    background: rgba(255, 255, 255, 0.1);
    cursor: default;
}

/* Jewel colors */
.jewel.red {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
}

.jewel.blue {
    background: linear-gradient(135deg, #4dabf7, #339af0);
}

.jewel.green {
    background: linear-gradient(135deg, #51cf66, #40c057);
}

.jewel.yellow {
    background: linear-gradient(135deg, #ffd43b, #fcc419);
}

.jewel.purple {
    background: linear-gradient(135deg, #cc5de8, #be4bdb);
}

.jewel.orange {
    background: linear-gradient(135deg, #ff922b, #fd7e14);
}

.jewel.pink {
    background: linear-gradient(135deg, #ff6ec7, #e64980);
}

.instructions {
    margin-top: 20px;
    text-align: left;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.instructions h3 {
    color: #333;
    margin-bottom: 10px;
}

.instructions ul {
    list-style-position: inside;
    color: #555;
}

.instructions li {
    margin: 5px 0;
}

/* Main Menu Styles */
.main-menu {
    text-align: center;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-title {
    font-size: 3em;
    margin-bottom: 15px;
    color: #2a5298;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2);
    animation: titleBounce 1s ease-in-out;
}

@keyframes titleBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.menu-subtitle {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 30px;
}

.game-modes {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 400px;
    margin: 0 auto;
}

.mode-button {
    padding: 20px 30px;
    font-size: 1.3em;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    color: white;
    position: relative;
    overflow: hidden;
}

.mode-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.mode-button:hover::before {
    width: 300px;
    height: 300px;
}

.mode-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.mode-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mode-button.easy {
    background: linear-gradient(135deg, #51cf66, #40c057);
}

.mode-button.normal {
    background: linear-gradient(135deg, #ffd43b, #fcc419);
}

.mode-button.hard {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
}

.mode-description {
    font-size: 0.8em;
    font-weight: normal;
    opacity: 0.95;
    margin-top: 5px;
}

.back-button {
    margin-top: 20px;
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border: 2px solid #2a5298;
    background: white;
    color: #2a5298;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: #2a5298;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.back-button:active {
    transform: translateY(0);
}

.hidden {
    display: none;
}

.game-container {
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Tablet (portrait) - 601px to 900px */
@media (max-width: 900px) and (min-width: 601px) {
    .game-board {
        grid-template-columns: repeat(8, 52px);
        grid-template-rows: repeat(9, 52px);
        gap: 3px;
        padding: 6px;
    }
    
    .jewel {
        width: 52px;
        height: 52px;
        font-size: 28px;
    }
    
    h1 {
        font-size: 2.2em;
    }
    
    .info-panel {
        font-size: 1.1em;
    }
}

/* Large tablets and small laptops - 901px to 1200px */
@media (max-width: 1200px) and (min-width: 901px) {
    .game-board {
        grid-template-columns: repeat(8, 56px);
        grid-template-rows: repeat(9, 56px);
        gap: 4px;
        padding: 7px;
    }
    
    .jewel {
        width: 56px;
        height: 56px;
        font-size: 30px;
    }
    
    h1 {
        font-size: 2.3em;
    }
}

/* Mobile devices - up to 600px */
@media (max-width: 600px) {
    .game-board {
        grid-template-columns: repeat(8, 45px);
        grid-template-rows: repeat(9, 45px);
        gap: 3px;
        padding: 6px;
    }
    
    .jewel {
        width: 45px;
        height: 45px;
        font-size: 24px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .container {
        padding: 20px 10px;
    }
    
    .info-panel {
        font-size: 1em;
        flex-direction: column;
        gap: 10px;
    }
}
