html,
body {
    margin: 0;
    height: 100%;
    width: 100%;
}

#main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

#main .main-background {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: url("../assets/web_page/zendoku-web-bg.webp") no-repeat center center;
    background-size: cover;
    z-index: 0;
}

#main .main-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1 0 auto;
}

#main .title-section {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60%;
    height: 50px;
    padding-top: 10px;
    padding-bottom: 10px;
    margin: 0 auto;
}

#main .game-section {
    display: flex;
    flex-wrap: wrap;
    height: fit-content;
}

#main .cross-promo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 20px;
    padding: 20px 10px;
    box-sizing: border-box;
}

#main .description-title-section {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 120px;
    padding-top: 30px;
    padding-bottom: 20px;
    margin: 0 auto;
}

#main .description-section {
    position: relative;
    display: flex;
    width: 70%;
    align-self: center;
    height: fit-content;
    margin-bottom: 100px;
    flex-wrap: wrap;
    border: 50px solid transparent;
    border-image-source: url("../assets/web_page/zendoku-info-bg.webp");
    border-image-slice: 50 fill;
    background: url("../assets/web_page/zendoku-info-bg.webp") no-repeat center;
    background-size: contain;
    box-sizing: border-box;
    box-shadow: 10px 20px 15px 5px rgba(0, 0, 0, 0.60);
}

.description-content {
    position: relative;
    display: block;
    width: 100%;
    height: fit-content;
    padding: 20px 50px;
}

.description-content h1, h2, p {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #573820;
}

.description-content h1, h2 {
    font-size: 35px;
}

.description-content p {
    font-size: 20px;
}

.colored-emoji {
    color: transparent; /* Makes the original emoji invisible */
    text-shadow: 0 0 0 #573820; /* Creates a colored "shadow" in its place */
}

#game-title {
    position: relative;
    display: block;
    width: 60%;
    height: 100%;
    background: url("../assets/web_page/zendoku-title.webp") no-repeat center center;
    background-size: contain;
}

#unity-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#unity-container {
    position: relative;
    width: 1366px;
    height: 768px;
    background-color: #231F20;
}

.fadeout-panel {
    opacity: 1;
    transition: opacity 0.2s ease-out;
}

.fadeout-panel.hidden {
    opacity: 0;
    display: none;
    transition-delay: 0s, 0.2s;
}

#unity-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #231F20;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99;
    font-family: OpenSans, sans-serif;
}

#unity-loading-logo {
    width: 125px;
    height: 125px;
    background: url("../zendoku.png") no-repeat center center;
    background-size: contain;
    margin-bottom: 20px;
}

#unity-progress-bar-empty {
    width: 300px;
    height: 10px;
    background: #444;
    border-radius: 5px;
    overflow: hidden;
}

#unity-progress-bar-full {
    width: 0%;
    height: 100%;
    background: #ccc;
    transition: width 0.1s ease-out;
}

#unity-loading-text {
    color: #ccc;
    margin-top: 10px;
    font-size: 14px;
}

.vertical-adsense-container {
    flex-grow: 1;
    /* background-color: rgb(76, 168, 248); */
}

.horizontal-adsense-container {
    width: 728px;
    height: 90px;
    background-color: rgb(76, 168, 248);
    min-height: 90px;
}

.cross-promo-apps-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center;
    padding: 0 10px;
}

.apps-grid {
    display: grid;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    justify-content: center;
    justify-items: center;
    align-items: center;
}

.app-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
    width: 80px;
    height: 80px;
}

.app-item:hover {
    transform: translateY(-5px);
    opacity: 0.9;
}

.app-item:active {
    transform: translateY(-2px);
}

.app-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 5px 5px 10px 2px rgba(0, 0, 0, 0.30);
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.2s ease;
}

.app-item:hover .app-icon-wrapper {
    box-shadow: 10px 10px 10px 5px rgba(0, 0, 0, 0.50);
}

.app-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Visually hidden but accessible for SEO and screen readers */
.app-name {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* --- FOOTER VARIABLES --- */
:root {
    --footer-bg: #362812; /* Dark Brown */
    --footer-bottom-bg: #1b0d06; /* Very Dark Brown */
    --text-color: #ffffff;
    --link-color: #d3c6b0; /* Warmer Beige/Gray */
    --hover-color: #fdae00; /* Green Accent */
    --border-color: rgba(255, 255, 255, 0.1);
}

/* --- FOOTER COMPONENT STYLES --- */
footer {
    position: relative;
    background-color: var(--footer-bg);
    color: var(--text-color);
    width: 100%;
    padding-top: 50px;
    font-size: 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-sizing: border-box;
    line-height: 1.5;
    z-index: 5;
    flex-shrink: 0; /* Prevents footer from squishing or jumping up */
}

/* Ensure all elements inside footer use border-box */
footer *, footer *::before, footer *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.footer-container {
    width: 100%;
    margin: 0 auto;
    padding: 0 50px;
}

.footer-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
}

/* Left Side: Brand Info */
.footer-brand {
    flex: 1; /* Takes up remaining space */
    max-width: 600px;
}

.footer-logo {
    font-size: 28px;
    font-weight: 600;
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.footer-logo img {
    width: 60%;
    height: 60%;
    margin-left: -28px;
}

.company-description {
    font-size: 14px;
    line-height: 1.6;
    color: #ccc;
}

/* Right Side: Contact & Socials */
.footer-connect {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Align to right on desktop */
    gap: 20px;
    min-width: 250px;
}

.contact-info p {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ccc;
}

.contact-info i {
    color: var(--link-color);
}

.social-icons {
    display: flex;
    gap: 10px;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 16px;
}

.social-icons a:hover {
    background-color: var(--hover-color);
    transform: translateY(-3px);
}

/* --- NAVIGATION STRIP (Horizontal) --- */
.footer-nav {
    padding: 25px 0;
    display: flex;
    justify-content: center; /* Center the links */
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 30px;
}

.footer-nav a {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 15px;
    letter-spacing: 0.5px;
    transition: color 0.3s;
    position: relative;
}

.footer-nav a:hover {
    color: var(--hover-color);
}

/* Add underline to policies per requirement */
.footer-nav a.policy {
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: rgba(255, 255, 255, 0.3);
}

.footer-nav a.policy:hover {
    text-decoration-color: var(--hover-color);
}

/* --- COPYRIGHT SECTION --- */
.footer-bottom {
    background-color: var(--footer-bottom-bg);
    padding: 15px 0;
    text-align: center;
    font-size: 13px;
    color: #888;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    .footer-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 30px;
    }

    .footer-connect {
        align-items: center; /* Center on mobile */
    }

    .contact-info p {
        justify-content: center;
    }

    .footer-nav {
        gap: 20px;
        flex-direction: column; /* Stack links vertically on smaller screens for better tap targets */
        align-items: center;
    }
}

/* Laptops and larger screens - retain layout as-is */
@media screen and (min-width: 1367px) {
    #main .game-section {
        height: fit-content;
    }

    #unity-container {
        width: 1366px;
        height: 768px;
    }
}

/* Hide side adsense containers on tablets and smaller */
@media screen and (max-width: 1366px) {
    .vertical-adsense-container {
        display: none;
    }
}

/* Tablets - 80% of site height for Unity canvas */
@media screen and (min-width: 768px) and (max-width: 1366px) {
    #main {
        height: 100vh;
    }

    #main .game-section {
        height: 80vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #main .description-section {
        width: 85%;
    }

    #unity-container {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .vertical-adsense-container {
        display: none;
    }

    .horizontal-adsense-container {
        display: none;
    }

    .cross-promo-section {
        height: auto;
        min-height: 20vh;
    }

    .cross-promo-apps-container {
        padding: 15px 10px;
    }

    .apps-grid {
        gap: 12px;
    }

    .description-content h1, h2 {
        font-size: 30px;
    }

    .footer-container {
        padding: 0 30px;
    }
}

/* Mobile - 100% viewport height for Unity canvas, content pushed below */
@media screen and (max-width: 767px) {
    #main {
        height: auto;
        min-height: 100vh;
    }

    #main .title-section {
        display: none;
    }

    #main .game-section {
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }

    #main .description-section {
        width: 100%;
    }

    #unity-container {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .vertical-adsense-container {
        display: none;
    }

    .horizontal-adsense-container {
        display: none;
    }

    .cross-promo-section {
        position: relative;
        width: 100%;
    }

    .cross-promo-apps-container {
        padding: 15px 10px;
    }

    .apps-grid {
        gap: 10px;
    }

    .description-content h1, h2 {
        font-size: 25px;
    }

    .description-content p {
        font-size: 17px;
    }

    .footer-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-connect {
        align-items: center;
    }
    
    .footer-logo {
        align-items: center;
    }

    .footer-logo img {
        margin: 0 auto;
    }

    .contact-info p {
        justify-content: center;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    .apps-grid {
        gap: 8px;
    }
}

/* Short viewport height adjustment */
@media screen and (max-height: 768px) {
    #unity-container {
        position: static;
        height: 100%;
    }
}
