body {
    font-family: 'VT323', monospace;
    background-color: #e8e8e8;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 20px;
    font-size: 18px;
}

#game-nav {
    position: static;
    margin: 20px;
    z-index: 1000;
}

.nav-link {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #003366, #004080);
    color: #e8e8e8;
    text-decoration: none;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'VT323', monospace;
    border: 2px solid #ccc;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    opacity: 0.3;
}

.nav-link:hover {
    background: linear-gradient(135deg, #004080, #003366);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    border-color: #999;
    opacity: 1;
}

header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

#logo {
    width: 200px;
    margin-bottom: 10px;
}

h1 {
    margin: 0;
    color: #003366;
    font-size: 3em;
}

h2 {
    color: #003366;
    border-bottom: 2px solid #ccc;
    padding-bottom: 5px;
    margin-top: 0;
}

.branding {
    font-style: italic;
    color: #888;
    margin: 5px 0 0 0;
}

main {
    display: flex;
    justify-content: center;
}

#game-container {
    display: flex;
    gap: 30px;
    background-color: #f7f7f7;
    padding: 20px;
    border: 1px solid #ccc;
    box-shadow: 5px 5px 0px 0px rgba(0,0,0,0.1);
}

#grid-container-wrapper {
    display: grid;
    grid-template-areas:
        ". header-cols"
        "header-rows grid";
    grid-template-columns: 30px 1fr;
    grid-template-rows: 25px 1fr;
}

#grid-header-cols {
    grid-area: header-cols;
    display: flex;
}
#grid-header-rows {
    grid-area: header-rows;
}

.header-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #d0d0d0;
    border: 1px solid #b0b0b0;
    font-weight: bold;
    color: #555;
    user-select: none;
}
#grid-header-cols .header-cell {
    width: 60px;
    height: 25px;
    border-bottom: 2px solid #888;
}
#grid-header-rows .header-cell {
    width: 30px;
    height: 30px;
    border-right: 2px solid #888;
}

#grid-container {
    grid-area: grid;
    display: grid;
    grid-template-columns: repeat(10, 60px);
    grid-template-rows: repeat(10, 30px);
    border: 2px solid #888;
}

.cell {
    width: 60px;
    height: 30px;
    border: 1px solid #ccc;
    background-color: #e9e9e9;
    cursor: pointer;
    text-align: center;
    line-height: 30px;
    font-size: 16px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    user-select: none;
    transition: background-color 0.2s;
}

.cell:hover {
    background-color: #d9d9d9;
}

.cell.revealed {
    background-color: #fff;
    cursor: default;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.cell.item {
    color: #006400;
    font-weight: bold;
}

.cell.enemy {
    color: #b22222;
    font-weight: bold;
}

.cell.treasure {
    color: gold;
    font-weight: bold;
    background-color: #fffacd;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 5px 10px rgba(255, 215, 0, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

#ui-container {
    width: 280px;
}

#inventory-list {
    list-style: none;
    padding: 0;
    margin: 0;
    height: 150px;
}

#inventory-list li {
    margin-bottom: 5px;
    padding: 2px;
}

#log-container {
    display: flex;
    flex-direction: column;
}

#log {
    height: 150px;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 5px;
    background-color: #fff;
    margin-bottom: 10px;
}

#log p {
    margin: 0 0 5px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
}

#log p:last-child {
    animation: fadeIn 0.5s;
}

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

#reset-button {
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 10px;
    cursor: pointer;
    background-color: #003366;
    color: white;
    border: none;
    box-shadow: 3px 3px 0px 0px rgba(0,0,0,0.2);
    transition: all 0.1s;
}

#reset-button:hover {
    background-color: #0055aa;
}
#reset-button:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px 0px rgba(0,0,0,0.2);
}

/* Entrance Animations */
@keyframes logoEntrance {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-180deg);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes titleSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-50px);
        letter-spacing: 10px;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        letter-spacing: normal;
    }
}

@keyframes brandingFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes gridWrapperExpand {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes gridSpectacular {
    0% {
        opacity: 0;
        transform: scale(0.5) rotateY(45deg);
        box-shadow: 0 0 0 0 rgba(0, 51, 102, 0);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05) rotateY(0deg);
        box-shadow: 0 0 30px 10px rgba(0, 51, 102, 0.3);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateY(0deg);
        box-shadow: 0 0 10px 2px rgba(0, 51, 102, 0.1);
    }
}

@keyframes cellCascade {
    0% {
        opacity: 0;
        transform: scale(0) rotate(180deg);
        background-color: #003366;
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1) rotate(0deg);
        background-color: #0055aa;
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        background-color: #e9e9e9;
    }
}

@keyframes uiSlideIn {
    0% {
        opacity: 0;
        transform: translateX(50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation Classes */
.animate-logo {
    animation: logoEntrance 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    opacity: 0;
}

.animate-title {
    animation: titleSlideIn 1s ease-out 0.8s forwards;
    opacity: 0;
}

.animate-branding {
    animation: brandingFadeIn 0.8s ease-out 1.5s forwards;
    opacity: 0;
}

.animate-main {
    animation: gameContainerSlideUp 1s ease-out 2s forwards;
    opacity: 0;
}

.animate-game-container {
    animation: gameContainerSlideUp 0.8s ease-out 2.2s forwards;
    opacity: 0;
}

.animate-grid-wrapper {
    animation: gridWrapperExpand 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) 2.5s forwards;
    opacity: 0;
}

.animate-grid-headers {
    animation: gridHeadersSlide 0.6s ease-out 3s forwards;
    opacity: 0;
}

.animate-grid {
    animation: gridSpectacular 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) 3.2s forwards;
    opacity: 0;
    perspective: 1000px;
}

.animate-ui {
    animation: uiSlideIn 0.8s ease-out 4s forwards;
    opacity: 0;
}

/* Cell cascade animation will be applied via JavaScript */
.cell.animate-cell {
    animation: cellCascade 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    opacity: 0;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 16px;
    }

    h1 {
        font-size: 2em;
    }

    #logo {
        width: 60px;
    }

    #game-container {
        flex-direction: column;
        gap: 20px;
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
    }

    #grid-container-wrapper {
        grid-template-columns: 25px 1fr;
        grid-template-rows: 20px 1fr;
    }

    #grid-container {
        grid-template-columns: repeat(10, 1fr);
        grid-template-rows: repeat(10, 25px);
        max-width: 100%;
        overflow-x: auto;
    }

    .cell {
        width: 100%;
        min-width: 30px;
        height: 25px;
        line-height: 25px;
        font-size: 14px;
    }

    #grid-header-cols .header-cell {
        width: 100%;
        min-width: 30px;
        height: 20px;
        font-size: 12px;
    }

    #grid-header-rows .header-cell {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }

    #ui-container {
        width: 100%;
    }

    #inventory-list {
        height: 100px;
    }

    #log {
        height: 120px;
    }
}

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

    h1 {
        font-size: 1.5em;
    }

    #logo {
        width: 50px;
    }

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

    #grid-container-wrapper {
        grid-template-columns: 20px 1fr;
        grid-template-rows: 18px 1fr;
    }

    #grid-container {
        grid-template-columns: repeat(10, 1fr);
        grid-template-rows: repeat(10, 22px);
    }

    .cell {
        min-width: 25px;
        height: 22px;
        line-height: 22px;
        font-size: 12px;
    }

    #grid-header-cols .header-cell {
        min-width: 25px;
        height: 18px;
        font-size: 10px;
    }

    #grid-header-rows .header-cell {
        width: 20px;
        height: 22px;
        font-size: 10px;
    }

    h2 {
        font-size: 1.2em;
    }

    #inventory-list {
        height: 80px;
        font-size: 14px;
    }

    #log {
        height: 100px;
    }

    #log p {
        font-size: 12px;
    }

    #reset-button {
        font-size: 16px;
        padding: 8px;
    }
}

