:root {
    --bg-color: #f0f4f8;
    --area-a-bg: #ffffff;
    --area-b-bg: #e1e8ed;
    --area-c-bg: #d1d9e0;
    --primary-color: #4a90e2;
    --btn-border: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
    background-color: #f8fafc;
    /* Modern slate-50 */
    color: #334155;
}

#game-container {
    display: grid;
    width: 100vw;
    height: 100vh;
}

.game-area {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    /* border: 1px dashed rgba(0, 0, 0, 0.1); */
    /* Removed temporary border */
}

#area-a {
    grid-area: A;
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4vmin;
    z-index: 100;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    border-bottom: 2px solid #e2e8f0;
}

#session-counter {
    font-size: 4.5vmin;
    font-weight: 800;
    color: #475569;
    background: #ffffff;
    padding: 1vmin 3.5vmin;
    border-radius: 100px;
    border: 1px solid #e2e8f0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

/* Card Stage and Flip Animation */
#card-stage {
    perspective: 1000px;
    width: 25vmax;
    height: 35vmax;
}

#game-card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#game-card.is-flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    background: #fdfbf7;
    /* Off-white / Creamy paper feel */
    background-image: radial-gradient(#00000005 1px, transparent 1px);
    background-size: 20px 20px;
    border: 0.8vmin solid #ffffff;
    border-radius: 4vmin;
    padding: 2vmin;
    box-shadow: 0 2vmax 5vmax rgba(0, 0, 0, 0.15);
}

.card-back {
    transform: rotateY(180deg);
}

.mystery-pattern {
    font-size: 15vmax;
    color: #f1f5f9;
    font-weight: 800;
    user-select: none;
}

.symbol-slot {
    width: 12vmax;
    height: 12vmax;
    display: flex;
    justify-content: center;
    align-items: center;
}

.symbol-wrapper {
    width: 90%;
    height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.symbol-wrapper svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    /* Use text color for easy coloring */
}

/* Vibrant Monochrome Colors using Text Color */
.color-white {
    color: #ffffff;
    /* Robust outline for visibility on white/light backgrounds */
    filter:
        drop-shadow(1px 0 0 #000) drop-shadow(-1px 0 0 #000) drop-shadow(0 1px 0 #000) drop-shadow(0 -1px 0 #000) drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.4));
}

.color-green {
    color: #00e600;
}

.color-grey {
    color: #64748b;
}

.color-blue {
    color: #0055ff;
}

.color-red {
    color: #ff0000;
}


/* SVG Asset Mapping is now handled via innerHTML in game.js */


#area-b {
    grid-area: B;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    position: relative;
    overflow: hidden;
}

#area-b::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 30c5.5 0 10-4.5 10-10S35.5 10 30 10s-10 4.5-10 10 4.5 10 10 10z' fill='%2394a3b8' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
    pointer-events: none;
}

#area-c {
    grid-area: C;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    box-shadow: inset 5px 0 15px rgba(0, 0, 0, 0.05);
}

/* Items Container and Circular Layout */
#items-container {
    position: relative;
    width: 35vmax;
    height: 35vmax;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-item {
    position: absolute;
    width: 12vmax;
    height: 12vmax;
    background: #f8fafc;
    /* Soft grey button background */
    border: 0.4vmin solid #cbd5e1;
    border-radius: 20%;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s, border-color 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1vmin;
    box-shadow: 0 0.5vmin 1vmin rgba(0, 0, 0, 0.05);
    /* Default position using variables */
    transform: translate(var(--tx), var(--ty));
}

.game-item svg {
    width: 80%;
    height: 80%;
    fill: currentColor;
}

/* Item Background Mapping is now handled via innerHTML in game.js */


/* Pure Vibrant Item Colors in Area B */
.item-ghost {
    color: #ffffff;
    /* CRITICAL: Make the ghost white */
    background-color: #f8fafc;
    /* Very light, almost white */
    border-color: #cbd5e1;
}

.item-ghost svg {
    /* Crisp dark outline for the white ghost in Area B */
    filter:
        drop-shadow(1px 0 0 #334155) drop-shadow(-1px 0 0 #334155) drop-shadow(0 1px 0 #334155) drop-shadow(0 -1px 0 #334155);
}

.item-bottle {
    color: #00e600;
    border-color: #00cc00;
}

.item-book {
    color: #0055ff;
    border-color: #0044cc;
}

.item-chair {
    color: #ff0000;
    border-color: #cc0000;
}

.item-mouse {
    color: #64748b;
    border-color: #475569;
}


.game-item:hover {
    transform: translate(var(--tx), var(--ty)) scale(1.1);
    box-shadow: 0 1vmin 2vmin rgba(0, 0, 0, 0.15);
}

.game-item:active {
    transform: translate(var(--tx), var(--ty)) scale(0.95);
}

/* Position variables for pentagon (R = 15vmax) */
.game-item:nth-child(1) {
    --tx: 0;
    --ty: -15vmax;
}

/* Top */
.game-item:nth-child(2) {
    --tx: 14.2vmax;
    --ty: -4.6vmax;
}

/* Top Right */
.game-item:nth-child(3) {
    --tx: 8.8vmax;
    --ty: 12.2vmax;
}

/* Bottom Right */
.game-item:nth-child(4) {
    --tx: -8.8vmax;
    --ty: 12.2vmax;
}

/* Bottom Left */
.game-item:nth-child(5) {
    --tx: -14.2vmax;
    --ty: -4.6vmax;
}

/* Top Left */

/* Top Left */

/* Feedback Animations */
@keyframes correct-pulse {
    0% {
        border-color: #2ecc71;
        box-shadow: 0 0 2vmin #2ecc71;
    }

    50% {
        transform: translate(var(--tx), var(--ty)) scale(1.2);
        border-color: #2ecc71;
        box-shadow: 0 0 5vmin #2ecc71;
    }

    100% {
        border-color: #2ecc71;
        box-shadow: 0 0 2vmin #2ecc71;
    }
}

@keyframes wrong-shake {
    0% {
        transform: translate(var(--tx), var(--ty)) translateX(0);
    }

    25% {
        transform: translate(var(--tx), var(--ty)) translateX(-1vmax);
    }

    50% {
        transform: translate(var(--tx), var(--ty)) translateX(1vmax);
    }

    75% {
        transform: translate(var(--tx), var(--ty)) translateX(-1vmax);
    }

    100% {
        transform: translate(var(--tx), var(--ty)) translateX(0);
    }
}

.correct-flash {
    animation: correct-pulse 0.5s ease-in-out infinite;
    border-color: #2ecc71 !important;
    z-index: 1000;
}

.wrong-flash {
    animation: wrong-shake 0.4s ease-in-out;
    border-color: #e74c3c !important;
}

/* Home Button Styling */
.ui-btn {
    width: 8vmin;
    max-width: 80px;
    height: 8vmin;
    max-height: 80px;
    background: var(--primary-color);
    border: 0.5vmin solid var(--btn-border);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font-size: 4vmin;
    box-shadow: 0 0.5vmin 1vmin rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.ui-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0.8vmin 1.5vmin rgba(0, 0, 0, 0.25);
}

/* Size Warning Overlay */
#size-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #ff4757;
    color: white;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 5vmin;
    text-align: center;
}

.warning-icon {
    font-size: 15vmin;
    margin-bottom: 2vmin;
}

#size-warning h2 {
    font-size: 6vmin;
    margin-bottom: 1vmin;
}

#size-warning p {
    font-size: 3vmin;
}

/* Orientation Specific Layouts */

/* Landscape */
@media (orientation: landscape) {
    #game-container {
        grid-template-areas:
            "A A"
            "B C";
        grid-template-rows: 15vmin 1fr;
        grid-template-columns: 50vmax 1fr;
    }

    .ui-btn {
        width: 10vmin;
        height: 10vmin;
        font-size: 5vmin;
    }
}

/* Portrait */
@media (orientation: portrait) {
    #game-container {
        grid-template-areas:
            "A"
            "B"
            "C";
        grid-template-rows: 15vmax 42vmax 1fr;
        grid-template-columns: 1fr;
    }

    #area-a {
        padding-left: 2vmax;
    }

    .ui-btn {
        width: 10vmax;
        height: 10vmax;
        font-size: 5vmax;
    }
}