* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #f4ece6; /* Light bright stone base color */
    touch-action: none; /* Prevent default touch actions like pull-to-refresh */
}

/* Background & Effects */
.background-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background-image: url('stone_world_bg.png');
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    opacity: 0.85; /* slight transparency to keep it neat and clean */
}

/* Old Temple Stone Monument */
.stone-monument {
    position: absolute;
    top: 55%; /* Centered vertically like the image */
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    pointer-events: none;
    z-index: 0;
    filter: drop-shadow(0 15px 15px rgba(0, 0, 0, 0.25)); /* Shadow on the ground */
}

.pillar {
    width: 25px;
    height: 80px;
    background: linear-gradient(to right, #e2d3c1, #bda894);
    position: relative;
    z-index: 2;
    border-radius: 2px;
}

.cap {
    position: absolute;
    left: -8px;
    right: -8px;
    height: 12px;
    background: #d4c5b5;
    border-top: 2px solid #f2e6d8;
    border-bottom: 3px solid #9b8774;
    border-radius: 2px;
}

.top-cap { top: -12px; }
.top-cap::before {
    content: '';
    position: absolute;
    top: -8px; left: 5px; right: 5px; height: 8px;
    background: linear-gradient(to right, #d4c5b5, #bda894);
    clip-path: polygon(20% 0, 80% 0, 100% 100%, 0% 100%);
}

.bottom-cap { bottom: -12px; }

.slab {
    background: #dcd0c0;
    padding: 15px 50px;
    position: relative;
    z-index: 1;
    margin: 0 -8px;
    box-shadow: 
        inset 0 3px 5px rgba(255, 255, 255, 0.7), /* Top light */
        inset 0 -12px 0 #ab9884, /* 3D depth of the slab at bottom */
        inset 0 -15px 5px rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slab-text {
    font-family: 'Cinzel', serif;
    font-size: 5vw;
    font-weight: 700;
    color: #a18e7b;
    text-shadow: 
        -2px -2px 3px rgba(0, 0, 0, 0.3), /* Carved dark shadow */
        2px 2px 3px rgba(255, 255, 255, 0.9); /* Carved light highlight */
    letter-spacing: 0.1em;
    position: relative;
    top: -4px; /* Visually center above the bottom depth */
}

/* Decorative crack on the bottom edge to make it look old/handmade */
.crack {
    position: absolute;
    bottom: 0;
    left: 30%;
    width: 30px;
    height: 12px;
    background: #ab9884;
    clip-path: polygon(20% 100%, 50% 0, 80% 100%);
}

/* Game Canvas */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: block;
}

/* UI Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through except on active panels */
    display: flex;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important;
}

.active {
    display: flex !important;
}

/* Glassmorphism Panel */
.panel {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border-radius: 30px;
    width: 90%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 8px 32px rgba(160, 150, 140, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.title {
    font-size: 3rem;
    font-weight: 700;
    color: #6b5b4f;
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.8);
    letter-spacing: 2px;
}

.subtitle {
    font-size: 2rem;
    font-weight: 700;
    color: #6b5b4f;
    margin-bottom: 20px;
}

.message {
    font-size: 1.2rem;
    color: #8c7b6d;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 500;
}

/* Inputs */
input {
    width: 100%;
    padding: 15px 20px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    color: #5a4c41;
    margin-bottom: 25px;
    outline: none;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    text-align: center;
}

input::placeholder {
    color: #a0958b;
}

input:focus {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), inset 0 2px 5px rgba(0,0,0,0.05);
}

/* Buttons */
.glass-btn {
    width: 100%;
    padding: 15px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.glass-btn:active {
    transform: scale(0.95);
}

.primary-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6));
    color: #6b5b4f;
    box-shadow: 0 4px 15px rgba(160, 150, 140, 0.2);
}

.primary-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.8));
    box-shadow: 0 6px 20px rgba(160, 150, 140, 0.3);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.3);
    color: #8c7b6d;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Glass Badge (Built by) */
.glass-badge {
    position: fixed;
    bottom: 25px;
    right: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px 8px 8px; /* pill shape with space for circle image */
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 30px;
    box-shadow: 0 8px 32px rgba(160, 150, 140, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    color: #6b5b4f;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
    z-index: 100;
    pointer-events: auto; /* Required to be clickable inside ui-layer */
}

.glass-badge:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(160, 150, 140, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.glass-badge .profile-pic {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Hide badge when start screen is hidden */
#start-screen.hidden ~ #built-by-badge {
    display: none !important;
}

/* In-Game UI Elements */
#in-game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#score-display {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 4rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 4px 10px rgba(0,0,0,0.15), 0 0 20px rgba(255,255,255,0.8);
    pointer-events: none;
    z-index: 20;
}

#settings-btn {
    position: absolute;
    top: 40px;
    right: 30px;
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #6b5b4f;
    margin: 0;
    z-index: 20;
}

/* Responsive adjustments */
