@font-face {
    font-family: 'aUI';
    src: url('aui.ttf') format('truetype');
}

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;700&display=swap');

@keyframes neonPulse {
    0% {
        opacity: 0.9;
        text-shadow: 0 0 3px var(--neon-aui-glow), 0 0 6px var(--neon-aui-glow);
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 8px var(--neon-aui-glow), 0 0 15px var(--neon-aui-glow), 0 0 45px var(--neon-aui-glow);
    }

    100% {
        opacity: 0.9;
        text-shadow: 0 0 3px var(--neon-aui-glow), 0 0 6px var(--neon-aui-glow);
    }
}

@keyframes scatter {
    0% {
        transform: translate(0, 0) scale(0.8);
        opacity: 0.5;
    }

    100% {
        transform: translate(var(--scatter-x), var(--scatter-y)) scale(1);
        opacity: 1;
    }
}

@keyframes flash {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
}

@keyframes starburst-animation {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    15% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(8);
        opacity: 0;
    }
}

@keyframes moon-appear {
    0% {
        opacity: 0;
        filter: brightness(0);
        transform: rotate(15deg);
    }
    100% {
        opacity: 1;
        filter: brightness(1);
        transform: rotate(0deg);
    }
}

:root {
    --text-color: white;
    --container-padding-x: 24px;
    --transition-duration: 0.2s;
    --padding-block: 70px;

    --neon-white: #fff;
    --neon-aui: #F0DF47;
    --neon-aui-glow: rgba(223, 199, 64, 0.4);
    --neon-translate: #5fcaa9;
    --sound-color: #5D95FD;
    --success-color: #5fdd54;
    --error-color: #ff5757;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Noto Sans', sans-serif;
    font-size: 32px;
    background-color: #000;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.background-gradient {
    position: fixed;
    z-index: -2;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top left,
            rgba(102, 51, 153, 0.3) 0%,
            transparent 60%),
        radial-gradient(circle at bottom right,
            rgba(0, 102, 204, 0.2) 0%,
            transparent 70%),
        #000;
    background-repeat: no-repeat;
    background-size: cover;
}

#tsparticles {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
}

.container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.game-area {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.moon-container {
    position: relative;
    width: 98vh;
    height: 98vh;
    max-width: 98vw;
    max-height: 98vw;
}

.moon-image {
    opacity: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    animation: moon-appear 1s ease-out forwards;
    animation-delay: 1s;
}

.symbol-orbit {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.symbol-element {
    position: absolute;
    cursor: grab;
    pointer-events: auto;
    user-select: none;
    z-index: 10;
}

.symbol-element.dragging {
    cursor: grabbing;
    z-index: 1000;
}

.symbol {
    font-family: 'aUI', sans-serif;
    font-size: 42px;
    color: var(--neon-aui);
    text-shadow: 0 0 10px var(--neon-aui-glow), 0 0 20px var(--neon-aui-glow);
    animation: neonPulse 3s infinite ease-in-out;
    text-align: center;
    transition: transform 0.3s ease, color 0.3s ease;
}

.symbol-element:hover .symbol {
    transform: scale(1.2);
}

.meaning-text .symbol {
    font-size: 18px;
    /* Match the word size */
    margin-left: 4px;
    display: inline-block;
}

.meaning-words {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.meaning-text {
    position: absolute !important;
    font-size: 18px;
    /* Reduced from 18px */
    color: var(--neon-translate);
    text-align: left;
    text-shadow: 0 0 3px var(--neon-translate);
    pointer-events: auto;
    cursor: default;
    padding: 2px 4px;
    /* Reduced padding */
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    /* Reduced gap */
    height: 20px;
    /* Reduced from 26px */
    line-height: 1;
    opacity: 0.85;
    white-space: nowrap;
    width: auto;
    /* Let it size naturally */
}

.meaning-text.matched {
    color: var(--success-color);
    text-shadow: 0 0 5px var(--success-color);
}

.message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 1000;
    text-align: center;
    pointer-events: none;
}

.success {
    background-color: var(--success-color);
}

.error {
    background-color: var(--error-color);
}

.progress {
    position: absolute;
    bottom: 20px;
    color: white;
    font-size: 18px;
    z-index: 10;
}

/* Symbol tray for mobile */
.symbol-tray {
    display: none;
    /* Hidden by default, shown in mobile */
    position: relative;
    width: 100%;
    padding: 15px 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    z-index: 100;
    max-height: 30vh;
    overflow-y: auto;
}

.explosion {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: rgba(199, 236, 255, 0.5);
    border-radius: 50%;
    pointer-events: none;
    animation: flash 1.5s ease-out forwards;
    box-shadow: 0 0 50px rgba(196, 232, 250, 0.8),
                0 0 100px rgba(186, 221, 238, 0.6),
                0 0 150px rgba(186, 221, 238, 0.5),
                0 0 200px rgba(186, 221, 238, 0.4),
                0 0 250px rgba(186, 221, 238, 0.3),
                0 0 300px rgba(186, 221, 238, 0.2),
                0 0 350px rgba(186, 221, 238, 0.1),
                0 0 400px rgba(186, 221, 238, 0.05);
}

.starburst {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: rgba(197, 236, 255, 0.5);
    clip-path: polygon(100% 50%,79.63% 54.69%,97.55% 65.45%,76.73% 63.62%,90.45% 79.39%,71.21% 71.21%,79.39% 90.45%,63.62% 76.73%,65.45% 97.55%,54.69% 79.63%,50% 100%,45.31% 79.63%,34.55% 97.55%,36.38% 76.73%,20.61% 90.45%,28.79% 71.21%,9.55% 79.39%,23.27% 63.62%,2.45% 65.45%,20.37% 54.69%,0% 50%,20.37% 45.31%,2.45% 34.55%,23.27% 36.38%,9.55% 20.61%,28.79% 28.79%,20.61% 9.55%,36.38% 23.27%,34.55% 2.45%,45.31% 20.37%,50% 0%,54.69% 20.37%,65.45% 2.45%,63.62% 23.27%,79.39% 9.55%,71.21% 28.79%,90.45% 20.61%,76.73% 36.38%,97.55% 34.55%,79.63% 45.31%);
    pointer-events: none;
    animation: starburst-animation 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-play-state: paused;
}


.overlay {
    position: fixed;
    z-index: 9999;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.start-btn {
    font-size: 2rem;
    padding: 1em 2em;
    border: none;
    border-radius: 10px;
    background: #fff;
    color: #222;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
    transition: background 0.2s;
}
.start-btn:hover {
    background: #e0e0e0;
}




/* Mobile responsiveness */
@media (max-width: 768px) {
    .symbol {
        font-size: 36px;
    }

    .meaning-text .symbol {
        font-size: 14px;
    }

    .meaning-text {
        font-size: 16px;
        font-weight: bold;
        background-color: rgba(0, 0, 0, 0.7);
        padding: 4px 8px;
        border-radius: 6px;
    }

    .moon-container {
        width: 130vw;
        /* Much wider than viewport to ensure no margins */
        height: 130vw;
        /* Keep aspect ratio */
        max-width: none;
        max-height: none;
        margin: 0 -15vw;
        /* Negative margin to center the oversized container */
        position: relative;
        left: 0;
    }

    .moon-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

@media (max-width: 480px) {
    .symbol {
        font-size: 30px;
    }

    .meaning-text .symbol {
        font-size: 14px;
    }

    .meaning-text {
        font-size: 16px;
        padding: 4px 8px;
    }

    .moon-container {
        width: 140vw;
        /* Even wider for smaller screens */
        height: 140vw;
        margin: 0 -20vw;
        /* Increased negative margin */
    }
}

@media (max-width: 768px) and (min-height: 700px) {
    .game-area {
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 0;
    }

    .container {
        padding: 0;
        margin: 0;
    }

    .symbol-orbit {
        display: none;
        /* Hide the orbiting symbols */
    }

    .symbol-tray {
        display: flex;
        /* Show the symbol tray */
        margin-top: 0;
        width: 100vw;
        padding: 10px 0;
        position: absolute;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
    }

    .symbol-element {
        position: relative;
        /* Not absolute in the tray */
        margin: 5px;
        display: inline-flex;
        justify-content: center;
        align-items: center;
    }

    .symbol-element.matched {
        display: none;
        /* Hide matched elements */
    }

    .progress {
        position: absolute;
        bottom: 5px;
        font-size: 14px;
    }
}