body {
    background: linear-gradient(130deg, #232946 0%, #1c1f2a 100%);
    font-family: 'Montserrat', Arial, Helvetica, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Navbar */
.case-navbar {
    background: linear-gradient(90deg, #232946 0%, #1c1f2a 100%);
    box-shadow: 0 2px 12px #23294644;
    font-family: 'Montserrat', Arial, sans-serif;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.5rem 2rem;
    display: flex;
    flex-direction: column;
}
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.case-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 12px;
}
.case-logo {
    height: 44px;
    width: 44px;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 2px 10px #23294655;
    object-fit: contain;
}
.case-navbar-title {
    font-size: 1.38rem;
    font-family: 'Orbitron', Arial, sans-serif;
    font-weight: 700;
    color: #ff6700;
    letter-spacing: 1px;
    text-shadow: 0 2px 14px #00968833;
}
.case-navbar-links {
    display: flex;
    gap: 2.1em;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: flex-end;
}
.nav-link {
    color: #fff;
    font-size: 1.07rem;
    font-weight: 600;
    padding: 10px 0;
    text-decoration: none;
    position: relative;
    transition: color 0.18s;
    border-radius: 4px;
}
.nav-link:hover, .nav-link:focus, .nav-link.active {
    color: #ff6700;
    background: rgba(255, 103, 0, 0.06);
}
.underline-anim::after {
    content: '';
    display: block;
    height: 2.5px;
    width: 0;
    background: linear-gradient(90deg, #ff6700 55%, #009688 100%);
    transition: width 0.27s cubic-bezier(.83,0,.17,1);
    border-radius: 2px;
    margin-top: 2px;
    position: absolute;
    left: 0;
}
.nav-link:hover.underline-anim::after, .nav-link:focus.underline-anim::after, .nav-link.active.underline-anim::after {
    width: 100%;
}
/* Hamburger Menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px 8px;
}
.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    width: 32px;
    height: 32px;
    gap: 6px;
}
.hamburger-icon span {
    display: block;
    height: 3px;
    width: 28px;
    background: #ff6700;
    border-radius: 2px;
    transition: all 0.25s cubic-bezier(.83,0,.17,1);
}
.hamburger-icon.active span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}
.hamburger-icon.active span:nth-child(2) {
    opacity: 0;
}
.hamburger-icon.active span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

/* Game Layout */
.case-container {
    margin: 38px auto 0 auto;
    background: rgba(255,255,255,0.06);
    border-radius: 20px;
    box-shadow: 0 8px 40px #ff670055, 0 2px 10px #00968844;
    border: 2.5px solid #ff670033;
    padding: 22px 18px 40px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 570px;
}

.case-title {
    font-family: 'Orbitron', Arial, sans-serif;
    color: #ff6700;
    font-size: 2rem;
    margin: 8px 0 9px 0;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 2px 16px #00968855;
}
.case-subtitle {
    color: #fffde9;
    font-size: 1.09rem;
    font-weight: 500;
    margin-bottom: 18px;
    text-shadow: 0 2px 10px #00968833;
    text-align: center;
}

.case-stats {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

#errors {
    font-family: 'Orbitron', Arial, sans-serif;
    font-size: 1.11rem;
    color: #ff6700;
    font-weight: 700;
    margin-left: 8px;
}

.restart-btn {
    background: linear-gradient(90deg, #ff6700 60%, #009688 100%);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 1.01rem;
    font-weight: 700;
    padding: 7px 19px;
    box-shadow: 0 2px 9px #ff670033;
    cursor: pointer;
    transition: background 0.2s, color 0.18s, transform 0.13s;
    display: flex;
    align-items: center;
    gap: 7px;
}
.restart-btn:hover, .restart-btn:focus {
    background: #009688;
    color: #fff;
    transform: scale(1.05);
}

#board {
    min-height: 430px;
    min-width: 370px;
    max-width: 98vw;
    margin: 14px auto 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    background: rgba(255,255,255,0.10);
    border-radius: 13px;
    border: 4px solid #ff670022;
    box-shadow: 0 2px 18px #00968822;
    padding: 8px;
    transition: background 0.2s;
}

.card {
    height: 104px;
    width: 74px;
    margin: 5px;
    border-radius: 11px;
    box-shadow: 0 2px 10px #ff670033;
    background: #fff;
    cursor: pointer;
    object-fit: cover;
    transition: transform 0.18s, box-shadow 0.18s, filter 0.08s;
    border: 2.5px solid transparent;
}
.card:hover, .card:focus {
    transform: scale(1.08) rotate(-1deg);
    box-shadow: 0 4px 18px #00968844;
    border: 2.5px solid #ff6700;
    z-index: 3;
}
.card.matched {
    filter: grayscale(0.75) brightness(0.82);
    opacity: 0.65;
    border: 2.5px solid #4caf50;
    cursor: default;
    pointer-events: none;
    box-shadow: 0 2px 8px #4caf5066;
    animation: matchPulse 0.7s;
}
@keyframes matchPulse {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
    100% { filter: brightness(0.82);}
}

/* Overlay */
.game-overlay {
    position: fixed;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    min-width: 275px;
    max-width: 90vw;
    background: rgba(34,42,62,0.97);
    box-shadow: 0 4px 32px #23294655;
    border-radius: 18px;
    border: 2.5px solid #ff670099;
    padding: 44px 28px 38px 28px;
    text-align: center;
    font-family: 'Montserrat', Arial, sans-serif;
    color: #fff;
    z-index: 99;
    animation: fadeIn 0.6s;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.gameover-title {
    font-family: 'Orbitron', Arial, sans-serif;
    font-size: 1.45rem;
    color: #ff6700;
    margin-bottom: 15px;
    letter-spacing: 1.1px;
}
.gameover-text {
    font-size: 1.11rem;
    margin-bottom: 18px;
    color: #ffcb05;
}
.quiz-next-btn {
    margin-top: 18px;
    padding: 10px 28px;
    border-radius: 10px;
    background: linear-gradient(90deg, #ff6700 40%, #009688 100%);
    color: #fff;
    font-size: 1.07rem;
    font-weight: 700;
    outline: none;
    border: none;
    box-shadow: 0 2px 12px #00968844;
    cursor: pointer;
    transition: background 0.18s, transform 0.13s;
}
.quiz-next-btn:active { transform: scale(0.97);}

/* Responsive Styles */
@media (min-width: 901px) {
    .case-navbar {
        flex-direction: row;
    }
    .nav-container {
        width: auto;
    }
    .case-navbar-links {
        margin-left: auto;
    }
}

@media (max-width: 900px) {
    .case-navbar {
        padding: 0.5rem 1rem;
    }
    .mobile-menu-toggle {
        display: block;
    }
    .case-navbar-links {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 0;
        padding: 0;
        margin-top: 10px;
    }
    .case-navbar-links.show {
        display: flex;
    }
    .case-navbar-links li {
        width: 100%;
        border-bottom: 1px solid #282b3a;
    }
    .case-navbar-links li:last-child {
        border-bottom: none;
    }
    .nav-link {
        padding: 13px 0 13px 10px;
        display: block;
        width: 100%;
    }
    .case-logo {
        height: 36px;
        width: 36px;
    }
    .case-navbar-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 700px) {
    .case-container {
        padding: 15px 10px 25px 10px;
        margin: 20px 10px;
        max-width: calc(100% - 20px);
    }
    .case-title { 
        font-size: 1.5rem;
    }
    .case-subtitle {
        font-size: 0.95rem;
        margin-bottom: 12px;
    }
    #board {
        min-width: unset;
        padding: 5px;
        gap: 5px;
    }
    .card {
        height: 80px;
        width: 56px;
        margin: 3px;
    }
    .restart-btn {
        font-size: 0.9rem;
        padding: 6px 15px;
    }
    .game-overlay {
        padding: 25px 20px;
    }
    .gameover-title {
        font-size: 1.2rem;
    }
    .gameover-text {
        font-size: 1rem;
    }
    .quiz-next-btn {
        font-size: 1rem;
        padding: 8px 20px;
    }
}

@media (max-width: 400px) {
    .card {
        height: 70px;
        width: 50px;
        margin: 2px;
    }
    .case-stats {
        flex-direction: column;
        gap: 10px;
    }
    #board {
        min-height: unset;
    }
}