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

:root {
    --primary-color: #9d4edd;
    --primary-light: rgba(157, 78, 221, 0.3);
    --primary-dark: #7b2cbf;
    --accent-color: #ff9e00;
    --bg-dark: #1a1a2e;
    --text-light: rgba(255, 255, 255, 0.9);
    --card-bg: rgba(0, 0, 0, 0.3);
}

/* Add default cursor styles */
body {
    cursor: default;
}

button, a, input[type="button"], input[type="submit"] {
    cursor: pointer;
}

.navbar {
    width: 100%;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(157, 78, 221, 0.3);
    padding: 15px 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 12px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(157, 78, 221, 0.1);
    border: 1px solid rgba(157, 78, 221, 0.2);
    position: relative;
    overflow: hidden;
}

.nav-link:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(157, 78, 221, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.nav-link:hover:before {
    width: 300%;
    height: 300%;
}

.nav-link:hover {
    color: white;
    border-color: rgba(157, 78, 221, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(157, 78, 221, 0.2);
}

.nav-link.active {
    background: linear-gradient(135deg, #9d4edd, #7b2cbf);
    color: white;
    border-color: transparent;
}

/* Adjust body padding to account for fixed navbar */
body {
    padding: 70px 10px 10px 10px;
    font-family: 'Arial', sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    background-attachment: fixed;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(157, 78, 221, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 158, 0, 0.1) 0%, transparent 50%);
    animation: backgroundShift 15s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: -1;
}

@keyframes backgroundShift {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}

body::after {
    display: none;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - var(--navbar-height));
    position: relative;
    gap: 25px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(157, 78, 221, 0.5), 
        transparent
    );
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #4a4e69;
    flex-wrap: wrap;
    gap: 8px;
}

h1 {
    font-size: 2rem;
    color: #f8f9fa;
    text-shadow: 0 0 10px #9d4edd, 0 0 20px #9d4edd;
    margin-right: auto;
}

.score-container {
    font-size: 1.2rem;
    background: linear-gradient(135deg,
        rgba(157, 78, 221, 0.2),
        rgba(157, 78, 221, 0.1)
    );
    padding: 10px 20px;
    border-radius: 15px;
    border: 2px solid rgba(157, 78, 221, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.score-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(157, 78, 221, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

#power-level {
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 0 0 10px var(--accent-color);
    animation: powerGlow 2s infinite;
}

@keyframes powerGlow {
    0%, 100% {
        text-shadow: 0 0 10px var(--accent-color);
    }
    50% {
        text-shadow: 0 0 20px var(--accent-color),
                     0 0 30px var(--accent-color);
    }
}

.lives-display {
    font-size: 1.2rem;
    background-color: rgba(255, 105, 180, 0.3);
    padding: 8px 15px;
    border-radius: 10px;
    border: 1px solid #ff69b4;
    text-align: center;
    letter-spacing: 2px;
    animation: livePulse 2s infinite;
    white-space: nowrap;
    margin-left: auto;
}

@keyframes livePulse {
    0% {
        transform: scale(1);
        text-shadow: 0 0 5px rgba(255, 105, 180, 0.5);
    }
    50% {
        transform: scale(1.05);
        text-shadow: 0 0 10px rgba(255, 105, 180, 0.8);
    }
    100% {
        transform: scale(1);
        text-shadow: 0 0 5px rgba(255, 105, 180, 0.5);
    }
}

.level-info {
    font-size: 1.1rem;
    background-color: rgba(255, 158, 0, 0.3);
    padding: 8px 15px;
    border-radius: 10px;
    border: 1px solid #ff9e00;
    color: #ff9e00;
    font-weight: bold;
    margin-top: 8px;
    width: 100%;
    text-align: center;
}

.michi-container {
    position: relative;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    margin: 20px 0;
    border: 1px solid rgba(157, 78, 221, 0.2);
}

.michi-image-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 
        0 0 30px rgba(157, 78, 221, 0.6),
        0 0 0 2px rgba(157, 78, 221, 0.3);
}

#michi-image {
    width: 120%;
    height: 120%;
    object-fit: cover;
    position: absolute;
    top: -10%;
    left: -10%;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.magic-effects {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at center,
        rgba(157, 78, 221, 0.1) 0%,
        transparent 70%
    );
    animation: magicPulse 3s infinite;
}

@keyframes magicPulse {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.2);
    }
    100% {
        opacity: 0.5;
        transform: scale(1);
    }
}

.michi-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff9e00;
    text-shadow: 0 0 10px #ff9e00;
    transition: all 0.5s ease;
}

.cards-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

#cards-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    width: 100%;
    max-width: 800px;
    justify-content: center;
    padding: 15px;
}

.card {
    position: relative;
    width: 100%;
    height: 100px;
    perspective: 1500px;
    cursor: pointer;
    margin: 0 auto;
    max-width: 100px;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-color: rgba(157, 78, 221, 0.8);
    transform: translateY(-2px);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card.matched .card-inner {
    animation: cardMatchSuccess 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    border-radius: 12px;
}

@keyframes cardMatchSuccess {
    0% {
        transform: rotateY(180deg) scale(1);
        box-shadow: 0 0 0 rgba(255, 158, 0, 0);
        border-radius: 12px;
    }
    50% {
        transform: rotateY(180deg) scale(1.1);
        box-shadow: 0 0 30px rgba(255, 158, 0, 0.6);
        border-radius: 12px;
    }
    100% {
        transform: rotateY(180deg) scale(1);
        box-shadow: 0 0 15px rgba(255, 158, 0, 0.3);
        border-radius: 12px;
    }
}

.card.matched {
    box-shadow: 0 0 6px rgba(255, 158, 0, 0.4);
}

.card.matched .card-front,
.card.matched .card-back {
    border-radius: 12px;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, 
        rgba(157, 78, 221, 0.2),
        rgba(157, 78, 221, 0.1)
    );
    border: 2px solid rgba(157, 78, 221, 0.3);
}

.card-front {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #4a4e69, #283c86);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px;
}

.card-back {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.magical-symbol {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 10px var(--accent-color);
    animation: floatSymbol 2s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

@keyframes floatSymbol {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-3px) scale(1.1);
    }
}

.card-back::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
    z-index: 1;
}

.card.flipped .magical-symbol {
    display: none;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

.card-emoji {
    font-size: 2.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.card-front img {
    width: 85%;
    height: 85%;
    object-fit: contain;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.card:hover .card-front img {
    transform: scale(1.05);
}

.game-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 25px auto;
    flex-wrap: wrap;
    max-width: 800px;
    padding: 0 20px;
}

button {
    position: relative;
    padding: 12px 25px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-light);
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    min-width: 160px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(157, 78, 221, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: 0.5s;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(157, 78, 221, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 4px 15px rgba(157, 78, 221, 0.2);
}

button:disabled {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.game-instructions {
    max-width: 900px;
    margin: 20px auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 25px;
    color: var(--text-light);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.game-instructions::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(157, 78, 221, 0.5), 
        transparent
    );
}

.game-instructions h2 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(255, 158, 0, 0.5);
    position: relative;
    display: inline-block;
}

.game-instructions h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg,
        transparent,
        var(--accent-color),
        transparent
    );
}

.game-instructions h3 {
    color: #ff9e00;
    margin: 15px 0 8px;
    font-size: 1.1rem;
}

.game-instructions p {
    margin: 8px 0;
    line-height: 1.4;
}

.level-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.level-list li {
    position: relative;
    padding: 15px;
    background: rgba(157, 78, 221, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(157, 78, 221, 0.2);
    transition: all 0.3s ease;
}

.level-list li:hover {
    transform: translateY(-2px);
    background: rgba(157, 78, 221, 0.15);
    border-color: rgba(157, 78, 221, 0.3);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.level-list li::before {
    content: '✨';
    margin-right: 10px;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-color);
}

/* Power level effects for Michi */
@keyframes floatingMichi {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}

@keyframes magicSparkle {
    0%, 100% { opacity: 0; transform: scale(0.5) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.2) rotate(180deg); }
}

@keyframes powerAura {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.15) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.power-level-1 .magic-effects {
    background: radial-gradient(circle, transparent 50%, rgba(157, 78, 221, 0.2) 100%);
}

.power-level-1 #michi-image {
    filter: brightness(1.1) contrast(1.1) saturate(1.2);
    animation: floatingMichi 3s ease-in-out infinite;
}

.power-level-2 .magic-effects {
    background: radial-gradient(circle, transparent 50%, rgba(157, 78, 221, 0.4) 100%);
    box-shadow: 0 0 15px #9d4edd inset;
}

.power-level-2 #michi-image {
    filter: brightness(1.2) contrast(1.2) saturate(1.4) hue-rotate(5deg);
    animation: floatingMichi 2.5s ease-in-out infinite;
}

.power-level-2 .magic-effects::before {
    content: '✨';
    opacity: 1;
    animation: magicSparkle 3s infinite;
    left: 20%;
    top: 20%;
}

.power-level-3 .magic-effects {
    background: radial-gradient(circle, transparent 40%, rgba(157, 78, 221, 0.6) 100%);
    box-shadow: 0 0 25px #9d4edd inset;
    animation: powerAura 4s infinite linear;
}

.power-level-3 #michi-image {
    filter: brightness(1.3) contrast(1.3) saturate(1.6) hue-rotate(10deg) drop-shadow(0 0 5px #9d4edd);
    animation: floatingMichi 2s ease-in-out infinite;
}

.power-level-3 .magic-effects::before,
.power-level-3 .magic-effects::after {
    content: '✨';
    opacity: 1;
    animation: magicSparkle 3s infinite;
}

.power-level-3 .magic-effects::before {
    left: 20%;
    top: 20%;
}

.power-level-3 .magic-effects::after {
    right: 20%;
    bottom: 20%;
}

.power-level-4 .magic-effects {
    background: radial-gradient(circle, rgba(157, 78, 221, 0.2) 0%, rgba(157, 78, 221, 0.4) 50%, rgba(157, 78, 221, 0.7) 100%);
    box-shadow: 0 0 35px #9d4edd inset;
    animation: powerAura 3s infinite linear;
}

.power-level-4 #michi-image {
    filter: brightness(1.4) contrast(1.4) saturate(1.8) hue-rotate(15deg) drop-shadow(0 0 10px #9d4edd);
    animation: floatingMichi 1.5s ease-in-out infinite;
}

.power-level-4 .magic-effects::before,
.power-level-4 .magic-effects::after {
    content: '⭐';
    font-size: 24px;
    opacity: 1;
    animation: magicSparkle 2s infinite;
}

.power-level-4 .magic-effects::before {
    left: 15%;
    top: 15%;
}

.power-level-4 .magic-effects::after {
    right: 15%;
    bottom: 15%;
}

.power-level-5 .magic-effects {
    background: radial-gradient(circle, rgba(255, 158, 0, 0.3) 0%, rgba(255, 158, 0, 0.5) 50%, rgba(255, 158, 0, 0.7) 100%);
    box-shadow: 
        0 0 45px #ff9e00 inset,
        0 0 60px #ff9e00;
    animation: powerAura 2s infinite linear;
}

.power-level-5 #michi-image {
    filter: brightness(1.5) contrast(1.5) saturate(2) hue-rotate(20deg) drop-shadow(0 0 15px #ff9e00);
    animation: floatingMichi 1s ease-in-out infinite;
}

.power-level-5 .magic-effects::before,
.power-level-5 .magic-effects::after {
    content: '🌟';
    font-size: 28px;
    opacity: 1;
    animation: magicSparkle 1.5s infinite;
}

.power-level-5 .magic-effects::before {
    left: 10%;
    top: 10%;
}

.power-level-5 .magic-effects::after {
    right: 10%;
    bottom: 10%;
}

/* Apply similar effects to modal Michi */
.modal-magic-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.power-level-1 #modal-michi-image {
    filter: brightness(1.1) contrast(1.1) saturate(1.2);
    animation: floatingMichi 3s ease-in-out infinite;
}

.power-level-2 #modal-michi-image {
    filter: brightness(1.2) contrast(1.2) saturate(1.4) hue-rotate(5deg);
    animation: floatingMichi 2.5s ease-in-out infinite;
}

.power-level-3 #modal-michi-image {
    filter: brightness(1.3) contrast(1.3) saturate(1.6) hue-rotate(10deg) drop-shadow(0 0 5px #9d4edd);
    animation: floatingMichi 2s ease-in-out infinite;
}

.power-level-4 #modal-michi-image {
    filter: brightness(1.4) contrast(1.4) saturate(1.8) hue-rotate(15deg) drop-shadow(0 0 10px #9d4edd);
    animation: floatingMichi 1.5s ease-in-out infinite;
}

.power-level-5 #modal-michi-image {
    filter: brightness(1.5) contrast(1.5) saturate(2) hue-rotate(20deg) drop-shadow(0 0 15px #ff9e00);
    animation: floatingMichi 1s ease-in-out infinite;
}

/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.modal.show {
    display: flex;
    opacity: 1;
    visibility: visible;
    animation: none;
}

.modal-content {
    background: linear-gradient(135deg, 
        rgba(26, 26, 46, 0.95), 
        rgba(40, 40, 70, 0.95)
    );
    border-radius: 24px;
    padding: 30px;
    width: 90%;
    max-width: 450px;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 0 40px rgba(157, 78, 221, 0.3),
        0 0 20px rgba(255, 158, 0, 0.2),
        0 0 0 1px rgba(157, 78, 221, 0.2) inset;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-content::before,
.modal-content::after {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at center,
        rgba(157, 78, 221, 0.1) 0%,
        transparent 60%
    );
    animation: modalGlow 10s infinite linear;
    pointer-events: none;
}

.modal-content::before {
    top: -100%;
    left: -100%;
}

.modal-content::after {
    bottom: -100%;
    right: -100%;
    animation-delay: -5s;
}

@keyframes modalGlow {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.modal-header {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
}

#modal-title {
    font-size: 1.8rem;
    margin: 0;
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(157, 78, 221, 0.3);
    position: relative;
    display: inline-block;
}

#modal-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg,
        transparent,
        var(--accent-color),
        transparent
    );
}

.modal-body {
    text-align: center;
    margin: 25px 0;
}

#modal-message {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--text-light);
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(157, 78, 221, 0.2);
}

.modal-footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
}

#modal-button {
    padding: 12px 30px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    position: relative;
    overflow: hidden;
}

#modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(157, 78, 221, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    background: linear-gradient(135deg, 
        rgba(157, 78, 221, 1), 
        rgba(123, 44, 191, 1)
    );
}

#modal-button:active {
    transform: translateY(1px);
}

#modal-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: 0.5s;
}

#modal-button:hover::before {
    left: 100%;
}

@media (max-width: 480px) {
    .modal-content {
        padding: 20px;
        max-width: 320px;
    }
    
    #modal-title {
        font-size: 1.4rem;
    }
    
    #modal-message {
        font-size: 1rem;
    }
    
    #modal-button {
        padding: 10px 20px;
        font-size: 1rem;
        min-width: 140px;
    }
}

@media (max-width: 360px) {
    .modal-content {
        padding: 15px;
        max-width: 300px;
    }
    
    #modal-title {
        font-size: 1.2rem;
    }
    
    #modal-message {
        font-size: 0.9rem;
    }
    
    #modal-button {
        padding: 8px 16px;
        font-size: 0.9rem;
        min-width: 120px;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 10px;
        gap: 12px;
    }

    .nav-link {
        padding: 10px 20px;
        font-size: 1rem;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .game-container {
        padding: 20px 15px;
        gap: 20px;
    }

    header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }

    h1 {
        font-size: 1.75rem;
        margin: 0;
    }

    .score-container, .lives-display {
        width: 100%;
        justify-content: center;
        font-size: 1.1rem;
        margin: 0;
    }

    .game-controls {
        gap: 15px;
        padding: 0 15px;
        margin: 20px auto;
    }

    button {
        padding: 10px 20px;
        font-size: 1rem;
        min-width: 140px;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 60px 5px 5px 5px;
    }

    .navbar {
        padding: 10px 0;
    }

    .nav-link {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .game-container {
        padding: 15px 10px;
        gap: 15px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .score-container, .lives-display {
        font-size: 1rem;
        padding: 8px 12px;
    }

    #cards-area {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }

    .card {
        aspect-ratio: 1;
        min-height: 80px;
    }

    .card-emoji {
        font-size: 2rem;
    }

    .game-instructions {
        font-size: 0.9rem;
        padding: 15px;
    }

    .game-instructions h2 {
        font-size: 1.3rem;
    }

    .game-instructions h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 360px) {
    .nav-link {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    h1 {
        font-size: 1.25rem;
    }

    .score-container, .lives-display {
        font-size: 0.9rem;
        padding: 6px 10px;
    }

    #cards-area {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 6px;
    }

    .card {
        min-height: 70px;
    }

    .card-emoji {
        font-size: 1.75rem;
    }

    button {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

/* Optimize touch interactions */
@media (hover: none) and (pointer: coarse) {
    * {
        cursor: auto !important;
    }

    .nav-link, button, .card {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    /* Add touch feedback */
    .nav-link:active, button:active, .card:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
}

/* Reduce animations for better performance on mobile */
@media (prefers-reduced-motion), (max-width: 480px) {
    .magic-effects,
    .card-inner,
    .nav-link,
    button,
    .modal-content,
    .score-container::before {
        transition-duration: 0.2s;
    }

    body::before {
        animation: none;
    }

    .magical-symbol {
        animation: none;
    }
}

/* Improve form factor for landscape mode */
@media (max-height: 480px) and (orientation: landscape) {
    body {
        padding-top: 50px;
    }

    .navbar {
        padding: 5px 0;
    }

    .game-container {
        display: grid;
        grid-template-columns: 300px 1fr;
        gap: 15px;
        align-items: start;
    }

    header {
        grid-column: 1 / -1;
    }

    #cards-area {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }
}

/* Ensure content is visible when keyboard is open on mobile */
@media (max-height: 400px) {
    body {
        min-height: 100%;
        height: auto;
    }
}

.lives-reward, .lives-reward-info {
    color: #ff69b4;
    font-weight: bold;
    margin: 10px 0;
    padding: 8px 15px;
    background-color: rgba(255, 105, 180, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 105, 180, 0.3);
    animation: livesRewardPulse 2s infinite;
}

.lives-reward strong, .lives-reward-info strong {
    color: #ff69b4;
    text-shadow: 0 0 8px rgba(255, 105, 180, 0.8);
}

@keyframes livesRewardPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 105, 180, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(255, 105, 180, 0.6);
    }
}

/* Adjust cat life display */
.cat-life {
    display: inline-block;
    margin: 0 2px;
    transition: all 0.3s ease;
}

.cat-life.lost {
    opacity: 0.3;
    filter: grayscale(100%);
}

/* Add animation for new lives */
.cat-life.new {
    animation: newLifeAnimation 1s ease-in-out;
}

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

/* Undo button specific styles */
.undo-button {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border-color: rgba(74, 144, 226, 0.3);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.undo-button:hover {
    background: linear-gradient(135deg, #357abd, #2868a9);
    border-color: rgba(74, 144, 226, 0.5);
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.5);
}

.undo-button:disabled {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    border-color: rgba(127, 140, 141, 0.3);
    box-shadow: none;
}

.undo-button i, 
.undo-button span {
    display: inline-block;
    transition: all 0.3s ease;
}

.undo-button i {
    font-size: 1.2em;
    transform: rotate(0deg);
}

.undo-button:hover i {
    transform: rotate(-45deg);
}

@media (max-width: 480px) {
    .undo-button {
        font-size: 0.9rem;
    }
    
    .undo-button i {
        font-size: 1.1em;
    }
} 