/* --- Global Styles & Perfect Centering --- */
body {
    background: radial-gradient(circle at center, #2c3e50 0%, #1a252f 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #ecf0f1;
    overflow: hidden;
}

.game-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    perspective: 1000px; /* Essential for 3D depth effects */
}

/* --- Header & Title --- */
.header h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin: 0;
    background: linear-gradient(to bottom, #fff 0%, #f1c40f 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 5px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

.header p {
    font-size: 1.1rem;
    margin: 10px 0 30px 0;
    color: #95a5a6;
    letter-spacing: 1px;
}

/* --- Safe Body with Realistic Metal & Neon --- */
.safe-body {
    width: 320px;
    height: 320px;
    background: linear-gradient(135deg, #576574 0%, #2c3e50 100%);
    border: 12px solid #1a252f;
    border-radius: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: 0 30px 60px rgba(0,0,0,0.7), inset 0 0 20px rgba(0,0,0,0.5);
    margin-bottom: 40px;
    overflow: hidden;
}

/* Golden Neon Trim */
.neon-trim {
    position: absolute;
    top: 10px; left: 10px; right: 10px; bottom: 10px;
    border: 2px solid #f1c40f;
    border-radius: 20px;
    box-shadow: 0 0 15px #f1c40f, inset 0 0 10px #f1c40f;
    opacity: 0.3;
    pointer-events: none;
}

/* --- Safe Door & Dial Container --- */
.safe-door {
    width: 250px;
    height: 250px;
    background: #7f8c8d;
    border-radius: 15px;
    border: 5px solid #576574;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.dial-container {
    position: relative;
    width: 170px;
    height: 170px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Dial Base (Behind the rotating part) */
.dial-base {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #576574, #2c3e50);
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    z-index: 1;
}

/* --- The Rotating Dial Handle --- */
.dial {
    width: 130px;
    height: 130px;
    background: radial-gradient(circle, #ecf0f1 0%, #bdc3c7 100%);
    border: 10px solid #1a252f;
    border-radius: 50%;
    position: relative;
    z-index: 5;
    /* Clean, professional rotation transition */
    transition: transform 3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5), inset 0 0 15px rgba(255,255,255,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Central Grip Knob */
.dial-knob {
    width: 30px;
    height: 30px;
    background: #34495e;
    border-radius: 50%;
    border: 3px solid #1a252f;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
    position: absolute;
    z-index: 10;
}

/* Red Indicator Mark */
.dial-mark {
    position: absolute;
    top: 15px;
    width: 8px;
    height: 30px;
    background: #c0392b; /* Vibrant red */
    border-radius: 4px;
    box-shadow: 0 0 5px #c0392b;
    z-index: 8;
}

/* --- Numbers on the Dial (Corrected Position) --- */
.dial-number {
    position: absolute;
    font-size: 0.9rem;
    font-weight: bold;
    color: #333;
    /* Position the number on the circle and keep it upright */
    --angle: calc(var(--nr) * 360 / 60 * 1deg);
    transform: rotate(var(--angle)) translate(0, -50px) rotate(calc(var(--angle) * -1));
    z-index: 6;
}

/* --- Main action Button (INITIATE CRACK) --- */
button#crackBtn {
    padding: 20px 60px;
    font-size: 24px;
    font-weight: 900;
    color: white;
    background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
    border: 3px solid #f1c40f;
    border-radius: 60px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 8px 0 #b7950b, 0 15px 25px rgba(0,0,0,0.3);
    transition: all 0.1s ease;
    outline: none;
    position: relative;
    overflow: hidden;
}

button#crackBtn:hover {
    box-shadow: 0 10px 0 #b7950b, 0 20px 30px rgba(0,0,0,0.4);
}

button#crackBtn:active {
    box-shadow: 0 2px 0 #b7950b;
    transform: translateY(6px); /* Button press effect */
}

/* Disabled state during spin */
button#crackBtn:disabled {
    background: #7f8c8d;
    border-color: #95a5a6;
    box-shadow: 0 4px 0 #7f8c8d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* --- Modal Window (Popup) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    display: none; /* Controlled by JS */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px); /* Modern background blur */
}

.modal {
    background: #ecf0f1;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    color: #2c3e50;
    width: 320px;
    border: 8px solid #f1c40f;
    box-shadow: 0 30px 70px rgba(0,0,0,0.6);
}

.modal-decoration {
    font-size: 4rem;
    margin-bottom: 10px;
    color: #388e3c; /* Success green */
}

.modal h2 { font-size: 2.2rem; margin-top: 0; color: #e67e22; }

/* The winning treasure emoji */
.prize-display {
    font-size: 6rem;
    margin: 15px 0 25px 0;
    line-height: 1;
    display: block;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.1));
}

/* --- THE FIX: Modal Button (SECURE LOOT) --- */
#closeModalBtn {
    background: linear-gradient(180deg, #27ae60 0%, #1e8449 100%); /* Strong Green */
    color: white; /* White text for contrast */
    border: 2px solid #ffffff;
    padding: 18px 45px;
    font-size: 22px;
    font-weight: 900;
    border-radius: 50px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 6px 0 #145a32, 0 10px 20px rgba(0,0,0,0.3);
    transition: all 0.1s ease;
    margin-top: 25px;
    display: inline-block;
    width: auto;
    min-width: 200px;
}

#closeModalBtn:hover {
    background: linear-gradient(180deg, #2ecc71 0%, #27ae60 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #145a32, 0 12px 25px rgba(0,0,0,0.4);
}

#closeModalBtn:active {
    box-shadow: 0 2px 0 #145a32;
    transform: translateY(4px);
}