@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Rye&display=swap');

:root {
    --hat-size: 100px;
    --stage-depth: 300px;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #050101;
    font-family: 'Playfair Display', serif;
    color: #e0d0b0;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-image: url('stage_curtains.png');
    background-size: cover;
    background-position: center;
}

#curtains-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 30%, rgba(0,0,0,0.8) 100%);
    pointer-events: none;
    z-index: 10;
}

#ui-layer {
    z-index: 20;
    text-align: center;
    margin-top: 20px;
    text-shadow: 2px 2px 4px #000;
}

.title-text {
    font-family: 'Rye', serif;
    font-size: 2.5rem;
    margin: 0;
    color: #ffcc00;
    letter-spacing: 2px;
}

#score-board {
    font-size: 1.2rem;
    margin-top: 10px;
    color: #aaa;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.score-row {
    text-shadow: 1px 1px 2px black;
}

.sub-score {
    font-size: 0.9rem;
    color: #8b0000;
    font-weight: bold;
}

.location-rank {
    font-family: 'Rye', serif;
    color: #ffcc00;
    font-size: 1.1rem;
    margin-top: 5px;
}

#message-area {
    margin-top: 20px;
    font-style: italic;
    font-size: 1.5rem;
    min-height: 2rem;
    color: #fff;
    transition: opacity 0.3s;
}

#stage-area {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60%;
    background-image: url('wood_table.png');
    background-size: cover;
    background-position: bottom;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 800px;
    box-shadow: inset 0 20px 50px rgba(0,0,0,0.8);
    overflow: hidden;
}

#locations-container {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.location-marker {
    position: absolute;
    width: var(--hat-size);
    height: var(--hat-size);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 204, 0, 0.1) 0%, rgba(139, 0, 0, 0) 70%);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    top: 50%;
    left: 0;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
}

.hat-container {
    position: absolute;
    width: var(--hat-size);
    height: var(--hat-size);
    top: 50%;
    left: 0;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 5;
    -webkit-tap-highlight-color: transparent;
}

.top-hat {
    width: 100%;
    height: 100%;
    background-image: url('top_hat.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.5));
    transition: transform 0.3s ease;
}

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

.cat-sprite {
    position: absolute;
    width: 85%;
    height: 85%;
    top: 7.5%;
    left: 7.5%;
    background-image: url('mystic_cat.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s ease;
    z-index: -1; /* Behind hat */
}

.cat-sprite.revealed {
    opacity: 1;
    transform: scale(1) translateY(-55%);
    z-index: 10;
}

.hat-container.hovering .top-hat {
    transform: translateY(-30px);
}

/* Modal Overlay */
#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

#overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: #1a1a1a;
    border: 2px solid #8b0000;
    padding: 30px;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 0 20px #8b0000;
    max-width: 80%;
}

.modal p {
    margin: 15px 0;
    line-height: 1.6;
    font-size: 1.1rem;
    color: #e0d0b0;
}

.modal em {
    color: #ffcc00;
    font-family: 'Rye', serif;
    font-style: normal;
}

button {
    background: #8b0000;
    color: #fff;
    border: none;
    padding: 15px 30px;
    font-family: 'Rye', serif;
    font-size: 1.2rem;
    cursor: pointer;
    margin-top: 20px;
    border: 1px solid #ffcc00;
    box-shadow: 0 4px 0 #4a0000;
}

button:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Animations */
@keyframes shake {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}

.shaking {
    animation: shake 0.3s infinite;
}