body {
    background-color: #000; /* Dark background outside the container */
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.main-container {
    width: 100%;
    max-width: 437px; /* Based on typical background width */
    min-height: 100vh;
    background-color: #261e1d; /* Solid color matching the center-bottom edge of background_top_part.jpg */
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
}

.top-part {
    width: 100%;
    display: flex;
}

.header-img {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: -1px; /* Prevent hairline gap */
}

.bottom-part-frame {
    /* Exact CSS replica of the image frame */
    flex-grow: 1;
    position: relative;
    background-color: #1b120c; 
    margin: 30px 14px 25px 14px; /* Margins for spacing */
    border: 1px solid #b89364; /* Thin gold border */
    border-radius: 18px;
    padding-top: 38px; /* Top padding for grid, so icons don't hit the title */
    box-shadow: inset 0 0 30px rgba(0,0,0,0.6), 0 5px 15px rgba(0,0,0,0.5); /* Inner and outer shadow */
}

.frame-title {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 42px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.title-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.frame-title-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 28px; /* Creates space in the middle for the SVG diamond */
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 1px;
    /* Rich gold text gradient */
    background: linear-gradient(to bottom, #fff5d7 0%, #f1cd7f 40%, #d89f3c 60%, #b3771c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0px 2px 2px rgba(0,0,0,0.4);
}

/* Fallback for text shadow with background-clip */
@supports (-webkit-background-clip: text) {
    .frame-title-content {
        filter: drop-shadow(0px 2px 2px rgba(0,0,0,0.8));
        text-shadow: none;
    }
}

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 0 14px 20px 14px; 
}

.game-card {
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
    text-decoration: none; /* For anchor tags */
}

.game-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; /* Ensure space is reserved before image loads */
    display: block;
    border: 2px solid #b89364; /* Matching the parent frame's gold border */
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.6), inset 0 0 10px rgba(0,0,0,0.3);
    will-change: transform; /* Hint for browser optimization */
}

.game-card:hover {
    transform: translateY(-5px) scale(1.02);
}

/* Popup Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

@keyframes popupShake {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(-3deg) scale(1.02); }
    20% { transform: rotate(3deg) scale(0.98); }
    30% { transform: rotate(-3deg) scale(1.02); }
    40% { transform: rotate(3deg) scale(0.98); }
    50% { transform: rotate(0deg) scale(1); }
}
.popup-content.image-popup {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    width: 90%;
    max-width: 300px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.popup-link {
    display: block;
    line-height: 0;
    animation: popupShake 2s infinite ease-in-out;
}

.popup-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 20px;
}

.close-btn {
    position: absolute;
    top: -25px;
    right: -25px;
    background: #4a2f1d;
    border: 2px solid #f9d88a;
    border-radius: 50%;
    font-size: 20px;
    color: #f9d88a;
    cursor: pointer;
    width: 35px;
    height: 35px;
    line-height: 30px;
    z-index: 2001;
    box-shadow: 0 2px 5px rgba(0,0,0,0.8);
    text-align: center;
    padding: 0;
}

/* 
// Fixed Action Footer - Commented out
.fixed-action-footer {
    position: sticky;
    bottom: 0;
    width: 100%;
    padding: 12px 14px;
    background-color: rgba(27, 18, 12, 0.7);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    z-index: 1000;
    box-sizing: border-box;
    backdrop-filter: blur(8px);
}

.action-btn-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tooltip {
    position: absolute;
    bottom: 100%;
    margin-bottom: 10px;
    padding: 5px 12px;
    background-color: #e74c3c; 
    color: #fff;
    font-size: 12px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #e74c3c transparent transparent transparent;
}

.action-btn {
    width: 100%;
    padding: 12px 0;
    text-align: center;
    font-weight: bold;
    text-decoration: none;
    border-radius: 8px;
    font-size: 15px;
    border: none; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.action-btn.blue { 
    background: #ffffff; 
    color: #333;
}
.action-btn.orange { 
    background: linear-gradient(to bottom, #d89f3c, #b3771c); 
    color: #fff;
}

.footer-spacer {
    height: 85px;
}
*/

@media (max-width: 450px) {
    .main-container {
        width: 100vw;
    }
}

/* Fixed Customer Service Icon */
.customer-service-link {
    position: fixed;
    /* Align with the right edge of the 437px centered container */
    right: calc(50% - 218.5px);
    top: 50%;
    transform: translateY(-50%);
    width: 60px; /* Elegant floating size */
    z-index: 1000;
    transition: transform 0.2s;
}

.customer-service-link img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
}

.customer-service-link:hover {
    transform: translateY(-50%) scale(1.1);
}

@media (max-width: 450px) {
    .customer-service-link {
        right: 0;
        width: 50px;
    }
}